- 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);
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
-
- // We did expect the animation to finish
- application.SendNotification();
- finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( !actor.IsVisible() );
-
- // Start Show animation
- animation = Animation::New(durationSeconds);
- animation.Show(actor, durationSeconds/*Show at end*/);
- animation.FinishedSignal().Connect(&application, finishCheck);
- animation.Play();
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.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 UtcDaliAnimationOpacityBy(void)
-{
- TestApplication application;
- Actor actor = Actor::New();
- float startingOpacity(0.5f);
- actor.SetOpacity(startingOpacity);
- application.SendNotification();
- application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
- Stage::GetCurrent().Add(actor);
-
- // Build the animation
- float durationSeconds(1.0f);
- Animation animation = Animation::New(durationSeconds);
- float relativeOpacity(-0.5f); // target of zero
- animation.OpacityBy(actor, relativeOpacity);