END_TEST;
}
+
+int UtcDaliImageViewSvgLoadingFailure(void)
+{
+ ToolkitTestApplication application;
+
+ // Local svg file
+ {
+ gResourceReadySignalFired = false;
+
+ ImageView imageView = ImageView::New( TEST_RESOURCE_DIR "/Kid1.svg" );
+ imageView.SetSize( 200.f, 200.f );
+ imageView.ResourceReadySignal().Connect( &ResourceReadySignal);
+
+ DALI_TEST_EQUALS( imageView.IsResourceReady(), false, TEST_LOCATION );
+
+ Stage::GetCurrent().Add( imageView );
+
+ application.SendNotification();
+
+ // loading started, this waits for the loader thread
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(16);
+
+ DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( imageView.IsResourceReady(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( imageView.GetVisualResourceStatus( ImageView::Property::IMAGE ), Visual::ResourceStatus::FAILED, TEST_LOCATION );
+ }
+
+ // Remote svg file
+ {
+ gResourceReadySignalFired = false;
+
+ ImageView imageView = ImageView::New( "https://bar.org/foobar.svg" );
+ imageView.SetSize( 200.f, 200.f );
+ imageView.ResourceReadySignal().Connect( &ResourceReadySignal);
+
+ DALI_TEST_EQUALS( imageView.IsResourceReady(), false, TEST_LOCATION );
+
+ Stage::GetCurrent().Add( imageView );
+
+ application.SendNotification();
+
+ // loading started, this waits for the loader thread
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(16);
+
+ DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( imageView.IsResourceReady(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( imageView.GetVisualResourceStatus( ImageView::Property::IMAGE ), Visual::ResourceStatus::FAILED, TEST_LOCATION );
+ }
+
+ END_TEST;
+}
// Svg loaded and ready to display
ResourceReady( Toolkit::Visual::ResourceStatus::READY );
}
+ else if( !mParsedImage )
+ {
+ ResourceReady( Toolkit::Visual::ResourceStatus::FAILED );
+ }
}
void SvgVisual::OnSetTransform()
}
}
+bool SvgVisual::IsResourceReady() const
+{
+ return ( mImpl->mResourceStatus == Toolkit::Visual::ResourceStatus::READY ||
+ mImpl->mResourceStatus == Toolkit::Visual::ResourceStatus::FAILED );
+}
+
} // namespace Internal
} // namespace Toolkit