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=ee1ebf564279c408a6c06dc4ec0d52941ece8771;hp=ce5881c942ce298cc64ef0bd76d1d4f0a3006a83;hb=d886d0a7b8637b2ad52844096091b63991157ff3;hpb=4e284359dc32cfcb20c49068406fb341afed833b diff --git a/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp index ce5881c..ee1ebf5 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) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -86,6 +86,25 @@ int UtcDaliRadioButtonCopyConstructorP(void) END_TEST; } +int UtcDaliRadioButtonMoveConstructor(void) +{ + ToolkitTestApplication application; + + RadioButton button = RadioButton::New(); + DALI_TEST_EQUALS( 1, button.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::TOGGLABLE ), true , TEST_LOCATION ); + button.SetProperty( Button::Property::TOGGLABLE, false ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::TOGGLABLE ), false , TEST_LOCATION ); + + RadioButton moved = std::move( button ); + DALI_TEST_CHECK( moved ); + DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( moved.GetProperty( Button::Property::TOGGLABLE ), false , TEST_LOCATION ); + DALI_TEST_CHECK( !button ); + + END_TEST; +} + int UtcDaliRadioButtonAssignmentOperatorP(void) { TestApplication application; @@ -99,6 +118,26 @@ int UtcDaliRadioButtonAssignmentOperatorP(void) END_TEST; } +int UtcDaliRadioButtonMoveAssignment(void) +{ + ToolkitTestApplication application; + + RadioButton button = RadioButton::New(); + DALI_TEST_EQUALS( 1, button.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::TOGGLABLE ), true , TEST_LOCATION ); + button.SetProperty( Button::Property::TOGGLABLE, false ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::TOGGLABLE ), false , TEST_LOCATION ); + + RadioButton moved; + moved = std::move( button ); + DALI_TEST_CHECK( moved ); + DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( moved.GetProperty( Button::Property::TOGGLABLE ), false , TEST_LOCATION ); + DALI_TEST_CHECK( !button ); + + END_TEST; +} + int UtcDaliRadioButtonNewP(void) { ToolkitTestApplication application; @@ -118,7 +157,7 @@ int UtcDaliRadioButtonNewP(void) DALI_TEST_CHECK( radioButton2 == radioButton ); //Additional check to ensure object is created by checking if it's registered - ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); + ObjectRegistry registry = application.GetCore().GetObjectRegistry(); DALI_TEST_CHECK( registry ); gObjectCreatedCallBackCalled = false; @@ -185,10 +224,10 @@ int UtcDaliRadioButtonSelectedProperty(void) // Create the RadioButton actor RadioButton radioButton = RadioButton::New(); - Stage::GetCurrent().Add( radioButton ); - radioButton.SetParentOrigin(ParentOrigin::TOP_LEFT); - radioButton.SetAnchorPoint(ParentOrigin::TOP_LEFT); - radioButton.SetPosition( 0.0f, 0.0f ); + application.GetScene().Add( radioButton ); + radioButton.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + radioButton.SetProperty( Actor::Property::ANCHOR_POINT,ParentOrigin::TOP_LEFT); + radioButton.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f )); // Default selected DALI_TEST_CHECK( radioButton.GetProperty( Button::Property::SELECTED ) == false ); @@ -207,21 +246,21 @@ int UtcDaliRadioButtonSelectedProperty(void) // Test selecting radio buttons RadioButton radioButton2 = RadioButton::New( "label" ); - radioButton2.SetParentOrigin(ParentOrigin::TOP_LEFT); - radioButton2.SetAnchorPoint(ParentOrigin::TOP_LEFT); - radioButton2.SetPosition( 0.0f, 0.0f ); + radioButton2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + radioButton2.SetProperty( Actor::Property::ANCHOR_POINT,ParentOrigin::TOP_LEFT); + radioButton2.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f )); RadioButton radioButton3 = RadioButton::New( "label" ); - radioButton3.SetParentOrigin(ParentOrigin::TOP_LEFT); - radioButton3.SetAnchorPoint(ParentOrigin::TOP_LEFT); - radioButton3.SetPosition( 0.0f, 40.0f ); + radioButton3.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + radioButton3.SetProperty( Actor::Property::ANCHOR_POINT,ParentOrigin::TOP_LEFT); + radioButton3.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 40.0f )); Actor radioGroup = Actor::New(); - Stage::GetCurrent().Add( radioGroup ); - radioGroup.SetParentOrigin(ParentOrigin::TOP_LEFT); - radioGroup.SetAnchorPoint(ParentOrigin::TOP_LEFT); - radioGroup.SetPosition( 0.0f, 0.0f ); - radioGroup.SetSize( 400.0f, 400.0 ); + application.GetScene().Add( radioGroup ); + radioGroup.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT); + radioGroup.SetProperty( Actor::Property::ANCHOR_POINT,ParentOrigin::TOP_LEFT); + radioGroup.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f )); + radioGroup.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0 ) ); radioGroup.Add( radioButton2 ); radioGroup.Add( radioButton3 ); @@ -334,4 +373,4 @@ int UtcDaliRadioButtonSelectedProperty(void) } END_TEST; -} \ No newline at end of file +}