/*
- * 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.
return point;
}
-static float ANIMATION_TIME( 0.5f );
-
} // namespace
int UtcDaliButtonConstructorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Button button;
int UtcDaliButtonCopyConstructorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
// Initialize an object, ref count == 1
Button button = PushButton::New();
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<bool>( Button::Property::TOGGLABLE ), false , TEST_LOCATION );
+ button.SetProperty( Button::Property::TOGGLABLE, true );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( 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<bool>( Button::Property::TOGGLABLE ), true , TEST_LOCATION );
+ DALI_TEST_CHECK( !button );
+
+ END_TEST;
+}
+
int UtcDaliButtonAssignmentOperatorP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Button button = PushButton::New();
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<bool>( Button::Property::TOGGLABLE ), false , TEST_LOCATION );
+ button.SetProperty( Button::Property::TOGGLABLE, true );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( 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<bool>( Button::Property::TOGGLABLE ), true , TEST_LOCATION );
+ DALI_TEST_CHECK( !button );
+
+ END_TEST;
+}
+
int UtcDaliButtonDownCastP(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
Button button = PushButton::New();
int UtcDaliButtonDownCastN(void)
{
- TestApplication application;
+ ToolkitTestApplication application;
BaseHandle unInitializedObject;
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<bool>( Button::Property::SELECTED );
Button button = PushButton::New();
- button.SetDisabled( true );
+ button.SetProperty( Button::Property::DISABLED, true);
- DALI_TEST_CHECK( button.IsDisabled() );
+ DALI_TEST_EQUALS( button.GetProperty<bool>( 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<bool>( Button::Property::DISABLED ), false, TEST_LOCATION );
END_TEST;
}
DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
- button.SetAutoRepeating( false );
-
- DALI_TEST_CHECK( !button.IsAutoRepeating() );
END_TEST;
}
Button button = PushButton::New();
- button.SetAutoRepeating( true );
+ button.SetProperty( Button::Property::AUTO_REPEATING, true);
+
+ DALI_TEST_EQUALS( button.GetProperty<bool>( 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<bool>( Button::Property::AUTO_REPEATING ), false, TEST_LOCATION );
- DALI_TEST_CHECK( !button.IsAutoRepeating() );
END_TEST;
}
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();
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;
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();
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();
button.SetProperty( Button::Property::TOGGLABLE, true);
- Stage::GetCurrent().Add( button );
+ application.GetScene().Add( button );
application.SendNotification();
application.Render();
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)
{
/**
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
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
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