const char* TEST_LARGE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/tbcol.png";
const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
+const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/Kid1.svg";
Vector4 GetControlBackgroundColor( Control& control )
{
return color;
}
+bool gResourceReadySignalFired = false;
+
+void ResourceReadySignal( Control control )
+{
+ if( control.GetVisualResourceStatus( Control::Property::BACKGROUND ) == Visual::ResourceStatus::FAILED )
+ {
+ Property::Map propertyMap;
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_SVG_FILE_NAME );
+ control.SetProperty( Control::Property::BACKGROUND, propertyMap );
+ }
+
+ gResourceReadySignalFired = true;
+}
+
} // namespace
///////////////////////////////////////////////////////////////////////////////////////////////////
END_TEST;
}
+int UtcDaliControlResourcesReady02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "Change a resource during ResourceReady callback" );
+
+ gResourceReadySignalFired = false;
+
+ Control control = Control::New();
+ control.SetSize( 200.f, 200.f );
+ control.ResourceReadySignal().Connect( &ResourceReadySignal );
+
+ Property::Map propertyMap;
+ propertyMap.Insert( ImageVisual::Property::URL, "invalid.jpg" );
+ control.SetProperty( Control::Property::BACKGROUND, propertyMap );
+
+ Stage::GetCurrent().Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( control.IsResourceReady(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION );
+ gResourceReadySignalFired = false;
+
+ END_TEST;
+}
+
int UtcDaliControlMarginProperty(void)
{
ToolkitTestApplication application;
DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "NotifyObservers() url:%s loadState:%s\n",
textureInfo.url.GetUrl().c_str(), GET_LOAD_STATE_STRING(textureInfo.loadState ) );
+ // It is possible for the observer to be deleted.
+ // Disconnect and remove the observer first.
+ observer->DestructionSignal().Disconnect( this, &TextureManager::ObserverDestroyed );
+
+ info->observerList.Erase( info->observerList.begin() );
+
if( info->loadPixelBuffer )
{
observer->LoadComplete( success, info->pixelBuffer, info->url, info->preMultiplied );
info->preMultiplied );
}
- observer->DestructionSignal().Disconnect( this, &TextureManager::ObserverDestroyed );
-
// Get the textureInfo from the container again as it may have been invalidated.
int textureInfoIndex = GetCacheIndexFromId( textureId );
if( textureInfoIndex == INVALID_CACHE_INDEX)
break; // texture has been removed - can stop.
}
info = &mTextureInfoContainer[ textureInfoIndex ];
-
- // remove the observer that was just triggered if it's still in the list
- for( TextureInfo::ObserverListType::Iterator j = info->observerList.Begin(); j != info->observerList.End(); ++j )
- {
- if( *j == observer )
- {
- info->observerList.Erase( j );
- break;
- }
- }
}
mQueueLoadFlag = false;