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-PushButton.cpp;h=7ea83bcba24f5ebf2369d915b17d5bdeaccdc17c;hp=57b39a59a844f3a64ea2e8275ee652f548325576;hb=b977f2ca75522fc2eb536eef07f1180ec4377589;hpb=8005908236e91165db7153110667c1bda43b972e diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp index 57b39a5..7ea83bc 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp @@ -48,6 +48,7 @@ void utc_dali_toolkit_pushbutton_cleanup(void) namespace { static const char* TEST_IMAGE_ONE = TEST_RESOURCE_DIR "/gallery-small-1.jpg"; +static const char* TEST_IMAGE_TWO = TEST_RESOURCE_DIR "/icon-delete.jpg"; static const Vector2 INSIDE_TOUCH_POINT_POSITON = Vector2( 240, 400 ); static const Vector3 BUTTON_POSITON_TO_GET_INSIDE_TOUCH_EVENTS = Vector3( 200, 360, 0 ); @@ -1816,3 +1817,37 @@ int UtcDaliPushButtonSetDisabledSelectedImageWithActorDeprecatedP(void) END_TEST; } + +int UtcDaliPushButtonReplaceButtonImageP2(void) +{ + tet_infoline("Set button image then replace with new image and query url"); + + ToolkitTestApplication application; + + ResourceImage setImage = ResourceImage::New( TEST_IMAGE_ONE ); + DALI_TEST_CHECK(setImage); + + Actor imgActorSet = ImageView::New(setImage); + DALI_TEST_CHECK(imgActorSet); + + PushButton pushButton = PushButton::New(); + pushButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, TEST_IMAGE_TWO ); + + + Stage::GetCurrent().Add( pushButton ); + + pushButton.SetButtonImage( imgActorSet ); + application.SendNotification(); + application.Render(); + + tet_infoline("Get button image before it has been able to load"); + + ImageView imageView = ImageView::DownCast(pushButton.GetButtonImage()); + + ResourceImage getImage = ResourceImage::DownCast( imageView.GetImage() ); + + tet_infoline("Check if url matches last assignment even if not loaded yet"); + DALI_TEST_EQUALS( getImage.GetUrl(), setImage.GetUrl() , TEST_LOCATION ); + + END_TEST; +}