namespace
{
+/// Allows the creation of a BaseObject
+class BaseObjectType : public BaseObject
+{
+public:
+ BaseObjectType()
+ {
+ }
+};
+
Handle ImplicitCopyConstructor(Handle passedByValue)
{
// object + copy + passedByValue, ref count == 3
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::COLOR_MODE ) );
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::POSITION_INHERITANCE ) );
DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::DRAW_MODE ) );
+ DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::SIZE_MODE ) );
+ DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::SIZE_MODE_FACTOR ) );
END_TEST;
}
exception = true;
}
- DALI_TEST_CHECK(exception);
+ DALI_TEST_CHECK(!exception);// trying to set a read-only property is a no-op
DALI_TEST_EQUALS( 0.f, actor.GetProperty( readonly ).Get<float>(), TEST_LOCATION );
valueMap.SetValue("key", 5.f);
valueMap.SetValue("2key", "a string");
- DALI_TEST_EQUALS( true, valueMap.HasKey("key"), TEST_LOCATION);
+ DALI_TEST_EQUALS( true, valueMap.HasKey("key"), TEST_LOCATION);
DALI_TEST_EQUALS( "key", valueMap.GetKey(0), TEST_LOCATION);
DALI_TEST_EQUALS( true, valueMap.HasKey("2key"), TEST_LOCATION);
valueMap.SetItem(0, Property::Value("a string"));
valueMap.SetItem(1, Property::Value(5.f));
- DALI_TEST_EQUALS( 5.f, valueMap.GetValue("2key").Get<float>(), TEST_LOCATION);
- DALI_TEST_EQUALS( "a string", valueMap.GetValue("key").Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS( 5.f, valueMap.GetValue("2key").Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS( "a string", valueMap.GetValue("key").Get<std::string>(), TEST_LOCATION);
// ordered map
valueMap = Property::Value(Property::MAP);
DALI_TEST_CHECK( !actor.IsPropertyWritable( Actor::WORLD_POSITION ) );
- try
- {
- // World position is not writable
- actor.SetProperty( Actor::WORLD_POSITION, Vector3(1,2,3) );
- }
- catch (Dali::DaliException& e)
- {
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT(e, "IsDefaultPropertyWritable(index) && \"Property is read-only\"", TEST_LOCATION);
- }
+ // World position is not writable so this is a no-op and should not crash
+ actor.SetProperty( Actor::WORLD_POSITION, Vector3(1,2,3) );
END_TEST;
}
END_TEST;
}
+int UtcDaliHandleDownCastNegative(void)
+{
+ TestApplication application;
+
+ // BaseObject is NOT an Object, so this DownCast should fail
+ BaseHandle handle( new BaseObjectType );
+ Handle customHandle1 = Handle::DownCast( handle );
+ DALI_TEST_CHECK( ! customHandle1 );
+
+ // A DownCast on an empty handle will also fail
+ Handle empty;
+ Handle customHandle2 = Handle::DownCast( empty );
+ DALI_TEST_CHECK( ! customHandle2 );
+ END_TEST;
+}
+
int UtcDaliHandleCreateProperty(void)
{
TestApplication application;
}
END_TEST;
}
+
+int UtcDaliHandleCustomProperty(void)
+{
+ TestApplication application;
+
+ Handle handle = Handle::New();
+
+ float startValue(1.0f);
+ Property::Index index = handle.RegisterProperty( "test-property", startValue );
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ application.Render(0);
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+
+ handle.SetProperty( index, 5.0f );
+
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
+ application.Render(0);
+ DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
+ END_TEST;
+}