X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-Button.cpp;h=76a10fc1006b5edd04e34a6d0040d82b9c66d521;hb=e483020277e28cd5f93a93cf50119edaac49a9e9;hp=83ebfb67868ac91860c8bf27d02beaabcc4b99b2;hpb=4be24b21c2acd28b5b14795afe57acbfdfd282ac;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 83ebfb6..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; } @@ -147,7 +146,7 @@ int UtcDaliButtonConstructorP(void) Button button; - DALI_TEST_CHECK( !button ); + DALI_TEST_CHECK(!button); END_TEST; } @@ -158,8 +157,8 @@ int UtcDaliButtonCopyConstructorP(void) // 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,16 +167,16 @@ 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; } @@ -188,10 +187,10 @@ int UtcDaliButtonAssignmentOperatorP(void) 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,17 +199,17 @@ 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; } @@ -223,10 +222,10 @@ int UtcDaliButtonDownCastP(void) 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