+
+int UtcTextureManagerGenerateHash(void)
+{
+ ToolkitTestApplication application;
+
+ TextureManager textureManager; // Create new texture manager
+
+ TestObserver observer;
+ std::string filename( "image.png" );
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ TextureManager::TextureId textureId = textureManager.RequestLoad(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ TextureManager::USE_ATLAS,
+ &observer,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ VisualUrl url = textureManager.GetVisualUrl( textureId );
+
+ DALI_TEST_EQUALS( url.GetUrl().compare( filename ), 0, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcTextureManagerCachingForDifferentLoadingType(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcTextureManagerCachingForDifferentLoadingType" );
+
+ TextureManager textureManager; // Create new texture manager
+
+ TestObserver observer1;
+ std::string filename( TEST_IMAGE_FILE_NAME );
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ textureManager.RequestLoad(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ TextureManager::NO_ATLAS,
+ &observer1,
+ 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();
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( observer1.mLoaded, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( observer1.mObserverCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( observer1.mCompleteType, TestObserver::CompleteType::UPLOAD_COMPLETE, TEST_LOCATION );
+
+ TestObserver observer2;
+ Devel::PixelBuffer pixelBuffer = textureManager.LoadPixelBuffer(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ false,
+ &observer2,
+ true,
+ preMultiply);
+
+ DALI_TEST_EQUALS( observer2.mLoaded, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( observer2.mObserverCalled, false, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( observer2.mLoaded, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( observer2.mObserverCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( observer2.mCompleteType, TestObserver::CompleteType::LOAD_COMPLETE, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcTextureManagerUseInvalidMask(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcTextureManagerUseInvalidMask" );
+
+ TextureManager textureManager; // Create new texture manager
+
+ TestObserver observer;
+ 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;
+
+ 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,
+ WrapMode::DEFAULT,
+ WrapMode::DEFAULT,
+ &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( 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 );
+
+ END_TEST;
+}