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-RadioButton.cpp;h=85cced6a9dc0a45dd79a77190a7e807f10b80d6e;hp=24b496474e18afe3d897bf1e3bfcbaa04d481718;hb=1a1dc01690d6b218743ce6a3e1acc63699bc171a;hpb=d748f6c99a59e045b8a8d267012372f996cbc3fd diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp index 24b4964..85cced6 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp @@ -47,6 +47,23 @@ static void TestCallback(BaseHandle handle) gObjectCreatedCallBackCalled = true; } +static std::string GetButtonText( Button button ) +{ + Property::Value value = button.GetProperty( Toolkit::Button::Property::LABEL ); + + Property::Map *labelProperty = value.GetMap(); + + std::string textLabel; + + if ( labelProperty ) + { + Property::Value* value = labelProperty->Find( Toolkit::TextVisual::Property::TEXT ); + value->Get( textLabel ); + } + + return textLabel; +} + } int UtcDaliRadioButtonConstructorP(void) @@ -138,11 +155,11 @@ int UtcDaliRadioButtonDownCast(void) END_TEST; } -int UtcDaliRadioButtonLabelActor(void) +int UtcDaliRadioButtonLabelProperty(void) { ToolkitTestApplication application; - std::string labelText = "test actor 1"; + const std::string labelText = "test actor 1"; RadioButton radioButton = RadioButton::New(); @@ -151,37 +168,14 @@ int UtcDaliRadioButtonLabelActor(void) .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f ) ); - radioButton.SetLabelText( labelText ); + radioButton.SetProperty( Toolkit::Button::Property::LABEL, labelText ); + DALI_TEST_EQUALS( GetButtonText( radioButton ), labelText, TEST_LOCATION ); - DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText, TEST_LOCATION ); std::string labelText2 = "test actor 2"; - radioButton.SetLabelText( labelText2 ); - DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText2, TEST_LOCATION ); - - END_TEST; -} + radioButton.SetProperty( Toolkit::Button::Property::LABEL, labelText2 ); -int UtcDaliRadioButtonSelected(void) -{ - ToolkitTestApplication application; - - RadioButton radioButton = RadioButton::New(); - - // Default selected - DALI_TEST_CHECK( radioButton.IsSelected() == false ); - - // False - radioButton.SetSelected( false ); - DALI_TEST_CHECK( radioButton.IsSelected() == false ); - - // True - radioButton.SetSelected( true ); - DALI_TEST_CHECK( radioButton.IsSelected() == true ); - - // False - radioButton.SetSelected( false ); - DALI_TEST_CHECK( radioButton.IsSelected() == false ); + DALI_TEST_EQUALS( GetButtonText( radioButton ), labelText2, TEST_LOCATION ); END_TEST; } @@ -343,3 +337,55 @@ int UtcDaliRadioButtonSelectedProperty(void) END_TEST; } + + +// Deprecated API Tests + +int UtcDaliRadioButtonLabelActor(void) +{ + ToolkitTestApplication application; + + std::string labelText = "test actor 1"; + + RadioButton radioButton = RadioButton::New(); + + radioButton.SetProperty( Toolkit::Button::Property::LABEL, + Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT ) + .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f ) + ); + + radioButton.SetLabelText( labelText ); + + DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText, TEST_LOCATION ); + + std::string labelText2 = "test actor 2"; + radioButton.SetLabelText( labelText2 ); + DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText2, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliRadioButtonSelected(void) +{ + ToolkitTestApplication application; + + RadioButton radioButton = RadioButton::New(); + + // Default selected + DALI_TEST_CHECK( radioButton.IsSelected() == false ); + + // False + radioButton.SetSelected( false ); + DALI_TEST_CHECK( radioButton.IsSelected() == false ); + + // True + radioButton.SetSelected( true ); + DALI_TEST_CHECK( radioButton.IsSelected() == true ); + + // False + radioButton.SetSelected( false ); + DALI_TEST_CHECK( radioButton.IsSelected() == false ); + + END_TEST; +} +