Renaming of enum values for coding standards compliance.
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Constraint.cpp
index 0bf072e..2e4b354 100644 (file)
@@ -485,7 +485,7 @@ int UtcDaliConstraintCloneCheckSourcesAndSetters(void)
   constraint.AddSource( LocalSource( Actor::Property::ORIENTATION ) );
   constraint.AddSource( LocalSource( Actor::Property::COLOR ) );
   constraint.AddSource( LocalSource( Actor::Property::VISIBLE ) );
-  constraint.SetRemoveAction( Constraint::Discard );
+  constraint.SetRemoveAction( Constraint::DISCARD );
   constraint.SetTag( 123 );
 
   // Clone the constraint & apply the clone
@@ -528,6 +528,53 @@ int UtcDaliConstraintCopyAndAssignment(void)
 }
 ///////////////////////////////////////////////////////////////////////////////
 
+int UtcDaliConstraintMoveConstructor(void)
+{
+  // Ensure copy constructor & assignment operators work
+
+  TestApplication application;
+
+  Actor actor = Actor::New();
+  application.GetScene().Add( actor );
+
+  Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
+  DALI_TEST_CHECK( constraint );
+  DALI_TEST_EQUALS( 1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+  DALI_TEST_CHECK( constraint.GetTargetObject() == actor );
+
+  Constraint moved = std::move( constraint );
+  DALI_TEST_CHECK( moved );
+  DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+  DALI_TEST_CHECK( moved.GetTargetObject() == actor );
+  DALI_TEST_CHECK( !constraint );
+
+  END_TEST;
+}
+
+int UtcDaliConstraintMoveAssignment(void)
+{
+  // Ensure copy constructor & assignment operators work
+
+  TestApplication application;
+
+  Actor actor = Actor::New();
+  application.GetScene().Add( actor );
+
+  Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
+  DALI_TEST_CHECK( constraint );
+  DALI_TEST_EQUALS( 1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+  DALI_TEST_CHECK( constraint.GetTargetObject() == actor );
+
+  Constraint moved;
+  moved = std::move( constraint );
+  DALI_TEST_CHECK( moved );
+  DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+  DALI_TEST_CHECK( moved.GetTargetObject() == actor );
+  DALI_TEST_CHECK( !constraint );
+
+  END_TEST;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 // Constraint::DownCast
 ///////////////////////////////////////////////////////////////////////////////
@@ -704,11 +751,11 @@ int UtcDaliConstraintRemoveActionP(void)
   Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
   DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::DEFAULT_REMOVE_ACTION, TEST_LOCATION );
 
-  constraint.SetRemoveAction( Constraint::Discard );
-  DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::Discard, TEST_LOCATION );
+  constraint.SetRemoveAction( Constraint::DISCARD );
+  DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::DISCARD, TEST_LOCATION );
 
-  constraint.SetRemoveAction( Constraint::Bake );
-  DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::Bake, TEST_LOCATION );
+  constraint.SetRemoveAction( Constraint::BAKE );
+  DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::BAKE, TEST_LOCATION );
 
   END_TEST;
 }
@@ -722,7 +769,7 @@ int UtcDaliConstraintSetRemoveActionN(void)
   Constraint constraint;
   try
   {
-    constraint.SetRemoveAction( Constraint::Discard );
+    constraint.SetRemoveAction( Constraint::DISCARD );
     DALI_TEST_CHECK( false ); // Should not reach here!
   }
   catch( ... )
@@ -772,7 +819,7 @@ int UtcDaliConstraintBakeRemoveAction(void)
 
   // Create a constraint that constrains to position
   Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, SetValueFunctor< Vector3 >( position ) );
-  constraint.SetRemoveAction( Constraint::Bake );
+  constraint.SetRemoveAction( Constraint::BAKE );
   constraint.Apply();
 
   application.SendNotification();
@@ -812,7 +859,7 @@ int UtcDaliConstraintDiscardRemoveAction(void)
 
   // Create a constraint that constrains to position
   Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, SetValueFunctor< Vector3 >( position ) );
-  constraint.SetRemoveAction( Constraint::Discard );
+  constraint.SetRemoveAction( Constraint::DISCARD );
   constraint.Apply();
 
   application.SendNotification();
@@ -1246,7 +1293,7 @@ void SetHalfOpacity( Vector4& current, const PropertyInputContainer& inputs )
 }
 } // unnamed namespace
 
-int UtcDaliConstraintEnsureResetterAppliedOnStageRemoval(void)
+int UtcDaliConstraintEnsureResetterAppliedOnSceneRemoval(void)
 {
   // Ensure BOTH double-buffered values of our color property is reset when a constraint is applied to it.
 
@@ -1262,7 +1309,7 @@ int UtcDaliConstraintEnsureResetterAppliedOnStageRemoval(void)
 
   // Create a constraint whose value is discarded when it is removed
   Constraint constraint = Constraint::New< Vector4 >( actor, Actor::Property::COLOR, SetHalfOpacity );
-  constraint.SetRemoveAction( Constraint::RemoveAction::Discard );
+  constraint.SetRemoveAction( Constraint::RemoveAction::DISCARD );
   constraint.Apply();
 
   // Check value after one render, it should be constrained
@@ -1317,7 +1364,7 @@ int UtcDaliConstraintOnActorAddedAndRemoved(void)
 
   // Create a constraint whose value is discarded when it is removed
   Constraint constraint = Constraint::New< Vector4 >( actor, Actor::Property::COLOR, SetHalfOpacity );
-  constraint.SetRemoveAction( Constraint::RemoveAction::Discard );
+  constraint.SetRemoveAction( Constraint::RemoveAction::DISCARD );
   constraint.Apply();
 
   // Check value after one render, it should be constrained
@@ -1358,3 +1405,150 @@ int UtcDaliConstraintOnActorAddedAndRemoved(void)
 }
 
 ///////////////////////////////////////////////////////////////////////////////
+
+int UtcDaliConstraintGetTargetObjectNegative(void)
+{
+  TestApplication application;
+  Dali::Constraint instance;
+  try
+  {
+    instance.GetTargetObject();
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliConstraintSetRemoveActionNegative(void)
+{
+  TestApplication application;
+  Dali::Constraint instance;
+  try
+  {
+    Dali::Constraint::RemoveAction arg1(Constraint::BAKE);
+    instance.SetRemoveAction(arg1);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliConstraintGetTargetPropertyNegative(void)
+{
+  TestApplication application;
+  Dali::Constraint instance;
+  try
+  {
+    instance.GetTargetProperty();
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliConstraintApplyNegative(void)
+{
+  TestApplication application;
+  Dali::Constraint instance;
+  try
+  {
+    instance.Apply();
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliConstraintCloneNegative(void)
+{
+  TestApplication application;
+  Dali::Constraint instance;
+  try
+  {
+    Dali::Handle arg1;
+    instance.Clone(arg1);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliConstraintRemoveNegative(void)
+{
+  TestApplication application;
+  Dali::Constraint instance;
+  try
+  {
+    instance.Remove();
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliConstraintSetTagNegative(void)
+{
+  TestApplication application;
+  Dali::Constraint instance;
+  try
+  {
+    unsigned int arg1(0u);
+    instance.SetTag(arg1);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliConstraintGetRemoveActionNegative(void)
+{
+  TestApplication application;
+  Dali::Constraint instance;
+  try
+  {
+    instance.GetRemoveAction();
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliConstraintGetTagNegative(void)
+{
+  TestApplication application;
+  Dali::Constraint instance;
+  try
+  {
+    instance.GetTag();
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}