- finishCheck.CheckSignalNotReceived();
- progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliAnimationRotate(void)
-{
- TestApplication application;
-
- Actor actor = Actor::New();
- Quaternion initialRotation(0.0f, Vector3::YAXIS);
- actor.SetRotation(initialRotation);
- Stage::GetCurrent().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentRotation(), initialRotation, ROTATION_EPSILON, TEST_LOCATION );
-
- // Build the animation
- float durationSeconds(1.0f);
- Animation animation = Animation::New(durationSeconds);
- TumbleFunc func(Vector3::YAXIS);
- animation.Rotate(actor, func, AlphaFunctions::Linear, 0.0f, durationSeconds);
-
- // Start the animation
- animation.Play();
-
- bool signalReceived(false);
- AnimationFinishCheck finishCheck(signalReceived);
- animation.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.25f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.5f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.75f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(1.0f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliAnimationScaleBy(void)
-{
- TestApplication application;
-
- Actor actor = Actor::New();
- Stage::GetCurrent().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
-
- // Build the animation
- float durationSeconds(1.0f);
- Animation animation = Animation::New(durationSeconds);
- Vector3 targetScale(2.0f, 2.0f, 2.0f);
- Vector3 relativeScale(targetScale - Vector3::ONE);
- animation.ScaleBy(actor, relativeScale.x, relativeScale.y, relativeScale.z);
-
- Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
-
- // Start the animation
- animation.Play();
-
- bool signalReceived(false);
- AnimationFinishCheck finishCheck(signalReceived);
- animation.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
-
- // Reset everything
- finishCheck.Reset();
- actor.SetScale(Vector3::ONE);
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
-
- // Repeat with a different (ease-in) alpha function
- animation = Animation::New(durationSeconds);
- animation.ScaleBy(actor, relativeScale, AlphaFunctions::EaseIn);
- animation.FinishedSignal().Connect(&application, finishCheck);
- animation.Play();
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
-
- // The scale should have grown less, than with a linear alpha function
- Vector3 current(actor.GetCurrentScale());
- DALI_TEST_CHECK( current.x > 1.0f );
- DALI_TEST_CHECK( current.y > 1.0f );
- DALI_TEST_CHECK( current.z > 1.0f );
- DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
- DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
- DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
-
- // Reset everything
- finishCheck.Reset();
- actor.SetScale(Vector3::ONE);
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
-
- // Repeat with a delay
- float delay = 0.5f;
- animation = Animation::New(durationSeconds);
- animation.ScaleBy(actor, relativeScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
- animation.FinishedSignal().Connect(&application, finishCheck);
- animation.Play();
-
- 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
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliAnimationScaleTo(void)
-{
- TestApplication application;
-
- Actor actor = Actor::New();
- Stage::GetCurrent().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
-
- // Build the animation
- float durationSeconds(1.0f);
- Animation animation = Animation::New(durationSeconds);
- Vector3 targetScale(2.0f, 2.0f, 2.0f);
- animation.ScaleTo(actor, targetScale.x, targetScale.y, targetScale.z);
-
- Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
-
- // Start the animation
- animation.Play();
-
- bool signalReceived(false);
- AnimationFinishCheck finishCheck(signalReceived);
- animation.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
-
- // Reset everything
- finishCheck.Reset();
- actor.SetScale(Vector3::ONE);
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
-
- // Repeat with a different (ease-in) alpha function
- animation = Animation::New(durationSeconds);
- animation.ScaleTo(actor, targetScale, AlphaFunctions::EaseIn);
- animation.FinishedSignal().Connect(&application, finishCheck);
- animation.Play();
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
-
- // The scale should have grown less, than with a linear alpha function
- Vector3 current(actor.GetCurrentScale());
- DALI_TEST_CHECK( current.x > 1.0f );
- DALI_TEST_CHECK( current.y > 1.0f );
- DALI_TEST_CHECK( current.z > 1.0f );
- DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
- DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
- DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
-
- // Reset everything
- finishCheck.Reset();
- actor.SetScale(Vector3::ONE);
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
-
- // Repeat with a delay
- float delay = 0.5f;
- animation = Animation::New(durationSeconds);
- animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
- animation.FinishedSignal().Connect(&application, finishCheck);
- animation.Play();
-
- 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
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliAnimationShow(void)
-{
- TestApplication application;
-
- Actor actor = Actor::New();
- actor.SetVisible(false);
- application.SendNotification();
- application.Render(0);
- DALI_TEST_CHECK( !actor.IsVisible() );
- Stage::GetCurrent().Add(actor);
-
- // Start the animation
- float durationSeconds(10.0f);
- Animation animation = Animation::New(durationSeconds);
- animation.Show(actor, durationSeconds*0.5f);
- animation.Play();
-
- bool signalReceived(false);
- AnimationFinishCheck finishCheck(signalReceived);
- animation.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( !actor.IsVisible() );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.IsVisible() );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.IsVisible() );
- END_TEST;
-}
-
-int UtcDaliAnimationHide(void)
-{
- TestApplication application;
-
- Actor actor = Actor::New();
- DALI_TEST_CHECK( actor.IsVisible() );
- Stage::GetCurrent().Add(actor);
-
- // Start the animation
- float durationSeconds(10.0f);
- Animation animation = Animation::New(durationSeconds);
- animation.Hide(actor, durationSeconds*0.5f);
- animation.Play();
-
- bool signalReceived(false);
- AnimationFinishCheck finishCheck(signalReceived);
- animation.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.IsVisible() );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
-
- // We didn't expect the animation to finish yet
- application.SendNotification();
- finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( !actor.IsVisible() );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( !actor.IsVisible() );
- END_TEST;
-}
-
-int UtcDaliAnimationShowHideAtEnd(void)
-{
- // Test that show/hide delay can be the same as animation duration
- // i.e. to show/hide at the end of the animation
-
- TestApplication application;
-
- Actor actor = Actor::New();
- DALI_TEST_CHECK( actor.IsVisible() );
- Stage::GetCurrent().Add(actor);
-
- // Start Hide animation
- float durationSeconds(10.0f);
- Animation animation = Animation::New(durationSeconds);
- animation.Hide(actor, durationSeconds/*Hide at end*/);
- animation.Play();
-
- bool signalReceived(false);
- AnimationFinishCheck finishCheck(signalReceived);
- animation.FinishedSignal().Connect(&application, finishCheck);