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-Button.cpp;h=e99c8f7e3493d39208bebd9b4b54605a9b4f92d5;hp=b1c5386a202ac2beea4c1c5a3dc960f17755d4e7;hb=268f651469300b3950b3f314fa33803b6c24273e;hpb=c0d8c3caf853d94266c589b425cadc26333f716a diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp index b1c5386..e99c8f7 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 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. @@ -163,6 +163,25 @@ int UtcDaliButtonCopyConstructorP(void) END_TEST; } +int UtcDaliButtonMoveConstructor(void) +{ + ToolkitTestApplication application; + + Button button = PushButton::New(); + DALI_TEST_EQUALS( 1, button.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::TOGGLABLE ), false , TEST_LOCATION ); + button.SetProperty( Button::Property::TOGGLABLE, true ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::TOGGLABLE ), true , TEST_LOCATION ); + + Button 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 ), true , TEST_LOCATION ); + DALI_TEST_CHECK( !button ); + + END_TEST; +} + int UtcDaliButtonAssignmentOperatorP(void) { TestApplication application; @@ -176,6 +195,26 @@ int UtcDaliButtonAssignmentOperatorP(void) END_TEST; } +int UtcDaliButtonMoveAssignment(void) +{ + ToolkitTestApplication application; + + Button button = PushButton::New(); + DALI_TEST_EQUALS( 1, button.GetBaseObject().ReferenceCount(), TEST_LOCATION ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::TOGGLABLE ), false , TEST_LOCATION ); + button.SetProperty( Button::Property::TOGGLABLE, true ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::TOGGLABLE ), true , TEST_LOCATION ); + + Button 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 ), true , TEST_LOCATION ); + DALI_TEST_CHECK( !button ); + + END_TEST; +} + int UtcDaliButtonDownCastP(void) { TestApplication application; @@ -358,11 +397,11 @@ int UtcDaliButtonAutoRepeatingP(void) const float AUTO_REPEATING_DELAY = 0.15f; Button button = PushButton::New(); - button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - button.SetParentOrigin( ParentOrigin::TOP_LEFT ); - button.SetPosition( 240, 400 ); - button.SetSize( 100, 100 ); - Stage::GetCurrent().Add( button ); + button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + button.SetProperty( Actor::Property::POSITION, Vector2( 240, 400 )); + button.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) ); + application.GetScene().Add( button ); application.SendNotification(); application.Render(); @@ -588,12 +627,12 @@ int UtcDaliButtonPressedSignalP(void) tet_infoline(" UtcDaliButtonPressedSignalP"); Button button = PushButton::New(); - button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - button.SetParentOrigin( ParentOrigin::TOP_LEFT ); - button.SetPosition( 240, 400 ); - button.SetSize( 100, 100 ); + button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + button.SetProperty( Actor::Property::POSITION, Vector2( 240, 400 )); + button.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) ); - Stage::GetCurrent().Add( button ); + application.GetScene().Add( button ); application.SendNotification(); application.Render(); @@ -695,12 +734,12 @@ int UtcDaliButtonClickedSignalP(void) tet_infoline(" UtcDaliButtonClickedSignalP"); Button button = PushButton::New(); - button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - button.SetParentOrigin( ParentOrigin::TOP_LEFT ); - button.SetPosition( 240, 400 ); - button.SetSize( 100, 100 ); + button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + button.SetProperty( Actor::Property::POSITION, Vector2( 240, 400 )); + button.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) ); - Stage::GetCurrent().Add( button ); + application.GetScene().Add( button ); application.SendNotification(); application.Render(); @@ -791,7 +830,7 @@ int UtcDaliButtonStateChangedSignalP(void) button.SetProperty( Button::Property::TOGGLABLE, true); - Stage::GetCurrent().Add( button ); + application.GetScene().Add( button ); application.SendNotification(); application.Render(); @@ -848,15 +887,15 @@ int UtcDaliButtonEventConsumption(void) ToolkitTestApplication application; Button parentButton = PushButton::New(); - parentButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - parentButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - parentButton.SetSize( 20, 20 ); - Stage::GetCurrent().Add( parentButton ); + parentButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + parentButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + parentButton.SetProperty( Actor::Property::SIZE, Vector2( 20, 20 ) ); + application.GetScene().Add( parentButton ); Button childButton = PushButton::New(); - childButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - childButton.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); - childButton.SetSize( 20, 20 ); + childButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + childButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT ); + childButton.SetProperty( Actor::Property::SIZE, Vector2( 20, 20 ) ); parentButton.Add( childButton ); // Reset signal flags @@ -902,10 +941,10 @@ int UtcDaliButtonRelease(void) ToolkitTestApplication application; Button parentButton = PushButton::New(); - parentButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - parentButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - parentButton.SetSize( 20, 20 ); - Stage::GetCurrent().Add( parentButton ); + parentButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + parentButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + parentButton.SetProperty( Actor::Property::SIZE, Vector2( 20, 20 ) ); + application.GetScene().Add( parentButton ); parentButton.ReleasedSignal().Connect( &ButtonCallback ); // Reset signal flags @@ -947,10 +986,10 @@ int UtcDaliButtonMultiTouch(void) Button button = PushButton::New(); button.SetProperty( Button::Property::TOGGLABLE, true); - button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - button.SetParentOrigin( ParentOrigin::TOP_LEFT ); - button.SetSize( 20, 20 ); - Stage::GetCurrent().Add( button ); + button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + button.SetProperty( Actor::Property::SIZE, Vector2( 20, 20 ) ); + application.GetScene().Add( button ); button.ReleasedSignal().Connect( &ButtonCallback ); // Reset signal flags