X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ImageView.cpp;h=7d709d85b82a8aff9f079700be42630d6bd69d58;hb=c4473b138fec8355d4b4583a48528f816a8cb42a;hp=2c23106bff0978337b8c08996fe2c0d667d48703;hpb=b7a36db4c66c579601b9be7fa4af0f5215d3922c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp index 2c23106..7d709d8 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp @@ -865,9 +865,16 @@ int UtcDaliImageViewSizeWithBackground(void) int width = 100; int height = 200; - Image image = CreateBufferImage( width, height, Vector4(1.f, 1.f, 1.f, 1.f) ); ImageView imageView = ImageView::New(); - imageView.SetBackgroundImage( image ); + + imageView.SetProperty( Control::Property::BACKGROUND, + { + { Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE }, + { Toolkit::ImageVisual::Property::URL, TEST_RESOURCE_DIR "/gallery-small-1.jpg" }, + { ImageVisual::Property::DESIRED_WIDTH, width }, + { ImageVisual::Property::DESIRED_HEIGHT, height }, + } + ); Stage::GetCurrent().Add( imageView ); application.SendNotification(); @@ -887,11 +894,19 @@ int UtcDaliImageViewSizeWithBackgroundAndImage(void) int heightBackground = 200; int width = 300; int height = 400; - Image imageBackground = CreateBufferImage( widthBackground, heightBackground, Vector4(1.f, 1.f, 1.f, 1.f) ); Image image = CreateBufferImage( width, height, Vector4(1.f, 1.f, 1.f, 1.f) ); ImageView imageView = ImageView::New(); - imageView.SetBackgroundImage( imageBackground ); + + imageView.SetProperty( Control::Property::BACKGROUND, + { + { Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE }, + { Toolkit::ImageVisual::Property::URL, TEST_RESOURCE_DIR "/gallery-small-1.jpg" }, + { ImageVisual::Property::DESIRED_WIDTH, widthBackground }, + { ImageVisual::Property::DESIRED_HEIGHT, heightBackground }, + } + ); + imageView.SetImage( image ); Stage::GetCurrent().Add( imageView ); @@ -910,10 +925,17 @@ int UtcDaliImageViewHeightForWidthBackground(void) int widthBackground = 100; int heightBackground = 200; - Image imageBackground = CreateBufferImage( widthBackground, heightBackground, Vector4(1.f, 1.f, 1.f, 1.f) ); ImageView imageView = ImageView::New(); - imageView.SetBackgroundImage( imageBackground ); + + imageView.SetProperty( Control::Property::BACKGROUND, + { + { Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE }, + { Toolkit::ImageVisual::Property::URL, TEST_RESOURCE_DIR "/gallery-small-1.jpg" }, + { ImageVisual::Property::DESIRED_WIDTH, widthBackground }, + { ImageVisual::Property::DESIRED_HEIGHT, heightBackground } + } + ); Stage::GetCurrent().Add( imageView ); application.SendNotification(); @@ -935,11 +957,20 @@ int UtcDaliImageViewHeightForWidthBackgroundAndImage(void) int heightBackground = 200; int width = 300; int height = 400; - Image imageBackground = CreateBufferImage( widthBackground, heightBackground, Vector4(1.f, 1.f, 1.f, 1.f) ); + Image image = CreateBufferImage( width, height, Vector4(1.f, 1.f, 1.f, 1.f) ); ImageView imageView = ImageView::New(); - imageView.SetBackgroundImage( imageBackground ); + + imageView.SetProperty( Control::Property::BACKGROUND, + { + { Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE }, + { Toolkit::ImageVisual::Property::URL, TEST_RESOURCE_DIR "/gallery-small-1.jpg" }, + { ImageVisual::Property::DESIRED_WIDTH, widthBackground }, + { ImageVisual::Property::DESIRED_HEIGHT, heightBackground } + } + ); + imageView.SetImage( image ); Stage::GetCurrent().Add( imageView ); @@ -1080,15 +1111,17 @@ int UtcDaliImageViewCheckResourceReady(void) gResourceReadySignalFired = false; - - int width = 100; - int height = 200; - Image image = CreateBufferImage( width, height, Vector4(1.f, 1.f, 1.f, 1.f) ); - // Check ImageView with background and main image, to ensure both visuals are marked as loaded ImageView imageView = ImageView::New( TEST_GIF_FILE_NAME ); - imageView.SetBackgroundImage( image ); + imageView.SetProperty( Control::Property::BACKGROUND, + { + { Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE }, + { Toolkit::ImageVisual::Property::URL, TEST_RESOURCE_DIR "/gallery-small-1.jpg" }, + { ImageVisual::Property::DESIRED_WIDTH, 100 }, + { ImageVisual::Property::DESIRED_HEIGHT, 200 } + } + ); DALI_TEST_EQUALS( imageView.IsResourceReady(), false, TEST_LOCATION ); @@ -1096,10 +1129,12 @@ int UtcDaliImageViewCheckResourceReady(void) Stage::GetCurrent().Add( imageView ); + // 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( imageView.IsResourceReady(), true, TEST_LOCATION ); DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION ); @@ -1293,10 +1328,10 @@ int UtcDaliImageViewResourceUrlP(void) ToolkitTestApplication application; ImageView imageView = ImageView::New(); - DALI_TEST_CHECK( imageView.GetProperty( ImageView::Property::RESOURCE_URL ).Get< std::string >().empty() ); + DALI_TEST_CHECK( imageView.GetProperty( ImageView::Property::IMAGE ).Get< std::string >().empty() ); - imageView.SetProperty( ImageView::Property::RESOURCE_URL, "TestString" ); - DALI_TEST_EQUALS( imageView.GetProperty( ImageView::Property::RESOURCE_URL ).Get< std::string >(), "TestString", TEST_LOCATION ); + imageView.SetProperty( ImageView::Property::IMAGE, "TestString" ); + DALI_TEST_EQUALS( imageView.GetProperty( ImageView::Property::IMAGE ).Get< std::string >(), "TestString", TEST_LOCATION ); END_TEST; }