END_TEST;
}
+int UtcDaliAnimationSetLoopCountP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+
+ // Start the animation
+ animation.SetLoopCount(3);
+ DALI_TEST_CHECK(animation.IsLooping());
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+
+ // Loop
+ float intervalSeconds = 3.0f;
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+
+ finishCheck.Reset();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSetLoopCountP2(void)
+{
+ TestApplication application;
+
+ //
+ // switching between forever and loop count
+ //
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+ animation.SetEndAction(Animation::Discard);
+
+ // Start the animation
+ animation.SetLoopCount(3);
+ DALI_TEST_CHECK(animation.IsLooping());
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+
+ float intervalSeconds = 3.0f;
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ finishCheck.Reset();
+
+ // Loop forever
+ animation.SetLooping(true);
+ DALI_TEST_CHECK(animation.IsLooping());
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ finishCheck.Reset();
+
+ // Loop N again
+ animation.SetLoopCount(3);
+ DALI_TEST_CHECK(animation.IsLooping());
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ finishCheck.Reset();
+
+ // loop forever
+ animation.SetLooping(true);
+ DALI_TEST_CHECK(animation.IsLooping());
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ finishCheck.Reset();
+
+ // Loop N again
+ animation.SetLoopCount(3);
+ DALI_TEST_CHECK(animation.IsLooping());
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived(); // we never hit play
+
+ finishCheck.Reset();
+
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSetLoopCountP3(void)
+{
+ TestApplication application;
+
+ //
+ // switching between forever and loop count
+ //
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+ animation.SetEndAction(Animation::Discard);
+
+ float intervalSeconds = 3.0f;
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+
+ // loop forever
+ animation.SetLooping(true);
+ DALI_TEST_CHECK(animation.IsLooping());
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ finishCheck.Reset();
+
+ // Loop N again
+ animation.SetLoopCount(3);
+ DALI_TEST_CHECK(animation.IsLooping());
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived(); // we never hit play
+
+ finishCheck.Reset();
+
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSetLoopCountP4(void)
+{
+ TestApplication application;
+
+ //
+ // ..and play again
+ //
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+ animation.SetEndAction(Animation::Bake);
+
+ float intervalSeconds = 3.0f;
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+
+ animation.SetLoopCount(1);
+ animation.Play();
+ DALI_TEST_CHECK(!animation.IsLooping());
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
+ actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
+
+ finishCheck.Reset();
+
+ animation.Play(); // again
+ DALI_TEST_CHECK(!animation.IsLooping());
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationGetLoopCountP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+
+ DALI_TEST_CHECK(1 == animation.GetLoopCount());
+
+ // Start the animation
+ animation.SetLoopCount(3);
+ DALI_TEST_CHECK(animation.IsLooping());
+ DALI_TEST_CHECK(3 == animation.GetLoopCount());
+
+ animation.Play();
+
+ application.Render(0);
+ application.SendNotification();
+
+ // Loop
+ float intervalSeconds = 3.0f;
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+
+ application.Render(0);
+ application.SendNotification();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+
+ animation.SetLoopCount(0);
+ DALI_TEST_CHECK(animation.IsLooping());
+ DALI_TEST_CHECK(0 == animation.GetLoopCount());
+
+ animation.SetLoopCount(1);
+ DALI_TEST_CHECK(!animation.IsLooping());
+ DALI_TEST_CHECK(1 == animation.GetLoopCount());
+
+ END_TEST;
+}
+
+
+int UtcDaliAnimationGetCurrentLoopP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+
+ // Start the animation
+ animation.SetLoopCount(3);
+ DALI_TEST_CHECK(animation.IsLooping());
+ DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+
+ application.SendNotification();
+
+ // Loop
+ float intervalSeconds = 3.0f;
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
+ DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
+
+ finishCheck.Reset();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
+
+ END_TEST;
+}
+
int UtcDaliAnimationIsLoopingP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationStoP(void)
+
+int UtcDaliAnimationGetStateP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+ DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
+
+ Vector3 fiftyPercentProgress(targetPosition * 0.5f);
+
+ // Start the animation
+ animation.Play();
+
+ DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
+
+ // Pause the animation
+ animation.Pause();
+ DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
+ application.SendNotification();
+ application.Render(0.f);
+
+ // Loop 5 times
+ for (int i=0; i<5; ++i)
+ {
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
+ DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
+ }
+
+ // Keep going
+ finishCheck.Reset();
+ animation.Play();
+ DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, 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.GetCurrentPosition(), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
+
+ // Check that nothing has changed after a couple of buffer swaps
+ application.Render(0);
+ DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+ application.Render(0);
+ DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
+
+ // re-play
+ finishCheck.Reset();
+ animation.Play();
+ DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+
+
+ END_TEST;
+}
+
+int UtcDaliAnimationStopP(void)
{
TestApplication application;
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), fiftyPercentProgress, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), fiftyPercentProgress, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), fiftyPercentProgress, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), fiftyPercentProgress, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
END_TEST;
}
-int P(void)
+int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
{
TestApplication application;
DALI_TEST_EQUALS( actor.GetProperty<int>(index), 20, TEST_LOCATION );
END_TEST;
}
-