X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-Button.cpp;h=76a10fc1006b5edd04e34a6d0040d82b9c66d521;hb=1621192f7b42f1fa210d6bdf12d853629304bea3;hp=e99c8f7e3493d39208bebd9b4b54605a9b4f92d5;hpb=d886d0a7b8637b2ad52844096091b63991157ff3;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 e99c8f7..76a10fc 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) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -15,16 +15,16 @@ * */ -#include #include +#include // Need to override adaptor classes for toolkit test harness, so include // test harness headers before dali headers. #include #include "dali-toolkit-test-utils/toolkit-timer.h" -#include #include +#include #include #include @@ -32,7 +32,6 @@ using namespace Dali; using namespace Toolkit; - void utc_dali_toolkit_button_startup(void) { test_return_value = TET_UNDEF; @@ -45,33 +44,33 @@ void utc_dali_toolkit_button_cleanup(void) namespace { -static bool gIsCalledButtonCallback = false; +static bool gIsCalledButtonCallback = false; static bool gIsCalledChildButtonCallback = false; -static bool ButtonCallback( Button button ) +static bool ButtonCallback(Button button) { gIsCalledButtonCallback = true; return false; } -static bool ChildButtonCallback( Button button ) +static bool ChildButtonCallback(Button button) { gIsCalledChildButtonCallback = true; return false; } -static std::string GetButtonText( Button button ) +static std::string GetButtonText(Button button) { - Property::Value value = button.GetProperty( Toolkit::Button::Property::LABEL ); + Property::Value value = button.GetProperty(Toolkit::Button::Property::LABEL); - Property::Map *labelProperty = value.GetMap(); + Property::Map* labelProperty = value.GetMap(); std::string textLabel; - if ( labelProperty ) + if(labelProperty) { - Property::Value* value = labelProperty->Find( Toolkit::TextVisual::Property::TEXT ); - value->Get( textLabel ); + Property::Value* value = labelProperty->Find(Toolkit::TextVisual::Property::TEXT); + value->Get(textLabel); } return textLabel; @@ -80,7 +79,7 @@ static std::string GetButtonText( Button button ) struct CallbackFunctor { CallbackFunctor(bool* callbackFlag) - : mCallbackFlag( callbackFlag ) + : mCallbackFlag(callbackFlag) { } @@ -94,48 +93,48 @@ struct CallbackFunctor Dali::Integration::Point GetPointDownInside() { Dali::Integration::Point point; - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 240, 400 ) ); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(240, 400)); return point; } Dali::Integration::Point GetPointUpInside() { Dali::Integration::Point point; - point.SetState( PointState::UP ); - point.SetScreenPosition( Vector2( 240, 400 ) ); + point.SetState(PointState::UP); + point.SetScreenPosition(Vector2(240, 400)); return point; } Dali::Integration::Point GetPointLeave() { Dali::Integration::Point point; - point.SetState( PointState::LEAVE ); - point.SetScreenPosition( Vector2( 240, 400 ) ); + point.SetState(PointState::LEAVE); + point.SetScreenPosition(Vector2(240, 400)); return point; } Dali::Integration::Point GetPointEnter() { Dali::Integration::Point point; - point.SetState( PointState::MOTION ); - point.SetScreenPosition( Vector2( 240, 400 ) ); + point.SetState(PointState::MOTION); + point.SetScreenPosition(Vector2(240, 400)); return point; } Dali::Integration::Point GetPointDownOutside() { Dali::Integration::Point point; - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10, 10 ) ); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10, 10)); return point; } Dali::Integration::Point GetPointUpOutside() { Dali::Integration::Point point; - point.SetState( PointState::UP ); - point.SetScreenPosition( Vector2( 10, 10 ) ); + point.SetState(PointState::UP); + point.SetScreenPosition(Vector2(10, 10)); return point; } @@ -143,23 +142,23 @@ Dali::Integration::Point GetPointUpOutside() int UtcDaliButtonConstructorP(void) { - TestApplication application; + ToolkitTestApplication application; Button button; - DALI_TEST_CHECK( !button ); + DALI_TEST_CHECK(!button); END_TEST; } int UtcDaliButtonCopyConstructorP(void) { - TestApplication application; + ToolkitTestApplication application; // Initialize an object, ref count == 1 Button button = PushButton::New(); - Button copy( button ); - DALI_TEST_CHECK( copy ); + Button copy(button); + DALI_TEST_CHECK(copy); END_TEST; } @@ -168,30 +167,30 @@ 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 ); + 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 ); + 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(); - Button copy( button ); - DALI_TEST_CHECK( copy ); + Button copy(button); + DALI_TEST_CHECK(copy); - DALI_TEST_CHECK( button == copy ); + DALI_TEST_CHECK(button == copy); END_TEST; } @@ -200,48 +199,48 @@ 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 ); + 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 ); + 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(); BaseHandle object(button); - Button button2 = Button::DownCast( object ); + Button button2 = Button::DownCast(object); DALI_TEST_CHECK(button2); - Button button3 = DownCast< Button >(object); + Button button3 = DownCast