X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Animation.cpp;h=2a46bf595582649b7436f7d246922dbccad78e3f;hb=462cbee2270984cdca45488f3733d664dcf49187;hp=72caae274f9e702254b2d5a9fece65bfa0967b98;hpb=4131947a503fe176a840926b2df8db6469673577;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-Animation.cpp b/automated-tests/src/dali/utc-Dali-Animation.cpp index 72caae2..2a46bf5 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ #include #include +#include +#include #include using std::max; @@ -336,19 +338,7 @@ int UtcDaliAnimationSetLoopingP(void) END_TEST; } -int UtcDaliAnimationIsLoopingP(void) -{ - TestApplication application; - - Animation animation = Animation::New(1.0f); - DALI_TEST_CHECK(!animation.IsLooping()); - - animation.SetLooping(true); - DALI_TEST_CHECK(animation.IsLooping()); - END_TEST; -} - -int UtcDaliAnimationSetEndActioN(void) +int UtcDaliAnimationSetLoopCountP(void) { TestApplication application; @@ -358,323 +348,304 @@ int UtcDaliAnimationSetEndActioN(void) // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation + animation.SetLoopCount(3); + DALI_TEST_CHECK(animation.IsLooping()); animation.Play(); bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); + application.Render(0); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); - - // We did expect the animation to finish + application.Render(0); application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); - - // Go back to the start - actor.SetPosition(Vector3::ZERO); + application.Render(0); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION ); - - // Test BakeFinal, animate again, for half the duration - finishCheck.Reset(); - animation.SetEndAction(Animation::BakeFinal); - DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal); - animation.Play(); - application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/); - // Stop the animation early - animation.Stop(); + // Loop + float intervalSeconds = 3.0f; - // We did NOT expect the animation to finish + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + + application.Render(0); + application.SendNotification(); + application.Render(0); + application.SendNotification(); + application.Render(0); + application.SendNotification(); + application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION ); - // The position should be same with target position in the next frame - application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - // Go back to the start - actor.SetPosition(Vector3::ZERO); application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); - // Test EndAction::Discard, animate again, but don't bake this time finishCheck.Reset(); - animation.SetEndAction(Animation::Discard); - DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard); - animation.Play(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); + finishCheck.CheckSignalNotReceived(); - // We did expect the animation to finish + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); - - // The position should be discarded in the next frame - application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION ); - application.Render(0); - DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationGetEndActionP(void) +int UtcDaliAnimationSetLoopCountP2(void) { TestApplication application; - Animation animation = Animation::New(1.0f); - DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake); + // + // switching between forever and loop count + // + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); animation.SetEndAction(Animation::Discard); - DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard); - animation.SetEndAction(Animation::BakeFinal); - DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal); + // Start the animation + animation.SetLoopCount(3); + DALI_TEST_CHECK(animation.IsLooping()); + animation.Play(); - END_TEST; -} + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); -int UtcDaliAnimationSetDisconnectActionP(void) -{ - TestApplication application; - Stage stage( Stage::GetCurrent() ); + float intervalSeconds = 3.0f; - // Default: BakeFinal - { - Actor actor = Actor::New(); - stage.Add(actor); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); + application.SendNotification(); + finishCheck.CheckSignalReceived(); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + finishCheck.Reset(); - // Start the animation - animation.Play(); + // Loop forever + animation.SetLooping(true); + DALI_TEST_CHECK(animation.IsLooping()); - application.SendNotification(); - application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); - actor.Unparent(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); - application.SendNotification(); - application.Render(); + finishCheck.Reset(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); - } + // Loop N again + animation.SetLoopCount(3); + DALI_TEST_CHECK(animation.IsLooping()); + animation.Play(); - // Bake - { - Actor actor = Actor::New(); - stage.Add(actor); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - animation.SetDisconnectAction( Animation::Bake ); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalReceived(); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + finishCheck.Reset(); - // Start the animation - animation.Play(); + // loop forever + animation.SetLooping(true); + DALI_TEST_CHECK(animation.IsLooping()); - application.SendNotification(); - application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); - actor.Unparent(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); - application.SendNotification(); - application.Render(); + finishCheck.Reset(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION ); - } + // Loop N again + animation.SetLoopCount(3); + DALI_TEST_CHECK(animation.IsLooping()); - // Discard - { - Actor actor = Actor::New(); - stage.Add(actor); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - animation.SetDisconnectAction( Animation::Discard ); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); // we never hit play - Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + finishCheck.Reset(); - // Start the animation - animation.Play(); - application.SendNotification(); - application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + END_TEST; +} - actor.Unparent(); +int UtcDaliAnimationSetLoopCountP3(void) +{ + TestApplication application; - application.SendNotification(); - application.Render(); + // + // switching between forever and loop count + // + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); - } + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + animation.SetEndAction(Animation::Discard); - // Don't play the animation: disconnect action should not be applied - { - Actor actor = Actor::New(); - stage.Add(actor); + float intervalSeconds = 3.0f; - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); - Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + // loop forever + animation.SetLooping(true); + DALI_TEST_CHECK(animation.IsLooping()); - application.SendNotification(); - application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); - actor.Unparent(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); - application.SendNotification(); - application.Render(); + finishCheck.Reset(); + + // Loop N again + animation.SetLoopCount(3); + DALI_TEST_CHECK(animation.IsLooping()); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); // we never hit play + + finishCheck.Reset(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); - } END_TEST; } -int UtcDaliAnimationGetDisconnectActionP(void) -{ - TestApplication application; - Animation animation = Animation::New(1.0f); - DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default! - - animation.SetDisconnectAction(Animation::Discard); - DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard); - - animation.SetDisconnectAction(Animation::Bake); - DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake); - - END_TEST; -} - -int UtcDaliAnimationSetDefaultAlphaFunctionP(void) -{ - TestApplication application; - - Animation animation = Animation::New(1.0f); - AlphaFunction func = animation.GetDefaultAlphaFunction(); - DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); - - animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN); - AlphaFunction func2 = animation.GetDefaultAlphaFunction(); - DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION); - END_TEST; -} - -int UtcDaliAnimationGetDefaultAlphaFunctionP(void) -{ - TestApplication application; - - Animation animation = Animation::New(1.0f); - AlphaFunction func = animation.GetDefaultAlphaFunction(); - - // Test that the default is linear - DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); - - animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN); - AlphaFunction func2 = animation.GetDefaultAlphaFunction(); - DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION); - - END_TEST; -} - -int UtcDaliAnimationSetCurrentProgressP(void) +int UtcDaliAnimationSetLoopCountP4(void) { TestApplication application; + // + // ..and play again + // Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); // Build the animation - Animation animation = Animation::New(0.0f); - - //Set duration float durationSeconds(1.0f); - animation.SetDuration(durationSeconds); + Animation animation = Animation::New(durationSeconds); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + animation.SetEndAction(Animation::Bake); + + float intervalSeconds = 3.0f; bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - - Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - // Start the animation from 40% progress - animation.SetCurrentProgress( 0.4f ); + animation.SetLoopCount(1); animation.Play(); + DALI_TEST_CHECK(!animation.IsLooping()); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION ); - DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION ); - - animation.Play(); // Test that calling play has no effect, when animation is already playing + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); application.SendNotification(); + finishCheck.CheckSignalReceived(); - //Set the progress to 70% - animation.SetCurrentProgress( 0.7f ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 80% progress */); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) ); + + finishCheck.Reset(); + + animation.Play(); // again + DALI_TEST_CHECK(!animation.IsLooping()); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION ); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); - - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); - // We did expect the animation to finish + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); application.SendNotification(); finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); - application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationSetCurrentProgressN(void) +int UtcDaliAnimationGetLoopCountP(void) { TestApplication application; @@ -682,32 +653,48 @@ int UtcDaliAnimationSetCurrentProgressN(void) Stage::GetCurrent().Add(actor); // Build the animation - Animation animation = Animation::New(0.0f); - - //Set duration float durationSeconds(1.0f); - animation.SetDuration(durationSeconds); + Animation animation = Animation::New(durationSeconds); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + DALI_TEST_CHECK(1 == animation.GetLoopCount()); + + // Start the animation + animation.SetLoopCount(3); + DALI_TEST_CHECK(animation.IsLooping()); + DALI_TEST_CHECK(3 == animation.GetLoopCount()); + + animation.Play(); + + application.Render(0); application.SendNotification(); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + // Loop + float intervalSeconds = 3.0f; - //Trying to set the current cursor outside the range [0..1] is ignored - animation.SetCurrentProgress( -1.0f); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + + application.Render(0); application.SendNotification(); - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); - animation.SetCurrentProgress( 100.0f); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); application.SendNotification(); - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + + animation.SetLoopCount(0); + DALI_TEST_CHECK(animation.IsLooping()); + DALI_TEST_CHECK(0 == animation.GetLoopCount()); + + animation.SetLoopCount(1); + DALI_TEST_CHECK(!animation.IsLooping()); + DALI_TEST_CHECK(1 == animation.GetLoopCount()); + END_TEST; } -int UtcDaliAnimationGetCurrentProgressP(void) + +int UtcDaliAnimationGetCurrentLoopP(void) { TestApplication application; @@ -715,65 +702,71 @@ int UtcDaliAnimationGetCurrentProgressP(void) Stage::GetCurrent().Add(actor); // Build the animation - Animation animation = Animation::New(0.0f); - animation.Play(); - - //Test GetCurrentProgress return 0.0 as the duration is 0.0 - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); - - animation.SetCurrentProgress( 0.5f ); - application.SendNotification(); - application.Render(static_cast(100.0f)); - - //Progress should still be 0.0 - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); - - //Set duration float durationSeconds(1.0f); - animation.SetDuration(durationSeconds); - application.SendNotification(); + Animation animation = Animation::New(durationSeconds); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + // Start the animation + animation.SetLoopCount(3); + DALI_TEST_CHECK(animation.IsLooping()); + DALI_TEST_CHECK(0 == animation.GetCurrentLoop()); + animation.Play(); bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + application.SendNotification(); - // Start the animation from 40% progress - animation.SetCurrentProgress( 0.4f ); - animation.Play(); + // Loop + float intervalSeconds = 3.0f; - application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_CHECK(2 == animation.GetCurrentLoop()); - animation.Play(); // Test that calling play has no effect, when animation is already playing - application.SendNotification(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); - //Set the progress to 70% - animation.SetCurrentProgress( 0.7f ); application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 80% progress */); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + DALI_TEST_CHECK(3 == animation.GetCurrentLoop()); + DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop()); + + finishCheck.Reset(); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_CHECK(3 == animation.GetCurrentLoop()); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); - // We did expect the animation to finish + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); + application.Render(static_cast(durationSeconds*intervalSeconds*1000.0f)); application.SendNotification(); - finishCheck.CheckSignalReceived(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_CHECK(3 == animation.GetCurrentLoop()); + + END_TEST; +} + +int UtcDaliAnimationIsLoopingP(void) +{ + TestApplication application; + + Animation animation = Animation::New(1.0f); + DALI_TEST_CHECK(!animation.IsLooping()); + + animation.SetLooping(true); + DALI_TEST_CHECK(animation.IsLooping()); END_TEST; } -int UtcDaliAnimationSetSpeedFactorP(void) +int UtcDaliAnimationSetEndActioN(void) { TestApplication application; @@ -783,17 +776,10 @@ int UtcDaliAnimationSetSpeedFactorP(void) // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); + DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake); - const Vector3 initialPosition(0.0f, 0.0f, 0.0f); - const Vector3 targetPosition(100.0f, 100.0f, 100.0f); - - KeyFrames keyframes = KeyFrames::New(); - keyframes.Add( 0.0f, initialPosition); - keyframes.Add( 1.0f, targetPosition ); - animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); - - //Set speed to be x2 - animation.SetSpeedFactor(2.0f); + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); @@ -803,48 +789,506 @@ int UtcDaliAnimationSetSpeedFactorP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); - // We didn't expect the animation to finish yet + // We did expect the animation to finish application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + // Go back to the start + actor.SetPosition(Vector3::ZERO); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION ); + + // Test BakeFinal, animate again, for half the duration + finishCheck.Reset(); + animation.SetEndAction(Animation::BakeFinal); + DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal); + animation.Play(); - // We didn't expect the animation to finish yet application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION ); + application.Render(static_cast(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/); - application.Render(static_cast(durationSeconds*100.0f) + 1u/*just beyond half the duration*/); + // Stop the animation early + animation.Stop(); - // We did expect the animation to finish + // We did NOT expect the animation to finish application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION ); - // Check that nothing has changed after a couple of buffer swaps + // The position should be same with target position in the next frame application.Render(0); DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + + // Go back to the start + actor.SetPosition(Vector3::ZERO); + application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION ); + // Test EndAction::Discard, animate again, but don't bake this time finishCheck.Reset(); - - //Test -1 speed factor. Animation will play in reverse at normal speed - animation.SetSpeedFactor( -1.0f ); - - // Start the animation + animation.SetEndAction(Animation::Discard); + DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard); animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); - // We didn't expect the animation to finish yet + // We did expect the animation to finish application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + + // The position should be discarded in the next frame + application.Render(0); + DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAnimationGetEndActionP(void) +{ + TestApplication application; + + Animation animation = Animation::New(1.0f); + DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake); + + animation.SetEndAction(Animation::Discard); + DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard); + + animation.SetEndAction(Animation::BakeFinal); + DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal); + + END_TEST; +} + +int UtcDaliAnimationSetDisconnectActionP(void) +{ + TestApplication application; + Stage stage( Stage::GetCurrent() ); + + // Default: BakeFinal + { + Actor actor = Actor::New(); + stage.Add(actor); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); + + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + // Start the animation + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + + actor.Unparent(); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + } + + // Bake + { + Actor actor = Actor::New(); + stage.Add(actor); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + animation.SetDisconnectAction( Animation::Bake ); + + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + // Start the animation + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + + actor.Unparent(); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION ); + } + + // Discard + { + Actor actor = Actor::New(); + stage.Add(actor); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + animation.SetDisconnectAction( Animation::Discard ); + + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + // Start the animation + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + + actor.Unparent(); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + } + + // Don't play the animation: disconnect action should not be applied + { + Actor actor = Actor::New(); + stage.Add(actor); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + + Vector3 targetPosition(10.0f, 10.0f, 10.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*0.5f*1000.0f)/*Only half the animation*/); + + actor.Unparent(); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + } + + END_TEST; +} + +int UtcDaliAnimationGetDisconnectActionP(void) +{ + TestApplication application; + Animation animation = Animation::New(1.0f); + DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default! + + animation.SetDisconnectAction(Animation::Discard); + DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard); + + animation.SetDisconnectAction(Animation::Bake); + DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake); + + END_TEST; +} + +int UtcDaliAnimationSetDefaultAlphaFunctionP(void) +{ + TestApplication application; + + Animation animation = Animation::New(1.0f); + AlphaFunction func = animation.GetDefaultAlphaFunction(); + DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); + + animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN); + AlphaFunction func2 = animation.GetDefaultAlphaFunction(); + DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION); + END_TEST; +} + +int UtcDaliAnimationGetDefaultAlphaFunctionP(void) +{ + TestApplication application; + + Animation animation = Animation::New(1.0f); + AlphaFunction func = animation.GetDefaultAlphaFunction(); + + // Test that the default is linear + DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); + + animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN); + AlphaFunction func2 = animation.GetDefaultAlphaFunction(); + DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliAnimationSetCurrentProgressP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + + // Build the animation + Animation animation = Animation::New(0.0f); + + //Set duration + float durationSeconds(1.0f); + animation.SetDuration(durationSeconds); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); + + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + // Start the animation from 40% progress + animation.SetCurrentProgress( 0.4f ); + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION ); + DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION ); + + animation.Play(); // Test that calling play has no effect, when animation is already playing + application.SendNotification(); + + //Set the progress to 70% + animation.SetCurrentProgress( 0.7f ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*100.0f)/* 80% progress */); + DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION ); + DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAnimationSetCurrentProgressN(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + + // Build the animation + Animation animation = Animation::New(0.0f); + + //Set duration + float durationSeconds(1.0f); + animation.SetDuration(durationSeconds); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); + + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + //Trying to set the current cursor outside the range [0..1] is ignored + animation.SetCurrentProgress( -1.0f); + application.SendNotification(); + DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + + animation.SetCurrentProgress( 100.0f); + application.SendNotification(); + DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAnimationGetCurrentProgressP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + + // Build the animation + Animation animation = Animation::New(0.0f); + animation.Play(); + + //Test GetCurrentProgress return 0.0 as the duration is 0.0 + DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + + animation.SetCurrentProgress( 0.5f ); + application.SendNotification(); + application.Render(static_cast(100.0f)); + + //Progress should still be 0.0 + DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + + //Set duration + float durationSeconds(1.0f); + animation.SetDuration(durationSeconds); + application.SendNotification(); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); + + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + // Start the animation from 40% progress + animation.SetCurrentProgress( 0.4f ); + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION ); + + animation.Play(); // Test that calling play has no effect, when animation is already playing + application.SendNotification(); + + //Set the progress to 70% + animation.SetCurrentProgress( 0.7f ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*100.0f)/* 80% progress */); + DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + END_TEST; +} + +int UtcDaliAnimationSetSpeedFactorP1(void) +{ + TestApplication application; + + tet_printf("Testing that setting a speed factor of 2 takes half the time\n"); + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + + const Vector3 initialPosition(0.0f, 0.0f, 0.0f); + const Vector3 targetPosition(100.0f, 100.0f, 100.0f); + + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add( 0.0f, initialPosition); + keyframes.Add( 1.0f, targetPosition ); + animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + + //Set speed to be x2 + animation.SetSpeedFactor(2.0f); + + // Start the animation + animation.Play(); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*100.0f) + 1u/*just beyond half the duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliAnimationSetSpeedFactorP2(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + + const Vector3 initialPosition(0.0f, 0.0f, 0.0f); + const Vector3 targetPosition(100.0f, 100.0f, 100.0f); + + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add( 0.0f, initialPosition); + keyframes.Add( 1.0f, targetPosition ); + animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + + tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n"); + animation.SetSpeedFactor( -1.0f ); + + // Start the animation + animation.Play(); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION ); application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); @@ -860,30 +1304,133 @@ int UtcDaliAnimationSetSpeedFactorP(void) finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION ); - application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliAnimationSetSpeedFactorP3(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + + const Vector3 initialPosition(0.0f, 0.0f, 0.0f); + const Vector3 targetPosition(100.0f, 100.0f, 100.0f); + + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add( 0.0f, initialPosition); + keyframes.Add( 1.0f, targetPosition ); + animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + tet_printf("Test half speed factor. Animation will take twice the duration\n"); + + //Set speed to be half of normal speed + animation.SetSpeedFactor( 0.5f ); + + // Start the animation + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 10% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + END_TEST; +} + + +int UtcDaliAnimationSetSpeedFactorP4(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + const Vector3 initialPosition(0.0f, 0.0f, 0.0f); + const Vector3 targetPosition(100.0f, 100.0f, 100.0f); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION ); + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add( 0.0f, initialPosition); + keyframes.Add( 1.0f, targetPosition ); + animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION ); - application.Render(0); - DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); - //Test change speed factor on the fly - finishCheck.Reset(); + tet_printf("Test half speed factor. Animation will take twice the duration\n"); - //Set speed to be half of normal speed + tet_printf("Set speed to be half of normal speed\n"); + tet_printf("SetSpeedFactor(0.5f)\n"); animation.SetSpeedFactor( 0.5f ); // Start the animation @@ -911,17 +1458,26 @@ int UtcDaliAnimationSetSpeedFactorP(void) finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION ); - //Change speed factor while animation still playing. - animation.SetSpeedFactor(-1.0f); + tet_printf("Reverse direction of animation whilst playing\n"); + tet_printf("SetSpeedFactor(-0.5f)\n"); + animation.SetSpeedFactor(-0.5f); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); + + // We didn't expect the animation to finish yet application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + application.Render(static_cast(durationSeconds*200.0f)/* 10% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*100.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); @@ -936,6 +1492,352 @@ int UtcDaliAnimationSetSpeedFactorP(void) END_TEST; } +int UtcDaliAnimationSetSpeedFactorAndRange(void) +{ + TestApplication application; + + const unsigned int NUM_FRAMES(15); + + struct TestData + { + float startTime; + float endTime; + float startX; + float endX; + float expected[NUM_FRAMES]; + }; + + TestData testData[] = { + // ACTOR 0 + /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ + /* |----------PlayRange---------------| */ + /* | reverse */ + { 0.0f, 1.0f, // TimePeriod + 0.0f, 100.0f, // POS + {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */ + /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */ + /**/ 50.0f, + /**/ 40.0f, + /**/ 30.0f, + /**/ 70.0f, + /**/ 60.0f, + /**/ 50.0f, + /**/ + } + }, + + // ACTOR 1 - Across start of range + /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ + /* |----------PlayRange---------------| */ + /* | reverse */ + { 0.2f, 0.5f, // TimePeriod + 20.0f, 50.0f, // POS + {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */ + /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */ + /**/ 50.0f, + /**/ 40.0f, + /**/ 30.0f, + /**/ 50.0f, + /**/ 50.0f, + /**/ 50.0f + } + }, + + // ACTOR 2 - Across end of range + /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ + /* |----------PlayRange---------------| */ + /* | reverse */ + {/**/ 0.5f, 0.9f, // TimePeriod + /**/ 50.0f, 90.0f, // POS + { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */ + /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */ + /**/ 50.0f, + /**/ 50.0f, + /**/ 50.0f, 70.0f, + /**/ 60.0f, + /**/ 50.0f, + } + }, + + // ACTOR 3 - Before beginning of range + /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ + /* |----------PlayRange---------------| */ + /* | reverse */ + {/**/ 0.1f, 0.25f, // TimePeriod + /**/ 10.0f, 25.0f, // POS + { /**/ + /**/ 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f + /**/ + } + }, + + // ACTOR 4 - After end of range + /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ + /* |----------PlayRange---------------| */ + /* | reverse */ + {/**/ 0.85f, 1.0f, // TimePeriod + /**/ 85.0f, 100.0f, // POS + { /**/ + /**/ 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f + /**/ + } + }, + // Actor 5 - Middle of range + /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ + /* |----------PlayRange---------------| */ + /* | reverse */ + {/**/ 0.4f, 0.65f, // Time Period + /**/ 40.0f, 65.0f, // Position + { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f, + /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse + /**/ 50.0f, + /**/ 40.0f, + /**/ 40.0f, + /**/ 65.0f, + /**/ 60.0f, + /**/ 50.0f, + } + } + }; + + const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData)); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + std::vector actors; + + for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex ) + { + Actor actor = Actor::New(); + actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) ); + actors.push_back(actor); + Stage::GetCurrent().Add(actor); + + if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 ) + { + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0)); + keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0)); + animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + } + else + { + animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) ); + } + } + + tet_printf("Test half speed factor. Animation will take twice the duration\n"); + tet_printf("Set play range to be 0.3 - 0.8 of the duration\n"); + tet_printf("SetSpeedFactor(0.5f)\n"); + animation.SetSpeedFactor( 0.5f ); + animation.SetPlayRange( Vector2(0.3f, 0.8f) ); + animation.SetLooping(true); + + // Start the animation + animation.Play(); + application.SendNotification(); + application.Render(0); // Frame 0 tests initial values + + for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame ) + { + unsigned int actorIndex = 0u; + for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex ) + { + DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION ); + if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) ) + { + tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex ); + } + } + + if( frame == 8 ) + { + tet_printf("Reverse direction of animation whilst playing after frame 8\n"); + tet_printf("SetSpeedFactor(-0.5f)\n"); + animation.SetSpeedFactor(-0.5f); + application.SendNotification(); + } + application.Render(200); // 200 ms at half speed corresponds to 0.1 s + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + } + + END_TEST; +} + +int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void) +{ + TestApplication application; + + const unsigned int NUM_FRAMES(15); + + struct TestData + { + float startTime; + float endTime; + float startX; + float endX; + float expected[NUM_FRAMES]; + }; + + TestData testData = + // ACTOR 0 + /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ + /* |----------PlayRange---------------| */ + { 0.0f, 1.0f, // TimePeriod + 0.0f, 100.0f, // POS + {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */ + /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, + /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, + /**/ + } + }; + + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + std::vector actors; + + Actor actor = Actor::New(); + actor.SetPosition( Vector3( testData.startX, 0, 0 ) ); + actors.push_back(actor); + Stage::GetCurrent().Add(actor); + + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0)); + keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0)); + animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + + tet_printf("Test half speed factor. Animation will take twice the duration\n"); + tet_printf("Set play range to be 0.3 - 0.8 of the duration\n"); + tet_printf("SetSpeedFactor(0.5f)\n"); + tet_printf("SetLoopCount(3)\n"); + animation.SetSpeedFactor( 0.5f ); + animation.SetPlayRange( Vector2(0.3f, 0.8f) ); + animation.SetLoopCount(3); + + // Start the animation + animation.Play(); + application.SendNotification(); + application.Render(0); // Frame 0 tests initial values + + for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame ) + { + DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION ); + + application.Render(200); // 200 ms at half speed corresponds to 0.1 s + + if( frame < NUM_FRAMES-1 ) + { + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + } + } + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void) +{ + TestApplication application; + + const unsigned int NUM_FRAMES(15); + + struct TestData + { + float startTime; + float endTime; + float startX; + float endX; + float expected[NUM_FRAMES]; + }; + + TestData testData = + // ACTOR 0 + /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */ + /* |----------PlayRange---------------| */ + { 0.0f, 1.0f, // TimePeriod + 0.0f, 100.0f, // POS + {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f, + /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f, + /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f, + } + }; + + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + std::vector actors; + + Actor actor = Actor::New(); + actor.SetPosition( Vector3( testData.startX, 0, 0 ) ); + actors.push_back(actor); + Stage::GetCurrent().Add(actor); + + KeyFrames keyframes = KeyFrames::New(); + keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0)); + keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0)); + animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); + + tet_printf("Test reverse half speed factor. Animation will take twice the duration\n"); + tet_printf("Set play range to be 0.3 - 0.8 of the duration\n"); + tet_printf("SetSpeedFactor(-0.5f)\n"); + tet_printf("SetLoopCount(3)\n"); + animation.SetSpeedFactor( -0.5f ); + animation.SetPlayRange( Vector2(0.3f, 0.8f) ); + animation.SetLoopCount(3); + + // Start the animation + animation.Play(); + application.SendNotification(); + application.Render(0); // Frame 0 tests initial values + + for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame ) + { + DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION ); + + application.Render(200); // 200 ms at half speed corresponds to 0.1 s + + if( frame < NUM_FRAMES-1 ) + { + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + } + } + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION ); + + END_TEST; +} + + int UtcDaliAnimationGetSpeedFactorP(void) { TestApplication application; @@ -1599,7 +2501,101 @@ int UtcDaliAnimationPauseP(void) END_TEST; } -int UtcDaliAnimationStoP(void) + +int UtcDaliAnimationGetStateP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION ); + + Vector3 fiftyPercentProgress(targetPosition * 0.5f); + + // Start the animation + animation.Play(); + + DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION ); + + // Pause the animation + animation.Pause(); + DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION ); + application.SendNotification(); + application.Render(0.f); + + // Loop 5 times + for (int i=0; i<5; ++i) + { + application.Render(static_cast(durationSeconds*500.0f)); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION ); + DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION ); + } + + // Keep going + finishCheck.Reset(); + animation.Play(); + DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*490.0f)/*slightly less than the animation duration*/); + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + application.Render(0); + DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION ); + DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION ); + + // re-play + finishCheck.Reset(); + animation.Play(); + DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*490.0f)/*slightly less than the animation duration*/); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION ); + + + END_TEST; +} + +int UtcDaliAnimationStopP(void) { TestApplication application; @@ -1798,6 +2794,7 @@ int UtcDaliAnimationAnimateByBooleanP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); // Build the animation float durationSeconds(2.0f); @@ -1819,7 +2816,7 @@ int UtcDaliAnimationAnimateByBooleanP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -1827,13 +2824,13 @@ int UtcDaliAnimationAnimateByBooleanP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Repeat with relative value "false" - this should be an NOOP animation = Animation::New(durationSeconds); @@ -1852,7 +2849,7 @@ int UtcDaliAnimationAnimateByBooleanP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -1860,13 +2857,13 @@ int UtcDaliAnimationAnimateByBooleanP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); END_TEST; } @@ -1881,6 +2878,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); // Build the animation float durationSeconds(2.0f); @@ -1902,7 +2900,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -1910,13 +2908,13 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Repeat with relative value "false" - this should be an NOOP animation = Animation::New(durationSeconds); @@ -1935,7 +2933,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -1943,7 +2941,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); END_TEST; } @@ -1958,6 +2956,7 @@ int UtcDaliAnimationAnimateByBooleanTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); // Build the animation float durationSeconds(2.0f); @@ -1982,7 +2981,7 @@ int UtcDaliAnimationAnimateByBooleanTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); application.SendNotification(); application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); @@ -1992,7 +2991,7 @@ int UtcDaliAnimationAnimateByBooleanTimePeriodP(void) finishCheck.CheckSignalNotReceived(); // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.SendNotification(); application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); @@ -2000,13 +2999,13 @@ int UtcDaliAnimationAnimateByBooleanTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); END_TEST; } @@ -2021,6 +3020,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); // Build the animation float durationSeconds(2.0f); @@ -2046,7 +3046,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); application.SendNotification(); application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); @@ -2056,7 +3056,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void) finishCheck.CheckSignalNotReceived(); // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.SendNotification(); application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); @@ -2064,13 +3064,13 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); END_TEST; } @@ -2085,6 +3085,7 @@ int UtcDaliAnimationAnimateByFloatP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -2108,7 +3109,7 @@ int UtcDaliAnimationAnimateByFloatP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -2116,13 +3117,13 @@ int UtcDaliAnimationAnimateByFloatP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2137,6 +3138,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2162,7 +3164,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - float current(actor.GetProperty(index)); + float current( DevelHandle::GetCurrentProperty< float >( actor, index ) ); DALI_TEST_CHECK( current > ninetyFivePercentProgress ); application.SendNotification(); @@ -2171,13 +3173,13 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2192,6 +3194,7 @@ int UtcDaliAnimationAnimateByFloatTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2216,7 +3219,7 @@ int UtcDaliAnimationAnimateByFloatTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -2224,7 +3227,7 @@ int UtcDaliAnimationAnimateByFloatTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -2232,13 +3235,13 @@ int UtcDaliAnimationAnimateByFloatTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2253,6 +3256,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2278,7 +3282,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -2286,7 +3290,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -2294,13 +3298,13 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2315,6 +3319,7 @@ int UtcDaliAnimationAnimateByIntegerP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -2338,7 +3343,7 @@ int UtcDaliAnimationAnimateByIntegerP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -2346,13 +3351,13 @@ int UtcDaliAnimationAnimateByIntegerP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2367,6 +3372,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2392,7 +3398,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - int current(actor.GetProperty(index)); + int current( DevelHandle::GetCurrentProperty< int >( actor, index ) ); DALI_TEST_CHECK( current > ninetyFivePercentProgress ); application.SendNotification(); @@ -2401,13 +3407,13 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2422,6 +3428,7 @@ int UtcDaliAnimationAnimateByIntegerTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2446,7 +3453,7 @@ int UtcDaliAnimationAnimateByIntegerTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -2454,7 +3461,7 @@ int UtcDaliAnimationAnimateByIntegerTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -2462,13 +3469,13 @@ int UtcDaliAnimationAnimateByIntegerTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2483,6 +3490,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2508,7 +3516,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -2516,7 +3524,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -2524,13 +3532,13 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2545,6 +3553,7 @@ int UtcDaliAnimationAnimateByVector2P(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -2568,7 +3577,7 @@ int UtcDaliAnimationAnimateByVector2P(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -2576,13 +3585,13 @@ int UtcDaliAnimationAnimateByVector2P(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2597,6 +3606,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2622,7 +3632,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector2 current(actor.GetProperty(index)); + Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) ); DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x ); DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y ); @@ -2632,13 +3642,13 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2653,6 +3663,7 @@ int UtcDaliAnimationAnimateByVector2TimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2677,7 +3688,7 @@ int UtcDaliAnimationAnimateByVector2TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -2685,7 +3696,7 @@ int UtcDaliAnimationAnimateByVector2TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -2693,13 +3704,13 @@ int UtcDaliAnimationAnimateByVector2TimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2714,6 +3725,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2739,7 +3751,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -2747,7 +3759,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -2755,13 +3767,13 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2776,6 +3788,7 @@ int UtcDaliAnimationAnimateByVector3P(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -2799,7 +3812,7 @@ int UtcDaliAnimationAnimateByVector3P(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -2807,13 +3820,13 @@ int UtcDaliAnimationAnimateByVector3P(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2828,6 +3841,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2853,7 +3867,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector3 current(actor.GetProperty(index)); + Vector3 current(DevelHandle::GetCurrentProperty< Vector3 >( actor, index )); DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x ); DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y ); DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z ); @@ -2864,13 +3878,13 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2885,6 +3899,7 @@ int UtcDaliAnimationAnimateByVector3TimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2909,7 +3924,7 @@ int UtcDaliAnimationAnimateByVector3TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -2917,7 +3932,7 @@ int UtcDaliAnimationAnimateByVector3TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -2925,13 +3940,13 @@ int UtcDaliAnimationAnimateByVector3TimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -2946,6 +3961,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -2971,7 +3987,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -2979,7 +3995,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -2987,13 +4003,13 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -3008,6 +4024,7 @@ int UtcDaliAnimationAnimateByVector4P(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -3031,7 +4048,7 @@ int UtcDaliAnimationAnimateByVector4P(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -3039,13 +4056,13 @@ int UtcDaliAnimationAnimateByVector4P(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -3060,6 +4077,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -3085,7 +4103,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector4 current(actor.GetProperty(index)); + Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) ); DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x ); DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y ); DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z ); @@ -3097,13 +4115,13 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -3118,6 +4136,7 @@ int UtcDaliAnimationAnimateByVector4TimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -3142,7 +4161,7 @@ int UtcDaliAnimationAnimateByVector4TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -3150,7 +4169,7 @@ int UtcDaliAnimationAnimateByVector4TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -3158,13 +4177,13 @@ int UtcDaliAnimationAnimateByVector4TimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -3179,6 +4198,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -3204,7 +4224,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -3212,7 +4232,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -3220,13 +4240,13 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); application.Render(0); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -3450,7 +4470,7 @@ int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void) END_TEST; } -int UtcDaliAnimationAnimateByActorOrientationP(void) +int UtcDaliAnimationAnimateByActorOrientationP1(void) { TestApplication application; @@ -3507,6 +4527,131 @@ int UtcDaliAnimationAnimateByActorOrientationP(void) END_TEST; } +int UtcDaliAnimationAnimateByActorOrientationP2(void) +{ + TestApplication application; + + tet_printf("Testing that rotation angle > 360 performs full rotations\n"); + + Actor actor = Actor::New(); + actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) ); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Degree relativeRotationDegrees(710.0f); + Radian relativeRotationRadians(relativeRotationDegrees); + + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) ); + + // Start the animation + animation.Play(); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + END_TEST; +} + + +int UtcDaliAnimationAnimateByActorOrientationP3(void) +{ + TestApplication application; + + tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n"); + + Actor actor = Actor::New(); + actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) ); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Degree relativeRotationDegrees(730.0f); + Radian relativeRotationRadians(relativeRotationDegrees); + + Radian actualRotationRadians( Degree(10.0f) ); + + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) ); + + // Start the animation + animation.Play(); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION ); + END_TEST; +} + + int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void) { TestApplication application; @@ -3746,6 +4891,7 @@ int UtcDaliAnimationAnimateToBooleanP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); // Build the animation float durationSeconds(2.0f); @@ -3766,7 +4912,7 @@ int UtcDaliAnimationAnimateToBooleanP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -3774,13 +4920,13 @@ int UtcDaliAnimationAnimateToBooleanP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue ); // Repeat with target value "false" animation = Animation::New(durationSeconds); @@ -3799,7 +4945,7 @@ int UtcDaliAnimationAnimateToBooleanP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -3807,13 +4953,13 @@ int UtcDaliAnimationAnimateToBooleanP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); END_TEST; } @@ -3828,6 +4974,7 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); // Build the animation float durationSeconds(2.0f); @@ -3848,7 +4995,7 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -3856,13 +5003,13 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue ); // Repeat with target value "false" animation = Animation::New(durationSeconds); @@ -3881,7 +5028,7 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == targetValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -3889,13 +5036,13 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); END_TEST; } @@ -3910,6 +5057,7 @@ int UtcDaliAnimationAnimateToBooleanTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); // Build the animation float durationSeconds(2.0f); @@ -3933,7 +5081,7 @@ int UtcDaliAnimationAnimateToBooleanTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); application.SendNotification(); application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); @@ -3943,7 +5091,7 @@ int UtcDaliAnimationAnimateToBooleanTimePeriodP(void) finishCheck.CheckSignalNotReceived(); // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.SendNotification(); application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); @@ -3951,13 +5099,13 @@ int UtcDaliAnimationAnimateToBooleanTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); END_TEST; } @@ -3972,6 +5120,7 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); // Build the animation float durationSeconds(2.0f); @@ -3996,7 +5145,7 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == startValue ); application.SendNotification(); application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); @@ -4006,7 +5155,7 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void) finishCheck.CheckSignalNotReceived(); // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.SendNotification(); application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); @@ -4014,13 +5163,13 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); // Check that nothing has changed after a couple of buffer swaps application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_CHECK( DevelHandle::GetCurrentProperty< bool >( actor, index ) == finalValue ); END_TEST; } @@ -4035,6 +5184,7 @@ int UtcDaliAnimationAnimateToFloatP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -4058,7 +5208,7 @@ int UtcDaliAnimationAnimateToFloatP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -4066,7 +5216,7 @@ int UtcDaliAnimationAnimateToFloatP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4081,6 +5231,7 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4106,7 +5257,7 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - float current(actor.GetProperty(index)); + float current( DevelHandle::GetCurrentProperty< float >( actor, index ) ); DALI_TEST_CHECK( current > ninetyFivePercentProgress ); application.SendNotification(); @@ -4115,7 +5266,7 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4130,6 +5281,7 @@ int UtcDaliAnimationAnimateToFloatTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4154,7 +5306,7 @@ int UtcDaliAnimationAnimateToFloatTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4162,7 +5314,7 @@ int UtcDaliAnimationAnimateToFloatTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4170,7 +5322,7 @@ int UtcDaliAnimationAnimateToFloatTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4185,6 +5337,7 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4210,7 +5363,7 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4218,7 +5371,7 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4226,7 +5379,7 @@ int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4241,6 +5394,7 @@ int UtcDaliAnimationAnimateToIntegerP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -4264,7 +5418,7 @@ int UtcDaliAnimationAnimateToIntegerP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -4272,7 +5426,7 @@ int UtcDaliAnimationAnimateToIntegerP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4287,6 +5441,7 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4312,7 +5467,7 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - int current(actor.GetProperty(index)); + int current( DevelHandle::GetCurrentProperty< int >( actor, index ) ); DALI_TEST_CHECK( current > ninetyFivePercentProgress ); application.SendNotification(); @@ -4321,7 +5476,7 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4336,6 +5491,7 @@ int UtcDaliAnimationAnimateToIntegerTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4360,7 +5516,7 @@ int UtcDaliAnimationAnimateToIntegerTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4368,7 +5524,7 @@ int UtcDaliAnimationAnimateToIntegerTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4376,7 +5532,7 @@ int UtcDaliAnimationAnimateToIntegerTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4391,6 +5547,7 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4416,7 +5573,7 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4424,7 +5581,7 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), static_cast(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4432,7 +5589,7 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4446,7 +5603,8 @@ int UtcDaliAnimationAnimateToVector2P(void) Vector2 startValue(-50.0f, -50.0f); Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -4470,7 +5628,7 @@ int UtcDaliAnimationAnimateToVector2P(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -4478,7 +5636,7 @@ int UtcDaliAnimationAnimateToVector2P(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4492,7 +5650,8 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void) Vector2 startValue(1000.0f, 1000.0f); Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4518,7 +5677,7 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector2 current(actor.GetProperty(index)); + Vector2 current( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ) ); DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); @@ -4528,7 +5687,7 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4542,7 +5701,8 @@ int UtcDaliAnimationAnimateToVector2TimePeriodP(void) Vector2 startValue(10.0f, 10.0f); Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4567,7 +5727,7 @@ int UtcDaliAnimationAnimateToVector2TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4575,7 +5735,7 @@ int UtcDaliAnimationAnimateToVector2TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4583,7 +5743,7 @@ int UtcDaliAnimationAnimateToVector2TimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4597,7 +5757,8 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void) Vector2 startValue(10.0f, 10.0f); Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4620,10 +5781,11 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void) application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); - // We didn't expect the animation to finish yet + // We didn't expect the animation to finish yet, but cached value should be the final one application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4631,7 +5793,7 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4639,7 +5801,8 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4653,7 +5816,8 @@ int UtcDaliAnimationAnimateToVector3P(void) Vector3 startValue(-50.0f, -50.0f, -50.0f); Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty( index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -4677,7 +5841,7 @@ int UtcDaliAnimationAnimateToVector3P(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -4685,7 +5849,7 @@ int UtcDaliAnimationAnimateToVector3P(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4700,6 +5864,7 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4725,7 +5890,7 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector3 current(actor.GetProperty(index)); + Vector3 current( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ) ); DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); @@ -4736,7 +5901,7 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4751,6 +5916,7 @@ int UtcDaliAnimationAnimateToVector3TimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4775,7 +5941,7 @@ int UtcDaliAnimationAnimateToVector3TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4783,7 +5949,7 @@ int UtcDaliAnimationAnimateToVector3TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4791,7 +5957,7 @@ int UtcDaliAnimationAnimateToVector3TimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4806,6 +5972,7 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4831,7 +5998,7 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4839,7 +6006,7 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4847,7 +6014,7 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4862,6 +6029,7 @@ int UtcDaliAnimationAnimateToVector3ComponentP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4891,7 +6059,7 @@ int UtcDaliAnimationAnimateToVector3ComponentP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4899,7 +6067,7 @@ int UtcDaliAnimationAnimateToVector3ComponentP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4907,7 +6075,7 @@ int UtcDaliAnimationAnimateToVector3ComponentP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4922,6 +6090,7 @@ int UtcDaliAnimationAnimateToVector4P(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); @@ -4945,7 +6114,7 @@ int UtcDaliAnimationAnimateToVector4P(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -4953,7 +6122,7 @@ int UtcDaliAnimationAnimateToVector4P(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -4968,6 +6137,7 @@ int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void) Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -4993,7 +6163,7 @@ int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector4 current(actor.GetProperty(index)); + Vector4 current( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ) ); DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); @@ -5005,7 +6175,7 @@ int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -5019,7 +6189,8 @@ int UtcDaliAnimationAnimateToVector4TimePeriodP(void) Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, VECTOR4_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -5044,7 +6215,64 @@ int UtcDaliAnimationAnimateToVector4TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, VECTOR4_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, VECTOR4_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + + // Register a Vector4 property + Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f); + Vector4 relativeValue(targetValue - startValue); + float delay = 0.5f; + animation.AnimateTo(Property(actor, index), + targetValue, + 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(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -5052,7 +6280,7 @@ int UtcDaliAnimationAnimateToVector4TimePeriodP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -5060,82 +6288,132 @@ int UtcDaliAnimationAnimateToVector4TimePeriodP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( actor, index ), targetValue, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAnimationAnimateToActorParentOriginP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT); + + try + { + animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin ); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliAnimationAnimateToActorParentOriginXP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + float startValue(0.0f); + DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + float targetX(1.0f); + + try + { + animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX ); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliAnimationAnimateToActorParentOriginYP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + float startValue(0.0f); + DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + float targetY(1.0f); + + try + { + animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY ); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION); + } END_TEST; } -int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void) +int UtcDaliAnimationAnimateToActorParentOriginZP(void) { TestApplication application; Actor actor = Actor::New(); - - // Register a Vector4 property - Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + float startValue(0.5f); + DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f); - Vector4 relativeValue(targetValue - startValue); - float delay = 0.5f; - animation.AnimateTo(Property(actor, index), - targetValue, - 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(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + float targetZ(1.0f); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + try + { + animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ ); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION); + } END_TEST; } -int UtcDaliAnimationAnimateToActorParentOriginP(void) +int UtcDaliAnimationAnimateToActorAnchorPointP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT); + Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT); try { - animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin ); + animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint); } catch (Dali::DaliException& e) { @@ -5145,15 +6423,15 @@ int UtcDaliAnimationAnimateToActorParentOriginP(void) END_TEST; } -int UtcDaliAnimationAnimateToActorParentOriginXP(void) +int UtcDaliAnimationAnimateToActorAnchorPointXP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION ); + float startValue(0.5f); + DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -5162,7 +6440,7 @@ int UtcDaliAnimationAnimateToActorParentOriginXP(void) try { - animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX ); + animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX ); } catch (Dali::DaliException& e) { @@ -5172,24 +6450,24 @@ int UtcDaliAnimationAnimateToActorParentOriginXP(void) END_TEST; } -int UtcDaliAnimationAnimateToActorParentOriginYP(void) +int UtcDaliAnimationAnimateToActorAnchorPointYP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION ); + float startValue(0.5f); + DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetY(1.0f); + float targetY(0.0f); try { - animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY ); + animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY ); } catch (Dali::DaliException& e) { @@ -5199,24 +6477,24 @@ int UtcDaliAnimationAnimateToActorParentOriginYP(void) END_TEST; } -int UtcDaliAnimationAnimateToActorParentOriginZP(void) +int UtcDaliAnimationAnimateToActorAnchorPointZP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); float startValue(0.5f); - DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetZ(1.0f); + float targetZ(100.0f); try { - animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ ); + animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ ); } catch (Dali::DaliException& e) { @@ -5226,113 +6504,283 @@ int UtcDaliAnimationAnimateToActorParentOriginZP(void) END_TEST; } -int UtcDaliAnimationAnimateToActorAnchorPointP(void) +int UtcDaliAnimationAnimateToActorSizeP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Vector3 targetSize(100.0f, 100.0f, 100.0f); + animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize ); + + Vector3 ninetyNinePercentProgress(targetSize * 0.99f); + + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION ); + + // Start the animation + animation.Play(); + + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION ); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); + + // Reset everything + finishCheck.Reset(); + actor.SetSize(Vector3::ZERO); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); + + // Repeat with a different (ease-in) alpha function + animation = Animation::New(durationSeconds); + animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN); + animation.FinishedSignal().Connect(&application, finishCheck); + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + + // The size should have travelled less, than with a linear alpha function + Vector3 current(actor.GetCurrentSize()); + DALI_TEST_CHECK( current.x > 0.0f ); + DALI_TEST_CHECK( current.y > 0.0f ); + DALI_TEST_CHECK( current.z > 0.0f ); + DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); + DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); + DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); + + // Reset everything + finishCheck.Reset(); + actor.SetSize(Vector3::ZERO); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); + + // Repeat with a delay + float delay = 0.5f; + animation = Animation::New(durationSeconds); + animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); + animation.FinishedSignal().Connect(&application, finishCheck); + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAnimationAnimateToActorSizeWidthP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + float startValue(0.0f); + DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + float targetWidth(10.0f); + animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth ); + + float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f); + + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION ); + + // Start the animation + animation.Play(); + + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION ); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAnimationAnimateToActorSizeHeightP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION ); + float startValue(0.0f); + DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT); + float targetHeight(-10.0f); + animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight ); - try - { - animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint); - } - catch (Dali::DaliException& e) - { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION); - } - END_TEST; -} + float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f); -int UtcDaliAnimationAnimateToActorAnchorPointXP(void) -{ - TestApplication application; + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION ); - Actor actor = Actor::New(); - Stage::GetCurrent().Add(actor); - float startValue(0.5f); - DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION ); + // Start the animation + animation.Play(); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - float targetX(1.0f); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION ); - try - { - animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX ); - } - catch (Dali::DaliException& e) - { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION); - } - END_TEST; -} + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); -int UtcDaliAnimationAnimateToActorAnchorPointYP(void) -{ - TestApplication application; + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); - Actor actor = Actor::New(); - Stage::GetCurrent().Add(actor); - float startValue(0.5f); - DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION ); + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION ); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - float targetY(0.0f); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); - try - { - animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY ); - } - catch (Dali::DaliException& e) - { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION); - } + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorAnchorPointZP(void) +int UtcDaliAnimationAnimateToActorSizeDepthP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - float startValue(0.5f); - DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION ); + float startValue(0.0f); + DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetZ(100.0f); + float targetDepth(-10.0f); + animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth ); - try - { - animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ ); - } - catch (Dali::DaliException& e) - { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION); - } + float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f); + + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION ); + + // Start the animation + animation.Play(); + + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION ); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorSizeP(void) +int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void) { TestApplication application; @@ -5344,7 +6792,7 @@ int UtcDaliAnimationAnimateToActorSizeP(void) float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); Vector3 targetSize(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize ); + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize ); Vector3 ninetyNinePercentProgress(targetSize * 0.99f); @@ -5380,7 +6828,8 @@ int UtcDaliAnimationAnimateToActorSizeP(void) // Repeat with a different (ease-in) alpha function animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN); + animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN ); + animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN ); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); @@ -5395,10 +6844,8 @@ int UtcDaliAnimationAnimateToActorSizeP(void) Vector3 current(actor.GetCurrentSize()); DALI_TEST_CHECK( current.x > 0.0f ); DALI_TEST_CHECK( current.y > 0.0f ); - DALI_TEST_CHECK( current.z > 0.0f ); DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); - DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z ); application.SendNotification(); application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); @@ -5406,7 +6853,8 @@ int UtcDaliAnimationAnimateToActorSizeP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION ); // Reset everything finishCheck.Reset(); @@ -5418,7 +6866,8 @@ int UtcDaliAnimationAnimateToActorSizeP(void) // Repeat with a delay float delay = 0.5f; animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); + animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); + animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); animation.FinishedSignal().Connect(&application, finishCheck); animation.Play(); @@ -5436,31 +6885,95 @@ int UtcDaliAnimationAnimateToActorSizeP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorSizeWidthP(void) +int UtcDaliAnimationAnimateToActorPositionP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Vector3 targetPosition(200.0f, 200.0f, 200.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); + + Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION ); + + // Start the animation + animation.Play(); + + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION ); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*750.0f)/* 75% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAnimationAnimateToActorPositionXP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetWidth(10.0f); - animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth ); + float targetX(1.0f); + animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX ); - float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); + + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION ); // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -5471,8 +6984,7 @@ int UtcDaliAnimationAnimateToActorSizeWidthP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -5480,32 +6992,44 @@ int UtcDaliAnimationAnimateToActorSizeWidthP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetX, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorSizeHeightP(void) +int UtcDaliAnimationAnimateToActorPositionYP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetHeight(-10.0f); - animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight ); + float targetY(10.0f); + animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY ); - float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); + + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION ); // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -5516,8 +7040,7 @@ int UtcDaliAnimationAnimateToActorSizeHeightP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -5525,32 +7048,44 @@ int UtcDaliAnimationAnimateToActorSizeHeightP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetY, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorSizeDepthP(void) +int UtcDaliAnimationAnimateToActorPositionZP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetDepth(-10.0f); - animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth ); + float targetZ(-5.0f); + animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ ); + + float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); - float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f); + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION ); // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -5561,8 +7096,7 @@ int UtcDaliAnimationAnimateToActorSizeDepthP(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -5570,26 +7104,28 @@ int UtcDaliAnimationAnimateToActorSizeDepthP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void) +int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetSize(100.0f, 100.0f, 100.0f); - animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize ); + Vector3 targetPosition(200.0f, 200.0f, 200.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN); - Vector3 ninetyNinePercentProgress(targetSize * 0.99f); + Vector3 seventyFivePercentProgress(targetPosition * 0.75f); // Start the animation animation.Play(); @@ -5599,93 +7135,32 @@ int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); - - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetSize(Vector3::ZERO); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); - - // Repeat with a different (ease-in) alpha function - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN ); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN ); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds*750.0f)/* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - // The size should have travelled less, than with a linear alpha function - Vector3 current(actor.GetCurrentSize()); - DALI_TEST_CHECK( current.x > 0.0f ); - DALI_TEST_CHECK( current.y > 0.0f ); - DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); - DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); - - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetSize(Vector3::ZERO); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); - - // Repeat with a delay - float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); - animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); + // The position should have moved less, than with a linear alpha function + Vector3 current(actor.GetCurrentPosition()); + DALI_TEST_CHECK( current.x > Vector3::ZERO.x ); + DALI_TEST_CHECK( current.y > Vector3::ZERO.y ); + DALI_TEST_CHECK( current.z > Vector3::ZERO.z ); + DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x ); + DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y ); + DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorPositionP(void) +int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void) { TestApplication application; @@ -5697,7 +7172,10 @@ int UtcDaliAnimationAnimateToActorPositionP(void) float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(200.0f, 200.0f, 200.0f); - animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); + float delay = 0.5f; + animation.AnimateTo( Property(actor, Actor::Property::POSITION), + targetPosition, + TimePeriod( delay, durationSeconds - delay ) ); Vector3 seventyFivePercentProgress(targetPosition * 0.75f); @@ -5709,7 +7187,15 @@ int UtcDaliAnimationAnimateToActorPositionP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*750.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); @@ -5717,7 +7203,7 @@ int UtcDaliAnimationAnimateToActorPositionP(void) DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); @@ -5726,25 +7212,25 @@ int UtcDaliAnimationAnimateToActorPositionP(void) END_TEST; } -int UtcDaliAnimationAnimateToActorPositionXP(void) +int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetX(1.0f); - animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX ); + Vector3 targetPosition(200.0f, 200.0f, 200.0f); + float delay = 0.5f; + animation.AnimateTo( Property(actor, Actor::Property::POSITION), + targetPosition, + AlphaFunction::LINEAR, + TimePeriod( delay, durationSeconds - delay ) ); - float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); + Vector3 seventyFivePercentProgress(targetPosition * 0.75f); // Start the animation animation.Play(); @@ -5754,99 +7240,107 @@ int UtcDaliAnimationAnimateToActorPositionXP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorPositionYP(void) +int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void) { TestApplication application; Actor actor = Actor::New(); + actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetY(10.0f); - animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY ); - - float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); + animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) ); // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorPositionZP(void) +int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void) { TestApplication application; Actor actor = Actor::New(); + actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetZ(-5.0f); - animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ ); - - float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); + Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS); + animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation ); // Start the animation animation.Play(); @@ -5856,44 +7350,54 @@ int UtcDaliAnimationAnimateToActorPositionZP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void) +int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); + actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN); - - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); + animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN); // Start the animation animation.Play(); @@ -5903,20 +7407,28 @@ int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*750.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - // The position should have moved less, than with a linear alpha function - Vector3 current(actor.GetCurrentPosition()); - DALI_TEST_CHECK( current.x > Vector3::ZERO.x ); - DALI_TEST_CHECK( current.y > Vector3::ZERO.y ); - DALI_TEST_CHECK( current.z > Vector3::ZERO.z ); - DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -5924,28 +7436,26 @@ int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void) +int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); + actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - float delay = 0.5f; - animation.AnimateTo( Property(actor, Actor::Property::POSITION), - targetPosition, - TimePeriod( delay, durationSeconds - delay ) ); - - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); + float delay(0.1f); + animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); @@ -5955,50 +7465,58 @@ int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); + progress = max(0.0f, 0.5f - delay) / (1.0f - delay); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + progress = max(0.0f, 0.75f - delay) / (1.0f - delay); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void) +int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); + actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - float delay = 0.5f; - animation.AnimateTo( Property(actor, Actor::Property::POSITION), - targetPosition, - AlphaFunction::LINEAR, - TimePeriod( delay, durationSeconds - delay ) ); - - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + Degree targetRotationDegrees(90.0f); + Radian targetRotationRadians(targetRotationDegrees); + float delay(0.1f); + animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); @@ -6008,422 +7526,564 @@ int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); + progress = max(0.0f, 0.5f - delay) / (1.0f - delay); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + progress = max(0.0f, 0.75f - delay) / (1.0f - delay); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void) +int UtcDaliAnimationAnimateToActorScaleP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) ); + Vector3 targetScale(2.0f, 2.0f, 2.0f); + animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale ); + + Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f); // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); + + // Reset everything + finishCheck.Reset(); + actor.SetScale(Vector3::ONE); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); + + // Repeat with a different (ease-in) alpha function + animation = Animation::New(durationSeconds); + animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN); + animation.FinishedSignal().Connect(&application, finishCheck); + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + // The scale should have grown less, than with a linear alpha function + Vector3 current(actor.GetCurrentScale()); + DALI_TEST_CHECK( current.x > 1.0f ); + DALI_TEST_CHECK( current.y > 1.0f ); + DALI_TEST_CHECK( current.z > 1.0f ); + DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); + DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); + DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); + + // Reset everything + finishCheck.Reset(); + actor.SetScale(Vector3::ONE); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); + + // Repeat with a delay + float delay = 0.5f; + animation = Animation::New(durationSeconds); + animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); + animation.FinishedSignal().Connect(&application, finishCheck); + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void) +int UtcDaliAnimationAnimateToActorScaleXP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + float startValue(1.0f); + DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation ); + 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(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); - // We didn't expect the animation to finish yet + // We did expect the animation to finish application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), targetX, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), targetY, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void) +int UtcDaliAnimationAnimateToActorScaleZP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + float startValue(1.0f); + DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN); + 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(durationSeconds*250.0f)/* 25% progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_X ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Y ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void) +int UtcDaliAnimationAnimateToActorColorP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - float delay(0.1f); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay)); + 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(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/); - // We didn't expect the animation to finish yet + // We did expect the animation to finish application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.5f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + // 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(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - float delay(0.1f); - animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay)); - - // Start the animation - animation.Play(); - - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION ); + // Reset everything + finishCheck.Reset(); + actor.SetColor(Color::WHITE); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(0); + DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, 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(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.5f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorScaleP(void) +int UtcDaliAnimationAnimateToActorColorRedP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); + float startValue(1.0f); + DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetScale(2.0f, 2.0f, 2.0f); - animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale ); + float targetRed(0.5f); + animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed ); - Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f); + 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(durationSeconds*990.0f)/* 99% progress */); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(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 ); - - // Reset everything - finishCheck.Reset(); - actor.SetScale(Vector3::ONE); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); - - // Repeat with a different (ease-in) alpha function - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); + DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), targetRed, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + END_TEST; +} - application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); +int UtcDaliAnimationAnimateToActorColorGreenP(void) +{ + TestApplication application; - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); + 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(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); - // The scale should have grown less, than with a linear alpha function - Vector3 current(actor.GetCurrentScale()); - DALI_TEST_CHECK( current.x > 1.0f ); - DALI_TEST_CHECK( current.y > 1.0f ); - DALI_TEST_CHECK( current.z > 1.0f ); - DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); - DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); - DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z ); + // 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 ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); + // Start the animation + animation.Play(); - // Reset everything - finishCheck.Reset(); - actor.SetScale(Vector3::ONE); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); + // 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 ); - // Repeat with a delay - float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -6431,33 +8091,46 @@ int UtcDaliAnimationAnimateToActorScaleP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorScaleXP(void) +int UtcDaliAnimationAnimateToActorColorBlueP(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(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 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 targetBlue(0.5f); + animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue ); - float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); + 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); @@ -6468,10 +8141,11 @@ int UtcDaliAnimationAnimateToActorScaleXP(void) // 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.GetProperty(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -6479,36 +8153,47 @@ int UtcDaliAnimationAnimateToActorScaleXP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_X), targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorScaleYP(void) +int UtcDaliAnimationAnimateToActorColorAlphaP(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(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 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 targetAlpha(0.5f); + animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha ); - float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); + 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); @@ -6519,10 +8204,11 @@ int UtcDaliAnimationAnimateToActorScaleYP(void) // 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.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -6530,80 +8216,241 @@ int UtcDaliAnimationAnimateToActorScaleYP(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorScaleZP(void) +int UtcDaliAnimationKeyFrames01P(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(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), startValue, TEST_LOCATION ); + KeyFrames keyFrames = KeyFrames::New(); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, 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 ); + keyFrames.Add(0.0f, 0.1f); - float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION); - // Start the animation - animation.Play(); + KeyFrames keyFrames2( keyFrames); + DALI_TEST_CHECK( keyFrames2 ); + DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + KeyFrames keyFrames3 = KeyFrames::New(); + keyFrames3.Add(0.6f, true); + DALI_TEST_CHECK( keyFrames3 ); + DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + keyFrames3 = keyFrames; + DALI_TEST_CHECK( keyFrames3 ); + DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION); - // 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.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), fiftyPercentProgress, 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)); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SCALE_Z), targetZ, 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 UtcDaliAnimationAnimateToActorColorP(void) +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(), Color::WHITE, TEST_LOCATION ); + + DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, 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)); + 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(); @@ -6611,120 +8458,98 @@ int UtcDaliAnimationAnimateToActorColorP(void) bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - - application.SendNotification(); - application.Render(static_cast(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(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(durationSeconds*100.0f)/* 10% progress */); - - // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION ); - // 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(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.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); 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(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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(durationSeconds*200.0f)/* 30% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*100.0f)/* 40% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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(durationSeconds*400.0f)/* 80% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*100.0f)/* 90% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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(durationSeconds*100.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorColorRedP(void) +int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION ); + + DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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); + 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(); @@ -6732,107 +8557,95 @@ int UtcDaliAnimationAnimateToActorColorRedP(void) bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); - - // We didn't expect the animation to finish yet + application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION ); - // We did expect the animation to finish + application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(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(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(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(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION ); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + application.Render(static_cast(durationSeconds*100.0f)/* 40% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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(durationSeconds*400.0f)/* 80% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*100.0f)/* 90% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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(durationSeconds*100.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorColorBlueP(void) +int UtcDaliAnimationAnimateBetweenActorColorP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION ); + + DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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); + 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(); @@ -6840,53 +8653,78 @@ int UtcDaliAnimationAnimateToActorColorBlueP(void) bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); + application.Render(0); + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); // We did expect the animation to finish - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorColorAlphaP(void) +int UtcDaliAnimationAnimateBetweenActorColorCubicP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - float startValue(1.0f); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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); + 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(); @@ -6894,256 +8732,207 @@ int UtcDaliAnimationAnimateToActorColorAlphaP(void) bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); - - // We didn't expect the animation to finish yet + application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION ); - // We did expect the animation to finish + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(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( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); - 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); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION ); - KeyFrames keyFrames3 = KeyFrames::New(); - keyFrames3.Add(0.6f, true); - DALI_TEST_CHECK( keyFrames3 ); - DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION); + application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); - keyFrames3 = keyFrames; - DALI_TEST_CHECK( keyFrames3 ); - DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION); + // We did expect the animation to finish + finishCheck.CheckSignalReceived(); END_TEST; } -int UtcDaliAnimationKeyFrames02P(void) +int UtcDaliAnimationAnimateBetweenActorVisibleP(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); + Actor actor = Actor::New(); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); + Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION); + application.SendNotification(); + application.Render(0); - 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; -} + DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION ); -int UtcDaliAnimationKeyFrames03P(void) -{ - TestApplication application; + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); + 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); - 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); + animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames ); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION); + // Start the animation + animation.Play(); - 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); - } + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)+1); + application.SendNotification(); + + DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION); + finishCheck.CheckSignalReceived(); END_TEST; } -int UtcDaliAnimationKeyFrames04P(void) +int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(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)); + Actor actor = Actor::New(); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); + Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION); + application.SendNotification(); + application.Render(0); - 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; -} + DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION ); -int UtcDaliAnimationKeyFrames05P(void) -{ - TestApplication application; + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); KeyFrames keyFrames = KeyFrames::New(); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); + 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); - 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)); + //Cubic interpolation for boolean values should be ignored + animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic ); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION); + // Start the animation + animation.Play(); - 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); - } + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)+1); + application.SendNotification(); + + DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION); + finishCheck.CheckSignalReceived(); END_TEST; } -int UtcDaliAnimationKeyFrames06P(void) +int UtcDaliAnimationAnimateBetweenActorOrientation01P(void) { TestApplication application; - KeyFrames keyFrames = KeyFrames::New(); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); + Actor actor = Actor::New(); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); + Stage::GetCurrent().Add(actor); - 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)); + application.SendNotification(); + application.Render(0); + Quaternion start(Radian(aa.angle), aa.axis); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION ); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION); + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); - 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; -} + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS)); -int UtcDaliAnimationKeyFrames07P(void) -{ - TestApplication application; + animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames ); - KeyFrames keyFrames = KeyFrames::New(); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); + // Start the animation + animation.Play(); - 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)); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)+1); + application.SendNotification(); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION); + Quaternion check( Radian(Degree(60)), Vector3::ZAXIS ); - 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); - } + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + finishCheck.CheckSignalReceived(); END_TEST; } -int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void) +int UtcDaliAnimationAnimateBetweenActorOrientation02P(void) { TestApplication application; - float startValue(1.0f); Actor actor = Actor::New(); - actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); + application.SendNotification(); + application.Render(0); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + 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, 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); + 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::COLOR_ALPHA), keyFrames ); + animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames ); // Start the animation animation.Play(); @@ -7155,90 +8944,105 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void) application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); + Quaternion check(Radian(Degree(60)), Vector3::XAXIS); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION ); + check = Quaternion( Radian(Degree(90)), Vector3::XAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION ); + check = Quaternion( Radian(Degree(120)), Vector3::XAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*100.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*400.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION ); + 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.Render(static_cast(durationSeconds*100.0f)/* 90% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION ); + application.Render(0); + Quaternion start(Radian(aa.angle), aa.axis); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*100.0f)+1/* 100% progress */); + // 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(durationSeconds*500.0f)); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)+1); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(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 + Quaternion check( Radian(Degree(60)), Vector3::ZAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); finishCheck.CheckSignalReceived(); END_TEST; } -int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void) +int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void) { TestApplication application; - float startValue(1.0f); Actor actor = Actor::New(); - actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); + application.SendNotification(); + application.Render(0); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + 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, 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); + 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::COLOR_ALPHA), keyFrames, Animation::Cubic ); + //Cubic interpolation should be ignored for quaternions + animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic ); // Start the animation animation.Play(); @@ -7250,55 +9054,29 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void) application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION ); - - application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); - application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(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(durationSeconds*200.0f)/* 30% progress */); - application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION ); + Quaternion check(Radian(Degree(60)), Vector3::XAXIS); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*100.0f)/* 40% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION ); + check = Quaternion( Radian(Degree(90)), Vector3::XAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*400.0f)/* 80% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION ); + check = Quaternion( Radian(Degree(120)), Vector3::XAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*100.0f)/* 90% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*100.0f)+1/* 100% progress */); + application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION ); + check = Quaternion( Radian(Degree(120)), Vector3::YAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); // We did expect the animation to finish @@ -7306,7 +9084,7 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void) END_TEST; } -int UtcDaliAnimationAnimateBetweenActorColorP(void) +int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void) { TestApplication application; @@ -7320,6 +9098,10 @@ int UtcDaliAnimationAnimateBetweenActorColorP(void) DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -7330,7 +9112,7 @@ int UtcDaliAnimationAnimateBetweenActorColorP(void) 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.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR ); // Start the animation animation.Play(); @@ -7342,38 +9124,38 @@ int UtcDaliAnimationAnimateBetweenActorColorP(void) application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION ); application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION ); application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); // We did expect the animation to finish @@ -7381,7 +9163,7 @@ int UtcDaliAnimationAnimateBetweenActorColorP(void) END_TEST; } -int UtcDaliAnimationAnimateBetweenActorColorCubicP(void) +int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void) { TestApplication application; @@ -7395,6 +9177,10 @@ int UtcDaliAnimationAnimateBetweenActorColorCubicP(void) DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -7405,7 +9191,7 @@ int UtcDaliAnimationAnimateBetweenActorColorCubicP(void) 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 ); + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic ); // Start the animation animation.Play(); @@ -7417,38 +9203,38 @@ int UtcDaliAnimationAnimateBetweenActorColorCubicP(void) application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION ); application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION ); application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); // We did expect the animation to finish @@ -7456,32 +9242,36 @@ int UtcDaliAnimationAnimateBetweenActorColorCubicP(void) END_TEST; } -int UtcDaliAnimationAnimateBetweenActorVisibleP(void) +int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetOrientation(aa.angle, aa.axis); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - application.SendNotification(); - application.Render(0); - - DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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, false); - keyFrames.Add(0.2f, true); - keyFrames.Add(0.4f, true); - keyFrames.Add(0.8f, false); - keyFrames.Add(1.0f, true); + 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::VISIBLE), keyFrames ); + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) ); // Start the animation animation.Play(); @@ -7490,44 +9280,79 @@ int UtcDaliAnimationAnimateBetweenActorVisibleP(void) AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); + + application.Render(static_cast(delay*1000.0f)/* 0% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + + // We did expect the animation to finish - DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; } -int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void) +int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetOrientation(aa.angle, aa.axis); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - application.SendNotification(); - application.Render(0); - - DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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, false); - keyFrames.Add(0.2f, true); - keyFrames.Add(0.4f, true); - keyFrames.Add(0.8f, false); - keyFrames.Add(1.0f, true); + 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)); - //Cubic interpolation for boolean values should be ignored - animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic ); + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic ); // Start the animation animation.Play(); @@ -7536,39 +9361,79 @@ int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void) AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); + + application.Render(static_cast(delay*1000.0f)/* 0% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + + // We did expect the animation to finish - DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION); finishCheck.CheckSignalReceived(); END_TEST; } -int UtcDaliAnimationAnimateBetweenActorOrientation01P(void) +int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void) { TestApplication application; + float startValue(1.0f); + float delay = 0.5f; Actor actor = Actor::New(); - AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetOrientation(aa.angle, aa.axis); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); 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 ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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, AngleAxis(Degree(60), Vector3::ZAXIS)); + 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::ORIENTATION), keyFrames ); + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); // Start the animation animation.Play(); @@ -7577,43 +9442,80 @@ int UtcDaliAnimationAnimateBetweenActorOrientation01P(void) AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); + + application.Render(static_cast(delay*1000.0f)/* 0% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); - Quaternion check( Radian(Degree(60)), Vector3::ZAXIS ); + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION ); + + application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); + application.SendNotification(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); + + // We did expect the animation to finish - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); finishCheck.CheckSignalReceived(); END_TEST; } -int UtcDaliAnimationAnimateBetweenActorOrientation02P(void) +int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetOrientation(aa.angle, aa.axis); - application.SendNotification(); - application.Render(0); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - Quaternion start(Radian(aa.angle), aa.axis); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, 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, AngleAxis(Degree(60), Vector3::XAXIS)); - keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS)); - keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS)); + 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::ORIENTATION), keyFrames ); + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic ); // Start the animation animation.Play(); @@ -7622,32 +9524,42 @@ int UtcDaliAnimationAnimateBetweenActorOrientation02P(void) AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(0); + + application.Render(static_cast(delay*1000.0f)/* 0% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION ); - Quaternion check(Radian(Degree(60)), Vector3::XAXIS); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(90)), Vector3::XAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(120)), Vector3::XAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + application.Render(static_cast((durationSeconds - delay)*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 ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(120)), Vector3::YAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION ); // We did expect the animation to finish @@ -7655,29 +9567,35 @@ int UtcDaliAnimationAnimateBetweenActorOrientation02P(void) END_TEST; } -int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void) +int UtcDaliAnimationAnimateP(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 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); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); + Dali::Path path = Dali::Path::New(); + path.AddPoint(position0); + path.AddPoint(position1); + path.AddPoint(position2); - KeyFrames keyFrames = KeyFrames::New(); - keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS)); + //Control points for first segment + path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); + path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); - //Cubic interpolation should be ignored for quaternions - animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic ); + //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(); @@ -7686,44 +9604,77 @@ int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void) AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); + application.Render(0); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); + 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(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); + 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(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 ); - Quaternion check( Radian(Degree(60)), Vector3::ZAXIS ); + application.Render(static_cast(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(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 ); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); finishCheck.CheckSignalReceived(); END_TEST; } -int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void) +int UtcDaliAnimationAnimateAlphaFunctionP(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 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); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); + Dali::Path path = Dali::Path::New(); + path.AddPoint(position0); + path.AddPoint(position1); + path.AddPoint(position2); - 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)); + //Control points for first segment + path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); + path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); - //Cubic interpolation should be ignored for quaternions - animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic ); + //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(); @@ -7735,61 +9686,74 @@ int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void) application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - - Quaternion check(Radian(Degree(60)), Vector3::XAXIS); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + 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(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(90)), Vector3::XAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + 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(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - check = Quaternion( Radian(Degree(120)), Vector3::XAXIS ); - DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + 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(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 ); + 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(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 + 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 UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void) +int UtcDaliAnimationAnimateTimePeriodP(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(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + //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); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); + Dali::Path path = Dali::Path::New(); + path.AddPoint(position0); + path.AddPoint(position1); + path.AddPoint(position2); - 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)); + //Control points for first segment + path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); + path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR ); + //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(); @@ -7801,70 +9765,74 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void) application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION ); - - // We did expect the animation to finish + 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 UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void) +int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(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(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + //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); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); + Dali::Path path = Dali::Path::New(); + path.AddPoint(position0); + path.AddPoint(position1); + path.AddPoint(position2); - 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)); + //Control points for first segment + path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); + path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic ); + //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(); @@ -7876,461 +9844,356 @@ int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void) application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION ); + 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(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION ); - - // We did expect the animation to finish + 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 UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void) +int UtcDaliAnimationShowP(void) { TestApplication application; - float startValue(1.0f); Actor actor = Actor::New(); - actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); + actor.SetVisible(false); + application.SendNotification(); + application.Render(0); + DALI_TEST_CHECK( !actor.IsVisible() ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(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 + 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(delay*1000.0f)/* 0% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*490.0f)); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_CHECK( !actor.IsVisible() ); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*10.0f)/*Should be shown now*/); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_CHECK( actor.IsVisible() ); - application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(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 UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void) +int UtcDaliAnimationHideP(void) { TestApplication application; - float startValue(1.0f); Actor actor = Actor::New(); - actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); + DALI_TEST_CHECK( actor.IsVisible() ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(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 + 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(delay*1000.0f)/* 0% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*490.0f)); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_CHECK( actor.IsVisible() ); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*10.0f)/*Should be hidden now*/); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_CHECK( !actor.IsVisible() ); - application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(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 UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void) +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; - float startValue(1.0f); - float delay = 0.5f; Actor actor = Actor::New(); - actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); + DALI_TEST_CHECK( actor.IsVisible() ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); - - // Build the animation - float durationSeconds(1.0f); + // Start Hide animation + float durationSeconds(10.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.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(delay*1000.0f)/* 0% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); + // We did expect the animation to finish application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + DALI_TEST_CHECK( !actor.IsVisible() ); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); - application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + // Start Show animation + animation = Animation::New(durationSeconds); + animation.Show(actor, durationSeconds/*Show at end*/); + animation.FinishedSignal().Connect(&application, finishCheck); + animation.Play(); - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); - application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); + // We did expect the animation to finish application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + DALI_TEST_CHECK( actor.IsVisible() ); + END_TEST; +} - // We did expect the animation to finish +int UtcDaliKeyFramesCreateDestroyP(void) +{ + tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()"); - finishCheck.CheckSignalReceived(); + KeyFrames* keyFrames = new KeyFrames; + delete keyFrames; + DALI_TEST_CHECK( true ); END_TEST; } -int P(void) +int UtcDaliKeyFramesDownCastP(void) { TestApplication application; + tet_infoline("Testing Dali::Animation::KeyFramesDownCast()"); - float startValue(1.0f); - Actor actor = Actor::New(); - actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); - Stage::GetCurrent().Add(actor); + KeyFrames keyFrames = KeyFrames::New(); + BaseHandle object(keyFrames); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION ); + KeyFrames keyFrames2 = KeyFrames::DownCast(object); + DALI_TEST_CHECK(keyFrames2); - // Build the animation - float durationSeconds(1.0f); - float delay = 0.5f; - Animation animation = Animation::New(durationSeconds); + KeyFrames keyFrames3 = DownCast< KeyFrames >(object); + DALI_TEST_CHECK(keyFrames3); - 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)); + BaseHandle unInitializedObject; + KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject); + DALI_TEST_CHECK(!keyFrames4); - animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic ); + KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject); + DALI_TEST_CHECK(!keyFrames5); + END_TEST; +} - // Start the animation - animation.Play(); +int UtcDaliAnimationCreateDestroyP(void) +{ + TestApplication application; + Animation* animation = new Animation; + DALI_TEST_CHECK( animation ); + delete animation; + END_TEST; +} - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); +struct UpdateManagerTestConstraint +{ + UpdateManagerTestConstraint(TestApplication& application) + : mApplication(application) + { + } - application.Render(static_cast(delay*1000.0f)/* 0% progress */); - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + void operator()( Vector3& current, const PropertyInputContainer& /* inputs */) + { + mApplication.SendNotification(); // Process events + } - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); - application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION ); + TestApplication& mApplication; +}; - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); - application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); +int UtcDaliAnimationUpdateManagerP(void) +{ + TestApplication application; - application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); - application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION ); + 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( 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.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION ); + application.UpdateOnly( 16 ); - // We did expect the animation to finish + finishCheck.CheckSignalNotReceived(); + + application.SendNotification(); // Process events finishCheck.CheckSignalReceived(); + END_TEST; } -int UtcDaliAnimationAnimateP(void) +int UtcDaliAnimationSignalOrderP(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); + Stage::GetCurrent().Add( actor ); - Dali::Path path = Dali::Path::New(); - path.AddPoint(position0); - path.AddPoint(position1); - path.AddPoint(position2); + // Build the animations + Animation animation1 = Animation::New( 0.0f ); // finishes first frame + Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms - //Control points for first segment - path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); - path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + bool signal1Received = false; + animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) ); - //Control points for second segment - path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); - path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); + bool signal2Received = false; + animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) ); - // Build the animation - float durationSeconds( 1.0f ); - Animation animation = Animation::New(durationSeconds); - animation.Animate(actor, path, Vector3::XAXIS); + // 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(); - // Start the animation - animation.Play(); + DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); + DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION ); - 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.UpdateOnly( 10 ); // 10ms progress - application.Render(static_cast(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 ); + // no notifications yet + DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); + DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION ); - application.Render(static_cast(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(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 ); + // first completed + DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION ); + DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION ); + signal1Received = false; - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + // 1st animation is complete now, do another update with no ProcessEvents in between + application.UpdateOnly( 20 ); // 20ms progress + + // ProcessEvents 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(); + // 2nd should complete now + DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); + DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION ); + END_TEST; } -int UtcDaliAnimationAnimateAlphaFunctionP(void) +int UtcDaliAnimationExtendDurationP(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)); + // Register a float property + float startValue(10.0f); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); // Build the animation - float durationSeconds( 1.0f ); - Animation animation = Animation::New(durationSeconds); - animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR); + 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(); @@ -8338,78 +10201,50 @@ int UtcDaliAnimationAnimateAlphaFunctionP(void) bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); - application.Render(0); + application.Render(static_cast(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + + // We didn't expect the animation to finish yet, but cached value should be the final one 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 ); + DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); - application.Render(static_cast(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(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + // We didn't expect the animation to finish yet 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 ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue+(relativeValue*0.5f), TEST_LOCATION ); - application.Render(static_cast(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(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + // We did expect the animation to finish 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(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateTimePeriodP(void) +int UtcDaliAnimationCustomIntProperty(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); + int startValue(0u); - //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)); + Property::Index index = actor.RegisterProperty("anIndex", startValue); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); // Build the animation - float durationSeconds( 1.0f ); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f)); + animation.AnimateTo( Property(actor, index), 20 ); // Start the animation animation.Play(); @@ -8417,509 +10252,464 @@ int UtcDaliAnimationAnimateTimePeriodP(void) 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(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(durationSeconds*500.0f)/* 50% progress */); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + // We didn't expect the animation to finish yet 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 ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 10, TEST_LOCATION ); - application.Render(static_cast(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(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + // We did expect the animation to finish 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(); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 20, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void) +int UtcDaliAnimationDuration(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); + Animation animation = Animation::New( 0.0f ); + DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION ); - //Control points for first segment - path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); - path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + // The animation duration should automatically increase depending on the animator time period - //Control points for second segment - path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); - path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) ); + DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION ); - // 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)); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) ); + DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION ); - // Start the animation - animation.Play(); + END_TEST; +} - 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 ); +int UtcDaliAnimationAnimateByNonAnimateableTypeN(void) +{ + TestApplication application; - application.Render(static_cast(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 ); + Actor actor = Actor::New(); - application.Render(static_cast(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 ); + // Register an integer property + int startValue(1); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - application.Render(static_cast(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 ); + try + { + // Build the animation + Animation animation = Animation::New( 2.0f ); + std::string relativeValue = "relative string"; + animation.AnimateBy( Property(actor, index), relativeValue ); + tet_result(TET_FAIL); + } + catch ( Dali::DaliException& e ) + { + DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION ); + } - application.Render(static_cast(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) + +int UtcDaliAnimationAnimateToNonAnimateableTypeN(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetVisible(false); - application.SendNotification(); - application.Render(0); - DALI_TEST_CHECK( !actor.IsVisible() ); + + // Register an integer property + int startValue(1); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - // Start the animation - float durationSeconds(10.0f); - Animation animation = Animation::New(durationSeconds); - animation.Show(actor, durationSeconds*0.5f); - animation.Play(); + try + { + // Build the animation + Animation animation = Animation::New( 2.0f ); + std::string relativeValue = "relative string"; + animation.AnimateTo( Property(actor, index), relativeValue ); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + tet_result(TET_FAIL); + } + catch ( Dali::DaliException& e ) + { + DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION ); + } - application.SendNotification(); - application.Render(static_cast(durationSeconds*490.0f)); + END_TEST; +} - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( !actor.IsVisible() ); +int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void) +{ + TestApplication application; - application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f)/*Should be shown now*/); + Actor actor = Actor::New(); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.IsVisible() ); + // Register an integer property + int startValue(1); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + try + { + // Build the animation + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add( 0.0f, std::string("relative string1") ); + keyFrames.Add( 1.0f, std::string("relative string2") ); + // no need to really create the animation as keyframes do the check + + tet_result(TET_FAIL); + } + catch ( Dali::DaliException& e ) + { + DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION ); + } - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.IsVisible() ); END_TEST; } -int UtcDaliAnimationHideP(void) +int UtcDaliAnimationSetAndGetTargetBeforePlayP(void) { + tet_infoline("Setting up an animation should not effect it's position property until the animation plays"); + TestApplication application; - Actor actor = Actor::New(); - DALI_TEST_CHECK( actor.IsVisible() ); - Stage::GetCurrent().Add(actor); + tet_infoline("Set initial position and set up animation to re-position actor"); + + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + Vector3 initialPosition(0.0f, 0.0f, 0.0f); + actor.SetProperty( Actor::Property::POSITION, initialPosition ); + + // Build the animation + Animation animation = Animation::New(2.0f); + + //Test GetCurrentProgress return 0.0 as the duration is 0.0 + DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION ); + + tet_infoline("Set target position in animation without intiating play"); + + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + application.SendNotification(); + application.Render(); + + tet_infoline("Ensure position of actor is still at intial value"); + + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION ); + + tet_infoline("Play animation and ensure actor position is now target"); - // Start the animation - float durationSeconds(10.0f); - Animation animation = Animation::New(durationSeconds); - animation.Hide(actor, durationSeconds*0.5f); animation.Play(); + application.SendNotification(); + application.Render(1000u); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + tet_infoline("Ensure position of actor is at target value when aninmation half way"); - application.SendNotification(); - application.Render(static_cast(durationSeconds*490.0f)); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION ); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.IsVisible() ); + tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f)/*Should be hidden now*/); + application.Render(2000u); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( !actor.IsVisible() ); + tet_infoline("Ensure position of actor is still at target value when aninmation complete"); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION ); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( !actor.IsVisible() ); END_TEST; } -int UtcDaliAnimationShowHideAtEndP(void) +int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void) { - // Test that show/hide delay can be the same as animation duration - // i.e. to show/hide at the end of the animation + tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators"); TestApplication application; + std::vector targetPositions; + + targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) ); + targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) ); + targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) ); + + tet_infoline("Set initial position and set up animation to re-position actor"); + Actor actor = Actor::New(); - DALI_TEST_CHECK( actor.IsVisible() ); Stage::GetCurrent().Add(actor); + Vector3 initialPosition(0.0f, 0.0f, 0.0f); + actor.SetProperty( Actor::Property::POSITION, initialPosition ); - // Start Hide animation - float durationSeconds(10.0f); - Animation animation = Animation::New(durationSeconds); - animation.Hide(actor, durationSeconds/*Hide at end*/); - animation.Play(); + // Build the animation + Animation animation = Animation::New(2.0f); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + //Test GetCurrentProgress return 0.0 as the duration is 0.0 + DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); + tet_infoline("Set target position in animation without intiating play"); + + for ( unsigned int i = 0; i < targetPositions.size(); i++ ) + { + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR); + } - // We did expect the animation to finish application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( !actor.IsVisible() ); + application.Render(); - // Start Show animation - animation = Animation::New(durationSeconds); - animation.Show(actor, durationSeconds/*Show at end*/); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); + tet_infoline("Ensure position of actor is still at intial value"); - application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION ); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.IsVisible() ); - END_TEST; -} + tet_infoline("Play animation and ensure actor position is now target"); -int UtcDaliKeyFramesCreateDestroyP(void) -{ - tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()"); + animation.Play(); + application.SendNotification(); + application.Render(1000u); - KeyFrames* keyFrames = new KeyFrames; - delete keyFrames; - DALI_TEST_CHECK( true ); - END_TEST; -} + tet_infoline("Ensure position of actor is at target value when aninmation half way"); -int UtcDaliKeyFramesDownCastP(void) -{ - TestApplication application; - tet_infoline("Testing Dali::Animation::KeyFramesDownCast()"); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION ); - KeyFrames keyFrames = KeyFrames::New(); - BaseHandle object(keyFrames); + tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x ); - KeyFrames keyFrames2 = KeyFrames::DownCast(object); - DALI_TEST_CHECK(keyFrames2); + application.Render(2000u); - KeyFrames keyFrames3 = DownCast< KeyFrames >(object); - DALI_TEST_CHECK(keyFrames3); + tet_infoline("Ensure position of actor is still at target value when aninmation complete"); - BaseHandle unInitializedObject; - KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject); - DALI_TEST_CHECK(!keyFrames4); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION ); - KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject); - DALI_TEST_CHECK(!keyFrames5); END_TEST; } -int UtcDaliAnimationCreateDestroyP(void) +int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void) { + tet_infoline("Setting up an animation should not effect it's size property until the animation plays even with mulitple animators of different Property Indexes"); + TestApplication application; - Animation* animation = new Animation; - DALI_TEST_CHECK( animation ); - delete animation; - END_TEST; -} -struct UpdateManagerTestConstraint -{ - UpdateManagerTestConstraint(TestApplication& application) - : mApplication(application) - { - } + std::vector targetSizes; + std::vector targetPositions; - void operator()( Vector3& current, const PropertyInputContainer& /* inputs */) - { - mApplication.SendNotification(); // Process events - } + targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) ); + targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) ); - TestApplication& mApplication; -}; + targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) ); -int UtcDaliAnimationUpdateManagerP(void) -{ - TestApplication application; + tet_infoline("Set initial position and set up animation to re-position actor"); Actor actor = Actor::New(); - Stage::GetCurrent().Add( actor ); + Stage::GetCurrent().Add(actor); + Vector3 initialSize( 10.0f, 10.0f, 10.0f); + Vector3 initialPosition(10.0f, 10.0f, 10.0f); + + actor.SetProperty( Actor::Property::SIZE, initialSize ); + actor.SetProperty( Actor::Property::POSITION, initialPosition ); // Build the animation - Animation animation = Animation::New( 0.0f ); + Animation animation = Animation::New(2.0f); - bool signalReceived = false; - AnimationFinishCheck finishCheck( signalReceived ); - animation.FinishedSignal().Connect( &application, finishCheck ); + tet_infoline("Set target size in animation without intiating play"); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR); + tet_infoline("Set target position in animation without intiating play"); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR); - Vector3 startValue(1.0f, 1.0f, 1.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); - Constraint constraint = Constraint::New( actor, index, UpdateManagerTestConstraint( application ) ); - constraint.Apply(); + application.SendNotification(); + application.Render(); - // Apply animation to actor - animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR ); + tet_infoline("Ensure position of actor is still at intial size and position"); - animation.Play(); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION ); + + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION ); + tet_infoline("Play animation and ensure actor position and size is now matches targets"); + + animation.Play(); application.SendNotification(); - application.UpdateOnly( 16 ); + application.Render(2000u); - finishCheck.CheckSignalNotReceived(); + tet_infoline("Ensure position and size of actor is at target value when aninmation playing"); - application.SendNotification(); // Process events + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION ); - finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationSignalOrderP(void) +int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void) { + tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated"); + TestApplication application; - Actor actor = Actor::New(); - Stage::GetCurrent().Add( actor ); + std::vector targetSizes; + std::vector targetColors; - // Build the animations - Animation animation1 = Animation::New( 0.0f ); // finishes first frame - Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms + targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) ); + targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) ); - bool signal1Received = false; - animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) ); + targetColors.push_back( 1.0f ); - bool signal2Received = false; - animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) ); + tet_infoline("Set initial position and set up animation to re-position actor"); - // 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(); + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + Vector3 initialSize( 10.0f, 5.0f, 10.0f); - DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); - DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION ); + actor.SetProperty( Actor::Property::SIZE, initialSize ); - application.SendNotification(); - application.UpdateOnly( 10 ); // 10ms progress + // Build the animation + Animation animation = Animation::New(2.0f); - // no notifications yet - DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); - DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION ); + tet_infoline("Set target size in animation without initiating play"); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR); + tet_infoline("Set target position in animation without intiating play"); + animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR); + animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR); application.SendNotification(); + application.Render(); - // first completed - DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION ); - DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION ); - signal1Received = false; + tet_infoline("Ensure position of actor is still at initial size and position"); - // 1st animation is complete now, do another update with no ProcessEvents in between - application.UpdateOnly( 20 ); // 20ms progress + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION ); - // ProcessEvents + tet_infoline("Play animation and ensure actor position and size is now matches targets"); + + animation.Play(); application.SendNotification(); + application.Render(2000u); - // 2nd should complete now - DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); - DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION ); + tet_infoline("Ensure position and size of actor is at target value when animation playing"); + + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION ); + + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationExtendDurationP(void) +int UtcDaliAnimationTimePeriodOrder(void) { + tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" ); + TestApplication application; Actor actor = Actor::New(); + Stage::GetCurrent().Add( actor ); - // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "testProperty", startValue ); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(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); + application.SendNotification(); + application.Render(); - animation.AnimateTo(Property(actor, index), - targetValue, - TimePeriod(animatorDelay, animatorDurationSeconds)); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); - // The duration should have been extended - DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION ); + tet_infoline( "With two AnimateTo calls" ); - // Start the animation + Animation animation = Animation::New( 0.0f ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) ); animation.Play(); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - application.Render(static_cast(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + application.Render(5000); // After the animation is complete - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); - application.SendNotification(); - application.Render(static_cast(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + tet_infoline( "Same animation again but in a different order - should yield the same result" ); - // We didn't expect the animation to finish yet + actor.SetX( 0.0f ); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); + application.Render(); - application.SendNotification(); - application.Render(static_cast(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + animation = Animation::New( 0.0f ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) ); + animation.Play(); - // We did expect the animation to finish application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); - END_TEST; -} + application.Render(5000); // After the animation is complete -int UtcDaliAnimationCustomIntProperty(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - Stage::GetCurrent().Add(actor); - int startValue(0u); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); - Property::Index index = actor.RegisterProperty("anIndex", startValue); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + tet_infoline( "Now with several AnimateTo calls" ); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, index), 20 ); + actor.SetX( 0.0f ); + application.SendNotification(); + application.Render(); - // Start the animation + animation = Animation::New( 0.0f ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) ); animation.Play(); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(14000); // After the animation is complete - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), 10, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); + + tet_infoline( "Same animation again but in a different order - should end up at the same point" ); + actor.SetX( 0.0f ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(); + + animation = Animation::New( 0.0f ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) ); + animation.Play(); - // We did expect the animation to finish application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), 20, TEST_LOCATION ); + application.Render(14000); // After the animation is complete + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); + END_TEST; } -