+ 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 UtcDaliAnimationAnimateToActorScaleXP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ float startValue(1.0f);
+ DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ float targetX(10.0f);
+ animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
+
+ float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
+
+ // 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);
+
+ 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( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, 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().x, targetX, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateToActorScaleYP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ float startValue(1.0f);
+ DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ float targetY(1000.0f);
+ animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
+
+ float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
+
+ // 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);
+
+ 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( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, 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().y, targetY, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateToActorScaleZP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ float startValue(1.0f);
+ DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ float targetZ(-1000.0f);
+ animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
+
+ float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
+
+ // 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);
+
+ 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( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, 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().z, targetZ, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateToActorColorP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector4 targetColor(Color::RED);
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
+
+ Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
+ Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
+
+ // 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);
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
+
+ // Reset everything
+ finishCheck.Reset();
+ actor.SetColor(Color::WHITE);
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+
+ // Repeat with a different (ease-in) alpha function
+ animation = Animation::New(durationSeconds);
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ // The color should have changed less, than with a linear alpha function
+ Vector4 current(actor.GetCurrentColor());
+ DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
+ DALI_TEST_CHECK( current.y < 1.0f );
+ DALI_TEST_CHECK( current.y > tenPercentProgress.y );
+ DALI_TEST_CHECK( current.z < 1.0f );
+ DALI_TEST_CHECK( current.z > tenPercentProgress.z );
+ DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
+
+ // Reset everything
+ finishCheck.Reset();
+ actor.SetColor(Color::WHITE);
+ application.SendNotification();
+ application.Render(0);
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+
+ // Repeat with a shorter animator duration
+ float animatorDuration = 0.5f;
+ animation = Animation::New(durationSeconds);
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, 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.GetCurrentColor(), targetColor, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateToActorColorRedP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ float startValue(1.0f);
+ DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ float targetRed(0.5f);
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
+
+ float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
+
+ // 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);
+
+ 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( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, 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.GetCurrentColor().r, targetRed, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateToActorColorGreenP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ float startValue(1.0f);
+ DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ float targetGreen(0.5f);
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
+
+ float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
+
+ // 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);
+
+ 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( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, 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.GetCurrentColor().g, targetGreen, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateToActorColorBlueP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ float startValue(1.0f);
+ DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ float targetBlue(0.5f);
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
+
+ float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
+
+ // 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);
+
+ 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( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, 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.GetCurrentColor().b, targetBlue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateToActorColorAlphaP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ float startValue(1.0f);
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ float targetAlpha(0.5f);
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
+
+ float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
+
+ // 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>(durationSeconds*500.0f)/* 50% progress */);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, 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.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationKeyFrames01P(void)
+{
+ TestApplication application;
+
+ KeyFrames keyFrames = KeyFrames::New();
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
+
+ keyFrames.Add(0.0f, 0.1f);
+
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
+
+ KeyFrames keyFrames2( keyFrames);
+ DALI_TEST_CHECK( keyFrames2 );
+ DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
+
+ KeyFrames keyFrames3 = KeyFrames::New();
+ keyFrames3.Add(0.6f, true);
+ DALI_TEST_CHECK( keyFrames3 );
+ DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
+
+ keyFrames3 = keyFrames;
+ DALI_TEST_CHECK( keyFrames3 );
+ DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliAnimationKeyFrames02P(void)
+{
+ TestApplication application;
+
+ KeyFrames keyFrames = KeyFrames::New();
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
+
+ keyFrames.Add(0.0f, 0.1f);
+ keyFrames.Add(0.2f, 0.5f);
+ keyFrames.Add(0.4f, 0.0f);
+ keyFrames.Add(0.6f, 1.0f);
+ keyFrames.Add(0.8f, 0.7f);
+ keyFrames.Add(1.0f, 0.9f);
+
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
+
+ try
+ {
+ keyFrames.Add(1.9f, false);
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
+ }
+ END_TEST;
+}
+
+int UtcDaliAnimationKeyFrames03P(void)
+{
+ TestApplication application;
+
+ KeyFrames keyFrames = KeyFrames::New();
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
+
+ keyFrames.Add(0.0f, true);
+ keyFrames.Add(0.2f, false);
+ keyFrames.Add(0.4f, false);
+ keyFrames.Add(0.6f, true);
+ keyFrames.Add(0.8f, true);
+ keyFrames.Add(1.0f, false);
+
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
+
+ try
+ {
+ keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
+ }
+ END_TEST;
+}
+
+int UtcDaliAnimationKeyFrames04P(void)
+{
+ TestApplication application;
+
+ KeyFrames keyFrames = KeyFrames::New();
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
+
+ keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
+ keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
+ keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
+ keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
+ keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
+ keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
+
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
+
+ try
+ {
+ keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
+ }
+ END_TEST;
+}
+
+int UtcDaliAnimationKeyFrames05P(void)
+{
+ TestApplication application;
+
+ KeyFrames keyFrames = KeyFrames::New();
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
+
+ keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
+ keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
+ keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
+ keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
+ keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
+ keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
+
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
+
+ try
+ {
+ keyFrames.Add(0.7f, 1.0f);
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
+ }
+ END_TEST;
+}
+
+int UtcDaliAnimationKeyFrames06P(void)
+{
+ TestApplication application;
+
+ KeyFrames keyFrames = KeyFrames::New();
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
+
+ keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
+ keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+ keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
+ keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
+ keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
+ keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
+
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
+
+ try
+ {
+ keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
+ }
+ END_TEST;
+}
+
+int UtcDaliAnimationKeyFrames07P(void)
+{
+ TestApplication application;
+
+ KeyFrames keyFrames = KeyFrames::New();
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
+
+ keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
+ keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
+ keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
+ keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
+ keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
+ keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
+
+ DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
+
+ try
+ {
+ keyFrames.Add(0.7f, 1.1f);
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
+ }
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, 0.1f);
+ keyFrames.Add(0.2f, 0.5f);
+ keyFrames.Add(0.4f, 0.0f);
+ keyFrames.Add(0.6f, 1.0f);
+ keyFrames.Add(0.8f, 0.7f);
+ keyFrames.Add(1.0f, 0.9f);
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
+
+ // 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);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, 0.1f);
+ keyFrames.Add(0.2f, 0.5f);
+ keyFrames.Add(0.4f, 0.0f);
+ keyFrames.Add(0.6f, 1.0f);
+ keyFrames.Add(0.8f, 0.7f);
+ keyFrames.Add(1.0f, 0.9f);
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
+ keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
+ keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
+ keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
+ keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ AngleAxis aa(Degree(90), Vector3::XAXIS);
+ actor.SetOrientation(aa.angle, aa.axis);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render(0);
+
+ DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, false);
+ keyFrames.Add(0.2f, true);
+ keyFrames.Add(0.4f, true);
+ keyFrames.Add(0.8f, false);
+ keyFrames.Add(1.0f, true);
+
+ animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
+
+ // Start the animation
+ animation.Play();
+
+ // Final key frame value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ AngleAxis aa(Degree(90), Vector3::XAXIS);
+ actor.SetOrientation(aa.angle, aa.axis);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render(0);
+
+ DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, false);
+ keyFrames.Add(0.2f, true);
+ keyFrames.Add(0.4f, true);
+ keyFrames.Add(0.8f, false);
+ keyFrames.Add(1.0f, true);
+
+ //Cubic interpolation for boolean values should be ignored
+ animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ AngleAxis aa(Degree(90), Vector3::XAXIS);
+ actor.SetOrientation(aa.angle, aa.axis);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render(0);
+ Quaternion start(Radian(aa.angle), aa.axis);
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
+
+ // Start the animation
+ animation.Play();
+
+ // Final key frame value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
+ application.SendNotification();
+
+ Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
+
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ AngleAxis aa(Degree(90), Vector3::XAXIS);
+ actor.SetOrientation(aa.angle, aa.axis);
+ application.SendNotification();
+ application.Render(0);
+ Stage::GetCurrent().Add(actor);
+
+ Quaternion start(Radian(aa.angle), aa.axis);
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
+ keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
+ keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ AngleAxis aa(Degree(90), Vector3::XAXIS);
+ actor.SetOrientation(aa.angle, aa.axis);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render(0);
+ Quaternion start(Radian(aa.angle), aa.axis);
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
+
+ //Cubic interpolation should be ignored for quaternions
+ animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
+ application.SendNotification();
+
+ Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
+
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ AngleAxis aa(Degree(90), Vector3::XAXIS);
+ actor.SetOrientation(aa.angle, aa.axis);
+ application.SendNotification();
+ application.Render(0);
+ Stage::GetCurrent().Add(actor);
+
+ Quaternion start(Radian(aa.angle), aa.axis);
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
+ keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
+ keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
+
+ //Cubic interpolation should be ignored for quaternions
+ animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
+ keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
+ keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
+ keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
+ keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ float delay = 0.5f;
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
+ keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
+ keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+
+ application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ float delay = 0.5f;
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
+ keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
+ keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+
+ application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ float delay = 0.5f;
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
+ keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
+ keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+
+ application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
+{
+ TestApplication application;
+
+ float startValue(1.0f);
+ Actor actor = Actor::New();
+ actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ float delay = 0.5f;
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
+ keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
+ keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+
+ application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+
+ // We did expect the animation to finish
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ //Build the path
+ Vector3 position0( 30.0, 80.0, 0.0);
+ Vector3 position1( 70.0, 120.0, 0.0);
+ Vector3 position2( 100.0, 100.0, 0.0);
+
+ Dali::Path path = Dali::Path::New();
+ path.AddPoint(position0);
+ path.AddPoint(position1);
+ path.AddPoint(position2);
+
+ //Control points for first segment
+ path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
+ path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+
+ //Control points for second segment
+ path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
+
+ // Build the animation
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New(durationSeconds);
+ animation.Animate(actor, path, Vector3::XAXIS);
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ Vector3 position, tangent;
+ Quaternion rotation;
+ path.Sample( 0.0f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ path.Sample( 0.25f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ path.Sample( 0.5f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ path.Sample( 0.75f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ path.Sample( 1.0f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateAlphaFunctionP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ //Build the path
+ Vector3 position0( 30.0, 80.0, 0.0);
+ Vector3 position1( 70.0, 120.0, 0.0);
+ Vector3 position2( 100.0, 100.0, 0.0);
+
+ Dali::Path path = Dali::Path::New();
+ path.AddPoint(position0);
+ path.AddPoint(position1);
+ path.AddPoint(position2);
+
+ //Control points for first segment
+ path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
+ path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+
+ //Control points for second segment
+ path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
+
+ // Build the animation
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New(durationSeconds);
+ animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ Vector3 position, tangent;
+ Quaternion rotation;
+ path.Sample( 0.0f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ path.Sample( 0.25f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ path.Sample( 0.5f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ path.Sample( 0.75f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ path.Sample( 1.0f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateTimePeriodP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ //Build the path
+ Vector3 position0( 30.0, 80.0, 0.0);
+ Vector3 position1( 70.0, 120.0, 0.0);
+ Vector3 position2( 100.0, 100.0, 0.0);
+
+ Dali::Path path = Dali::Path::New();
+ path.AddPoint(position0);
+ path.AddPoint(position1);
+ path.AddPoint(position2);
+
+ //Control points for first segment
+ path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
+ path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+
+ //Control points for second segment
+ path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
+
+ // Build the animation
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New(durationSeconds);
+ animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ Vector3 position, tangent;
+ Quaternion rotation;
+ path.Sample( 0.0f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ path.Sample( 0.25f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ path.Sample( 0.5f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ path.Sample( 0.75f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ path.Sample( 1.0f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ //Build the path
+ Vector3 position0( 30.0, 80.0, 0.0);
+ Vector3 position1( 70.0, 120.0, 0.0);
+ Vector3 position2( 100.0, 100.0, 0.0);
+
+ Dali::Path path = Dali::Path::New();
+ path.AddPoint(position0);
+ path.AddPoint(position1);
+ path.AddPoint(position2);
+
+ //Control points for first segment
+ path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
+ path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+
+ //Control points for second segment
+ path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
+
+ // Build the animation
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New(durationSeconds);
+ animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ Vector3 position, tangent;
+ Quaternion rotation;
+ path.Sample( 0.0f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.SendNotification();
+ path.Sample( 0.25f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.SendNotification();
+ path.Sample( 0.5f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.SendNotification();
+ path.Sample( 0.75f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.SendNotification();
+ path.Sample( 1.0f, position, tangent );
+ rotation = Quaternion( Vector3::XAXIS, tangent );
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
+
+ finishCheck.CheckSignalReceived();
+ END_TEST;
+}
+
+int UtcDaliAnimationShowP(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 UtcDaliAnimationHideP(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 UtcDaliAnimationShowHideAtEndP(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 UtcDaliKeyFramesCreateDestroyP(void)
+{
+ tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
+
+ KeyFrames* keyFrames = new KeyFrames;
+ delete keyFrames;
+ DALI_TEST_CHECK( true );
+ END_TEST;
+}
+
+int UtcDaliKeyFramesDownCastP(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
+
+ KeyFrames keyFrames = KeyFrames::New();
+ BaseHandle object(keyFrames);
+
+ KeyFrames keyFrames2 = KeyFrames::DownCast(object);
+ DALI_TEST_CHECK(keyFrames2);
+
+ KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
+ DALI_TEST_CHECK(keyFrames3);
+
+ BaseHandle unInitializedObject;
+ KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
+ DALI_TEST_CHECK(!keyFrames4);
+
+ KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
+ DALI_TEST_CHECK(!keyFrames5);
+ END_TEST;
+}
+
+int UtcDaliAnimationCreateDestroyP(void)
+{
+ TestApplication application;
+ Animation* animation = new Animation;
+ DALI_TEST_CHECK( animation );
+ delete animation;
+ END_TEST;
+}
+
+struct UpdateManagerTestConstraint
+{
+ UpdateManagerTestConstraint(TestApplication& application)
+ : mApplication(application)
+ {
+ }
+
+ void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
+ {
+ mApplication.SendNotification(); // Process events
+ }
+
+ TestApplication& mApplication;
+};
+
+int UtcDaliAnimationUpdateManagerP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add( actor );
+
+ // Build the animation
+ Animation animation = Animation::New( 0.0f );
+
+ bool signalReceived = false;
+ AnimationFinishCheck finishCheck( signalReceived );
+ animation.FinishedSignal().Connect( &application, finishCheck );
+
+ Vector3 startValue(1.0f, 1.0f, 1.0f);
+ Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
+ constraint.Apply();
+
+ // Apply animation to actor
+ animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
+ animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
+
+ animation.Play();
+
+ application.SendNotification();
+ application.UpdateOnly( 16 );
+
+ finishCheck.CheckSignalNotReceived();
+
+ application.SendNotification(); // Process events
+
+ finishCheck.CheckSignalReceived();
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSignalOrderP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add( actor );
+
+ // Build the animations
+ Animation animation1 = Animation::New( 0.0f ); // finishes first frame
+ Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
+
+ bool signal1Received = false;
+ animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
+
+ bool signal2Received = false;
+ animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
+
+ // Apply animations to actor
+ animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
+ animation1.Play();
+ animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
+ animation2.Play();
+
+ DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
+
+ application.SendNotification();
+ application.UpdateOnly( 10 ); // 10ms progress
+
+ // no notifications yet
+ DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
+
+ application.SendNotification();
+
+ // first completed
+ DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
+ signal1Received = false;
+
+ // 1st animation is complete now, do another update with no ProcessEvents in between
+ application.UpdateOnly( 20 ); // 20ms progress
+
+ // ProcessEvents
+ application.SendNotification();
+
+ // 2nd should complete now
+ DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationExtendDurationP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ // Register a float property
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float initialDurationSeconds(1.0f);
+ float animatorDelay = 5.0f;
+ float animatorDurationSeconds(5.0f);
+ float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
+ Animation animation = Animation::New(initialDurationSeconds);
+ float targetValue(30.0f);
+ float relativeValue(targetValue - startValue);
+
+ animation.AnimateTo(Property(actor, index),
+ targetValue,
+ TimePeriod(animatorDelay, animatorDurationSeconds));
+
+ // The duration should have been extended
+ DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);