// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Final key frame value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
Property::Index index = actor.RegisterProperty("anIndex", startValue);
DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
// Build the animation
float durationSeconds(1.0f);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
finishCheck.CheckSignalReceived();
DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 20, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
END_TEST;
}
application.Render();
DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
+ //////////////////////////////////////////////////////////////////////////////////
tet_infoline( "With two AnimateTo calls" );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
animation.Play();
+ tet_infoline( "The target position should change instantly" );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+
application.SendNotification();
application.Render(5000); // After the animation is complete
DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+
+ //////////////////////////////////////////////////////////////////////////////////
tet_infoline( "Same animation again but in a different order - should yield the same result" );
actor.SetX( 0.0f );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
animation = Animation::New( 0.0f );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
animation.Play();
+ tet_infoline( "The target position should change instantly" );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+
application.SendNotification();
application.Render(5000); // After the animation is complete
DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
- tet_infoline( "Now with several AnimateTo calls" );
+ END_TEST;
+}
+
+int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
+{
+ tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls" );
+
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add( actor );
- actor.SetX( 0.0f );
application.SendNotification();
application.Render();
- animation = Animation::New( 0.0f );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
+ //////////////////////////////////////////////////////////////////////////////////
+
+ tet_infoline( "" );
+
+ Animation animation = Animation::New( 0.0f );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
animation.Play();
+ tet_infoline( "The target position should change instantly" );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+
application.SendNotification();
application.Render(14000); // After the animation is complete
DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+
+ //////////////////////////////////////////////////////////////////////////////////
tet_infoline( "Same animation again but in a different order - should end up at the same point" );
actor.SetX( 0.0f );
+
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
animation = Animation::New( 0.0f );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
animation.Play();
+ tet_infoline( "The target position should change instantly" );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+
application.SendNotification();
application.Render(14000); // After the animation is complete
DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
END_TEST;
}