Rendering API Stencil Implementation
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Constraint.cpp
index e1b8ac0..410a14a 100644 (file)
@@ -365,11 +365,10 @@ int UtcDaliConstraintCloneP(void)
   // 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();
@@ -377,8 +376,8 @@ int UtcDaliConstraintCloneP(void)
   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;
@@ -569,7 +568,7 @@ int UtcDaliConstraintGetTargetPropertyP(void)
 
   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;
 }
@@ -606,9 +605,9 @@ int UtcDaliConstraintTagP(void)
 
   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 );
 
@@ -997,8 +996,7 @@ int UtcDaliConstraintApplySeveralTimes(void)
   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;
@@ -1153,3 +1151,54 @@ int UtcDaliConstraintChaining(void)
   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;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+