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=66bb90d18ec8c1e2964dd04f230e0bd6ed90582c;hb=91a4fc1e5cf2efe42e1d7266cf307e237bf0a771;hpb=e6bf46a6c76b0000dd5174ae406cc62ca8f5d9c2 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp index 66bb90d..c20a167 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp @@ -105,33 +105,25 @@ int UtcDaliRadioButtonLabelActor(void) { ToolkitTestApplication application; - TextView actor1 = TextView::New( "test actor 1" ); + TextLabel actor1 = TextLabel::New( "test actor 1" ); RadioButton radioButton = RadioButton::New( actor1 ); DALI_TEST_CHECK( actor1 == radioButton.GetLabel() ); - TextView actor2 = TextView::New( "test actor 2" ); + 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 @@ -149,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(); @@ -161,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" ); @@ -201,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 ); + + 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 ) == 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::Up, 10.0f, 50.0f ); - event.AddPoint( pointDown ); + const Dali::TouchPoint pointDown( 0, TouchPoint::Down, 10.0f, 50.0f ); + const Dali::TouchPoint pointUp( 0, TouchPoint::Up, 10.0f, 50.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 ) == 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;