X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-RadioButton.cpp;h=ce5881c942ce298cc64ef0bd76d1d4f0a3006a83;hb=19c7495f5e82eb301e7af38370ea2897e7324b7b;hp=07f275e12d72cd955d9844324ac9df8286caccc1;hpb=47937fd0ad346e3b9f48126bc611e36cb4e271d5;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp index 07f275e..ce5881c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,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) @@ -136,42 +153,27 @@ int UtcDaliRadioButtonDownCast(void) END_TEST; } -int UtcDaliRadioButtonLabelActor(void) +int UtcDaliRadioButtonLabelProperty(void) { ToolkitTestApplication application; - std::string labelText = "test actor 1"; - - RadioButton radioButton = RadioButton::New( 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; + const std::string labelText = "test actor 1"; RadioButton radioButton = RadioButton::New(); - // Default selected - DALI_TEST_CHECK( radioButton.IsSelected() == false ); + radioButton.SetProperty( Toolkit::Button::Property::LABEL, + Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::Visual::TEXT ) + .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f ) + ); - // False - radioButton.SetSelected( false ); - DALI_TEST_CHECK( radioButton.IsSelected() == false ); + radioButton.SetProperty( Toolkit::Button::Property::LABEL, labelText ); + DALI_TEST_EQUALS( GetButtonText( radioButton ), labelText, TEST_LOCATION ); - // True - radioButton.SetSelected( true ); - DALI_TEST_CHECK( radioButton.IsSelected() == true ); - // False - radioButton.SetSelected( false ); - DALI_TEST_CHECK( radioButton.IsSelected() == false ); + std::string labelText2 = "test actor 2"; + radioButton.SetProperty( Toolkit::Button::Property::LABEL, labelText2 ); + + DALI_TEST_EQUALS( GetButtonText( radioButton ), labelText2, TEST_LOCATION ); END_TEST; } @@ -332,4 +334,4 @@ int UtcDaliRadioButtonSelectedProperty(void) } END_TEST; -} +} \ No newline at end of file