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=24b496474e18afe3d897bf1e3bfcbaa04d481718;hp=9b3c9e500554eff7326f0bfe8d41b5b22e31db89;hb=863244a09761c6e22a224299b6155a285e21d6ec;hpb=dc3613bb6248908c267a76e378b04962bce85664 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp index 9b3c9e5..24b4964 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp @@ -21,6 +21,8 @@ #include #include +#include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -47,10 +49,45 @@ static void TestCallback(BaseHandle handle) } -int UtcDaliRadioButtonNew(void) +int UtcDaliRadioButtonConstructorP(void) +{ + TestApplication application; + + RadioButton button; + + DALI_TEST_CHECK( !button ); + END_TEST; +} + +int UtcDaliRadioButtonCopyConstructorP(void) +{ + TestApplication application; + + // Initialize an object, ref count == 1 + RadioButton button = RadioButton::New(); + + RadioButton copy( button ); + DALI_TEST_CHECK( copy ); + END_TEST; +} + +int UtcDaliRadioButtonAssignmentOperatorP(void) +{ + TestApplication application; + + RadioButton button = RadioButton::New(); + + RadioButton copy( button ); + DALI_TEST_CHECK( copy ); + + DALI_TEST_CHECK( button == copy ); + END_TEST; +} + +int UtcDaliRadioButtonNewP(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliRadioButtonNew"); + tet_infoline(" UtcDaliRadioButtonNewP"); // Create the Slider actor RadioButton radioButton; @@ -78,7 +115,7 @@ int UtcDaliRadioButtonNew(void) END_TEST; } -int UtcDaliRadioButtonDestructor(void) +int UtcDaliRadioButtonDestructorP(void) { ToolkitTestApplication application; @@ -105,14 +142,22 @@ int UtcDaliRadioButtonLabelActor(void) { ToolkitTestApplication application; - TextView actor1 = TextView::New( "test actor 1" ); + std::string labelText = "test actor 1"; + + RadioButton radioButton = RadioButton::New(); - RadioButton radioButton = RadioButton::New( actor1 ); - DALI_TEST_CHECK( actor1 == radioButton.GetLabel() ); + radioButton.SetProperty( Toolkit::Button::Property::LABEL, + Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT ) + .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f ) + ); - TextView actor2 = TextView::New( "test actor 2" ); - radioButton.SetLabel( actor2 ); - DALI_TEST_CHECK( actor2 == radioButton.GetLabel() ); + 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; } @@ -154,19 +199,19 @@ int UtcDaliRadioButtonSelectedProperty(void) radioButton.SetPosition( 0.0f, 0.0f ); // Default selected - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_SELECTED ) == false ); + DALI_TEST_CHECK( radioButton.GetProperty( Button::Property::SELECTED ) == false ); // Setting false selected - radioButton.SetProperty( Button::PROPERTY_SELECTED, false ); - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_SELECTED ) == false ); + radioButton.SetProperty( Button::Property::SELECTED, false ); + DALI_TEST_CHECK( radioButton.GetProperty( Button::Property::SELECTED ) == false ); // Setting true selected - radioButton.SetProperty( Button::PROPERTY_SELECTED, true ); - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_SELECTED ) == true ); + radioButton.SetProperty( Button::Property::SELECTED, true ); + DALI_TEST_CHECK( radioButton.GetProperty( Button::Property::SELECTED ) == true ); // Setting false again - radioButton.SetProperty( Button::PROPERTY_SELECTED, false ); - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_SELECTED ) == false ); + radioButton.SetProperty( Button::Property::SELECTED, false ); + DALI_TEST_CHECK( radioButton.GetProperty( Button::Property::SELECTED ) == false ); // Test selecting radio buttons RadioButton radioButton2 = RadioButton::New( "label" ); @@ -193,16 +238,20 @@ int UtcDaliRadioButtonSelectedProperty(void) application.Render(); // Simulate touch events - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == false ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == false ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::Property::SELECTED ) == false ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::Property::SELECTED ) == false ); // Select first radio { Dali::Integration::TouchEvent event1 = Dali::Integration::TouchEvent(); Dali::Integration::TouchEvent event2 = Dali::Integration::TouchEvent(); - const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 10.0f ); - const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 10.0f ); + Dali::Integration::Point pointDown; + pointDown.SetState( PointState::DOWN ); + pointDown.SetScreenPosition( Vector2( 1.0f, 1.0f ) ); + + Dali::Integration::Point pointUp( pointDown ); + pointUp.SetState( PointState::UP ); event1.AddPoint( pointDown ); application.ProcessEvent( event1 ); @@ -213,8 +262,8 @@ int UtcDaliRadioButtonSelectedProperty(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == true ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == false ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::Property::SELECTED ) == true ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::Property::SELECTED ) == false ); } // Select an already selected radio @@ -222,8 +271,12 @@ int UtcDaliRadioButtonSelectedProperty(void) Dali::Integration::TouchEvent event1 = Dali::Integration::TouchEvent(); Dali::Integration::TouchEvent event2 = Dali::Integration::TouchEvent(); - const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 10.0f ); - const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 10.0f ); + Dali::Integration::Point pointDown; + pointDown.SetState( PointState::DOWN ); + pointDown.SetScreenPosition( Vector2( 1.0f, 1.0f ) ); + + Dali::Integration::Point pointUp( pointDown ); + pointUp.SetState( PointState::UP ); event1.AddPoint( pointDown ); application.ProcessEvent( event1 ); @@ -234,8 +287,8 @@ int UtcDaliRadioButtonSelectedProperty(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == true ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == false ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::Property::SELECTED ) == true ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::Property::SELECTED ) == false ); } // Select second radio @@ -243,8 +296,12 @@ int UtcDaliRadioButtonSelectedProperty(void) Dali::Integration::TouchEvent event1 = Dali::Integration::TouchEvent(); Dali::Integration::TouchEvent event2 = Dali::Integration::TouchEvent(); - const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 50.0f ); - const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 50.0f ); + Dali::Integration::Point pointDown; + pointDown.SetState( PointState::DOWN ); + pointDown.SetScreenPosition( Vector2( 1.0f, 41.0f ) ); + + Dali::Integration::Point pointUp( pointDown ); + pointUp.SetState( PointState::UP ); event1.AddPoint( pointDown ); application.ProcessEvent( event1 ); @@ -255,8 +312,8 @@ int UtcDaliRadioButtonSelectedProperty(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == false ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == true ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::Property::SELECTED ) == false ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::Property::SELECTED ) == true ); } // Select outside radio group @@ -264,8 +321,12 @@ int UtcDaliRadioButtonSelectedProperty(void) Dali::Integration::TouchEvent event1 = Dali::Integration::TouchEvent(); Dali::Integration::TouchEvent event2 = Dali::Integration::TouchEvent(); - const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 500.0f ); - const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 500.0f ); + Dali::Integration::Point pointDown; + pointDown.SetState( PointState::DOWN ); + pointDown.SetScreenPosition( Vector2( 1.0f, 500.0f ) ); + + Dali::Integration::Point pointUp( pointDown ); + pointUp.SetState( PointState::UP ); event1.AddPoint( pointDown ); application.ProcessEvent( event1 ); @@ -276,8 +337,8 @@ int UtcDaliRadioButtonSelectedProperty(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_SELECTED ) == false ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_SELECTED ) == true ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::Property::SELECTED ) == false ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::Property::SELECTED ) == true ); } END_TEST;