X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ImageView.cpp;h=a59b0ff1b938daf7dec12530d9e3238972005bc3;hp=0124b73d69b525381a9217c55c8c19e4e0d565bb;hb=c02f801e5fd89a14e2f49f36ff1513248eead35d;hpb=a5e299ffec7a2f1e4a7cc7456159fc92eebcc269 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp index 0124b73..a59b0ff 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp @@ -2432,3 +2432,103 @@ int UtcDaliImageViewLoadRemoteSVG(void) 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; +} + +namespace +{ + +static int gResourceReadySignalCounter = 0; + +void OnResourceReadySignal( Control control ) +{ + gResourceReadySignalCounter++; + + if( gResourceReadySignalCounter == 1 ) + { + // Set image twice + ImageView::DownCast( control ).SetImage( gImage_34_RGBA ); + ImageView::DownCast( control ).SetImage( gImage_34_RGBA ); + } +} + +} + +int UtcDaliImageViewSetImageOnResourceReadySignal(void) +{ + tet_infoline("Test setting image from within signal handler."); + + ToolkitTestApplication application; + + gResourceReadySignalCounter = 0; + + ImageView imageView = ImageView::New( gImage_34_RGBA ); + imageView.ResourceReadySignal().Connect( &OnResourceReadySignal ); + + Stage::GetCurrent().Add( imageView ); + + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( gResourceReadySignalCounter, 2, TEST_LOCATION ); + + DALI_TEST_EQUALS( imageView.IsResourceReady(), true, TEST_LOCATION ); + + END_TEST; +}