X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Constraint.cpp;h=2f7ae2a1b09c14be4a08eec35a2e6c9dcb043ce6;hb=364efcf77b11cc5b88fbc154770283d2af7af798;hp=e560e2dd5a5012522ffd10e7df8dbd516875bfe1;hpb=7dcb0a38005dd8c6d71e466c1ea0ec4d7d57239f;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-Constraint.cpp b/automated-tests/src/dali/utc-Dali-Constraint.cpp index e560e2d..2f7ae2a 100644 --- a/automated-tests/src/dali/utc-Dali-Constraint.cpp +++ b/automated-tests/src/dali/utc-Dali-Constraint.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include using namespace Dali; @@ -66,6 +66,7 @@ class PropertyInputAbstraction : public Dali::PropertyInput public: PropertyInputAbstraction(const bool& val) : mType(Dali::Property::BOOLEAN), mBoolData( val ) {} PropertyInputAbstraction(const float& val) : mType(Dali::Property::FLOAT), mFloatData( val ) {} + PropertyInputAbstraction(const int& val) : mType(Dali::Property::INTEGER), mIntData( val ) {} PropertyInputAbstraction(const Vector2& val) : mType(Dali::Property::VECTOR2), mVector2Data( val ) {} PropertyInputAbstraction(const Vector3& val) : mType(Dali::Property::VECTOR3), mVector3Data( val ) {} PropertyInputAbstraction(const Vector4& val) : mType(Dali::Property::VECTOR4), mVector4Data( val ) {} @@ -81,6 +82,8 @@ public: const float& GetFloat() const { return mFloatData; } + const int& GetInteger() const { return mIntData; } + const Vector2& GetVector2() const { return mVector2Data; } const Vector3& GetVector3() const { return mVector3Data; } const Vector4& GetVector4() const { return mVector4Data; } @@ -94,6 +97,7 @@ private: Dali::Property::Type mType; bool mBoolData; float mFloatData; + int mIntData; Vector2 mVector2Data; Vector3 mVector3Data; Vector4 mVector4Data; @@ -167,9 +171,9 @@ struct TestAlwaysTrueConstraint } }; -struct TestAlwaysEqualOrGreaterThanConstraint +struct TestAlwaysEqualOrGreaterThanConstraintFloat { - TestAlwaysEqualOrGreaterThanConstraint( float value ) + TestAlwaysEqualOrGreaterThanConstraintFloat( float value ) : mValue( value ) { } @@ -182,6 +186,21 @@ struct TestAlwaysEqualOrGreaterThanConstraint float mValue; }; +struct TestAlwaysEqualOrGreaterThanConstraintInteger +{ + TestAlwaysEqualOrGreaterThanConstraintInteger( int value ) + : mValue( value ) + { + } + + int operator()( const int& current ) + { + return ( current < mValue ) ? mValue : current; + } + + int mValue; +}; + struct TestAlwaysEqualOrGreaterThanConstraintVector2 { TestAlwaysEqualOrGreaterThanConstraintVector2( Vector2 value ) @@ -251,6 +270,21 @@ struct TestConstraintFloat float mValue; }; +struct TestConstraintInteger +{ + TestConstraintInteger( int value ) + : mValue( value ) + { + } + + int operator()( const int& current ) + { + return mValue; + } + + int mValue; +}; + struct TestConstraintVector2 { TestConstraintVector2( Vector2 value ) @@ -592,7 +626,7 @@ int UtcDaliConstraintNewFloat(void) // Apply constraint float minValue( 2.0f ); - Constraint constraint = Constraint::New( index, TestAlwaysEqualOrGreaterThanConstraint( minValue ) ); + Constraint constraint = Constraint::New( index, TestAlwaysEqualOrGreaterThanConstraintFloat( minValue ) ); actor.ApplyConstraint( constraint ); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -650,6 +684,91 @@ int UtcDaliConstraintNewFloat(void) END_TEST; } +int UtcDaliConstraintNewInteger(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + + // Register an integer property + int startValue( 1 ); + Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Stage::GetCurrent().Add(actor); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + + /** + * Test that the Constraint is correctly applied on a clean Node + */ + application.SendNotification(); + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + + // Apply constraint + + int minValue( 2 ); + Constraint constraint = Constraint::New( index, TestAlwaysEqualOrGreaterThanConstraintInteger( minValue ) ); + + actor.ApplyConstraint( constraint ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + + application.SendNotification(); + application.Render(0); + + // Constraint should be fully applied + DALI_TEST_EQUALS( actor.GetProperty(index), minValue, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), minValue, TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), minValue, TEST_LOCATION ); + + // Set to greater than 2f, the constraint will allow this + actor.SetProperty( index, 3 ); + + application.SendNotification(); + application.Render(0); + + DALI_TEST_EQUALS( actor.GetProperty(index), 3, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), 3, TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), 3, TEST_LOCATION ); + + // Set to less than 2, the constraint will NOT allow this + actor.SetProperty( index, 1 ); + + application.SendNotification(); + application.Render(0); + + DALI_TEST_EQUALS( actor.GetProperty(index), minValue/*not 1*/, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), minValue, TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), minValue, TEST_LOCATION ); + + // Remove the constraint, then set new value + actor.RemoveConstraints(); + actor.SetProperty( index, 1 ); + + // Constraint should have been removed + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), 1, TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), 1, TEST_LOCATION ); + END_TEST; + +} + int UtcDaliConstraintNewVector2(void) { TestApplication application; @@ -940,7 +1059,7 @@ int UtcDaliConstraintNewMatrix(void) } catch (Dali::DaliException& e) { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); + DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_CHECK(0); } END_TEST; @@ -977,7 +1096,7 @@ int UtcDaliConstraintNewMatrix3(void) } catch (Dali::DaliException& e) { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() ); + DALI_TEST_PRINT_ASSERT( e ); DALI_TEST_CHECK(0); } END_TEST; @@ -1231,6 +1350,95 @@ int UtcDaliConstraintNewOffStageFloat(void) END_TEST; } +int UtcDaliConstraintNewOffStageInteger(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + + // Register an integer property + int startValue(1); + Property::Index index = actor.RegisterProperty( "test-property", startValue ); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + + // Apply constraint to off-stage Actor + int constrainedValue( 2 ); + Constraint constraint = Constraint::New( index, TestConstraintInteger( constrainedValue ) ); + actor.ApplyConstraint( constraint ); + + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + + // Add actor to stage + Stage::GetCurrent().Add(actor); + application.SendNotification(); + application.Render(0); + + // Constraint should be fully applied + DALI_TEST_EQUALS( actor.GetProperty(index), constrainedValue, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), constrainedValue, TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), constrainedValue, TEST_LOCATION ); + + // Take the actor off-stage + Stage::GetCurrent().Remove(actor); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), constrainedValue, TEST_LOCATION ); + + // Set back to startValue; the constraint will not prevent this + actor.SetProperty( index, startValue ); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + + // Add actor to stage (2nd time) + Stage::GetCurrent().Add(actor); + application.SendNotification(); + application.Render(0); + + // Constraint should be fully applied (2nd time) + DALI_TEST_EQUALS( actor.GetProperty(index), constrainedValue, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), constrainedValue, TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), constrainedValue, TEST_LOCATION ); + + // Take the actor off-stage (2nd-time) + Stage::GetCurrent().Remove(actor); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), constrainedValue, TEST_LOCATION ); + + // Remove the constraint, and set back to startValue + actor.RemoveConstraints(); + actor.SetProperty( index, startValue ); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + + // Add actor to stage (3rd time) + Stage::GetCurrent().Add(actor); + application.SendNotification(); + application.Render(0); + + // Constraint should be gone + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + END_TEST; +} + int UtcDaliConstraintNewOffStageVector2(void) { TestApplication application; @@ -1604,20 +1812,20 @@ int UtcDaliConstraintNewLocalInput(void) */ application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); // Apply constraint with a local input property - Constraint constraint = Constraint::New( Actor::POSITION, - LocalSource( Actor::COLOR ), + Constraint constraint = Constraint::New( Actor::Property::POSITION, + LocalSource( Actor::Property::COLOR ), MoveAwayWithFadeConstraint(distanceWhenFullyTransparent) ); actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(0); @@ -1630,9 +1838,9 @@ int UtcDaliConstraintNewLocalInput(void) application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), ( startValue - Vector3(0.0f, 0.0f, progress*distanceWhenFullyTransparent) ), POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), ( startValue - Vector3(0.0f, 0.0f, progress*distanceWhenFullyTransparent) ), POSITION_EPSILON, TEST_LOCATION ); } - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), ( startValue - Vector3(0.0f, 0.0f, distanceWhenFullyTransparent) ), POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), ( startValue - Vector3(0.0f, 0.0f, distanceWhenFullyTransparent) ), POSITION_EPSILON, TEST_LOCATION ); END_TEST; } @@ -1655,26 +1863,26 @@ int UtcDaliConstraintNewParentInput(void) */ application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); // Apply constraint with a parent input property - Constraint constraint = Constraint::New( Actor::POSITION, - ParentSource( Actor::SIZE ), + Constraint constraint = Constraint::New( Actor::Property::POSITION, + ParentSource( Actor::Property::SIZE ), TestBottomRightAlignConstraint() ); actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), parentStartSize, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), parent.GetCurrentSize(), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), parentStartSize, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), parent.GetCurrentSize(), TEST_LOCATION ); // Gradually shrink the parent; the actor should move inwards @@ -1686,10 +1894,10 @@ int UtcDaliConstraintNewParentInput(void) application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), size, POSITION_EPSILON, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), parent.GetCurrentSize(), POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), size, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), parent.GetCurrentSize(), POSITION_EPSILON, TEST_LOCATION ); } - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), Vector3::ZERO, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), Vector3::ZERO, POSITION_EPSILON, TEST_LOCATION ); END_TEST; } @@ -1716,30 +1924,30 @@ int UtcDaliConstraintNewInput1(void) */ application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); // Apply constraint with a parent input property - Constraint constraint = Constraint::New( Actor::POSITION, - Source( sibling1, Actor::POSITION ), + Constraint constraint = Constraint::New( Actor::Property::POSITION, + Source( sibling1, Actor::Property::POSITION ), MeanPositionConstraint1() ); actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), sibling1.GetCurrentPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), sibling1.GetCurrentPosition(), TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), sibling1.GetCurrentPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), sibling1.GetCurrentPosition(), TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), sibling1.GetCurrentPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), sibling1.GetCurrentPosition(), TEST_LOCATION ); END_TEST; } @@ -1776,31 +1984,31 @@ int UtcDaliConstraintNewInput2(void) */ application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); // Apply constraint with a parent input property - Constraint constraint = Constraint::New( Actor::POSITION, - Source( sibling1, Actor::POSITION ), - Source( sibling2, Actor::POSITION ), + Constraint constraint = Constraint::New( Actor::Property::POSITION, + Source( sibling1, Actor::Property::POSITION ), + Source( sibling2, Actor::Property::POSITION ), MeanPositionConstraint2() ); actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); END_TEST; } @@ -1842,32 +2050,32 @@ int UtcDaliConstraintNewInput3(void) */ application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); // Apply constraint with a parent input property - Constraint constraint = Constraint::New( Actor::POSITION, - Source( sibling1, Actor::POSITION ), - Source( sibling2, Actor::POSITION ), - Source( sibling3, Actor::POSITION ), + Constraint constraint = Constraint::New( Actor::Property::POSITION, + Source( sibling1, Actor::Property::POSITION ), + Source( sibling2, Actor::Property::POSITION ), + Source( sibling3, Actor::Property::POSITION ), MeanPositionConstraint3() ); actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); END_TEST; } @@ -1911,33 +2119,33 @@ int UtcDaliConstraintNewInput4(void) */ application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); // Apply constraint with a parent input property - Constraint constraint = Constraint::New( Actor::POSITION, - Source( sibling1, Actor::POSITION ), - Source( sibling2, Actor::POSITION ), - ParentSource( Actor::POSITION ), - Source( sibling3, Actor::POSITION ), + Constraint constraint = Constraint::New( Actor::Property::POSITION, + Source( sibling1, Actor::Property::POSITION ), + Source( sibling2, Actor::Property::POSITION ), + ParentSource( Actor::Property::POSITION ), + Source( sibling3, Actor::Property::POSITION ), MeanPositionConstraint4() ); actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); END_TEST; } @@ -1986,34 +2194,34 @@ int UtcDaliConstraintNewInput5(void) */ application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); // Apply constraint with a parent input property - Constraint constraint = Constraint::New( Actor::POSITION, - Source( sibling1, Actor::POSITION ), - Source( sibling2, Actor::POSITION ), - ParentSource( Actor::POSITION ), - Source( sibling3, Actor::POSITION ), - Source( sibling4, Actor::POSITION ), + Constraint constraint = Constraint::New( Actor::Property::POSITION, + Source( sibling1, Actor::Property::POSITION ), + Source( sibling2, Actor::Property::POSITION ), + ParentSource( Actor::Property::POSITION ), + Source( sibling3, Actor::Property::POSITION ), + Source( sibling4, Actor::Property::POSITION ), MeanPositionConstraint5() ); actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); END_TEST; } @@ -2067,35 +2275,35 @@ int UtcDaliConstraintNewInput6(void) */ application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); // Apply constraint with a parent input property - Constraint constraint = Constraint::New( Actor::POSITION, - Source( child, Actor::POSITION ), - Source( sibling1, Actor::POSITION ), - Source( sibling2, Actor::POSITION ), - ParentSource( Actor::POSITION ), - Source( sibling3, Actor::POSITION ), - Source( sibling4, Actor::POSITION ), + Constraint constraint = Constraint::New( Actor::Property::POSITION, + Source( child, Actor::Property::POSITION ), + Source( sibling1, Actor::Property::POSITION ), + Source( sibling2, Actor::Property::POSITION ), + ParentSource( Actor::Property::POSITION ), + Source( sibling3, Actor::Property::POSITION ), + Source( sibling4, Actor::Property::POSITION ), MeanPositionConstraint6() ); actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), meanValue, POSITION_EPSILON, TEST_LOCATION ); END_TEST; } @@ -2135,7 +2343,7 @@ int UtcDaliConstraintSetApplyTime(void) // Build constraint Vector4 targetColor(Color::BLACK); - Constraint constraint = Constraint::New( Actor::COLOR, TestColorConstraint(targetColor) ); + Constraint constraint = Constraint::New( Actor::Property::COLOR, TestColorConstraint(targetColor) ); DALI_TEST_EQUALS(constraint.GetApplyTime(), TimePeriod(0.0f), TEST_LOCATION); float applySeconds(7.0f); @@ -2192,7 +2400,7 @@ int UtcDaliConstraintGetApplyTime(void) { TestApplication application; - Constraint constraint = Constraint::New( Actor::COLOR, TestConstraint() ); + Constraint constraint = Constraint::New( Actor::Property::COLOR, TestConstraint() ); DALI_TEST_EQUALS(constraint.GetApplyTime(), TimePeriod(0.0f), TEST_LOCATION); float applySeconds(7.0f); @@ -2204,99 +2412,6 @@ int UtcDaliConstraintGetApplyTime(void) END_TEST; } -int UtcDaliConstraintSetRemoveTime(void) -{ - TestApplication application; - - Vector3 sourcePosition(0.0f, 0.0f, 0.0f); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); - - // Build constraint - - Constraint constraint = Constraint::New( Actor::POSITION, TestPositionConstraint(targetPosition) ); - DALI_TEST_EQUALS(constraint.GetRemoveTime(), TimePeriod(0.0f), TEST_LOCATION); - - float removeSeconds(8.0f); - constraint.SetRemoveTime(removeSeconds); - DALI_TEST_EQUALS(constraint.GetRemoveTime(), TimePeriod(removeSeconds), TEST_LOCATION); - - // Apply to an actor - - Actor actor = Actor::New(); - Stage::GetCurrent().Add(actor); - - actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), sourcePosition, TEST_LOCATION ); - - application.SendNotification(); - application.Render(100u/*0.1 seconds*/); - - // Constraint should be fully applied - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); - - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); - - // Remove from the actor, and set to alternative position - - actor.RemoveConstraints(); - - Vector3 thirdPosition(200.0f, 200.0f, 200.0f); - actor.SetPosition(thirdPosition); // Go back to 3rd position - - application.SendNotification(); - application.Render(static_cast(removeSeconds*200.0f)/* 20% removal progress */); - - // Constraint shouldn't be fully removed yet - Vector3 twentyPercentBack( targetPosition + (thirdPosition - targetPosition)*0.2f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), twentyPercentBack, TEST_LOCATION ); - - application.Render(static_cast(removeSeconds*200.0f)/* 40% removal progress */); - - // Constraint shouldn't be fully removed yet - Vector3 fourtyPercentBack( targetPosition + (thirdPosition - targetPosition)*0.4f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), fourtyPercentBack, TEST_LOCATION ); - - application.Render(static_cast(removeSeconds*200.0f)/* 60% removal progress */); - - // Constraint shouldn't be fully removed yet - Vector3 sixtyPercentBack( targetPosition + (thirdPosition - targetPosition)*0.6f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), sixtyPercentBack, TEST_LOCATION ); - - application.Render(static_cast(removeSeconds*200.0f)/* 80% removal progress */); - - // Constraint shouldn't be fully removed yet - Vector3 eightyPercentBack( targetPosition + (thirdPosition - targetPosition)*0.8f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), eightyPercentBack, TEST_LOCATION ); - - // Constraint should be fully removed - application.Render(static_cast(removeSeconds*200.0f)/* 100% removal progress */); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), thirdPosition, TEST_LOCATION ); - - // Constraint should still be fully applied - application.Render(static_cast(removeSeconds*200.0f)/* Still 100% removal progress */); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), thirdPosition, TEST_LOCATION ); - - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), thirdPosition, TEST_LOCATION ); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), thirdPosition, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliConstraintGetRemoveTime(void) -{ - TestApplication application; - - Constraint constraint = Constraint::New( Actor::COLOR, TestConstraint() ); - DALI_TEST_EQUALS(constraint.GetRemoveTime(), TimePeriod(0.0f), TEST_LOCATION); - END_TEST; -} - int UtcDaliConstraintSetAlphaFunction(void) { TestApplication application; @@ -2304,7 +2419,7 @@ int UtcDaliConstraintSetAlphaFunction(void) Vector3 startValue( Vector3::ZERO ); Vector3 targetValue(100.0f, 100.0f, 100.0f); - Constraint constraint = Constraint::New( Actor::POSITION, + Constraint constraint = Constraint::New( Actor::Property::POSITION, TestConstraintVector3( targetValue ) ); // Test the alpha-function itself @@ -2319,42 +2434,42 @@ int UtcDaliConstraintSetAlphaFunction(void) application.SendNotification(); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); constraint.SetApplyTime( 10.0f ); actor.ApplyConstraint( constraint ); application.SendNotification(); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue) * 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue) * 0.1f, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue) * 0.2f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue) * 0.2f, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue) * 0.3f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue) * 0.3f, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue) * 0.4f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue) * 0.4f, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue) * 0.5f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue) * 0.5f, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue) * 0.6f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue) * 0.6f, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue) * 0.7f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue) * 0.7f, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue) * 0.8f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue) * 0.8f, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue) * 0.9f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue) * 0.9f, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue), TEST_LOCATION ); // Check that the constrained value is stable application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue), TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue), TEST_LOCATION ); // Remove the constraint @@ -2363,11 +2478,11 @@ int UtcDaliConstraintSetAlphaFunction(void) application.SendNotification(); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), startValue, TEST_LOCATION ); // Change to non-linear alpha and retest @@ -2380,23 +2495,23 @@ int UtcDaliConstraintSetAlphaFunction(void) application.SendNotification(); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_CHECK( actor.GetProperty( Actor::POSITION ).x > startValue.x ); - DALI_TEST_CHECK( actor.GetProperty( Actor::POSITION ).y > startValue.y ); - DALI_TEST_CHECK( actor.GetProperty( Actor::POSITION ).z > startValue.z ); + DALI_TEST_CHECK( actor.GetProperty( Actor::Property::POSITION ).x > startValue.x ); + DALI_TEST_CHECK( actor.GetProperty( Actor::Property::POSITION ).y > startValue.y ); + DALI_TEST_CHECK( actor.GetProperty( Actor::Property::POSITION ).z > startValue.z ); Vector3 lessThanTenPercentProgress( (targetValue - startValue) * 0.09f ); - DALI_TEST_CHECK( actor.GetProperty( Actor::POSITION ).x < lessThanTenPercentProgress.x ); - DALI_TEST_CHECK( actor.GetProperty( Actor::POSITION ).y < lessThanTenPercentProgress.y ); - DALI_TEST_CHECK( actor.GetProperty( Actor::POSITION ).z < lessThanTenPercentProgress.z ); + DALI_TEST_CHECK( actor.GetProperty( Actor::Property::POSITION ).x < lessThanTenPercentProgress.x ); + DALI_TEST_CHECK( actor.GetProperty( Actor::Property::POSITION ).y < lessThanTenPercentProgress.y ); + DALI_TEST_CHECK( actor.GetProperty( Actor::Property::POSITION ).z < lessThanTenPercentProgress.z ); application.Render(static_cast(9000.0f/*9 seconds*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue), TEST_LOCATION ); // Check that the constrained value is stable application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue), TEST_LOCATION ); application.Render(static_cast(1000.0f/*1 second*/)); - DALI_TEST_EQUALS( actor.GetProperty( Actor::POSITION ), (targetValue - startValue), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ), (targetValue - startValue), TEST_LOCATION ); END_TEST; } @@ -2404,7 +2519,7 @@ int UtcDaliConstraintGetAlphaFunction(void) { TestApplication application; - Constraint constraint = Constraint::New( Actor::COLOR, TestConstraint() ); + Constraint constraint = Constraint::New( Actor::Property::COLOR, TestConstraint() ); AlphaFunction func = constraint.GetAlphaFunction(); DALI_TEST_EQUALS(func(0.5f), 0.5f, TEST_LOCATION); // Default is Linear @@ -2420,16 +2535,12 @@ int UtcDaliConstraintSetRemoveAction(void) // Build constraint, with "Discard" remove action - Constraint constraint = Constraint::New( Actor::POSITION, TestPositionConstraint(targetPosition) ); + Constraint constraint = Constraint::New( Actor::Property::POSITION, TestPositionConstraint(targetPosition) ); DALI_TEST_EQUALS((unsigned int)constraint.GetRemoveAction(), (unsigned int)Constraint::Bake, TEST_LOCATION); constraint.SetRemoveAction(Constraint::Discard); DALI_TEST_EQUALS((unsigned int)constraint.GetRemoveAction(), (unsigned int)Constraint::Discard, TEST_LOCATION); - float removeSeconds(8.0f); - constraint.SetRemoveTime(removeSeconds); - DALI_TEST_EQUALS(constraint.GetRemoveTime(), TimePeriod(removeSeconds), TEST_LOCATION); - // Apply to an actor Actor actor = Actor::New(); @@ -2451,40 +2562,16 @@ int UtcDaliConstraintSetRemoveAction(void) DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); // Remove from the actor - actor.RemoveConstraints(); // should go back to source position application.SendNotification(); - application.Render(static_cast(removeSeconds*200.0f)/* 20% removal progress */); - - // Constraint shouldn't be fully removed yet - Vector3 twentyPercentBack( targetPosition * 0.8f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), twentyPercentBack, TEST_LOCATION ); - - application.Render(static_cast(removeSeconds*200.0f)/* 40% removal progress */); - - // Constraint shouldn't be fully removed yet - Vector3 fourtyPercentBack( targetPosition * 0.6f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), fourtyPercentBack, TEST_LOCATION ); - - application.Render(static_cast(removeSeconds*200.0f)/* 60% removal progress */); - - // Constraint shouldn't be fully removed yet - Vector3 sixtyPercentBack( targetPosition * 0.4f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), sixtyPercentBack, TEST_LOCATION ); - - application.Render(static_cast(removeSeconds*200.0f)/* 80% removal progress */); - - // Constraint shouldn't be fully removed yet - Vector3 eightyPercentBack( targetPosition * 0.2f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), eightyPercentBack, TEST_LOCATION ); + application.Render(static_cast(1000.0f)); // Constraint should be fully removed - application.Render(static_cast(removeSeconds*200.0f)/* 100% removal progress */); DALI_TEST_EQUALS( actor.GetCurrentPosition(), sourcePosition, TEST_LOCATION ); - // Constraint should still be fully applied - application.Render(static_cast(removeSeconds*200.0f)/* Still 100% removal progress */); + // Constraint should still be fully removed + application.Render(static_cast(1000.0f)/* Still 100% removal progress */); DALI_TEST_EQUALS( actor.GetCurrentPosition(), sourcePosition, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps @@ -2499,7 +2586,7 @@ int UtcDaliConstraintGetRemoveAction(void) { TestApplication application; - Constraint constraint = Constraint::New( Actor::COLOR, TestConstraint() ); + Constraint constraint = Constraint::New( Actor::Property::COLOR, TestConstraint() ); DALI_TEST_EQUALS((unsigned int)constraint.GetRemoveAction(), (unsigned int)Constraint::Bake, TEST_LOCATION); constraint.SetRemoveAction(Constraint::Discard); @@ -2511,83 +2598,6 @@ int UtcDaliConstraintGetRemoveAction(void) } /** - * Test a constraint with non-zero apply-time and remove-time, where the constraint is removed during the apply-time - */ -int UtcDaliConstraintRemoveDuringApply(void) -{ - TestApplication application; - - Vector3 sourcePosition(0.0f, 0.0f, 0.0f); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); - Vector3 halfwayPosition(targetPosition * 0.5f); - - // Build constraint - - Constraint constraint = Constraint::New( Actor::POSITION, TestPositionConstraint(targetPosition) ); - DALI_TEST_EQUALS((unsigned int)constraint.GetRemoveAction(), (unsigned int)Constraint::Bake, TEST_LOCATION); - - float applySeconds(4.0f); - constraint.SetApplyTime(applySeconds); - DALI_TEST_EQUALS(constraint.GetApplyTime(), TimePeriod(applySeconds), TEST_LOCATION); - - float removeSeconds(8.0f); - constraint.SetRemoveTime(removeSeconds); - DALI_TEST_EQUALS(constraint.GetRemoveTime(), TimePeriod(removeSeconds), TEST_LOCATION); - - // Apply to an actor - - Actor actor = Actor::New(); - Stage::GetCurrent().Add(actor); - - actor.ApplyConstraint( constraint ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), sourcePosition, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(applySeconds*250.0f)/* 25% progress */); - - // Constraint shouldn't be fully applied yet - Vector3 twentyFivePercent( targetPosition * 0.25f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), twentyFivePercent, TEST_LOCATION ); - - application.Render(static_cast(applySeconds*250.0f)/* 50% progress */); - - // Constraint shouldn't be fully applied yet - Vector3 fiftyPercent( targetPosition * 0.5f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercent, TEST_LOCATION ); - - // Remove from the actor - - actor.RemoveConstraints(); // should go back to source position - - application.SendNotification(); - application.Render(static_cast(removeSeconds*100.0f)/* 50% - 5% = 45% progress */); - - // Constraint shouldn't be fully removed yet - Vector3 fourtyFivePercent( targetPosition * 0.45f ); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), fourtyFivePercent, TEST_LOCATION ); - - application.Render(static_cast(removeSeconds*400.0f)/* 50% - 25% = 25% progress */); - - // Constraint shouldn't be fully removed yet - DALI_TEST_EQUALS( actor.GetCurrentPosition(), twentyFivePercent, TEST_LOCATION ); - - // Constraint should be fully removed - application.Render(static_cast(removeSeconds*500.0f)/* 0% progress */); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), sourcePosition, TEST_LOCATION ); - - // Constraint should still be fully applied - application.Render(static_cast(removeSeconds*200.0f)/* Still 0% progress */); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), sourcePosition, TEST_LOCATION ); - - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), sourcePosition, TEST_LOCATION ); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), sourcePosition, TEST_LOCATION ); - END_TEST; -} - -/** * Test a constraint with non-zero apply-time & zero (immediate) remove-time, where the constraint is removed during the apply-time */ int UtcDaliConstraintImmediateRemoveDuringApply(void) @@ -2599,13 +2609,12 @@ int UtcDaliConstraintImmediateRemoveDuringApply(void) // Build constraint - Constraint constraint = Constraint::New( Actor::POSITION, TestPositionConstraint(targetPosition) ); + Constraint constraint = Constraint::New( Actor::Property::POSITION, TestPositionConstraint(targetPosition) ); DALI_TEST_EQUALS((unsigned int)constraint.GetRemoveAction(), (unsigned int)Constraint::Bake, TEST_LOCATION); float applySeconds(4.0f); constraint.SetApplyTime(applySeconds); DALI_TEST_EQUALS(constraint.GetApplyTime(), TimePeriod(applySeconds), TEST_LOCATION); - DALI_TEST_EQUALS(constraint.GetRemoveTime(), TimePeriod(0.0f), TEST_LOCATION); // Apply to an actor @@ -2655,8 +2664,8 @@ int UtcDaliConstraintActorSize(void) // Build constraint, to make child 20% of parent size - Constraint constraint = Constraint::New( Actor::SIZE, - ParentSource( Actor::SIZE ), + Constraint constraint = Constraint::New( Actor::Property::SIZE, + ParentSource( Actor::Property::SIZE ), TestRelativeConstraintVector3(0.2f) ); // Apply to a child actor @@ -2675,7 +2684,7 @@ int UtcDaliConstraintActorSize(void) float durationSeconds(10.0f); Animation animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(parent, Actor::SIZE), targetParentSize ); + animation.AnimateTo( Property(parent, Actor::Property::SIZE), targetParentSize ); animation.Play(); application.SendNotification(); @@ -2712,8 +2721,8 @@ int UtcDaliConstraintActorSizeWidth(void) // Build constraint, to make child 20% of parent width - Constraint constraint = Constraint::New( Actor::SIZE_WIDTH, - ParentSource( Actor::SIZE_WIDTH ), + Constraint constraint = Constraint::New( Actor::Property::SIZE_WIDTH, + ParentSource( Actor::Property::SIZE_WIDTH ), TestRelativeConstraintFloat(0.2f) ); // Apply to a child actor @@ -2732,7 +2741,7 @@ int UtcDaliConstraintActorSizeWidth(void) float durationSeconds(10.0f); Animation animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(parent, Actor::SIZE), targetParentSize ); + animation.AnimateTo( Property(parent, Actor::Property::SIZE), targetParentSize ); animation.Play(); application.SendNotification(); @@ -2782,8 +2791,8 @@ int UtcDaliConstraintActorSizeHeight(void) // Build constraint, to make child 20% of parent height - Constraint constraint = Constraint::New( Actor::SIZE_HEIGHT, - ParentSource( Actor::SIZE_HEIGHT ), + Constraint constraint = Constraint::New( Actor::Property::SIZE_HEIGHT, + ParentSource( Actor::Property::SIZE_HEIGHT ), TestRelativeConstraintFloat(0.2f) ); // Apply to a child actor @@ -2802,7 +2811,7 @@ int UtcDaliConstraintActorSizeHeight(void) float durationSeconds(10.0f); Animation animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(parent, Actor::SIZE), targetParentSize ); + animation.AnimateTo( Property(parent, Actor::Property::SIZE), targetParentSize ); animation.Play(); application.SendNotification(); @@ -2852,8 +2861,8 @@ int UtcDaliConstraintActorSizeDepth(void) // Build constraint, to make child 20% of parent height - Constraint constraint = Constraint::New( Actor::SIZE_DEPTH, - ParentSource( Actor::SIZE_DEPTH ), + Constraint constraint = Constraint::New( Actor::Property::SIZE_DEPTH, + ParentSource( Actor::Property::SIZE_DEPTH ), TestRelativeConstraintFloat(0.2f) ); // Apply to a child actor @@ -2872,7 +2881,7 @@ int UtcDaliConstraintActorSizeDepth(void) float durationSeconds(10.0f); Animation animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(parent, Actor::SIZE), targetParentSize ); + animation.AnimateTo( Property(parent, Actor::Property::SIZE), targetParentSize ); animation.Play(); application.SendNotification(); @@ -2959,8 +2968,8 @@ int UtcDaliConstraintInputWorldPosition(void) // Build constraint, to make actor track the world-position of another actor // Note that the world-position is always from the previous frame, so the tracking actor will lag behind - Constraint constraint = Constraint::New( Actor::POSITION, - Source( child, Actor::WORLD_POSITION ), + Constraint constraint = Constraint::New( Actor::Property::POSITION, + Source( child, Actor::Property::WORLD_POSITION ), EqualToConstraint() ); trackingActor.ApplyConstraint( constraint ); @@ -2972,7 +2981,7 @@ int UtcDaliConstraintInputWorldPosition(void) // Move the actors and try again Vector3 relativePosition( 5, 5, 5 ); - parent.MoveBy( relativePosition ); + parent.TranslateBy( relativePosition ); application.SendNotification(); application.Render(0); @@ -3008,36 +3017,36 @@ int UtcDaliConstraintInputWorldRotation(void) Actor parent = Actor::New(); Radian rotationAngle( Degree(90.0f) ); Quaternion rotation( rotationAngle, Vector3::YAXIS ); - parent.SetRotation( rotation ); + parent.SetOrientation( rotation ); Stage::GetCurrent().Add( parent ); Actor child = Actor::New(); - child.SetRotation( rotation ); + child.SetOrientation( rotation ); parent.Add( child ); Actor trackingActor = Actor::New(); Stage::GetCurrent().Add( trackingActor ); // The actors should not have a world rotation yet - DALI_TEST_EQUALS( parent.GetCurrentWorldRotation(), Quaternion(0.0f, Vector3::YAXIS), 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentWorldRotation(), Quaternion(0.0f, Vector3::YAXIS), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion(0.0f, Vector3::YAXIS), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), Quaternion(0.0f, Vector3::YAXIS), 0.001, TEST_LOCATION ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( parent.GetCurrentRotation(), rotation, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentRotation(), rotation, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( trackingActor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( parent.GetCurrentOrientation(), rotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetCurrentOrientation(), rotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( trackingActor.GetCurrentOrientation(), Quaternion(0.0f, Vector3::YAXIS), 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentWorldRotation(), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION ); Quaternion previousRotation( rotationAngle * 2.0f, Vector3::YAXIS ); - DALI_TEST_EQUALS( child.GetCurrentWorldRotation(), previousRotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), previousRotation, 0.001, TEST_LOCATION ); // Build constraint, to make actor track the world-rotation of another actor // Note that the world-rotation is always from the previous frame, so the tracking actor will lag behind - Constraint constraint = Constraint::New( Actor::ROTATION, - Source( child, Actor::WORLD_ROTATION ), + Constraint constraint = Constraint::New( Actor::Property::ORIENTATION, + Source( child, Actor::Property::WORLD_ORIENTATION ), EqualToQuaternion() ); trackingActor.ApplyConstraint( constraint ); @@ -3045,7 +3054,7 @@ int UtcDaliConstraintInputWorldRotation(void) application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( trackingActor.GetCurrentRotation(), previousRotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( trackingActor.GetCurrentOrientation(), previousRotation, 0.001, TEST_LOCATION ); // Rotate the actors and try again parent.RotateBy( rotation ); @@ -3053,27 +3062,27 @@ int UtcDaliConstraintInputWorldRotation(void) application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( parent.GetCurrentRotation(), rotation * rotation, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentRotation(), rotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( parent.GetCurrentOrientation(), rotation * rotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetCurrentOrientation(), rotation, 0.001, TEST_LOCATION ); // The tracking actor lags behind - DALI_TEST_EQUALS( trackingActor.GetCurrentRotation(), previousRotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( trackingActor.GetCurrentOrientation(), previousRotation, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentWorldRotation(), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION ); previousRotation = Quaternion( rotationAngle * 3.0f, Vector3::YAXIS ); - DALI_TEST_EQUALS( child.GetCurrentWorldRotation(), previousRotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), previousRotation, 0.001, TEST_LOCATION ); // Allow the tracking actor to catch up application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( parent.GetCurrentRotation(), rotation * rotation, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentRotation(), rotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( parent.GetCurrentOrientation(), rotation * rotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetCurrentOrientation(), rotation, 0.001, TEST_LOCATION ); // The tracking actor catches up! - DALI_TEST_EQUALS( trackingActor.GetCurrentRotation(), previousRotation, 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( parent.GetCurrentWorldRotation(), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION ); - DALI_TEST_EQUALS( child.GetCurrentWorldRotation(), previousRotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( trackingActor.GetCurrentOrientation(), previousRotation, 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( parent.GetCurrentWorldOrientation(), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION ); + DALI_TEST_EQUALS( child.GetCurrentWorldOrientation(), previousRotation, 0.001, TEST_LOCATION ); END_TEST; } @@ -3114,8 +3123,8 @@ int UtcDaliConstraintInputWorldScale(void) // Build constraint, to make actor track the world-scale of another actor // Note that the world-scale is always from the previous frame, so the tracking actor will lag behind - Constraint constraint = Constraint::New( Actor::SCALE, - Source( child, Actor::WORLD_SCALE ), + Constraint constraint = Constraint::New( Actor::Property::SCALE, + Source( child, Actor::Property::WORLD_SCALE ), EqualToConstraint() ); trackingActor.ApplyConstraint( constraint ); @@ -3192,8 +3201,8 @@ int UtcDaliConstraintInputWorldColor(void) // Build constraint, to make actor track the world-color of another actor // Note that the world-color is always from the previous frame, so the tracking actor will lag behind - Constraint constraint = Constraint::New( Actor::COLOR, - Source( child, Actor::WORLD_COLOR ), + Constraint constraint = Constraint::New( Actor::Property::COLOR, + Source( child, Actor::Property::WORLD_COLOR ), EqualToVector4() ); trackingActor.ApplyConstraint( constraint ); @@ -3238,7 +3247,7 @@ int UtcDaliConstraintInvalidInputProperty(void) { TestApplication application; Actor actor = Actor::New(); - Constraint constraint = Constraint::New( Actor::POSITION, LocalSource( PROPERTY_REGISTRATION_START_INDEX ), MultiplyConstraint() ); + Constraint constraint = Constraint::New( Actor::Property::POSITION, LocalSource( PROPERTY_REGISTRATION_START_INDEX ), EqualToConstraint() ); Stage::GetCurrent().Add( actor ); @@ -3250,7 +3259,7 @@ int UtcDaliConstraintInvalidInputProperty(void) } catch ( DaliException& e ) { - DALI_TEST_ASSERT( e, "mTargetProxy->IsPropertyAConstraintInput( source.propertyIndex )", TEST_LOCATION ); + DALI_TEST_ASSERT( e, "mTargetObject->IsPropertyAConstraintInput( source.propertyIndex )", TEST_LOCATION ); } END_TEST; } @@ -3275,7 +3284,7 @@ int UtcDaliBuiltinConstraintParentSize(void) // Apply constraint - Constraint constraint = Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ); + Constraint constraint = Constraint::New( Actor::Property::SIZE, ParentSource( Actor::Property::SIZE ), EqualToConstraint() ); actor.ApplyConstraint( constraint ); application.SendNotification(); @@ -3329,7 +3338,7 @@ int UtcDaliBuiltinConstraintParentSizeRelative(void) // Apply constraint - Constraint constraint = Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( scale ) ); + Constraint constraint = Constraint::New( Actor::Property::SIZE, ParentSource( Actor::Property::SIZE ), RelativeToConstraint( scale ) ); actor.ApplyConstraint( constraint ); application.SendNotification(); @@ -3387,9 +3396,9 @@ int UtcDaliBuiltinConstraintScaleToFitConstraint(void) // Apply constraint - Constraint constraint = Constraint::New( Actor::SCALE, - LocalSource( Actor::SIZE ), - ParentSource( Actor::SIZE ), + Constraint constraint = Constraint::New( Actor::Property::SCALE, + LocalSource( Actor::Property::SIZE ), + ParentSource( Actor::Property::SIZE ), ScaleToFitConstraint() ); actor.ApplyConstraint( constraint ); @@ -3444,9 +3453,9 @@ int UtcDaliBuiltinConstraintScaleToFitKeepAspectRatio(void) // Apply constraint - Constraint constraint = Constraint::New( Actor::SCALE, - LocalSource( Actor::SIZE ), - ParentSource( Actor::SIZE ), + Constraint constraint = Constraint::New( Actor::Property::SCALE, + LocalSource( Actor::Property::SIZE ), + ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); actor.ApplyConstraint( constraint ); @@ -3470,53 +3479,6 @@ int UtcDaliBuiltinConstraintScaleToFitKeepAspectRatio(void) END_TEST; } -int UtcDaliBuiltinConstraintScaleToFillKeepAspectRatio(void) -{ - TestApplication application; - - Actor parent = Actor::New(); - Vector3 parentSize1( 10, 10, 10 ); - parent.SetSize( parentSize1 ); - Stage::GetCurrent().Add( parent ); - - Actor actor = Actor::New(); - Vector3 childSize( 4, 5, 5 ); - actor.SetSize( childSize ); - parent.Add( actor ); - - application.SendNotification(); - application.Render(0); - Vector3 childScale1( 1.0f, 1.0f, 1.0f ); - DALI_TEST_EQUALS( actor.GetCurrentScale(), childScale1, TEST_LOCATION ); - - // Apply constraint - - Constraint constraint = Constraint::New( Actor::SCALE, - LocalSource( Actor::SIZE ), - ParentSource( Actor::SIZE ), - ScaleToFillKeepAspectRatioConstraint() ); - actor.ApplyConstraint( constraint ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied, but parent size is larger than child - float val = 10.f / 4.f; - Vector3 childScale2( val, val, val ); - DALI_TEST_EQUALS( actor.GetCurrentScale(), childScale2, TEST_LOCATION ); - - // change parent size - Vector3 parentSize2( 40, 50, 50 ); - parent.SetSize( parentSize2 ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied, but parent size is larger than child - Vector3 childScale3( 10.0f, 10.0f, 10.0f ); - DALI_TEST_EQUALS( actor.GetCurrentScale(), childScale3, TEST_LOCATION ); - END_TEST; -} int UtcDaliBuiltinConstraintScaleToFillXYKeepAspectRatio(void) { @@ -3539,9 +3501,9 @@ int UtcDaliBuiltinConstraintScaleToFillXYKeepAspectRatio(void) // Apply constraint - Constraint constraint = Constraint::New( Actor::SCALE, - LocalSource( Actor::SIZE ), - ParentSource( Actor::SIZE ), + Constraint constraint = Constraint::New( Actor::Property::SCALE, + LocalSource( Actor::Property::SIZE ), + ParentSource( Actor::Property::SIZE ), ScaleToFillXYKeepAspectRatioConstraint() ); actor.ApplyConstraint( constraint ); @@ -3566,151 +3528,6 @@ int UtcDaliBuiltinConstraintScaleToFillXYKeepAspectRatio(void) END_TEST; } -int UtcDaliBuiltinConstraintShrinkInsideKeepAspectRatioConstraint(void) -{ - TestApplication application; - - Actor parent = Actor::New(); - Vector3 parentSize1( 10, 10, 10 ); - parent.SetSize( parentSize1 ); - Stage::GetCurrent().Add( parent ); - - Actor actor = Actor::New(); - Vector3 childSize( 4, 5, 5 ); - actor.SetSize( childSize ); - parent.Add( actor ); - - application.SendNotification(); - application.Render(0); - Vector3 childScale1( 1.0f, 1.0f, 1.0f ); - DALI_TEST_EQUALS( actor.GetCurrentScale(), childScale1, TEST_LOCATION ); - - // Apply constraint - - Constraint constraint = Constraint::New( Actor::SCALE, - LocalSource( Actor::SIZE ), - ParentSource( Actor::SIZE ), - ShrinkInsideKeepAspectRatioConstraint() ); - actor.ApplyConstraint( constraint ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied, but parent size is larger than child - Vector3 childScale2( 1.0f, 1.0f, 1.0f ); - DALI_TEST_EQUALS( actor.GetCurrentScale(), childScale2, TEST_LOCATION ); - - // change parent size - Vector3 parentSize2( 40, 50, 50 ); - parent.SetSize( parentSize2 ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied, but parent size is larger than child - Vector3 childScale3( 1.0f, 1.0f, 1.0f ); - DALI_TEST_EQUALS( actor.GetCurrentScale(), childScale3, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliBuiltinConstraintMultiplyConstraint(void) -{ - TestApplication application; - - Actor actor1 = Actor::New(); - Vector3 startPosition( 10, 10, 10 ); - actor1.SetPosition( startPosition ); - Stage::GetCurrent().Add( actor1 ); - - Actor actor2 = Actor::New(); - Vector3 startSize( 100, 100, 100 ); - actor2.SetSize( startSize ); - Stage::GetCurrent().Add( actor2 ); - - application.SendNotification(); - application.Render(0); - DALI_TEST_CHECK( actor1.GetCurrentPosition() == startPosition ); - DALI_TEST_CHECK( actor2.GetCurrentSize() == startSize ); - - // Apply constraint - multiply actor1 size by actor2 position - - Constraint constraint = Constraint::New( Actor::SIZE, - Source( actor1, Actor::POSITION ), - MultiplyConstraint() ); - constraint.SetRemoveAction( Constraint::Discard ); - actor2.ApplyConstraint( constraint ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied - Vector3 size( startSize * startPosition ); - DALI_TEST_EQUALS( actor2.GetCurrentSize(), size, TEST_LOCATION ); - - // Change the multiply input - Vector3 endPosition( 2, 2, 2 ); - actor1.SetPosition( endPosition ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied - size = Vector3( startSize * endPosition ); - DALI_TEST_EQUALS( actor2.GetCurrentSize(), size, TEST_LOCATION ); - application.Render(0); - DALI_TEST_EQUALS( actor2.GetCurrentSize(), size, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliBuiltinConstraintDivideConstraint(void) -{ - TestApplication application; - - Actor actor1 = Actor::New(); - Vector3 startPosition( 10, 10, 10 ); - actor1.SetPosition( startPosition ); - Stage::GetCurrent().Add( actor1 ); - - Actor actor2 = Actor::New(); - Vector3 startSize( 100, 100, 100 ); - actor2.SetSize( startSize ); - Stage::GetCurrent().Add( actor2 ); - - application.SendNotification(); - application.Render(0); - DALI_TEST_CHECK( actor1.GetCurrentPosition() == startPosition ); - DALI_TEST_CHECK( actor2.GetCurrentSize() == startSize ); - - // Apply constraint - divide actor1 size by actor2 position - - Constraint constraint = Constraint::New( Actor::SIZE, - Source( actor1, Actor::POSITION ), - DivideConstraint() ); - constraint.SetRemoveAction( Constraint::Discard ); - actor2.ApplyConstraint( constraint ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied - Vector3 size( 10, 10, 10 ); // startSize / startPosition - DALI_TEST_EQUALS( actor2.GetCurrentSize(), size, TEST_LOCATION ); - - // Change the divide input - Vector3 endPosition( 2, 2, 2 ); - actor1.SetPosition( endPosition ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied - size = Vector3( 50, 50, 50 ); // startSize / endPosition - DALI_TEST_EQUALS( actor2.GetCurrentSize(), size, TEST_LOCATION ); - application.Render(0); - DALI_TEST_EQUALS( actor2.GetCurrentSize(), size, TEST_LOCATION ); - END_TEST; -} - int UtcDaliBuiltinConstraintEqualToConstraint(void) { TestApplication application; @@ -3732,8 +3549,8 @@ int UtcDaliBuiltinConstraintEqualToConstraint(void) // Apply constraint - actor1 size == actor2 position - Constraint constraint = Constraint::New( Actor::SIZE, - Source( actor1, Actor::POSITION ), + Constraint constraint = Constraint::New( Actor::Property::SIZE, + Source( actor1, Actor::Property::POSITION ), EqualToConstraint() ); constraint.SetRemoveAction( Constraint::Discard ); actor2.ApplyConstraint( constraint ); @@ -3769,8 +3586,8 @@ int UtcDaliBuiltinConstraintEqualToConstraint(void) DALI_TEST_EQUALS( actor1.GetCurrentOpacity(), startOpacity, TEST_LOCATION ); DALI_TEST_EQUALS( actor2.GetCurrentOpacity(), startOpacity, TEST_LOCATION ); - Constraint constraint2 = Constraint::New( Actor::COLOR_ALPHA, - Source( actor1, Actor::COLOR_ALPHA ), + Constraint constraint2 = Constraint::New( Actor::Property::COLOR_ALPHA, + Source( actor1, Actor::Property::COLOR_ALPHA ), EqualToConstraint() ); constraint2.SetRemoveAction( Constraint::Discard ); actor2.ApplyConstraint( constraint2 ); @@ -3793,8 +3610,8 @@ int UtcDaliBuiltinConstraintEqualToConstraint(void) DALI_TEST_CHECK( actor1.GetCurrentColor() == Color::GREEN ); DALI_TEST_CHECK( actor2.GetCurrentColor() == Color::RED ); - Constraint constraint3 = Constraint::New( Actor::COLOR, - Source( actor1, Actor::COLOR ), + Constraint constraint3 = Constraint::New( Actor::Property::COLOR, + Source( actor1, Actor::Property::COLOR ), EqualToConstraint() ); constraint3.SetRemoveAction( Constraint::Discard ); actor2.ApplyConstraint( constraint3 ); @@ -3807,22 +3624,22 @@ int UtcDaliBuiltinConstraintEqualToConstraint(void) // Quaternion q1 = Quaternion( Math::PI_2, Vector3::XAXIS ); Quaternion q2 = Quaternion( Math::PI_4, Vector3::YAXIS ); - actor1.SetRotation( q1 ); - actor2.SetRotation( q2 ); + actor1.SetOrientation( q1 ); + actor2.SetOrientation( q2 ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor1.GetCurrentRotation(), q1, 0.01, TEST_LOCATION ); - DALI_TEST_EQUALS( actor2.GetCurrentRotation(), q2, 0.01, TEST_LOCATION ); + DALI_TEST_EQUALS( actor1.GetCurrentOrientation(), q1, 0.01, TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetCurrentOrientation(), q2, 0.01, TEST_LOCATION ); - Constraint constraint4 = Constraint::New( Actor::ROTATION, - Source( actor1, Actor::ROTATION ), + Constraint constraint4 = Constraint::New( Actor::Property::ORIENTATION, + Source( actor1, Actor::Property::ORIENTATION ), EqualToConstraint() ); constraint4.SetRemoveAction( Constraint::Discard ); actor2.ApplyConstraint( constraint4 ); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor2.GetCurrentRotation(), q1, 0.01, TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetCurrentOrientation(), q1, 0.01, TEST_LOCATION ); // // Check Matrix3 variant @@ -3863,8 +3680,8 @@ int UtcDaliBuiltinConstraintRelativeToConstraint(void) RelativeToConstraint( 0.f ); Vector3 scale( 0.5, 0.6, 0.7 ); - Constraint constraint = Constraint::New( Actor::SIZE, - Source( actor1, Actor::POSITION ), + Constraint constraint = Constraint::New( Actor::Property::SIZE, + Source( actor1, Actor::Property::POSITION ), RelativeToConstraint( scale ) ); constraint.SetRemoveAction( Constraint::Discard ); actor2.ApplyConstraint( constraint ); @@ -3900,8 +3717,8 @@ int UtcDaliBuiltinConstraintRelativeToConstraint(void) DALI_TEST_EQUALS( actor1.GetCurrentOpacity(), startOpacity, TEST_LOCATION ); DALI_TEST_EQUALS( actor2.GetCurrentOpacity(), startOpacity, TEST_LOCATION ); - Constraint constraint2 = Constraint::New( Actor::COLOR_ALPHA, - Source( actor1, Actor::COLOR_ALPHA ), + Constraint constraint2 = Constraint::New( Actor::Property::COLOR_ALPHA, + Source( actor1, Actor::Property::COLOR_ALPHA ), RelativeToConstraintFloat(scale2) ); constraint2.SetRemoveAction( Constraint::Discard ); actor2.ApplyConstraint(constraint2); @@ -3912,55 +3729,6 @@ int UtcDaliBuiltinConstraintRelativeToConstraint(void) END_TEST; } -int UtcDaliBuiltinConstraintInverseOfConstraint(void) -{ - TestApplication application; - - Actor actor1 = Actor::New(); - Vector3 startPosition( 10, 10, 10 ); - actor1.SetPosition( startPosition ); - Stage::GetCurrent().Add( actor1 ); - - Actor actor2 = Actor::New(); - Vector3 startSize( 100, 100, 100 ); - actor2.SetSize( startSize ); - Stage::GetCurrent().Add( actor2 ); - - application.SendNotification(); - application.Render(0); - DALI_TEST_CHECK( actor1.GetCurrentPosition() == startPosition ); - DALI_TEST_CHECK( actor2.GetCurrentSize() == startSize ); - - // Apply constraint - actor1 size == ( 1 / actor2 position ) - - Constraint constraint = Constraint::New( Actor::SIZE, - Source( actor1, Actor::POSITION ), - InverseOfConstraint() ); - constraint.SetRemoveAction( Constraint::Discard ); - actor2.ApplyConstraint( constraint ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied - Vector3 size( 0.1, 0.1, 0.1 ); // 1 / startPosition - DALI_TEST_EQUALS( actor2.GetCurrentSize(), size, 0.00001f, TEST_LOCATION ); - - // Change the input - Vector3 endPosition( 2, 2, 2 ); - actor1.SetPosition( endPosition ); - - application.SendNotification(); - application.Render(0); - - // Constraint should be fully applied - size = Vector3( 0.5, 0.5, 0.5 ); // 1 / endPosition - DALI_TEST_EQUALS( actor2.GetCurrentSize(), size, TEST_LOCATION ); - application.Render(0); - DALI_TEST_EQUALS( actor2.GetCurrentSize(), size, TEST_LOCATION ); - END_TEST; -} - int UtcDaliBuiltinConstraintFunctions(void) { TestApplication application; @@ -3985,26 +3753,6 @@ int UtcDaliBuiltinConstraintFunctions(void) } } - { - SourceHeightFixedWidth sourceHeightFixedWidth( 10.f ); - Vector3 current; - { - Vector3 reference(10,1,0); - Vector3 value = sourceHeightFixedWidth( current, PropertyInputAbstraction(Vector3::ONE) ); - DALI_TEST_EQUALS( reference, value, TEST_LOCATION ); - } - { - Vector3 reference(10,10,0); - Vector3 value = sourceHeightFixedWidth( current, PropertyInputAbstraction(Vector3::ONE*10.f) ); - DALI_TEST_EQUALS( reference, value, TEST_LOCATION ); - } - { - Vector3 reference(10,100,0); - Vector3 value = sourceHeightFixedWidth( current, PropertyInputAbstraction(Vector3::ONE*100.f) ); - DALI_TEST_EQUALS( reference, value, TEST_LOCATION ); - } - } - { // LookAt Quaternion current(0, Vector3::YAXIS); PropertyInputAbstraction target(Vector3::ZAXIS); @@ -4017,12 +3765,6 @@ int UtcDaliBuiltinConstraintFunctions(void) DALI_TEST_EQUALS( reference, value, 0.001, TEST_LOCATION ); } - { - OrientedLookAt orientedLookAt(90.f); - Quaternion reference(.525322, 0., 0., 0.850904); - Quaternion value = orientedLookAt( current, target, camera, targetRotation ); - DALI_TEST_EQUALS( reference, value, 0.001, TEST_LOCATION ); - } } END_TEST;