/*
- * Copyright (c) 2018 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.
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_ORIENTATION ) );
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_SCALE ) );
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_MODE ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_INHERITANCE ) );
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::DRAW_MODE ) );
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_MODE_FACTOR ) );
DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 29 ), TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliHandlePropertySetProperties(void)
+{
+ TestApplication application;
+ const Vector3 actorSize( 10.0f, 20.0f, 30.0f );
+ const Vector3 anchorPoint( 1.0f, 0.5f, 0.0f );
+ const Vector4 color( 0.1f, 0.2, 0.3f, 0.4f );
+
+ Handle handle = Actor::New();
+ DevelHandle::SetProperties(
+ handle,
+ Property::Map
+ {
+ { Actor::Property::SIZE, actorSize },
+ { Actor::Property::ANCHOR_POINT, anchorPoint },
+ { "color", color },
+ { "invalid", Vector2::ZERO } // It should quietly ignore invalid data
+ }
+ );
+ DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), actorSize, TEST_LOCATION );
+ DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::ANCHOR_POINT ).Get< Vector3 >(), anchorPoint, TEST_LOCATION );
+ DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::COLOR ).Get< Vector4 >(), color, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliHandleTemplateNew(void)
+{
+ TestApplication application;
+ const Vector3 actorSize( 10.0f, 20.0f, 30.0f );
+ const Vector3 anchorPoint( 1.0f, 0.5f, 0.0f );
+ const Vector4 color( 0.1f, 0.2, 0.3f, 0.4f );
+
+ Handle handle = DevelHandle::New< Actor >(
+ Property::Map
+ {
+ { Actor::Property::SIZE, actorSize },
+ { Actor::Property::ANCHOR_POINT, anchorPoint },
+ { "color", color },
+ { "invalid", Vector2::ZERO } // It should quietly ignore invalid data
+ }
+ );
+
+ DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), actorSize, TEST_LOCATION );
+ DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::ANCHOR_POINT ).Get< Vector3 >(), anchorPoint, TEST_LOCATION );
+ DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::COLOR ).Get< Vector4 >(), color, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliHandleGetProperties(void)
+{
+ TestApplication application;
+
+ Handle handle = Actor::New();
+ DevelHandle::SetProperties(
+ handle,
+ Property::Map
+ {
+ { Actor::Property::SIZE, Vector3( 400.0f, 200.0f, 100.0f ) },
+ { Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER },
+ { Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER },
+ { Actor::Property::NAME, "Actor" },
+ { Actor::Property::LEAVE_REQUIRED, true },
+ { "color", Color::RED },
+ }
+ );
+
+ Property::Map map;
+ DevelHandle::GetProperties( handle, map );
+
+ // Get all the properties and ensure they match
+
+ DALI_TEST_EQUALS( handle.GetPropertyCount(), map.Count(), TEST_LOCATION );
+
+ for( auto position = 0u; position < map.Count(); ++position )
+ {
+ auto keyValuePair = map.GetKeyValue( position );
+ const auto& index = keyValuePair.first.indexKey;
+ const auto& value = keyValuePair.second;
+ auto handleValue = handle.GetProperty( index );
+
+ switch( value.GetType() )
+ {
+ case Property::NONE: break;
+ case Property::BOOLEAN: DALI_TEST_EQUALS( value.Get< bool >(), handleValue.Get< bool >(), TEST_LOCATION ); break;
+ case Property::FLOAT: DALI_TEST_EQUALS( value.Get< float >(), handleValue.Get< float >(), TEST_LOCATION ); break;
+ case Property::INTEGER: DALI_TEST_EQUALS( value.Get< int >(), handleValue.Get< int >(), TEST_LOCATION ); break;
+ case Property::VECTOR2: DALI_TEST_EQUALS( value.Get< Vector2 >(), handleValue.Get< Vector2 >(), TEST_LOCATION ); break;
+ case Property::VECTOR3: DALI_TEST_EQUALS( value.Get< Vector3 >(), handleValue.Get< Vector3 >(), TEST_LOCATION ); break;
+ case Property::VECTOR4: DALI_TEST_EQUALS( value.Get< Vector4 >(), handleValue.Get< Vector4 >(), TEST_LOCATION ); break;
+ case Property::MATRIX3: DALI_TEST_EQUALS( value.Get< Matrix3 >(), handleValue.Get< Matrix3 >(), TEST_LOCATION ); break;
+ case Property::MATRIX: DALI_TEST_EQUALS( value.Get< Matrix >(), handleValue.Get< Matrix >(), TEST_LOCATION ); break;
+ case Property::RECTANGLE: DALI_TEST_EQUALS( value.Get< Rect< int > >(), handleValue.Get< Rect< int > >(), TEST_LOCATION ); break;
+ case Property::ROTATION: DALI_TEST_EQUALS( value.Get< Quaternion >(), handleValue.Get< Quaternion >(), TEST_LOCATION ); break;
+ case Property::STRING: DALI_TEST_EQUALS( value.Get< std::string >(), handleValue.Get< std::string >(), TEST_LOCATION ); break;
+ case Property::ARRAY: DALI_TEST_EQUALS( value.GetArray()->Count(), handleValue.GetArray()->Count(), TEST_LOCATION ); break;
+ case Property::MAP: DALI_TEST_EQUALS( value.GetMap()->Count(), handleValue.GetMap()->Count(), TEST_LOCATION ); break;
+ case Property::EXTENTS: DALI_TEST_EQUALS( value.Get< Extents >(), handleValue.Get< Extents >(), TEST_LOCATION ); break;
+ }
+ }
+
+ // Add a custom property and ensure the count goes up by one.
+ const auto countBefore = map.Count();
+ handle.RegisterProperty( "tempProperty", Color::GREEN );
+ DevelHandle::GetProperties( handle, map );
+ DALI_TEST_EQUALS( countBefore + 1, map.Count(), TEST_LOCATION );
+
+ END_TEST;
+}