+ DALI_TEST_EQUALS(observer.mLoaded, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mObserverCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mCompleteType, TestObserver::CompleteType::UPLOAD_COMPLETE, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcTextureManagerUseInvalidMaskAndMaskLoadedFirst(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcTextureManagerUseInvalidMask when normal image loaded first, and mask image loaded first");
+ tet_infoline("Try to check PostLoad works well");
+
+ TextureManager textureManager; // Create new texture manager
+
+ TestObserver observer;
+ std::string filename(TEST_IMAGE_FILE_NAME);
+ std::string maskname("invalid.png");
+ TextureManager::MaskingDataPointer maskInfo = nullptr;
+ maskInfo.reset(new TextureManager::MaskingData());
+ maskInfo->mAlphaMaskUrl = maskname;
+ maskInfo->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
+ maskInfo->mCropToMask = true;
+ maskInfo->mContentScaleFactor = 1.0f;
+
+ auto textureId(TextureManager::INVALID_TEXTURE_ID);
+ Vector4 atlasRect(0.f, 0.f, 1.f, 1.f);
+ Dali::ImageDimensions atlasRectSize(0, 0);
+ bool synchronousLoading(false);
+ bool atlasingStatus(false);
+ bool loadingStatus(false);
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ ImageAtlasManagerPtr atlasManager = nullptr;
+ Toolkit::AtlasUploadObserver* atlasUploadObserver = nullptr;
+
+ textureManager.LoadTexture(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ maskInfo,
+ synchronousLoading,
+ textureId,
+ atlasRect,
+ atlasRectSize,
+ atlasingStatus,
+ loadingStatus,
+ &observer,
+ atlasUploadObserver,
+ atlasManager,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(observer.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mObserverCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(observer.mLoaded, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mObserverCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mCompleteType, TestObserver::CompleteType::UPLOAD_COMPLETE, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcTextureManagerUseInvalidMaskAndMaskLoadedLater(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcTextureManagerUseInvalidMask when normal image loaded first, and mask image loaded later");
+ tet_infoline("Try to check CheckForWaitingTexture called");
+
+ TextureManager textureManager; // Create new texture manager
+
+ TestObserver observer;
+ std::string filename(TEST_IMAGE_FILE_NAME);
+ std::string maskname("invalid.png");
+ TextureManager::MaskingDataPointer maskInfo = nullptr;
+ maskInfo.reset(new TextureManager::MaskingData());
+ maskInfo->mAlphaMaskUrl = maskname;
+ maskInfo->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
+ maskInfo->mCropToMask = true;
+ maskInfo->mContentScaleFactor = 1.0f;
+
+ auto textureId(TextureManager::INVALID_TEXTURE_ID);
+ Vector4 atlasRect(0.f, 0.f, 1.f, 1.f);
+ Dali::ImageDimensions atlasRectSize(0, 0);
+ bool synchronousLoading(false);
+ bool atlasingStatus(false);
+ bool loadingStatus(false);
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ ImageAtlasManagerPtr atlasManager = nullptr;
+ Toolkit::AtlasUploadObserver* atlasUploadObserver = nullptr;
+
+ textureManager.LoadTexture(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ maskInfo,
+ synchronousLoading,
+ textureId,
+ atlasRect,
+ atlasRectSize,
+ atlasingStatus,
+ loadingStatus,
+ &observer,
+ atlasUploadObserver,
+ atlasManager,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(observer.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mObserverCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ // CAPTION : HARD-CODING for coverage. If you are a good boy, Do not follow this code.
+ {
+ Dali::Devel::PixelBuffer pixelBuffer = textureManager.LoadPixelBuffer(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ true, ///< synchronousLoading
+ nullptr,
+ true, ///< orientationCorrection
+ preMultiply);
+
+ std::vector<Devel::PixelBuffer> pixelBuffers;
+ pixelBuffers.push_back(pixelBuffer);
+ textureManager.AsyncLoadComplete(textureId, pixelBuffers);
+ std::vector<Devel::PixelBuffer> maskBuffers;
+ textureManager.AsyncLoadComplete(maskInfo->mAlphaMaskId, maskBuffers);
+ textureManager.Remove(maskInfo->mAlphaMaskId, nullptr);
+ textureManager.Remove(textureId, &observer);
+ }
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(observer.mLoaded, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mObserverCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mCompleteType, TestObserver::CompleteType::UPLOAD_COMPLETE, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcTextureManagerSynchronousLoadingFail(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcTextureManagerSynchronousLoadingFail");
+
+ TextureManager textureManager; // Create new texture manager
+
+ std::string maskname("");
+ TextureManager::MaskingDataPointer maskInfo = nullptr;
+ maskInfo.reset(new TextureManager::MaskingData());
+ maskInfo->mAlphaMaskUrl = maskname;
+ maskInfo->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
+ maskInfo->mCropToMask = true;
+ maskInfo->mContentScaleFactor = 1.0f;
+
+ std::string filename("dummy");
+ auto textureId(TextureManager::INVALID_TEXTURE_ID);
+ Vector4 atlasRect(0.f, 0.f, 0.f, 0.f);
+ Dali::ImageDimensions atlasRectSize(0, 0);
+ bool atlasingStatus(false);
+ bool loadingStatus(false);
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ ImageAtlasManagerPtr atlasManager = nullptr;
+ Toolkit::AtlasUploadObserver* atlasUploadObserver = nullptr;
+
+ // load image synchronously.
+ TestObserver observer;
+ TextureSet textureSet = textureManager.LoadTexture(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ maskInfo,
+ true, // synchronous loading.
+ textureId,
+ atlasRect,
+ atlasRectSize,
+ atlasingStatus,
+ loadingStatus,
+ &observer,
+ atlasUploadObserver,
+ atlasManager,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(loadingStatus, false, TEST_LOCATION);
+ DALI_TEST_CHECK(!textureSet); // texture loading fail.
+ DALI_TEST_CHECK(textureId == TextureManager::INVALID_TEXTURE_ID); // invalid texture id is returned.
+
+ END_TEST;
+}
+
+int UtcTextureManagerCachingSynchronousLoading(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcTextureManagerCachingSynchronousLoading");
+
+ TextureManager textureManager; // Create new texture manager
+
+ std::string filename(TEST_IMAGE_FILE_NAME);
+
+ std::string maskname("");
+ TextureManager::MaskingDataPointer maskInfo = nullptr;
+ maskInfo.reset(new TextureManager::MaskingData());
+ maskInfo->mAlphaMaskUrl = maskname;
+ maskInfo->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
+ maskInfo->mCropToMask = true;
+ maskInfo->mContentScaleFactor = 1.0f;
+
+ Vector4 atlasRect(0.f, 0.f, 0.f, 0.f);
+ Dali::ImageDimensions atlasRectSize(0, 0);
+ bool atlasingStatus(false);
+ bool loadingStatus(false);
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ ImageAtlasManagerPtr atlasManager = nullptr;
+ Toolkit::AtlasUploadObserver* atlasUploadObserver = nullptr;
+
+ // load image synchronously.
+ TestObserver observer;
+ auto textureId(TextureManager::INVALID_TEXTURE_ID);
+ TextureSet textureSet = textureManager.LoadTexture(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ maskInfo,
+ true, // synchronous loading.
+ textureId,
+ atlasRect,
+ atlasRectSize,
+ atlasingStatus,
+ loadingStatus,
+ &observer,
+ atlasUploadObserver,
+ atlasManager,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(loadingStatus, false, TEST_LOCATION);
+ DALI_TEST_CHECK(textureSet); // texture is loaded.
+
+ // observer isn't called in synchronous loading.
+ DALI_TEST_EQUALS(observer.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mObserverCalled, false, TEST_LOCATION);
+
+ // load same image asynchronously.
+ TestObserver asyncObserver;
+ auto asyncTextureId(TextureManager::INVALID_TEXTURE_ID);
+ loadingStatus = false;
+ TextureSet asyncTextureSet = textureManager.LoadTexture(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ maskInfo,
+ false, // asynchronous loading.
+ asyncTextureId,
+ atlasRect,
+ atlasRectSize,
+ atlasingStatus,
+ loadingStatus,
+ &asyncObserver,
+ atlasUploadObserver,
+ atlasManager,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(asyncTextureId, textureId, TEST_LOCATION); // texture is loaded.
+ DALI_TEST_EQUALS(loadingStatus, false, TEST_LOCATION);
+ DALI_TEST_CHECK(asyncTextureSet); // Cached texture.
+
+ // observer is directly called because textureSet is retrieved by cache.
+ DALI_TEST_EQUALS(asyncObserver.mLoaded, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(asyncObserver.mObserverCalled, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcTextureManagerAsyncSyncAsync(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcTextureManagerAsyncSyncAsync");
+
+ TextureManager textureManager; // Create new texture manager
+
+ std::string filename(TEST_IMAGE_FILE_NAME);
+
+ std::string maskname("");
+ TextureManager::MaskingDataPointer maskInfo = nullptr;
+ maskInfo.reset(new TextureManager::MaskingData());
+ maskInfo->mAlphaMaskUrl = maskname;
+ maskInfo->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
+ maskInfo->mCropToMask = true;
+ maskInfo->mContentScaleFactor = 1.0f;
+
+ Vector4 atlasRect(0.f, 0.f, 0.f, 0.f);
+ Dali::ImageDimensions atlasRectSize(0, 0);
+ bool atlasingStatus(false);
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ ImageAtlasManagerPtr atlasManager = nullptr;
+ Toolkit::AtlasUploadObserver* atlasUploadObserver = nullptr;
+
+ // load image asynchronously.
+ TestObserver asyncObserver1;
+ auto asyncTextureId1(TextureManager::INVALID_TEXTURE_ID);
+ bool asyncLoadingStatus1 = false;
+ TextureSet asyncTextureSet1 = textureManager.LoadTexture(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ maskInfo,
+ false, // asynchronous loading.
+ asyncTextureId1,
+ atlasRect,
+ atlasRectSize,
+ atlasingStatus,
+ asyncLoadingStatus1,
+ &asyncObserver1,
+ atlasUploadObserver,
+ atlasManager,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(asyncLoadingStatus1, true, TEST_LOCATION); // texture is loading now.
+ DALI_TEST_CHECK(!asyncTextureSet1); // texture is not loaded yet.
+
+ // observer is still not called.
+ DALI_TEST_EQUALS(asyncObserver1.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(asyncObserver1.mObserverCalled, false, TEST_LOCATION);
+
+ // load same image synchronously just after asynchronous loading.
+ TestObserver syncObserver;
+ auto textureId(TextureManager::INVALID_TEXTURE_ID);
+ bool syncLoadingStatus = false;
+ TextureSet syncTextureSet = textureManager.LoadTexture(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ maskInfo,
+ true, // synchronous loading.
+ textureId,
+ atlasRect,
+ atlasRectSize,
+ atlasingStatus,
+ syncLoadingStatus,
+ &syncObserver,
+ atlasUploadObserver,
+ atlasManager,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(asyncTextureId1, textureId, TEST_LOCATION); // texture is loaded.
+ DALI_TEST_EQUALS(syncLoadingStatus, false, TEST_LOCATION); // texture is loaded.
+ DALI_TEST_CHECK(syncTextureSet); // texture is loaded.
+
+ // syncObserver isn't called in synchronous loading.
+ DALI_TEST_EQUALS(syncObserver.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(syncObserver.mObserverCalled, false, TEST_LOCATION);
+
+ // asyncObserver1 is still not called too.
+ DALI_TEST_EQUALS(asyncObserver1.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(asyncObserver1.mObserverCalled, false, TEST_LOCATION);
+
+ // load image asynchronously.
+ TestObserver asyncObserver2;
+ auto asyncTextureId2(TextureManager::INVALID_TEXTURE_ID);
+ bool asyncLoadingStatus2 = false;
+ TextureSet asyncTextureSet2 = textureManager.LoadTexture(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ maskInfo,
+ false, // asynchronous loading.
+ asyncTextureId2,
+ atlasRect,
+ atlasRectSize,
+ atlasingStatus,
+ asyncLoadingStatus2,
+ &asyncObserver2,
+ atlasUploadObserver,
+ atlasManager,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(asyncLoadingStatus2, false, TEST_LOCATION); // texture is loaded by previous sync request
+ DALI_TEST_CHECK(asyncTextureSet2); // texture is loaded
+ Texture syncTexture = syncTextureSet.GetTexture(0u);
+ Texture asyncTexture2 = asyncTextureSet2.GetTexture(0u);
+ DALI_TEST_CHECK(syncTexture);
+ DALI_TEST_CHECK(asyncTexture2);
+ DALI_TEST_CHECK(asyncTexture2 == syncTexture); // check loaded two texture is same.
+
+ // observer is called synchronously because the texture is cached.
+ DALI_TEST_EQUALS(asyncObserver2.mLoaded, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(asyncObserver2.mObserverCalled, true, TEST_LOCATION);
+
+ asyncObserver2.mLoaded = false;
+ asyncObserver2.mObserverCalled = false;
+
+ application.SendNotification();
+ application.Render();
+
+ // Requested asynchronous loading at first is finished now and async observer is called now.
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(asyncObserver1.mLoaded, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(asyncObserver1.mObserverCalled, true, TEST_LOCATION);
+ DALI_TEST_CHECK(asyncObserver1.mTextureSet);
+
+ Texture observerTexture = asyncObserver1.mTextureSet.GetTexture(0u);
+ DALI_TEST_CHECK(observerTexture == asyncTexture2); // check loaded two texture is same.
+
+ // asyncObserver2 was already called so it isn't called here.
+ DALI_TEST_EQUALS(asyncObserver2.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(asyncObserver2.mObserverCalled, false, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcTextureManagerQueueRemoveDuringObserve(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcTextureManagerQueueRemoveDuringObserve");
+
+ TextureManager textureManager; // Create new texture manager
+
+ TestObserverRemoveAndGenerateUrl observer(&textureManager); // special observer for this UTC.
+
+ std::string filename(TEST_IMAGE_FILE_NAME);
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+
+ TextureManager::TextureId textureId = textureManager.RequestLoad(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ TextureManager::UseAtlas::NO_ATLAS,
+ &observer,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(observer.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mObserverCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(observer.mLoaded, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mObserverCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer.mCompleteType, TestObserver::CompleteType::UPLOAD_COMPLETE, TEST_LOCATION);
+
+ tet_printf("loaded textureId is %d, generated url is %s\n", static_cast<int>(textureId), observer.mGeneratedExternalUrl.c_str());
+
+ DALI_TEST_CHECK(static_cast<int>(textureId) != std::stoi(VisualUrl::GetLocation(observer.mGeneratedExternalUrl))); // Check we don't reuse textureId during observe
+
+ // Decrease external texture reference count who observer created
+ textureManager.RemoveExternalTexture(observer.mGeneratedExternalUrl);
+
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
+int UtcTextureManagerRemoveDuringApplyMasking(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcTextureManagerRemoveDuringApplyMasking");
+
+ TextureManager textureManager; // Create new texture manager
+
+ TestObserver observer1;
+ TestObserver observer2;
+
+ std::string filename(TEST_IMAGE_FILE_NAME);
+ std::string maskname(TEST_MASK_FILE_NAME);
+ TextureManager::MaskingDataPointer maskInfo = nullptr;
+ maskInfo.reset(new TextureManager::MaskingData());
+ maskInfo->mAlphaMaskUrl = maskname;
+ maskInfo->mAlphaMaskId = TextureManager::INVALID_TEXTURE_ID;
+ maskInfo->mCropToMask = true;
+ maskInfo->mContentScaleFactor = 1.0f;
+
+ auto textureId1(TextureManager::INVALID_TEXTURE_ID);
+ Vector4 atlasRect(0.f, 0.f, 1.f, 1.f);
+ Dali::ImageDimensions atlasRectSize(0, 0);
+ bool synchronousLoading(false);
+ bool atlasingStatus(false);
+ bool loadingStatus(false);
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ ImageAtlasManagerPtr atlasManager = nullptr;
+ Toolkit::AtlasUploadObserver* atlasUploadObserver = nullptr;
+
+ textureManager.LoadTexture(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ maskInfo,
+ synchronousLoading,
+ textureId1,
+ atlasRect,
+ atlasRectSize,
+ atlasingStatus,
+ loadingStatus,
+ &observer1,
+ atlasUploadObserver,
+ atlasManager,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ DALI_TEST_EQUALS(observer1.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer1.mObserverCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ // Load image and mask image.
+ // Now, LoadState become MASK_APPLYING
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
+
+ tet_printf("Current textureId1:%d's state become MASK_APPLYING\n", static_cast<int>(textureId1));
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(observer1.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer1.mObserverCalled, false, TEST_LOCATION);
+
+ // Remove current textureId1. and request new texture again.
+ textureManager.Remove(textureId1, &observer1);
+ auto textureId2 = textureManager.RequestLoad(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ TextureManager::UseAtlas::NO_ATLAS,
+ &observer2,
+ true, ///< orientationCorrection
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply,
+ synchronousLoading);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(observer1.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer1.mObserverCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer2.mLoaded, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer2.mObserverCalled, false, TEST_LOCATION);
+
+ tet_printf("textureId1:%d removed and textureId2:%d requested\n", static_cast<int>(textureId1), static_cast<int>(textureId2));
+
+ // CAPTION : HARD-CODING.
+ {
+ std::vector<Devel::PixelBuffer> pixelBuffers;
+ textureManager.AsyncLoadComplete(textureId2, pixelBuffers);
+ textureManager.Remove(textureId2, &observer2);
+ }
+
+ DALI_TEST_EQUALS(observer2.mLoaded, false, TEST_LOCATION); ///< Note that we call AsyncLoadComplete hardly with empty pixelbuffer.
+ DALI_TEST_EQUALS(observer2.mObserverCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer2.mCompleteType, TestObserver::CompleteType::UPLOAD_COMPLETE, TEST_LOCATION);