// Note that we only re-load 0 frame.
DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
- // To do: we need to fix caching bug in animated-visual
- //tet_infoline("Test that we don't try to re-load new image cause it cached");
- //DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1, 1), false, TEST_LOCATION);
+ tet_infoline("Test that we don't try to re-load new image cause it cached");
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1, 1), false, TEST_LOCATION);
// Batch 2 frames. Now visual frame 1, 2, 3 cached and visual2 frame 0, 1 cached.
application.SendNotification();
}
}
+void OnResourceReadySignal05(Control control)
+{
+ gResourceReadySignalCounter++;
+
+ // Request load with same image
+ // NOTE : The url must not be same as gImageView1
+ const int viewCount = 4;
+ for(int i = 0; i < viewCount; ++i)
+ {
+ gImageView1.Add(ImageView::New("invalid2.jpg"));
+ }
+}
+
} // namespace
int UtcDaliImageViewSetImageOnResourceReadySignal01(void)
END_TEST;
}
+int UtcDaliImageViewSetImageOnResourceReadySignal05(void)
+{
+ tet_infoline("Test multiple views with same image during ResourceReady load the image only 1 times");
+
+ ToolkitTestApplication application;
+
+ gResourceReadySignalCounter = 0;
+
+ gImageView1 = ImageView::New("invalid.jpg"); // request invalid image, to make loading failed fast.
+ gImageView1.ResourceReadySignal().Connect(&OnResourceReadySignal05);
+ application.GetScene().Add(gImageView1);
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline("Try to load 1 invalid.jpg image");
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gResourceReadySignalCounter, 1, TEST_LOCATION);
+
+ tet_infoline("Try to load 1 invalid2.jpg image");
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+ tet_infoline("Now we don't have any image to be loaded. Check event thread trigger failed.");
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1, 1), false, TEST_LOCATION);
+
+ gImageView1.Unparent();
+ gImageView1.Reset();
+
+ END_TEST;
+}
TextureManager::TextureManager()
: mTextureCacheManager(),
- mAsyncLocalLoaders(GetNumberOfLocalLoaderThreads(), [&]()
- { return TextureAsyncLoadingHelper(*this); }),
- mAsyncRemoteLoaders(GetNumberOfRemoteLoaderThreads(), [&]()
- { return TextureAsyncLoadingHelper(*this); }),
+ mAsyncLocalLoaders(GetNumberOfLocalLoaderThreads(), [&]() { return TextureAsyncLoadingHelper(*this); }),
+ mAsyncRemoteLoaders(GetNumberOfRemoteLoaderThreads(), [&]() { return TextureAsyncLoadingHelper(*this); }),
mLifecycleObservers(),
mLoadQueue(),
mRemoveQueue(),
{
TextureHash textureHash = INITIAL_HASH_NUMBER;
TextureCacheIndex cacheIndex = INVALID_CACHE_INDEX;
- if(storageType != StorageType::RETURN_PIXEL_BUFFER && frameIndex == 0)
+ if(storageType != StorageType::RETURN_PIXEL_BUFFER)
{
textureHash = mTextureCacheManager.GenerateHash(url, desiredSize, fittingMode, samplingMode, useAtlas, maskTextureId, cropToMask, frameIndex);
// Cache new texutre, and get cacheIndex.
cacheIndex = mTextureCacheManager.AppendCache(TextureInfo(textureId, maskTextureId, url, desiredSize, contentScale, fittingMode, samplingMode, false, cropToMask, useAtlas, textureHash, orientationCorrection, preMultiply, animatedImageLoading, frameIndex));
- DALI_LOG_INFO(gTextureManagerLogFilter, Debug::General, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d, frameindex=%d\n", url.GetUrl().c_str(), observer, cacheIndex.GetIndex(), textureId, frameIndex);
+ DALI_LOG_INFO(gTextureManagerLogFilter, Debug::General, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d, frameindex=%d premultiply=%d\n", url.GetUrl().c_str(), observer, cacheIndex.GetIndex(), textureId, frameIndex, preMultiply);
}
// The below code path is common whether we are using the cache or not.
{
EmitLoadComplete(element.mObserver, textureInfo, true);
}
+ else if(textureInfo.loadState == LoadState::LOADING)
+ {
+ // Note : LOADING state texture cannot be queue.
+ // This case be occured when same texture id are queue in mLoadQueue.
+ ObserveTexture(textureInfo, element.mObserver);
+ }
else
{
LoadTexture(textureInfo, element.mObserver);