#include <dali-toolkit/internal/visuals/texture-manager-impl.h>
#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
using namespace Dali::Toolkit::Internal;
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;
+}
{
Devel::PixelBuffer pixelBuffer = LoadImageFromFile( url.GetUrl(), desiredSize, fittingMode, samplingMode,
orientationCorrection );
- if( maskInfo )
+ if( maskInfo && maskInfo->mAlphaMaskUrl.IsValid() )
{
Devel::PixelBuffer maskPixelBuffer = LoadImageFromFile( maskInfo->mAlphaMaskUrl.GetUrl(), ImageDimensions(),
FittingMode::SCALE_TO_FILL, SamplingMode::NO_FILTER, true );
if( !textureSet ) // big image, no atlasing or atlasing failed
{
atlasingStatus = false;
- if( !maskInfo )
+ if( !maskInfo || !maskInfo->mAlphaMaskUrl.IsValid() )
{
textureId = RequestLoad( url, desiredSize, fittingMode, samplingMode, TextureManager::NO_ATLAS,
textureObserver, orientationCorrection, reloadPolicy, preMultiplyOnLoad );