X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-Button.cpp;h=5de1c0670ef257d34d31d9abfbed6ebe72581836;hb=65fe4d97a7a58199b2f5ad2d84e26acbb2b6ae39;hp=e9c092d69d64e497b795dad75d4a3786df50ca3c;hpb=c295a64b88c2cbbdd30543afe2464060de7816fd;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 e9c092d..5de1c06 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) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -48,8 +48,6 @@ namespace static bool gIsCalledButtonCallback = false; static bool gIsCalledChildButtonCallback = false; -const int RENDER_FRAME_INTERVAL = 16; - static bool ButtonCallback( Button button ) { gIsCalledButtonCallback = true; @@ -141,8 +139,6 @@ Dali::Integration::Point GetPointUpOutside() return point; } -static float ANIMATION_TIME( 0.5f ); - } // namespace int UtcDaliButtonConstructorP(void) @@ -279,7 +275,7 @@ int UtcDaliButtonSetDisabledWithDifferentStates02P(void) DALI_TEST_EQUALS( isSelected, SELECTED , TEST_LOCATION ); tet_infoline("Set button to DISABLED = false whilst disabled and then set to unselected\n"); - button.SetProperty( Button::Property::DISABLED, false ); + button.SetProperty( Button::Property::DISABLED, false); button.SetProperty( Button::Property::SELECTED, !SELECTED ); isSelected = button.GetProperty( Button::Property::SELECTED ); @@ -306,13 +302,13 @@ int UtcDaliButtonIsDisabledP(void) Button button = PushButton::New(); - button.SetDisabled( true ); + button.SetProperty( Button::Property::DISABLED, true); - DALI_TEST_CHECK( button.IsDisabled() ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::DISABLED ), true, TEST_LOCATION ); - button.SetDisabled( false ); + button.SetProperty( Button::Property::DISABLED, false); - DALI_TEST_CHECK( !button.IsDisabled() ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::DISABLED ), false, TEST_LOCATION ); END_TEST; } @@ -334,9 +330,6 @@ int UtcDaliButtonAutoRepeatingPropertyP(void) DALI_TEST_EQUALS( button.GetProperty( button.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION ); - button.SetAutoRepeating( false ); - - DALI_TEST_CHECK( !button.IsAutoRepeating() ); END_TEST; } @@ -346,13 +339,14 @@ int UtcDaliButtonIsAutoRepeatingP(void) Button button = PushButton::New(); - button.SetAutoRepeating( true ); + button.SetProperty( Button::Property::AUTO_REPEATING, true); + + DALI_TEST_EQUALS( button.GetProperty( Button::Property::AUTO_REPEATING ), true, TEST_LOCATION ); - DALI_TEST_CHECK( button.IsAutoRepeating() ); + button.SetProperty( Button::Property::AUTO_REPEATING, false); - button.SetAutoRepeating( false ); + DALI_TEST_EQUALS( button.GetProperty( Button::Property::AUTO_REPEATING ), false, TEST_LOCATION ); - DALI_TEST_CHECK( !button.IsAutoRepeating() ); END_TEST; } @@ -364,10 +358,10 @@ 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 ); + 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.SendNotification(); @@ -482,19 +476,6 @@ int UtcDaliButtonSelectedPropertyP(void) END_TEST; } -int UtcDaliButtonSetAnimationTimeP(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliButtonSetAnimationTimeP"); - - Button button = PushButton::New(); - - button.SetAnimationTime( ANIMATION_TIME ); - - DALI_TEST_EQUALS( button.GetAnimationTime(), ANIMATION_TIME, TEST_LOCATION ); - END_TEST; -} - int UtcDaliButtonSetLabelStringWithPropertyMapP(void) { ToolkitTestApplication application; @@ -607,10 +588,10 @@ 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 ); @@ -714,10 +695,10 @@ 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 ); @@ -853,121 +834,6 @@ int UtcDaliButtonSetProperty(void) END_TEST; } -// Deprecated API Tests - -int UtcDaliButtonSetDisabledP(void) -{ - ToolkitTestApplication application; - - Button button = PushButton::New(); - - button.SetDisabled( true ); - - DALI_TEST_CHECK( button.IsDisabled() ); - - button.SetDisabled( false ); - - DALI_TEST_CHECK( !button.IsDisabled() ); - - button.SetDisabled( true ); - - DALI_TEST_CHECK( button.IsDisabled() ); - - button.SetDisabled( false ); - - DALI_TEST_CHECK( !button.IsDisabled() ); - END_TEST; -} - -int UtcDaliButtonSetAutoRepeatingP(void) -{ - ToolkitTestApplication application; - - Button button = PushButton::New(); - - button.SetAutoRepeating( true ); - - DALI_TEST_CHECK( button.IsAutoRepeating() ); - - button.SetAutoRepeating( false ); - - DALI_TEST_CHECK( !button.IsAutoRepeating() ); - - button.SetAutoRepeating( true ); - - DALI_TEST_CHECK( button.IsAutoRepeating() ); - - button.SetAutoRepeating( false ); - - DALI_TEST_CHECK( !button.IsAutoRepeating() ); - END_TEST; -} - -int UtcDaliButtonSetInitialAutoRepeatingDelayP(void) -{ - ToolkitTestApplication application; - - Button button = PushButton::New(); - - button.SetInitialAutoRepeatingDelay( 0.5f ); - - DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.5f, TEST_LOCATION ); - - button.SetInitialAutoRepeatingDelay( 0.2f ); - - DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.2f, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliButtonSetNextAutoRepeatingDelayP(void) -{ - ToolkitTestApplication application; - - Button button = PushButton::New(); - - button.SetNextAutoRepeatingDelay( 0.5f ); - - DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.5f, TEST_LOCATION ); - - button.SetProperty( Button::Property::NEXT_AUTO_REPEATING_DELAY, 0.2f ); - - DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.2f, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliButtonSetTogglableButtonP(void) -{ - ToolkitTestApplication application; - - Button button = PushButton::New(); - - button.SetTogglableButton( true ); - - DALI_TEST_CHECK( button.IsTogglableButton() ); - - button.SetTogglableButton( false ); - - DALI_TEST_CHECK( !button.IsTogglableButton() ); - END_TEST; -} - -int UtcDaliButtonSetSelectedP(void) -{ - ToolkitTestApplication application; - - Button button = PushButton::New(); - button.SetTogglableButton( true ); - - button.SetSelected( true ); - - DALI_TEST_CHECK( button.IsSelected() ); - - button.SetSelected( false ); - - DALI_TEST_CHECK( !button.IsSelected() ); - END_TEST; -} - int UtcDaliButtonEventConsumption(void) { /** @@ -982,15 +848,15 @@ int UtcDaliButtonEventConsumption(void) ToolkitTestApplication application; Button parentButton = PushButton::New(); - parentButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - parentButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - parentButton.SetSize( 20, 20 ); + 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 ); 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 @@ -1036,9 +902,9 @@ int UtcDaliButtonRelease(void) ToolkitTestApplication application; Button parentButton = PushButton::New(); - parentButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - parentButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - parentButton.SetSize( 20, 20 ); + 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 ); parentButton.ReleasedSignal().Connect( &ButtonCallback ); @@ -1081,9 +947,9 @@ 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 ); + 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 ); button.ReleasedSignal().Connect( &ButtonCallback ); @@ -1141,4 +1007,4 @@ int UtcDaliButtonMultiTouch(void) DALI_TEST_EQUALS( gIsCalledButtonCallback, true, TEST_LOCATION ); END_TEST; -} \ No newline at end of file +}