X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-Button.cpp;h=83ebfb67868ac91860c8bf27d02beaabcc4b99b2;hb=ec1db95268e1cf8e8bd893027d45a19c64b32848;hp=5de1c0670ef257d34d31d9abfbed6ebe72581836;hpb=cbda2de83c5025276c35d69044934ab1258b4998;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp index 5de1c06..83ebfb6 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. @@ -143,7 +143,7 @@ Dali::Integration::Point GetPointUpOutside() int UtcDaliButtonConstructorP(void) { - TestApplication application; + ToolkitTestApplication application; Button button; @@ -153,7 +153,7 @@ int UtcDaliButtonConstructorP(void) int UtcDaliButtonCopyConstructorP(void) { - TestApplication application; + ToolkitTestApplication application; // Initialize an object, ref count == 1 Button button = PushButton::New(); @@ -163,9 +163,28 @@ 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; + ToolkitTestApplication application; Button button = PushButton::New(); @@ -176,9 +195,29 @@ 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; + ToolkitTestApplication application; Button button = PushButton::New(); @@ -194,7 +233,7 @@ int UtcDaliButtonDownCastP(void) int UtcDaliButtonDownCastN(void) { - TestApplication application; + ToolkitTestApplication application; BaseHandle unInitializedObject; @@ -362,7 +401,7 @@ int UtcDaliButtonAutoRepeatingP(void) 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(); @@ -593,7 +632,7 @@ int UtcDaliButtonPressedSignalP(void) 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(); @@ -700,7 +739,7 @@ int UtcDaliButtonClickedSignalP(void) 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(); @@ -851,7 +890,7 @@ int UtcDaliButtonEventConsumption(void) 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 ) ); - Stage::GetCurrent().Add( parentButton ); + application.GetScene().Add( parentButton ); Button childButton = PushButton::New(); childButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); @@ -905,7 +944,7 @@ int UtcDaliButtonRelease(void) 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 ) ); - Stage::GetCurrent().Add( parentButton ); + application.GetScene().Add( parentButton ); parentButton.ReleasedSignal().Connect( &ButtonCallback ); // Reset signal flags @@ -950,7 +989,7 @@ int UtcDaliButtonMultiTouch(void) 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 ) ); - Stage::GetCurrent().Add( button ); + application.GetScene().Add( button ); button.ReleasedSignal().Connect( &ButtonCallback ); // Reset signal flags