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
}
///////////////////////////////////////////////////////////////////////////////
+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
///////////////////////////////////////////////////////////////////////////////
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;
}
Constraint constraint;
try
{
- constraint.SetRemoveAction( Constraint::Discard );
+ constraint.SetRemoveAction( Constraint::DISCARD );
DALI_TEST_CHECK( false ); // Should not reach here!
}
catch( ... )
// 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();
// 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();
}
} // 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.
// 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
// 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
}
///////////////////////////////////////////////////////////////////////////////
+
+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;
+}