application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
- // We didn't expect the animation to finish yet
+ // We didn't expect the animation to finish yet, but cached value should be the final one
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty<Vector2>( actor, index ), startValue, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
application.SendNotification();
finishCheck.CheckSignalReceived();
DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
END_TEST;
}
Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
+ // Should return the initial properties before play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
+
// Start the animation
animation.Play();
+ // Should return the target property after play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
+ // Should return the initial properties before play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
+
// Start the animation
animation.Play();
+ // Should return the target property after play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
+ // Should return the initial properties before play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
+
// Start the animation
animation.Play();
+ // Should return the target property after play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
+ // Should return the initial properties before play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
+
// Start the animation
animation.Play();
+ // Should return the target property after play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
+ // Should return the initial properties before play
+ 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( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
+
// Start the animation
animation.Play();
+ // Should return the target property after play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
+ // Should return the initial properties before play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
+
// Start the animation
animation.Play();
+ // Should return the target property after play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
+ // Should return the initial properties before play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
+
// Start the animation
animation.Play();
+ // Should return the target property after play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
+ // Should return the initial properties before play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
+
// Start the animation
animation.Play();
+ // Should return the target property after play
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, 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(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, 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 );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, 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 ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, 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 ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, 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 ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, 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 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, 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 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, 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 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, 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 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, 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 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
- // We didn't expect the animation to finish yet
+ // We didn't expect the animation to finish yet, but cached value should be the final one
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
application.SendNotification();
finishCheck.CheckSignalReceived();
DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
END_TEST;
}
// Build the animation
Animation animation = Animation::New(2.0f);
- tet_infoline("Set target size in animation without intiating play");
+ tet_infoline("Set target size in animation without initiating play");
animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
tet_infoline("Set target position in animation without intiating play");
animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
application.SendNotification();
application.Render();
- tet_infoline("Ensure position of actor is still at intial size and position");
+ tet_infoline("Ensure position of actor is still at initial size and position");
DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
application.SendNotification();
application.Render(2000u);
- tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
+ tet_infoline("Ensure position and size of actor is at target value when animation playing");
DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliAnimationTimePeriodOrder(void)
+{
+ tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
+
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+
+ tet_infoline( "With two AnimateTo calls" );
+
+ Animation animation = Animation::New( 0.0f );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(5000); // After the animation is complete
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Same animation again but in a different order - should yield the same result" );
+
+ actor.SetX( 0.0f );
+ application.SendNotification();
+ application.Render();
+
+ 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();
+
+ application.SendNotification();
+ application.Render(5000); // After the animation is complete
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Now with several AnimateTo calls" );
+
+ actor.SetX( 0.0f );
+ application.SendNotification();
+ application.Render();
+
+ 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 ), 1.0f, TimePeriod( 3.0f, 4.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.Play();
+
+ application.SendNotification();
+ application.Render(14000); // After the animation is complete
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ tet_infoline( "Same animation again but in a different order - should end up at the same point" );
+
+ actor.SetX( 0.0f );
+ application.SendNotification();
+ application.Render();
+
+ 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 ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(14000); // After the animation is complete
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ END_TEST;
+}