/*
- * 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.
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;
Button button = PushButton::New();
button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- button.SetPosition( 240, 400 );
- button.SetSize( 100, 100 );
- Stage::GetCurrent().Add( button );
+ button.SetProperty( Actor::Property::POSITION, Vector2( 240, 400 ));
+ button.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) );
+ application.GetScene().Add( button );
application.SendNotification();
application.Render();
Button button = PushButton::New();
button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- button.SetPosition( 240, 400 );
- button.SetSize( 100, 100 );
+ 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 button = PushButton::New();
button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- button.SetPosition( 240, 400 );
- button.SetSize( 100, 100 );
+ 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();
Button parentButton = PushButton::New();
parentButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
parentButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- parentButton.SetSize( 20, 20 );
- Stage::GetCurrent().Add( parentButton );
+ parentButton.SetProperty( Actor::Property::SIZE, Vector2( 20, 20 ) );
+ application.GetScene().Add( parentButton );
Button childButton = PushButton::New();
childButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
childButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT );
- childButton.SetSize( 20, 20 );
+ childButton.SetProperty( Actor::Property::SIZE, Vector2( 20, 20 ) );
parentButton.Add( childButton );
// Reset signal flags
Button parentButton = PushButton::New();
parentButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
parentButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- parentButton.SetSize( 20, 20 );
- Stage::GetCurrent().Add( parentButton );
+ parentButton.SetProperty( Actor::Property::SIZE, Vector2( 20, 20 ) );
+ application.GetScene().Add( parentButton );
parentButton.ReleasedSignal().Connect( &ButtonCallback );
// Reset signal flags
button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- button.SetSize( 20, 20 );
- Stage::GetCurrent().Add( button );
+ button.SetProperty( Actor::Property::SIZE, Vector2( 20, 20 ) );
+ application.GetScene().Add( button );
button.ReleasedSignal().Connect( &ButtonCallback );
// Reset signal flags