// Reset
calledCount = 0;
- // Ensure constraint isn't called again if scene doesn't change
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( calledCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( calledCount, 1, TEST_LOCATION );
// Apply the clone constraint
constraintClone.Apply();
application.SendNotification();
application.Render();
- // Should only be called once for the new constraint clone ONLY
- DALI_TEST_EQUALS( calledCount, 1, TEST_LOCATION );
+ // Should be called once for the new constraint clone and once for the original constraint
+ DALI_TEST_EQUALS( calledCount, 3, TEST_LOCATION );
// Reset
calledCount = 0;
Actor actor = Actor::New();
Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
- DALI_TEST_EQUALS( constraint.GetTargetProperty(), Actor::Property::POSITION, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraint.GetTargetProperty(), (Property::Index)Actor::Property::POSITION, TEST_LOCATION );
END_TEST;
}
Actor actor = Actor::New();
Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
- DALI_TEST_EQUALS( constraint.GetTag(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( constraint.GetTag(), 0u, TEST_LOCATION );
- const int tag = 123;
+ const unsigned int tag = 123;
constraint.SetTag( tag );
DALI_TEST_EQUALS( constraint.GetTag(), tag, TEST_LOCATION );
application.SendNotification();
application.Render();
- // Constraint should not have been called as the input-properties (none) have not changed for the constraint
- DALI_TEST_EQUALS( count, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( count, 1, TEST_LOCATION );
// Reset
count = 0;
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+namespace TestPropertyTypes
+{
+template< typename T >
+void Execute( T value )
+{
+ TestApplication application;
+ bool functorCalled = false;
+
+ Actor actor = Actor::New();
+ Property::Index index = actor.RegisterProperty( "TEMP_PROPERTY_NAME", value );
+
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION );
+
+ // Add a constraint
+ Constraint constraint = Constraint::New< T >( actor, index, BasicCalledFunctor< T >( functorCalled ) );
+ DALI_TEST_CHECK( constraint );
+ constraint.Apply();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION );
+}
+} // namespace UtcDaliConstraintNewFunctor
+
+int UtcDaliConstraintTestPropertyTypesP(void)
+{
+ // Ensure we can use a constraint functor with all supported property types
+
+ TestPropertyTypes::Execute< bool >( false );
+ TestPropertyTypes::Execute< int >( 0 );
+ TestPropertyTypes::Execute< float >( 0.0f );
+ TestPropertyTypes::Execute< Vector2 >( Vector2::ZERO );
+ TestPropertyTypes::Execute< Vector3 >( Vector3::ZERO );
+ TestPropertyTypes::Execute< Vector4 >( Vector4::ZERO );
+ TestPropertyTypes::Execute< Quaternion >( Quaternion::IDENTITY );
+ TestPropertyTypes::Execute< Matrix >( Matrix::IDENTITY );
+ TestPropertyTypes::Execute< Matrix3 >( Matrix3::IDENTITY );
+
+ END_TEST;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+