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=c20a167e0ef3837e867717d752db3eb20a8b0978;hp=f6201e934bdde9dc8aae47a5ee75303618ec507e;hb=4d75bf1bc38c24eb1d968688d094d0ffef2ee946;hpb=306d2f61a1b64179e801fa8a0bb2bd7b4e9dd682 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp index f6201e9..c20a167 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp @@ -103,25 +103,27 @@ int UtcDaliRadioButtonDownCast(void) int UtcDaliRadioButtonLabelActor(void) { - // TODO + ToolkitTestApplication application; + + TextLabel actor1 = TextLabel::New( "test actor 1" ); + + RadioButton radioButton = RadioButton::New( actor1 ); + DALI_TEST_CHECK( actor1 == radioButton.GetLabel() ); + + TextLabel actor2 = TextLabel::New( "test actor 2" ); + radioButton.SetLabel( actor2 ); + DALI_TEST_CHECK( actor2 == radioButton.GetLabel() ); + END_TEST; } -int UtcDaliRadioButtonActive(void) +int UtcDaliRadioButtonSelected(void) { ToolkitTestApplication application; RadioButton radioButton = RadioButton::New(); - // Default active - DALI_TEST_CHECK( radioButton.IsSelected() == false ); - - // False to true - radioButton.ToggleState(); - DALI_TEST_CHECK( radioButton.IsSelected() == true ); - - // True to false - radioButton.ToggleState(); + // Default selected DALI_TEST_CHECK( radioButton.IsSelected() == false ); // False @@ -139,10 +141,10 @@ int UtcDaliRadioButtonActive(void) END_TEST; } -int UtcDaliRadioButtonActiveProperty(void) +int UtcDaliRadioButtonSelectedProperty(void) { ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline(" UtcDaliRadioButtonActiveProperty"); + tet_infoline(" UtcDaliRadioButtonSelectedProperty"); // Create the RadioButton actor RadioButton radioButton = RadioButton::New(); @@ -151,20 +153,20 @@ int UtcDaliRadioButtonActiveProperty(void) radioButton.SetAnchorPoint(ParentOrigin::TOP_LEFT); radioButton.SetPosition( 0.0f, 0.0f ); - // Default active - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + // Default selected + DALI_TEST_CHECK( radioButton.GetProperty( Button::Property::SELECTED ) == false ); - // Setting false active - radioButton.SetProperty( Button::PROPERTY_TOGGLED, false ); - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + // Setting false selected + radioButton.SetProperty( Button::Property::SELECTED, false ); + DALI_TEST_CHECK( radioButton.GetProperty( Button::Property::SELECTED ) == false ); - // Setting true active - radioButton.SetProperty( Button::PROPERTY_TOGGLED, true ); - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_TOGGLED ) == true ); + // Setting true selected + radioButton.SetProperty( Button::Property::SELECTED, true ); + DALI_TEST_CHECK( radioButton.GetProperty( Button::Property::SELECTED ) == true ); // Setting false again - radioButton.SetProperty( Button::PROPERTY_TOGGLED, false ); - DALI_TEST_CHECK( radioButton.GetProperty( Button::PROPERTY_TOGGLED ) == 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" ); @@ -191,71 +193,91 @@ int UtcDaliRadioButtonActiveProperty(void) application.Render(); // Simulate touch events - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == false ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == 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 event = Dali::Integration::TouchEvent(); + 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 ); - event.AddPoint( pointUp ); - application.ProcessEvent( event ); + event1.AddPoint( pointDown ); + application.ProcessEvent( event1 ); + + event2.AddPoint( pointUp ); + application.ProcessEvent( event2 ); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == true ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::Property::SELECTED ) == true ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::Property::SELECTED ) == false ); } // Select an already selected radio { - Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event1 = Dali::Integration::TouchEvent(); + Dali::Integration::TouchEvent event2 = Dali::Integration::TouchEvent(); - const Dali::TouchPoint pointDown( 0, TouchPoint::Up, 10.0f, 10.0f ); - event.AddPoint( pointDown ); + const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 10.0f ); + const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 10.0f ); - application.ProcessEvent( event ); + event1.AddPoint( pointDown ); + application.ProcessEvent( event1 ); + + event2.AddPoint( pointUp ); + application.ProcessEvent( event2 ); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == true ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == false ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::Property::SELECTED ) == true ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::Property::SELECTED ) == false ); } // Select second radio { - Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent(); + 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 ); - const Dali::TouchPoint pointDown( 0, TouchPoint::Up, 10.0f, 50.0f ); - event.AddPoint( pointDown ); + event1.AddPoint( pointDown ); + application.ProcessEvent( event1 ); - application.ProcessEvent( event ); + event2.AddPoint( pointUp ); + application.ProcessEvent( event2 ); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == false ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == true ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::Property::SELECTED ) == false ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::Property::SELECTED ) == true ); } // Select outside radio group { - Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent(); + 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 ); - const Dali::TouchPoint pointDown( 0, TouchPoint::Up, 10.0f, 500.0f ); - event.AddPoint( pointDown ); + event1.AddPoint( pointDown ); + application.ProcessEvent( event1 ); - application.ProcessEvent( event ); + event2.AddPoint( pointUp ); + application.ProcessEvent( event2 ); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( radioButton2.GetProperty( Button::PROPERTY_TOGGLED ) == false ); - DALI_TEST_CHECK( radioButton3.GetProperty( Button::PROPERTY_TOGGLED ) == true ); + DALI_TEST_CHECK( radioButton2.GetProperty( Button::Property::SELECTED ) == false ); + DALI_TEST_CHECK( radioButton3.GetProperty( Button::Property::SELECTED ) == true ); } END_TEST;