+int UtcDaliHandleCustomPropertyInvalidToFloat(void)
+{
+ TestApplication application;
+
+ Handle handle = Handle::New();
+
+ float startValue(5.0);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
+
+ // Negative test i.e. there is no conversion from Vector3 to float
+ handle.SetProperty(index, Vector3(1, 2, 3));
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
+ END_TEST;
+}
+
+int UtcDaliHandleCustomPropertyInvalidToRotation(void)
+{
+ TestApplication application;
+
+ Handle handle = Handle::New();
+
+ Quaternion startValue(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<Quaternion>(index) == startValue);
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK(handle.GetProperty<Quaternion>(index) == startValue);
+
+ // Negative test i.e. there is no conversion from float to Quaternion
+ handle.SetProperty(index, float(7.0));
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK(handle.GetProperty<Quaternion>(index) == startValue);
+
+ // Positive test (sanity check)
+ Quaternion endValue(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ handle.SetProperty(index, endValue);
+ DALI_TEST_CHECK(handle.GetProperty<Quaternion>(index) == endValue);
+
+ END_TEST;
+}
+
+int UtcDaliHandleCustomPropertyInvalidToMatrix(void)
+{
+ TestApplication application;
+
+ Handle handle = Handle::New();
+
+ Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ Matrix startValue(rotation);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix>(index) == startValue);
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix>(index) == startValue);
+
+ // Negative test i.e. there is no conversion from float to Matrix
+ handle.SetProperty(index, float(7.0));
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix>(index) == startValue);
+
+ // Positive test (sanity check)
+ Quaternion endRotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ Matrix endValue(endRotation);
+ handle.SetProperty(index, endValue);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix>(index) == endValue);
+
+ END_TEST;
+}
+
+int UtcDaliHandleCustomPropertyInvalidToMatrix3(void)
+{
+ TestApplication application;
+
+ Handle handle = Handle::New();
+
+ Matrix3 startValue(11, 12, 13, 21, 22, 23, 31, 32, 33);
+
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix3>(index) == startValue);
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix3>(index) == startValue);
+
+ // Negative test i.e. there is no conversion from float to Matrix3
+ handle.SetProperty(index, float(7.0));
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix3>(index) == startValue);
+
+ // Positive test (sanity check)
+ Matrix3 endValue(31, 32, 33, 21, 22, 23, 11, 12, 13);
+ handle.SetProperty(index, endValue);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix3>(index) == endValue);
+
+ END_TEST;
+}
+
+int UtcDaliHandleWeightNew(void)
+{
+ TestApplication application;
+
+ Handle handle = WeightObject::New();
+ DALI_TEST_CHECK(handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f);
+
+ // process the message so scene object is added to update manager
+ application.SendNotification();
+ application.Render(0);
+
+ // no message to release scene object in this scenario
+
+ END_TEST;
+}
+
+int UtcDaliHandleWeightNew2(void)
+{
+ TestApplication application;
+
+ // scope for the weight object
+ {
+ Handle handle = WeightObject::New();
+ DALI_TEST_CHECK(handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f);
+
+ // process the message so scene object is added to update manager
+ application.SendNotification();
+ application.Render(0);
+ }
+ // handle out of scope so object gets destroyed
+ // process the message so update manager destroys the scene object
+ application.SendNotification();
+ application.Render(0);
+
+ END_TEST;
+}
+
+int UtcDaliHandleSetTypeInfo(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(typeInfo);
+
+ Actor actor = Actor::DownCast(typeInfo.CreateInstance());
+ DALI_TEST_CHECK(actor);
+
+ DevelHandle::SetTypeInfo(actor, typeInfo);
+
+ TypeInfo newTypeInfo;
+ bool success = actor.GetTypeInfo(newTypeInfo);
+ DALI_TEST_CHECK(success);
+
+ DALI_TEST_CHECK(typeInfo.GetName() == newTypeInfo.GetName());
+ DALI_TEST_CHECK(typeInfo.GetBaseName() == newTypeInfo.GetBaseName());
+
+ END_TEST;
+}
+
+int UtcDaliHandleCustomPropertySynchronousGetSet(void)
+{
+ TestApplication application;
+
+ tet_infoline("Create a custom property and set the value ensuring it can be retrieved synchronously");
+
+ Actor actor = Actor::New();
+ application.GetScene().Add(actor);
+
+ tet_infoline("Create the custom property with an initial value");
+ float startValue(1.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+
+ tet_infoline("Set the value, retrieve it and ensure both the synchronous and the async version work");
+ actor.SetProperty(index, 5.0f);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
+
+ tet_infoline("Render and retrieve values again");
+ application.SendNotification();
+ application.Render(0);
+
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 5.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleCustomPropertyGetType(void)
+{
+ TestApplication application;
+
+ tet_infoline("Create a custom property and retrieve its type");
+
+ Handle handle = Handle::New();
+ Property::Index index = handle.RegisterProperty("testProperty", 1.0f);
+ DALI_TEST_EQUALS(handle.GetPropertyType(index), Property::FLOAT, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleCustomPropertyAccessMode(void)
+{
+ TestApplication application;
+
+ tet_infoline("Create a custom property and retrieve whether it's animatable etc.");
+
+ Handle handle = Handle::New();
+ Property::Index index = handle.RegisterProperty("testProperty", 1.0f);
+ DALI_TEST_EQUALS(handle.IsPropertyAnimatable(index), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.IsPropertyWritable(index), true, TEST_LOCATION);
+
+ index = handle.RegisterProperty("testProperty2", 1.0f, Property::READ_ONLY);
+ DALI_TEST_EQUALS(handle.IsPropertyAnimatable(index), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.IsPropertyWritable(index), false, TEST_LOCATION);
+
+ index = handle.RegisterProperty("testProperty3", 1.0f, Property::READ_WRITE);
+ DALI_TEST_EQUALS(handle.IsPropertyAnimatable(index), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.IsPropertyWritable(index), true, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleGetCurrentProperty(void)
+{
+ TestApplication application;
+
+ tet_infoline("Get a default and non-animatable custom property using the GetCurrentProperty API");
+
+ Actor actor = Actor::New();
+ application.GetScene().Add(actor);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
+
+ Property::Index index = actor.RegisterProperty("testProperty3", 1.0f, Property::READ_WRITE);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 1.0f, TEST_LOCATION);
+
+ actor.SetProperty(index, 2.0f);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 2.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistP1(void)
+{
+ TestApplication application; // Needs type registry
+
+ tet_infoline("Test if a registered custom property exists on object");
+
+ Actor actor = Actor::New();
+ auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
+
+ DALI_TEST_EQUALS(actor.DoesCustomPropertyExist(propertyIndex), true, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistN1(void)
+{
+ TestApplication application; // Needs type registry
+
+ tet_infoline("Test if a registered custom property does not exist on object");
+
+ Actor actor = Actor::New();
+ auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
+
+ DALI_TEST_EQUALS(actor.DoesCustomPropertyExist(propertyIndex + 1), false, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistN2(void)
+{
+ TestApplication application; // Needs type registry
+
+ tet_infoline("Test that a default property does not show as a custom property on object");
+
+ Actor actor = Actor::New();
+ DALI_TEST_EQUALS(actor.DoesCustomPropertyExist(Actor::Property::POSITION), false, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistN3(void)
+{
+ TestApplication application; // Needs type registry
+
+ tet_infoline("Test that a child property does not exist on actor after parenting to container");
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor));
+
+ const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const char* CHILD_PROPERTY_NAME("childProperty");
+
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER);
+
+ auto container = Test::TestCustomActor::New();
+ application.GetScene().Add(container);
+ auto child = Actor::New();
+ container.Add(child); // Resolve child properties (if any)
+
+ DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), false, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistP2(void)
+{
+ TestApplication application; // Needs type registry
+
+ tet_infoline("Test that a child property exists after being set");
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor));
+
+ const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const char* CHILD_PROPERTY_NAME("childProperty");
+
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER);
+
+ auto container = Test::TestCustomActor::New();
+ application.GetScene().Add(container);
+ auto child = Actor::New();
+ container.Add(child); // Resolve child properties (if any)
+ child.SetProperty(CHILD_PROPERTY, 2);
+
+ DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetProperty<int>(CHILD_PROPERTY), 2, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistP3(void)
+{
+ TestApplication application; // Needs type registry
+
+ tet_infoline("Test that a child property is re-indexed after registration, and that it exists");
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor));
+
+ const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const char* CHILD_PROPERTY_NAME("childProperty");
+
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER);
+
+ auto container = Test::TestCustomActor::New();
+ application.GetScene().Add(container);
+ auto child = Actor::New();
+ child.RegisterProperty(CHILD_PROPERTY_NAME, Property::Value(3));
+ container.Add(child); // Resolve child properties (if any)
+
+ DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetProperty<int>(CHILD_PROPERTY), 3, TEST_LOCATION);
+ END_TEST;
+}
+
+namespace
+{
+struct PropertySetSignalCheck
+{
+ PropertySetSignalCheck(bool& signalReceived, Property::Value& value)
+ : mSignalReceived(signalReceived),
+ mValue(value)
+ {
+ }
+
+ void operator()(Handle& handle, Property::Index index, Property::Value value)
+ {
+ mSignalReceived = true;
+ mValue = value;
+ }
+
+ void Reset()
+ {
+ mSignalReceived = false;
+ }
+
+ void CheckSignalReceived()
+ {
+ if(!mSignalReceived)
+ {
+ tet_printf("Expected Property Set signal was not received\n");
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ bool& mSignalReceived; // owned by individual tests
+ Property::Value& mValue;
+};
+
+} // namespace
+
+int UtcDaliHandlePropertySetSignal01(void)
+{
+ TestApplication application;
+
+ bool signalReceived(false);
+ Property::Value value;
+ PropertySetSignalCheck propertySetCheck(signalReceived, value);
+
+ tet_infoline("Test that setting a default property triggers a signal");
+
+ auto actor = Actor::New();
+ actor.PropertySetSignal().Connect(&application, propertySetCheck);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3::XAXIS);
+ propertySetCheck.CheckSignalReceived();
+
+ END_TEST;
+}
+
+int UtcDaliHandlePropertySetSignal02(void)
+{
+ TestApplication application;
+
+ bool signalReceived(false);
+ Property::Value value;
+ PropertySetSignalCheck propertySetCheck(signalReceived, value);
+
+ tet_infoline("Test that setting a custom property triggers a signal");
+
+ auto actor = Actor::New();
+ actor.PropertySetSignal().Connect(&application, propertySetCheck);
+
+ auto propertyIndex = actor.RegisterProperty("propName", 3.0f);
+ actor.SetProperty(propertyIndex, 5.0f);
+ propertySetCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS(propertySetCheck.mValue, Property::Value(5.0f), 0.001f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandlePropertySetSignal03(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ bool signalReceived(false);
+ Property::Value value;
+ PropertySetSignalCheck propertySetCheck(signalReceived, value);
+
+ tet_infoline("Test that setting a child property triggers a signal");
+
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor));
+
+ const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const char* CHILD_PROPERTY_NAME("childProperty");
+
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER);
+
+ auto container = Test::TestCustomActor::New();
+ application.GetScene().Add(container);
+ auto child = Actor::New();
+ child.RegisterProperty(CHILD_PROPERTY_NAME, Property::Value(3));
+ child.PropertySetSignal().Connect(&application, propertySetCheck);
+ container.Add(child); // Resolve child properties (if any)
+
+ DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetProperty<int>(CHILD_PROPERTY), 3, TEST_LOCATION);
+
+ child.SetProperty(CHILD_PROPERTY, 29);
+ propertySetCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS(propertySetCheck.mValue, Property::Value(29), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliHandlePropertySetSignal04(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ bool signalReceived(false);
+ Property::Value value;
+ PropertySetSignalCheck propertySetCheck(signalReceived, value);
+
+ tet_infoline("Test that setting a property on a vanilla Object triggers a signal");
+
+ constexpr Property::Index TEST_PROPERTY_KEY_INDEX = 1;
+ const std::string TEST_PROPERTY_KEY_NAME = "testProperty";
+
+ Handle vanillaObject = Handle::New();
+ auto propertyIndex = vanillaObject.RegisterProperty(
+ TEST_PROPERTY_KEY_INDEX,
+ TEST_PROPERTY_KEY_NAME,
+ Color::WHITE);
+
+ vanillaObject.PropertySetSignal().Connect(&application, propertySetCheck);
+
+ DALI_TEST_EQUALS(vanillaObject.DoesCustomPropertyExist(propertyIndex), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(vanillaObject.GetProperty<Vector4>(propertyIndex), Color::WHITE, 0.001f, TEST_LOCATION);
+
+ vanillaObject[TEST_PROPERTY_KEY_NAME] = Color::RED;
+
+ propertySetCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS(propertySetCheck.mValue, Property::Value(Color::RED), 0.001f, TEST_LOCATION);
+ DALI_TEST_VALUE_EQUALS(vanillaObject[propertyIndex], Property::Value(Color::RED), 0.001f, 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();
+ handle.SetProperties(
+ 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 UtcDaliHandleTemplateNew01(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 = Handle::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();
+ handle.SetProperties(
+ 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;
+ handle.GetProperties(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);
+ handle.GetProperties(map);
+ DALI_TEST_EQUALS(countBefore + 1, map.Count(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleReserveProperties(void)
+{
+ TestApplication application;
+ Dali::Handle instance = Handle::New();
+ DALI_TEST_EQUALS(instance.GetPropertyCount(), 0, TEST_LOCATION);
+
+ instance.ReserveCustomProperties(0);
+ DALI_TEST_EQUALS(instance.GetPropertyCount(), 0, TEST_LOCATION);
+
+ instance.ReserveCustomProperties(20);
+ DALI_TEST_EQUALS(instance.GetPropertyCount(), 0, TEST_LOCATION);
+
+ instance.RegisterProperty("testProperty", 22.0f);
+ DALI_TEST_EQUALS(instance.GetPropertyCount(), 1, TEST_LOCATION);
+
+ // Test that reserving actor properties doesn't change property count
+ Dali::Actor actor = Actor::New();
+ auto count = actor.GetPropertyCount();
+
+ actor.ReserveCustomProperties(15);
+ DALI_TEST_EQUALS(actor.GetPropertyCount(), count, TEST_LOCATION);
+
+ // Test that reserving renderer properties doesn't change property count
+ Geometry geom = Geometry::New();
+ Shader shader = Shader::New("vertex", "frag");
+ Dali::Renderer renderer = Renderer::New(geom, shader);
+ count = renderer.GetPropertyCount();
+ renderer.ReserveCustomProperties(22);
+ DALI_TEST_EQUALS(renderer.GetPropertyCount(), count, TEST_LOCATION);
+
+ count = shader.GetPropertyCount();
+ shader.ReserveCustomProperties(5);
+ DALI_TEST_EQUALS(shader.GetPropertyCount(), count, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
+int UtcDaliHandleSetPropertyNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ Dali::Property::Value arg2;
+ instance.SetProperty(arg1, arg2);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleRegisterPropertyNegative01(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ std::string arg1;
+ Dali::Property::Value arg2;
+ instance.RegisterProperty(arg1, arg2);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleRegisterPropertyNegative02(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ std::string arg1;
+ Dali::Property::Value arg2;
+ Dali::Property::AccessMode arg3(Property::READ_ONLY);
+ instance.RegisterProperty(arg1, arg2, arg3);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleRemoveConstraintsNegative01(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ unsigned int arg1(0u);
+ instance.RemoveConstraints(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleRemoveConstraintsNegative02(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ instance.RemoveConstraints();
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleAddPropertyNotificationNegative01(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ int arg2(0);
+ Dali::PropertyCondition arg3;
+ instance.AddPropertyNotification(arg1, arg2, arg3);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleAddPropertyNotificationNegative02(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ Dali::PropertyCondition arg2;
+ instance.AddPropertyNotification(arg1, arg2);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleRemovePropertyNotificationNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ Dali::PropertyNotification arg1;
+ instance.RemovePropertyNotification(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleRemovePropertyNotificationsNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ instance.RemovePropertyNotifications();
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleGetPropertyNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ instance.GetProperty(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleGetPropertyNameNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ instance.GetPropertyName(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleGetPropertyTypeNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ instance.GetPropertyType(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleGetPropertyCountNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ instance.GetPropertyCount();
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleGetPropertyIndexNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ std::string arg1;
+ instance.GetPropertyIndex(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleGetCurrentPropertyNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ instance.GetCurrentProperty(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleGetPropertyIndicesNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ Dali::Vector<int> arg1;
+ instance.GetPropertyIndices(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleIsPropertyWritableNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ instance.IsPropertyWritable(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleIsPropertyAnimatableNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ instance.IsPropertyAnimatable(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleIsPropertyAConstraintInputNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ int arg1(0);
+ instance.IsPropertyAConstraintInput(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleSupportsNegative(void)
+{
+ TestApplication application;
+ Dali::Handle instance;
+ try
+ {
+ Dali::Handle::Capability arg1(Handle::DYNAMIC_PROPERTIES);
+ instance.Supports(arg1);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliHandleIndexOperatorByIndexP01(void)
+{
+ TestApplication application;
+ Actor actor = Actor::New();
+
+ actor[Actor::Property::SIZE] = Vector3(100.0f, 200.0f, 1.0f);
+
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(100.0f, 200.0f, 1.0f), 0.001f, TEST_LOCATION);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
+
+ Vector3 position = actor[Actor::Property::POSITION];
+ DALI_TEST_EQUALS(position, Vector3(10.0f, 20.0f, 0.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleIndexOperatorByIndexP02(void)
+{
+ TestApplication application;
+ Actor actor = Actor::New();
+
+ const Vector4 defaultActorColor(1.0f, 1.0f, 1.0f, 1.0f);
+ actor.SetProperty(Actor::Property::COLOR, defaultActorColor);
+ actor[Actor::Property::COLOR_RED] = 0.5f;
+
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
+
+ DALI_TEST_EQUALS((float)actor[Actor::Property::POSITION_Z], 0.0f, 0.001f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleIndexOperatorByIndexP03(void)
+{
+ TestApplication application;
+ Actor actor = Actor::New();
+
+ const Vector4 defaultActorColor(1.0f, 1.0f, 1.0f, 1.0f);
+ actor.SetProperty(Actor::Property::COLOR, defaultActorColor);
+
+ // Value under test is second to allow compiler to deduce type
+ DALI_TEST_VALUE_EQUALS(actor[Actor::Property::COLOR_RED], 1.0f, 0.001f, TEST_LOCATION);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
+
+ DALI_TEST_EQUALS((float)actor[Actor::Property::POSITION_Z], 0.0f, 0.001f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleIndexOperatorByNameP01(void)
+{
+ TestApplication application;
+ Actor actor = Actor::New();
+
+ actor["size"] = Vector3(100.0f, 200.0f, 1.0f);
+
+ DALI_TEST_VALUE_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3(100.0f, 200.0f, 1.0f), 0.001f, TEST_LOCATION);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
+ Vector3 position = actor["position"];
+
+ DALI_TEST_EQUALS(position, Vector3(10.0f, 20.0f, 0.0f), 0.001f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleIndexOperatorByNameP02(void)
+{
+ TestApplication application;
+ Actor actor = Actor::New();
+
+ const Vector4 defaultActorColor(1.0f, 1.0f, 1.0f, 1.0f);
+ actor.SetProperty(Actor::Property::COLOR, defaultActorColor);
+ actor["colorRed"] = 0.5f;
+
+ DALI_TEST_VALUE_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION);
+ DALI_TEST_VALUE_EQUALS(actor.GetProperty(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
+
+ float positionY = actor["positionY"];
+ DALI_TEST_EQUALS(positionY, 20.0f, 0.001f, TEST_LOCATION);
+
+ // Should automatically promote IndirectValue to Property::Value rvalue.
+ DALI_TEST_VALUE_EQUALS(actor["positionZ"], 0.0f, 0.001f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliHandleIndexOperatorNegative02(void)
+{
+ TestApplication application;
+
+ Actor actor;
+ try
+ {
+ Vector3 position = actor[Actor::Property::POSITION];
+ if(position == position)
+ {
+ DALI_TEST_CHECK(false); // Should throw before reaching here.
+ }
+ DALI_TEST_CHECK(false); // Should throw before reaching here.
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // Assert expected
+ }