X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Animation.cpp;h=e38d61bd5677d1d6adbea8723f0a00651b78504b;hb=2db94f8b729b4bb312d7adb9d3e0df87ae9c1a86;hp=69b2a569f7a7d435fc37cf435f3874ea7e26b271;hpb=69439f9117d886a29e847abbbfcdb5cd12948d48;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 69b2a56..e38d61b 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -25,12 +25,12 @@ using std::max; using namespace Dali; -void utc_dali_animation_startup(void) +void utc_dali_animation_startuP(void) { test_return_value = TET_UNDEF; } -void utc_dali_animation_cleanup(void) +void utc_dali_animation_cleanuP(void) { test_return_value = TET_PASS; } @@ -90,44 +90,41 @@ struct AnimationFinishCheck } // anon namespace -int UtcDaliAnimationNew01(void) +int UtcDaliAnimationConstructorP(void) { TestApplication application; Animation animation; - DALI_TEST_CHECK(!animation); - animation = Animation::New(1.0f); + DALI_TEST_CHECK( !animation ); + END_TEST; +} + +int UtcDaliAnimationNewP(void) +{ + TestApplication application; + + Animation animation = Animation::New( 1.0f ); DALI_TEST_CHECK(animation); END_TEST; } -int UtcDaliAnimationNew02(void) +int UtcDaliAnimationNewN(void) { TestApplication application; - Animation animation; - DALI_TEST_CHECK(!animation); - try - { - animation = Animation::New(0.0f); - } - catch (Dali::DaliException& e) - { - // TODO: Determine why catch doesn't. - // + Animation animation = Animation::New( -1.0f ); - // Tests that a negative test of an assertion succeeds - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_EQUALS(e.mCondition, "durationSeconds > 0.0f", TEST_LOCATION); - } + DALI_TEST_CHECK(animation); + DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION); END_TEST; } -int UtcDaliAnimationDownCast(void) +int UtcDaliAnimationDownCastP(void) { TestApplication application; + tet_infoline("Testing Dali::Animation::DownCast()"); float durationSeconds(1.0f); @@ -140,17 +137,53 @@ int UtcDaliAnimationDownCast(void) Animation animation3 = DownCast< Animation >(object); DALI_TEST_CHECK(animation3); + END_TEST; +} + +int UtcDaliAnimationDownCastN(void) +{ + TestApplication application; BaseHandle unInitializedObject; - Animation animation4 = Animation::DownCast(unInitializedObject); - DALI_TEST_CHECK(!animation4); - Animation animation5 = DownCast< Animation >(unInitializedObject); - DALI_TEST_CHECK(!animation5); + Animation animation1 = Animation::DownCast( unInitializedObject ); + DALI_TEST_CHECK( !animation1 ); + + Animation animation2 = DownCast< Animation >( unInitializedObject ); + DALI_TEST_CHECK( !animation2 ); + END_TEST; +} + +int UtcDaliAnimationCopyConstructorP(void) +{ + TestApplication application; + + // Initialize an object, ref count == 1 + Animation animation = Animation::New( 1.0f ); + + Animation copy( animation ); + DALI_TEST_CHECK( copy ); + + DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() ); + END_TEST; +} + +int UtcDaliAnimationAssignmentOperatorP(void) +{ + TestApplication application; + + Animation animation = Animation::New( 1.0f ); + + Animation copy = animation; + DALI_TEST_CHECK( copy ); + + DALI_TEST_CHECK( animation == copy ); + + DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() ); END_TEST; } -int UtcDaliAnimationSetDuration(void) +int UtcDaliAnimationSetDurationP(void) { TestApplication application; @@ -164,7 +197,7 @@ int UtcDaliAnimationSetDuration(void) // Start the animation Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); animation.Play(); bool signalReceived(false); @@ -215,7 +248,19 @@ int UtcDaliAnimationSetDuration(void) END_TEST; } -int UtcDaliAnimationGetDuration(void) +int UtcDaliAnimationSetDurationN(void) +{ + TestApplication application; + + Animation animation = Animation::New( 1.0f ); + DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION ); + + animation.SetDuration( -1.0f ); + DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION ); + END_TEST; +} + +int UtcDaliAnimationGetDurationP(void) { TestApplication application; @@ -227,7 +272,7 @@ int UtcDaliAnimationGetDuration(void) END_TEST; } -int UtcDaliAnimationSetLooping(void) +int UtcDaliAnimationSetLoopingP(void) { TestApplication application; @@ -238,7 +283,7 @@ int UtcDaliAnimationSetLooping(void) float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.SetLooping(true); @@ -291,7 +336,7 @@ int UtcDaliAnimationSetLooping(void) END_TEST; } -int UtcDaliAnimationIsLooping(void) +int UtcDaliAnimationIsLoopingP(void) { TestApplication application; @@ -303,7 +348,7 @@ int UtcDaliAnimationIsLooping(void) END_TEST; } -int UtcDaliAnimationSetEndAction(void) +int UtcDaliAnimationSetEndActioN(void) { TestApplication application; @@ -316,7 +361,7 @@ int UtcDaliAnimationSetEndAction(void) DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake); Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); @@ -356,6 +401,10 @@ int UtcDaliAnimationSetEndAction(void) 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 ); + // Go back to the start actor.SetPosition(Vector3::ZERO); application.SendNotification(); @@ -388,7 +437,7 @@ int UtcDaliAnimationSetEndAction(void) END_TEST; } -int UtcDaliAnimationGetEndAction(void) +int UtcDaliAnimationGetEndActionP(void) { TestApplication application; @@ -404,7 +453,7 @@ int UtcDaliAnimationGetEndAction(void) END_TEST; } -int UtcDaliAnimationSetDisconnectAction(void) +int UtcDaliAnimationSetDisconnectActionP(void) { TestApplication application; Stage stage( Stage::GetCurrent() ); @@ -420,7 +469,7 @@ int UtcDaliAnimationSetDisconnectAction(void) DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); @@ -447,7 +496,7 @@ int UtcDaliAnimationSetDisconnectAction(void) animation.SetDisconnectAction( Animation::Bake ); Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); @@ -474,7 +523,7 @@ int UtcDaliAnimationSetDisconnectAction(void) animation.SetDisconnectAction( Animation::Discard ); Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); @@ -500,7 +549,7 @@ int UtcDaliAnimationSetDisconnectAction(void) Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(10.0f, 10.0f, 10.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + 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*/); @@ -516,7 +565,7 @@ int UtcDaliAnimationSetDisconnectAction(void) END_TEST; } -int UtcDaliAnimationGetDisconnectAction(void) +int UtcDaliAnimationGetDisconnectActionP(void) { TestApplication application; Animation animation = Animation::New(1.0f); @@ -531,21 +580,21 @@ int UtcDaliAnimationGetDisconnectAction(void) END_TEST; } -int UtcDaliAnimationSetDefaultAlphaFunction(void) +int UtcDaliAnimationSetDefaultAlphaFunctionP(void) { TestApplication application; Animation animation = Animation::New(1.0f); AlphaFunction func = animation.GetDefaultAlphaFunction(); - DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION); + DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); - animation.SetDefaultAlphaFunction(AlphaFunctions::EaseIn); + animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN); AlphaFunction func2 = animation.GetDefaultAlphaFunction(); - DALI_TEST_CHECK(func2(0.1f) < AlphaFunctions::Linear(0.1f)); // less progress when easing-in + DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION); END_TEST; } -int UtcDaliAnimationGetDefaultAlphaFunction(void) +int UtcDaliAnimationGetDefaultAlphaFunctionP(void) { TestApplication application; @@ -553,11 +602,16 @@ int UtcDaliAnimationGetDefaultAlphaFunction(void) AlphaFunction func = animation.GetDefaultAlphaFunction(); // Test that the default is linear - DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION); + 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 UtcDaliAnimationPlay(void) +int UtcDaliAnimationSetCurrentProgressP(void) { TestApplication application; @@ -565,36 +619,24 @@ int UtcDaliAnimationPlay(void) 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.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + Animation animation = Animation::New(0.0f); - // Start the animation - animation.Play(); + //Set duration + float durationSeconds(1.0f); + animation.SetDuration(durationSeconds); bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - - 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 ); - animation.Play(); // Test that calling play has no effect, when animation is already playing - application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + Vector3 targetPosition(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION ); + // Start the animation from 40% progress + animation.SetCurrentProgress( 0.4f ); + animation.Play(); - animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); @@ -602,20 +644,23 @@ int UtcDaliAnimationPlay(void) 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(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); - // We didn't expect the animation to finish yet + //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 ); - animation.Play(); // Test that calling play has no effect, when animation is already playing - application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); - // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); @@ -629,7 +674,106 @@ int UtcDaliAnimationPlay(void) END_TEST; } -int UtcDaliAnimationSetSpeedFactor(void) +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 UtcDaliAnimationSetSpeedFactorP(void) { TestApplication application; @@ -646,7 +790,7 @@ int UtcDaliAnimationSetSpeedFactor(void) KeyFrames keyframes = KeyFrames::New(); keyframes.Add( 0.0f, initialPosition); keyframes.Add( 1.0f, targetPosition ); - animation.AnimateBetween( Property(actor, Actor::POSITION), keyframes, AlphaFunctions::Linear); + animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR); //Set speed to be x2 animation.SetSpeedFactor(2.0f); @@ -736,7 +880,6 @@ int UtcDaliAnimationSetSpeedFactor(void) application.Render(0); DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION ); - //Test change speed factor on the fly finishCheck.Reset(); @@ -793,7 +936,7 @@ int UtcDaliAnimationSetSpeedFactor(void) END_TEST; } -int UtcDaliAnimationGetSpeedFactor(void) +int UtcDaliAnimationGetSpeedFactorP(void) { TestApplication application; @@ -806,93 +949,59 @@ int UtcDaliAnimationGetSpeedFactor(void) END_TEST; } -int UtcDaliAnimationPlayOffStage(void) +int UtcDaliAnimationSetPlayRangeP(void) { - // Test that an animation can be played, when the actor is off-stage. - // When the actor is added to the stage, it should appear at the current position - // i.e. where it would have been anyway, if on-stage from the beginning. - TestApplication application; Actor actor = Actor::New(); - Vector3 basePosition(Vector3::ZERO); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION ); - // Not added to the stage! + Stage::GetCurrent().Add( actor ); // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - animation.SetDisconnectAction( Animation::Discard ); - Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); - - // 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)/* 20% progress */); + float durationSeconds( 1.0f ); + Animation animation = Animation::New( durationSeconds ); - // We didn't expect the animation to finish yet + bool signalReceived( false ); + AnimationFinishCheck finishCheck( signalReceived ); + animation.FinishedSignal().Connect( &application, finishCheck ); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION ); - - // Add to the stage - Stage::GetCurrent().Add(actor); + // Set range between 0.4 and 0.8 + animation.SetPlayRange( Vector2( 0.4f, 0.9f ) ); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); + DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION ); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION ); + Vector3 targetPosition( 100.0f, 100.0f, 100.0f ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR ); - // Remove from the stage - Stage::GetCurrent().Remove(actor); + // Start the animation from 40% progress + animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ ); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION ); - - // Add to the stage - Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ ); - // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + application.Render( static_cast< unsigned int >( durationSeconds*100.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 ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationPlayDiscardHandle(void) +int UtcDaliAnimationSetPlayRangeN(void) { TestApplication application; @@ -900,22 +1009,66 @@ int UtcDaliAnimationPlayDiscardHandle(void) 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.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + Animation animation = Animation::New(0); + application.SendNotification(); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + //PlayRange out of bounds + animation.SetPlayRange( Vector2(-1.0f,1.0f) ); + application.SendNotification(); + DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION ); + animation.SetPlayRange( Vector2(0.0f,2.0f) ); + application.SendNotification(); + DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION ); + + //If playRange is not in the correct order it has to be ordered + animation.SetPlayRange( Vector2(0.8f,0.2f) ); + application.SendNotification(); + DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliAnimationGetPlayRangeP(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add( actor ); + + // Build the animation + Animation animation = Animation::New( 1.0f ); + application.SendNotification(); + + //If PlayRange not specified it should be 0.0-1.0 by default + DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION ); + + // Set range between 0.4 and 0.8 + animation.SetPlayRange( Vector2( 0.4f, 0.8f ) ); + application.SendNotification(); + DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliAnimationPlayP(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); // Start the animation animation.Play(); - // This is a test of the "Fire and Forget" behaviour - // Discard the animation handle! - animation.Reset(); - DALI_TEST_CHECK( !animation ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); @@ -925,6 +1078,7 @@ int UtcDaliAnimationPlayDiscardHandle(void) finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); @@ -933,6 +1087,7 @@ int UtcDaliAnimationPlayDiscardHandle(void) finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION ); + animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); @@ -941,6 +1096,7 @@ int UtcDaliAnimationPlayDiscardHandle(void) finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION ); + animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); @@ -949,6 +1105,7 @@ int UtcDaliAnimationPlayDiscardHandle(void) finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION ); + animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); @@ -965,18 +1122,25 @@ int UtcDaliAnimationPlayDiscardHandle(void) END_TEST; } -int UtcDaliAnimationPlayStopDiscardHandle(void) +int UtcDaliAnimationPlayOffStageP(void) { + // Test that an animation can be played, when the actor is off-stage. + // When the actor is added to the stage, it should appear at the current position + // i.e. where it would have been anyway, if on-stage from the beginning. + TestApplication application; Actor actor = Actor::New(); - Stage::GetCurrent().Add(actor); + Vector3 basePosition(Vector3::ZERO); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION ); + // Not added to the stage! // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); + animation.SetDisconnectAction( Animation::Discard ); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); // Start the animation animation.Play(); @@ -991,50 +1155,60 @@ int UtcDaliAnimationPlayStopDiscardHandle(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION ); - // This is a test of the "Fire and Forget" behaviour - // Stop the animation, and Discard the animation handle! - animation.Stop(); - animation.Reset(); - DALI_TEST_CHECK( !animation ); + // Add to the stage + Stage::GetCurrent().Add(actor); application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); - // We expect the animation to finish at 20% progress + // We didn't expect the animation to finish yet application.SendNotification(); - finishCheck.CheckSignalReceived(); - finishCheck.Reset(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION ); + + // Remove from the stage + Stage::GetCurrent().Remove(actor); application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); - // Check that nothing has changed + // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION ); + + // Add to the stage + Stage::GetCurrent().Add(actor); application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); - // Check that nothing has changed + // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 100% progress */); + application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); - // Check that nothing has changed + // We did expect the animation to finish application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + 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 UtcDaliAnimationPlayFrom(void) +int UtcDaliAnimationPlayDiscardHandleP(void) { TestApplication application; @@ -1045,23 +1219,35 @@ int UtcDaliAnimationPlayFrom(void) float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + + // Start the animation + animation.Play(); + + // This is a test of the "Fire and Forget" behaviour + // Discard the animation handle! + animation.Reset(); + DALI_TEST_CHECK( !animation ); - //PlayFrom with an argument outside the range [0..1] will be ignored - animation.PlayFrom(-1.0f); application.SendNotification(); - DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); - animation.PlayFrom(100.0f); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); - // Start the animation from 40% progress - animation.PlayFrom( 0.4f ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); @@ -1071,7 +1257,6 @@ int UtcDaliAnimationPlayFrom(void) finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION ); - animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); @@ -1080,7 +1265,9 @@ int UtcDaliAnimationPlayFrom(void) finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION ); + application.SendNotification(); application.Render(static_cast(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/); + // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); @@ -1094,7 +1281,7 @@ int UtcDaliAnimationPlayFrom(void) END_TEST; } -int UtcDaliAnimationSetCurrentProgress(void) +int UtcDaliAnimationPlayStopDiscardHandleP(void) { TestApplication application; @@ -1102,86 +1289,68 @@ int UtcDaliAnimationSetCurrentProgress(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(100.0f, 100.0f, 100.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); + + // Start the animation + animation.Play(); bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - - Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::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 ); + application.Render(static_cast(durationSeconds*200.0f)/* 20% progress */); - animation.SetCurrentProgress( 100.0f); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); - // Start the animation from 40% progress - animation.SetCurrentProgress( 0.4f ); - animation.Play(); + // This is a test of the "Fire and Forget" behaviour + // Stop the animation, and Discard the animation handle! + animation.Stop(); + animation.Reset(); + DALI_TEST_CHECK( !animation ); application.SendNotification(); - application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); + application.Render(static_cast(durationSeconds*200.0f)/* 40% progress */); - // We didn't expect the animation to finish yet + // We expect the animation to finish at 20% progress application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION ); - DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + finishCheck.Reset(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); - animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); - //Set the progress to 70% - animation.SetCurrentProgress( 0.7f ); + // Check that nothing has changed application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 80% progress */); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); + // Check that nothing has changed application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION ); - DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION ); - - // + 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(), targetPosition, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*200.0f)/* 100% progress */); - // 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 ); + // Check that nothing has changed + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationPlayRange(void) +int UtcDaliAnimationPlayRangeP(void) { TestApplication application; @@ -1196,7 +1365,7 @@ int UtcDaliAnimationPlayRange(void) keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) ); keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) ); - animation.AnimateBetween( Property( actor, Actor::POSITION), keyframes ); + animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes ); // Set range between 0.4 and 0.8 animation.SetPlayRange( Vector2(0.4f,0.8f) ); @@ -1285,7 +1454,7 @@ int UtcDaliAnimationPlayRange(void) END_TEST; } -int UtcDaliAnimationSetPlayRange(void) +int UtcDaliAnimationPlayFromP(void) { TestApplication application; @@ -1293,34 +1462,74 @@ int UtcDaliAnimationSetPlayRange(void) Stage::GetCurrent().Add(actor); // Build the animation - Animation animation = Animation::New(0); - application.SendNotification(); + 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); - //If PlayRange not specified it should be 0.0-1.0 by default - DALI_TEST_EQUALS( Vector2(0.0,1.0), animation.GetPlayRange(), TEST_LOCATION ); + // Start the animation from 40% progress + animation.PlayFrom( 0.4f ); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); - //PlayRange out of bounds - animation.SetPlayRange( Vector2(-1.0f,1.0f) ); - application.SendNotification(); - DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION ); - animation.SetPlayRange( Vector2(0.0f,2.0f) ); application.SendNotification(); - DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION ); + application.Render(static_cast(durationSeconds*200.0f)/* 60% progress */); - //If playRange is not in the correct order it has to be ordered - animation.SetPlayRange( Vector2(0.8f,0.2f) ); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION ); - // Set range between 0.4 and 0.8 - animation.SetPlayRange( Vector2(0.4f,0.8f) ); + animation.Play(); // Test that calling play has no effect, when animation is already playing application.SendNotification(); - DALI_TEST_EQUALS( Vector2(0.4f,0.8f), animation.GetPlayRange(), TEST_LOCATION ); + application.Render(static_cast(durationSeconds*200.0f)/* 80% progress */); - END_TEST; -} + // 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) + 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 UtcDaliAnimationPlayFromN(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); + + //PlayFrom with an argument outside the range [0..1] will be ignored + animation.PlayFrom(-1.0f); + application.SendNotification(); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + + animation.PlayFrom(100.0f); + application.SendNotification(); + DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION ); + END_TEST; +} -int UtcDaliAnimationPause(void) +int UtcDaliAnimationPauseP(void) { TestApplication application; @@ -1331,7 +1540,7 @@ int UtcDaliAnimationPause(void) float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); Vector3 fiftyPercentProgress(targetPosition * 0.5f); @@ -1390,7 +1599,7 @@ int UtcDaliAnimationPause(void) END_TEST; } -int UtcDaliAnimationStop(void) +int UtcDaliAnimationStoP(void) { TestApplication application; @@ -1401,7 +1610,7 @@ int UtcDaliAnimationStop(void) float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); Vector3 fiftyPercentProgress(targetPosition * 0.5f); @@ -1437,7 +1646,7 @@ int UtcDaliAnimationStop(void) END_TEST; } -int UtcDaliAnimationStopSetPosition(void) +int UtcDaliAnimationStopSetPositionP(void) { // Test that Animation::Stop & Actor::SetPosition can be used in conjunction // i.e. to check that the animation does not interfere with the position set. @@ -1451,7 +1660,7 @@ int UtcDaliAnimationStopSetPosition(void) float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); Vector3 fiftyPercentProgress(targetPosition * 0.5f); @@ -1489,7 +1698,7 @@ int UtcDaliAnimationStopSetPosition(void) END_TEST; } -int UtcDaliAnimationClear(void) +int UtcDaliAnimationClearP(void) { TestApplication application; @@ -1500,7 +1709,7 @@ int UtcDaliAnimationClear(void) float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(100.0f, 100.0f, 100.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR); Vector3 fiftyPercentProgress(targetPosition * 0.5f); @@ -1534,7 +1743,7 @@ int UtcDaliAnimationClear(void) finishCheck.Reset(); actor.SetPosition(Vector3::ZERO); Vector3 targetScale(3.0f, 3.0f, 3.0f); - animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear); + animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR ); animation.Play(); application.SendNotification(); @@ -1556,7 +1765,7 @@ int UtcDaliAnimationClear(void) END_TEST; } -int UtcDaliAnimationSignalFinish(void) +int UtcDaliAnimationFinishedSignalP(void) { TestApplication application; @@ -1578,7 +1787,7 @@ int UtcDaliAnimationSignalFinish(void) END_TEST; } -int UtcDaliAnimationAnimateByBoolean(void) +int UtcDaliAnimationAnimateByBooleanP(void) { TestApplication application; @@ -1586,7 +1795,7 @@ int UtcDaliAnimationAnimateByBoolean(void) // Register a boolean property bool startValue(false); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); @@ -1661,7 +1870,7 @@ int UtcDaliAnimationAnimateByBoolean(void) END_TEST; } -int UtcDaliAnimationAnimateByBooleanAlphaFunction(void) +int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void) { TestApplication application; @@ -1669,7 +1878,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunction(void) // Register a boolean property bool startValue(false); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); @@ -1678,7 +1887,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunction(void) Animation animation = Animation::New(durationSeconds); bool relativeValue(true); bool finalValue( false || relativeValue ); - animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseIn); + animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN); // Start the animation animation.Play(); @@ -1712,7 +1921,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunction(void) // Repeat with relative value "false" - this should be an NOOP animation = Animation::New(durationSeconds); bool noOpValue(false); - animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunctions::EaseIn); + animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN); // Start the animation animation.Play(); @@ -1738,7 +1947,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunction(void) END_TEST; } -int UtcDaliAnimationAnimateByBooleanTimePeriod(void) +int UtcDaliAnimationAnimateByBooleanTimePeriodP(void) { TestApplication application; @@ -1746,7 +1955,7 @@ int UtcDaliAnimationAnimateByBooleanTimePeriod(void) // Register a boolean property bool startValue(false); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); @@ -1801,7 +2010,7 @@ int UtcDaliAnimationAnimateByBooleanTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void) { TestApplication application; @@ -1809,7 +2018,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriod(void) // Register a boolean property bool startValue(false); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); @@ -1821,7 +2030,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriod(void) float animatorDurationSeconds(durationSeconds * 0.5f); animation.AnimateBy( Property(actor, index), relativeValue, - AlphaFunctions::EaseInOut, + AlphaFunction::EASE_IN_OUT, TimePeriod( animatorDurationSeconds ) ); // Start the animation @@ -1865,7 +2074,7 @@ int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByFloat(void) +int UtcDaliAnimationAnimateByFloatP(void) { TestApplication application; @@ -1873,7 +2082,7 @@ int UtcDaliAnimationAnimateByFloat(void) // Register a float property float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -1917,7 +2126,7 @@ int UtcDaliAnimationAnimateByFloat(void) END_TEST; } -int UtcDaliAnimationAnimateByFloatAlphaFunction(void) +int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void) { TestApplication application; @@ -1925,7 +2134,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunction(void) // Register a float property float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -1934,7 +2143,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunction(void) Animation animation = Animation::New(durationSeconds); float targetValue(90.0f); float relativeValue(targetValue - startValue); - animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut); + animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); float ninetyFivePercentProgress(startValue + relativeValue*0.95f); @@ -1972,7 +2181,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunction(void) END_TEST; } -int UtcDaliAnimationAnimateByFloatTimePeriod(void) +int UtcDaliAnimationAnimateByFloatTimePeriodP(void) { TestApplication application; @@ -1980,7 +2189,7 @@ int UtcDaliAnimationAnimateByFloatTimePeriod(void) // Register a float property float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2033,7 +2242,7 @@ int UtcDaliAnimationAnimateByFloatTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void) { TestApplication application; @@ -2041,7 +2250,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriod(void) // Register a float property float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2053,7 +2262,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriod(void) float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, - AlphaFunctions::Linear, + AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); // Start the animation @@ -2095,7 +2304,7 @@ int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByInteger(void) +int UtcDaliAnimationAnimateByIntegerP(void) { TestApplication application; @@ -2103,7 +2312,7 @@ int UtcDaliAnimationAnimateByInteger(void) // Register an integer property int startValue(1); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2147,7 +2356,7 @@ int UtcDaliAnimationAnimateByInteger(void) END_TEST; } -int UtcDaliAnimationAnimateByIntegerAlphaFunction(void) +int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void) { TestApplication application; @@ -2155,7 +2364,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunction(void) // Register an integer property int startValue(1); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2164,7 +2373,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunction(void) Animation animation = Animation::New(durationSeconds); int targetValue(90); int relativeValue(targetValue - startValue); - animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut); + animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); int ninetyFivePercentProgress(static_cast(startValue + relativeValue*0.95f + 0.5f)); @@ -2202,7 +2411,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunction(void) END_TEST; } -int UtcDaliAnimationAnimateByIntegerTimePeriod(void) +int UtcDaliAnimationAnimateByIntegerTimePeriodP(void) { TestApplication application; @@ -2210,7 +2419,7 @@ int UtcDaliAnimationAnimateByIntegerTimePeriod(void) // Register an integer property int startValue(10); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2263,7 +2472,7 @@ int UtcDaliAnimationAnimateByIntegerTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void) { TestApplication application; @@ -2271,7 +2480,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriod(void) // Register an integer property int startValue(10); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2283,7 +2492,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriod(void) float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, - AlphaFunctions::Linear, + AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); // Start the animation @@ -2325,7 +2534,7 @@ int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByVector2(void) +int UtcDaliAnimationAnimateByVector2P(void) { TestApplication application; @@ -2333,7 +2542,7 @@ int UtcDaliAnimationAnimateByVector2(void) // Register a Vector2 property Vector2 startValue(10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2377,7 +2586,7 @@ int UtcDaliAnimationAnimateByVector2(void) END_TEST; } -int UtcDaliAnimationAnimateByVector2AlphaFunction(void) +int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void) { TestApplication application; @@ -2385,7 +2594,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunction(void) // Register a Vector2 property Vector2 startValue(100.0f, 100.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2394,7 +2603,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunction(void) Animation animation = Animation::New(durationSeconds); Vector2 targetValue(20.0f, 20.0f); Vector2 relativeValue(targetValue - startValue); - animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut); + animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f); @@ -2433,7 +2642,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunction(void) END_TEST; } -int UtcDaliAnimationAnimateByVector2TimePeriod(void) +int UtcDaliAnimationAnimateByVector2TimePeriodP(void) { TestApplication application; @@ -2441,7 +2650,7 @@ int UtcDaliAnimationAnimateByVector2TimePeriod(void) // Register a Vector2 property Vector2 startValue(10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2494,7 +2703,7 @@ int UtcDaliAnimationAnimateByVector2TimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void) { TestApplication application; @@ -2502,7 +2711,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriod(void) // Register a Vector2 property Vector2 startValue(5.0f, 5.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2514,7 +2723,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriod(void) float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, - AlphaFunctions::Linear, + AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); // Start the animation @@ -2556,7 +2765,7 @@ int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByVector3(void) +int UtcDaliAnimationAnimateByVector3P(void) { TestApplication application; @@ -2564,7 +2773,7 @@ int UtcDaliAnimationAnimateByVector3(void) // Register a Vector3 property Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2608,7 +2817,7 @@ int UtcDaliAnimationAnimateByVector3(void) END_TEST; } -int UtcDaliAnimationAnimateByVector3AlphaFunction(void) +int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void) { TestApplication application; @@ -2616,7 +2825,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunction(void) // Register a Vector3 property Vector3 startValue(100.0f, 100.0f, 100.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2625,7 +2834,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunction(void) Animation animation = Animation::New(durationSeconds); Vector3 targetValue(20.0f, 20.0f, 20.0f); Vector3 relativeValue(targetValue - startValue); - animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut); + animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f); @@ -2665,7 +2874,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunction(void) END_TEST; } -int UtcDaliAnimationAnimateByVector3TimePeriod(void) +int UtcDaliAnimationAnimateByVector3TimePeriodP(void) { TestApplication application; @@ -2673,7 +2882,7 @@ int UtcDaliAnimationAnimateByVector3TimePeriod(void) // Register a Vector3 property Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2726,7 +2935,7 @@ int UtcDaliAnimationAnimateByVector3TimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void) { TestApplication application; @@ -2734,7 +2943,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriod(void) // Register a Vector3 property Vector3 startValue(5.0f, 5.0f, 5.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2746,7 +2955,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriod(void) float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, - AlphaFunctions::Linear, + AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); // Start the animation @@ -2788,7 +2997,7 @@ int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByVector4(void) +int UtcDaliAnimationAnimateByVector4P(void) { TestApplication application; @@ -2796,7 +3005,7 @@ int UtcDaliAnimationAnimateByVector4(void) // Register a Vector4 property Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2840,7 +3049,7 @@ int UtcDaliAnimationAnimateByVector4(void) END_TEST; } -int UtcDaliAnimationAnimateByVector4AlphaFunction(void) +int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void) { TestApplication application; @@ -2848,7 +3057,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunction(void) // Register a Vector4 property Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2857,7 +3066,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunction(void) Animation animation = Animation::New(durationSeconds); Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f); Vector4 relativeValue(targetValue - startValue); - animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut); + animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT); Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f); @@ -2898,7 +3107,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunction(void) END_TEST; } -int UtcDaliAnimationAnimateByVector4TimePeriod(void) +int UtcDaliAnimationAnimateByVector4TimePeriodP(void) { TestApplication application; @@ -2906,7 +3115,7 @@ int UtcDaliAnimationAnimateByVector4TimePeriod(void) // Register a Vector4 property Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2959,7 +3168,7 @@ int UtcDaliAnimationAnimateByVector4TimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void) { TestApplication application; @@ -2967,7 +3176,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriod(void) // Register a Vector4 property Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -2979,7 +3188,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriod(void) float delay = 0.5f; animation.AnimateBy(Property(actor, index), relativeValue, - AlphaFunctions::Linear, + AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); // Start the animation @@ -3021,7 +3230,7 @@ int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByActorPosition(void) +int UtcDaliAnimationAnimateByActorPositionP(void) { TestApplication application; @@ -3038,7 +3247,7 @@ int UtcDaliAnimationAnimateByActorPosition(void) Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(20.0f, 20.0f, 20.0f); Vector3 relativePosition(targetPosition - startPosition); - animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition); + animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition); Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); @@ -3073,7 +3282,7 @@ int UtcDaliAnimationAnimateByActorPosition(void) END_TEST; } -int UtcDaliAnimationAnimateByActorPositionAlphaFunction(void) +int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void) { TestApplication application; @@ -3090,7 +3299,7 @@ int UtcDaliAnimationAnimateByActorPositionAlphaFunction(void) Animation animation = Animation::New(durationSeconds); Vector3 targetPosition(20.0f, 20.0f, 20.0f); Vector3 relativePosition(targetPosition - startPosition); - animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition, AlphaFunctions::EaseOut); + animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT); Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); @@ -3130,7 +3339,7 @@ int UtcDaliAnimationAnimateByActorPositionAlphaFunction(void) END_TEST; } -int UtcDaliAnimationAnimateByActorPositionTimePeriod(void) +int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void) { TestApplication application; @@ -3148,7 +3357,7 @@ int UtcDaliAnimationAnimateByActorPositionTimePeriod(void) Vector3 targetPosition(20.0f, 20.0f, 20.0f); Vector3 relativePosition(targetPosition - startPosition); float delay = 0.5f; - animation.AnimateBy(Property(actor, Actor::POSITION), + animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, TimePeriod(delay, durationSeconds - delay)); @@ -3185,7 +3394,7 @@ int UtcDaliAnimationAnimateByActorPositionTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void) { TestApplication application; @@ -3203,9 +3412,9 @@ int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriod(void) Vector3 targetPosition(20.0f, 20.0f, 20.0f); Vector3 relativePosition(targetPosition - startPosition); float delay = 0.5f; - animation.AnimateBy(Property(actor, Actor::POSITION), + animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, - AlphaFunctions::Linear, + AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); @@ -3241,23 +3450,21 @@ int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriod(void) END_TEST; } -int UtcDaliAnimationAnimateToBoolean(void) +int UtcDaliAnimationAnimateByActorOrientationP(void) { TestApplication application; Actor actor = Actor::New(); - - // Register a boolean property - const bool startValue(false); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - const bool targetValue( !startValue ); - animation.AnimateTo(Property(actor, index), targetValue); + Degree relativeRotationDegrees(360.0f); + Radian relativeRotationRadians(relativeRotationDegrees); + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) ); // Start the animation animation.Play(); @@ -3267,79 +3474,54 @@ int UtcDaliAnimationAnimateToBoolean(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% 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_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - // We did expect the animation to finish + // We didn't expect the animation to finish yet application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - - // Repeat with target value "false" - animation = Animation::New(durationSeconds); - const bool finalValue( !targetValue ); - animation.AnimateTo(Property(actor, index), finalValue); - - // Start the animation - animation.Play(); - - finishCheck.Reset(); - animation.FinishedSignal().Connect(&application, finishCheck); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.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_CHECK( actor.GetProperty(index) == finalValue ); - - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToBooleanAlphaFunction(void) +int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); - - // Register a boolean property - const bool startValue(false); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - const bool targetValue( !startValue ); - animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut); + Degree relativeRotationDegrees(360.0f); + Radian relativeRotationRadians(relativeRotationDegrees); + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN ); // Start the animation animation.Play(); @@ -3349,82 +3531,56 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunction(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% 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_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - // We did expect the animation to finish + // We didn't expect the animation to finish yet application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - - // Repeat with target value "false" - animation = Animation::New(durationSeconds); - const bool finalValue( !targetValue ); - animation.AnimateTo(Property(actor, index), finalValue, AlphaFunctions::EaseOut); - - // Start the animation - animation.Play(); - - finishCheck.Reset(); - animation.FinishedSignal().Connect(&application, finishCheck); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.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_CHECK( actor.GetProperty(index) == finalValue ); - - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToBooleanTimePeriod(void) +int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); - - // Register a boolean property - bool startValue(false); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION ); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - bool finalValue( !startValue ); - float animatorDurationSeconds(durationSeconds * 0.5f); - animation.AnimateTo( Property(actor, index), - finalValue, - TimePeriod( animatorDurationSeconds ) ); + Degree relativeRotationDegrees(360.0f); + Radian relativeRotationRadians(relativeRotationDegrees); + float delay = 0.3f; + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), + AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) ); // Start the animation animation.Play(); @@ -3434,60 +3590,58 @@ int UtcDaliAnimationAnimateToBooleanTimePeriod(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*950.0f)/* 95% 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_CHECK( actor.GetProperty(index) == startValue ); + float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - // We didn't expect the animation to finish yet... + // 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(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); + finishCheck.CheckSignalNotReceived(); + progress = max(0.0f, 0.75f - delay) / (1.0f - delay); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 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_CHECK( actor.GetProperty(index) == finalValue ); - - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateByActorScaleP(void) { TestApplication application; Actor actor = Actor::New(); - - // Register a boolean property - bool startValue(false); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - bool finalValue( !startValue ); - float animatorDurationSeconds(durationSeconds * 0.5f); - animation.AnimateTo( Property(actor, index), - finalValue, - AlphaFunctions::Linear, - TimePeriod( animatorDurationSeconds ) ); + Vector3 targetScale(2.0f, 2.0f, 2.0f); + Vector3 relativeScale(targetScale - Vector3::ONE); + animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) ); + + Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f); // Start the animation animation.Play(); @@ -3497,155 +3651,107 @@ int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriod(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*950.0f)/* 95% animator 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_CHECK( actor.GetProperty(index) == startValue ); - - application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); - - // We didn't expect the animation to finish yet... - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - - // ...however we should have reached the final value - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); + 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_CHECK( actor.GetProperty(index) == finalValue ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); - // Check that nothing has changed after a couple of buffer swaps - application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + // Reset everything + finishCheck.Reset(); + actor.SetScale(Vector3::ONE); + application.SendNotification(); application.Render(0); - DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); - END_TEST; -} - -int UtcDaliAnimationAnimateToFloat(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - - // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - - // Build the animation - float durationSeconds(2.0f); - Animation animation = Animation::New(durationSeconds); - float targetValue(50.0f); - float relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, "test-property"), targetValue); - - float ninetyFivePercentProgress(startValue + relativeValue*0.95f); - - // Start the animation - animation.Play(); + DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); + // Repeat with a different (ease-in) alpha function + animation = Animation::New(durationSeconds); + animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN ); animation.FinishedSignal().Connect(&application, finishCheck); + animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% 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.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliAnimationAnimateToFloatAlphaFunction(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - - // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), 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 targetValue(90.0f); - float relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut); + application.SendNotification(); + application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); - float ninetyFivePercentProgress(startValue + relativeValue*0.95f); + // 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 ); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); + // Repeat with a delay + float delay = 0.5f; + animation = Animation::New(durationSeconds); + animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); animation.FinishedSignal().Connect(&application, finishCheck); + animation.Play(); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% 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(); - - // The position should have moved more, than with a linear alpha function - float current(actor.GetProperty(index)); - DALI_TEST_CHECK( current > ninetyFivePercentProgress ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.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.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToFloatTimePeriod(void) +int UtcDaliAnimationAnimateToBooleanP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register a boolean property + const bool startValue(false); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - float targetValue(30.0f); - float relativeValue(targetValue - startValue); - float delay = 0.5f; - animation.AnimateTo(Property(actor, index), - targetValue, - TimePeriod(delay, durationSeconds - delay)); + const bool targetValue( !startValue ); + animation.AnimateTo(Property(actor, index), targetValue); // Start the animation animation.Play(); @@ -3655,107 +3761,79 @@ int UtcDaliAnimationAnimateToFloatTimePeriod(void) 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 */); + application.Render(static_cast(durationSeconds*950.0f)/* 95% 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 ); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriod(void) -{ - TestApplication application; - - Actor actor = Actor::New(); + DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - // Register a float property - float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - float targetValue(30.0f); - float relativeValue(targetValue - startValue); - float delay = 0.5f; - animation.AnimateTo(Property(actor, index), - targetValue, - AlphaFunctions::Linear, - TimePeriod(delay, durationSeconds - delay)); + // Repeat with target value "false" + animation = Animation::New(durationSeconds); + const bool finalValue( !targetValue ); + animation.AnimateTo(Property(actor, index), finalValue); // Start the animation animation.Play(); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); + finishCheck.Reset(); 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 */); + application.Render(static_cast(durationSeconds*950.0f)/* 95% 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 ); + DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); END_TEST; } -int UtcDaliAnimationAnimateToInteger(void) +int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); - // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register a boolean property + const bool startValue(false); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); // Build the animation float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(50); - int relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, "test-property"), targetValue); - - int ninetyFivePercentProgress(static_cast(startValue + relativeValue*0.95f + 0.5f)); + const bool targetValue( !startValue ); + animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT); // Start the animation animation.Play(); @@ -3770,7 +3848,7 @@ int UtcDaliAnimationAnimateToInteger(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_CHECK( actor.GetProperty(index) == startValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -3778,36 +3856,23 @@ int UtcDaliAnimationAnimateToInteger(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliAnimationAnimateToIntegerAlphaFunction(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - - // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - int targetValue(90); - int relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut); + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); - int ninetyFivePercentProgress(static_cast(startValue + relativeValue*0.95f + 0.5f)); + // Repeat with target value "false" + animation = Animation::New(durationSeconds); + const bool finalValue( !targetValue ); + animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT); // Start the animation animation.Play(); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); + finishCheck.Reset(); animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); @@ -3816,10 +3881,7 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunction(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - - // The position should have moved more, than with a linear alpha function - int current(actor.GetProperty(index)); - DALI_TEST_CHECK( current > ninetyFivePercentProgress ); + DALI_TEST_CHECK( actor.GetProperty(index) == targetValue ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -3827,31 +3889,36 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunction(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); END_TEST; } -int UtcDaliAnimationAnimateToIntegerTimePeriod(void) +int UtcDaliAnimationAnimateToBooleanTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); - // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register a boolean property + bool startValue(false); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(30); - int relativeValue(targetValue - startValue); - float delay = 0.5f; - animation.AnimateTo(Property(actor, index), - targetValue, - TimePeriod(delay, durationSeconds - delay)); + bool finalValue( !startValue ); + float animatorDurationSeconds(durationSeconds * 0.5f); + animation.AnimateTo( Property(actor, index), + finalValue, + TimePeriod( animatorDurationSeconds ) ); // Start the animation animation.Play(); @@ -3861,53 +3928,60 @@ int UtcDaliAnimationAnimateToIntegerTimePeriod(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(animatorDurationSeconds*950.0f)/* 95% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); - // We didn't expect the animation to finish yet + // 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 ); + + // ...however we should have reached the final value + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); END_TEST; } -int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); - // Register an integer property - int startValue(10); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register a boolean property + bool startValue(false); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - int targetValue(30); - int relativeValue(targetValue - startValue); - float delay = 0.5f; - animation.AnimateTo(Property(actor, index), - targetValue, - AlphaFunctions::Linear, - TimePeriod(delay, durationSeconds - delay)); + bool finalValue( !startValue ); + float animatorDurationSeconds(durationSeconds * 0.5f); + animation.AnimateTo( Property(actor, index), + finalValue, + AlphaFunction::LINEAR, + TimePeriod( animatorDurationSeconds ) ); // Start the animation animation.Play(); @@ -3917,51 +3991,59 @@ int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriod(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(animatorDurationSeconds*950.0f)/* 95% animator progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == startValue ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); + application.Render(static_cast(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/); - // We didn't expect the animation to finish yet + // 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 ); + + // ...however we should have reached the final value + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + + // Check that nothing has changed after a couple of buffer swaps + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); + application.Render(0); + DALI_TEST_CHECK( actor.GetProperty(index) == finalValue ); END_TEST; } -int UtcDaliAnimationAnimateToVector2(void) +int UtcDaliAnimationAnimateToFloatP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector2 property - Vector2 startValue(-50.0f, -50.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // 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( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(50.0f, 50.0f); - Vector2 relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, index), targetValue); + float targetValue(50.0f); + float relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, "testProperty"), targetValue); - Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + float ninetyFivePercentProgress(startValue + relativeValue*0.95f); // Start the animation animation.Play(); @@ -3976,7 +4058,7 @@ int UtcDaliAnimationAnimateToVector2(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( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -3984,30 +4066,30 @@ int UtcDaliAnimationAnimateToVector2(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector2AlphaFunction(void) +int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector2 property - Vector2 startValue(1000.0f, 1000.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // 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( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(9000.0f, 9000.0f); - Vector2 relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut); + float targetValue(90.0f); + float relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT); - Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + float ninetyFivePercentProgress(startValue + relativeValue*0.95f); // Start the animation animation.Play(); @@ -4024,9 +4106,8 @@ int UtcDaliAnimationAnimateToVector2AlphaFunction(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector2 current(actor.GetProperty(index)); - DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); + float current(actor.GetProperty(index)); + DALI_TEST_CHECK( current > ninetyFivePercentProgress ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -4034,27 +4115,27 @@ int UtcDaliAnimationAnimateToVector2AlphaFunction(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector2TimePeriod(void) +int UtcDaliAnimationAnimateToFloatTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector2 property - Vector2 startValue(10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // 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( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(-10.0f, 20.0f); - Vector2 relativeValue(targetValue - startValue); + float targetValue(30.0f); + float relativeValue(targetValue - startValue); float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, @@ -4073,7 +4154,7 @@ int UtcDaliAnimationAnimateToVector2TimePeriod(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( actor.GetProperty(index), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4081,7 +4162,7 @@ int UtcDaliAnimationAnimateToVector2TimePeriod(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( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4089,31 +4170,31 @@ int UtcDaliAnimationAnimateToVector2TimePeriod(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector2 property - Vector2 startValue(10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // 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( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector2 targetValue(30.0f, 30.0f); - Vector2 relativeValue(targetValue - startValue); + float targetValue(30.0f); + float relativeValue(targetValue - startValue); float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, - AlphaFunctions::Linear, + AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); // Start the animation @@ -4129,7 +4210,7 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriod(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( actor.GetProperty(index), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4137,7 +4218,7 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriod(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( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4145,30 +4226,30 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriod(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector3(void) +int UtcDaliAnimationAnimateToIntegerP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector3 property - Vector3 startValue(-50.0f, -50.0f, -50.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register an integer property + int startValue(10); + 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 ); // Build the animation float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(50.0f, 50.0f, 50.0f); - Vector3 relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, index), targetValue); + int targetValue(50); + int relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, "testProperty"), targetValue); - Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + int ninetyFivePercentProgress(static_cast(startValue + relativeValue*0.95f + 0.5f)); // Start the animation animation.Play(); @@ -4183,7 +4264,7 @@ int UtcDaliAnimationAnimateToVector3(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( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -4191,30 +4272,30 @@ int UtcDaliAnimationAnimateToVector3(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector3AlphaFunction(void) +int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector3 property - Vector3 startValue(1000.0f, 1000.0f, 1000.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register an integer property + int startValue(10); + 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(9000.0f, 9000.0f, 9000.0f); - Vector3 relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut); + int targetValue(90); + int relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT); - Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + int ninetyFivePercentProgress(static_cast(startValue + relativeValue*0.95f + 0.5f)); // Start the animation animation.Play(); @@ -4231,10 +4312,8 @@ int UtcDaliAnimationAnimateToVector3AlphaFunction(void) finishCheck.CheckSignalNotReceived(); // The position should have moved more, than with a linear alpha function - Vector3 current(actor.GetProperty(index)); - DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); + int current(actor.GetProperty(index)); + DALI_TEST_CHECK( current > ninetyFivePercentProgress ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -4242,27 +4321,27 @@ int UtcDaliAnimationAnimateToVector3AlphaFunction(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector3TimePeriod(void) +int UtcDaliAnimationAnimateToIntegerTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector3 property - Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register an integer property + int startValue(10); + 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(-10.0f, 20.0f, 100.0f); - Vector3 relativeValue(targetValue - startValue); + int targetValue(30); + int relativeValue(targetValue - startValue); float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, @@ -4281,7 +4360,7 @@ int UtcDaliAnimationAnimateToVector3TimePeriod(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( actor.GetProperty(index), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4289,7 +4368,7 @@ int UtcDaliAnimationAnimateToVector3TimePeriod(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( actor.GetProperty(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*/); @@ -4297,31 +4376,31 @@ int UtcDaliAnimationAnimateToVector3TimePeriod(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector3 property - Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register an integer property + int startValue(10); + 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(30.0f, 30.0f, 30.0f); - Vector3 relativeValue(targetValue - startValue); + int targetValue(30); + int relativeValue(targetValue - startValue); float delay = 0.5f; - animation.AnimateTo(Property(actor, "test-property"), + animation.AnimateTo(Property(actor, index), targetValue, - AlphaFunctions::Linear, + AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); // Start the animation @@ -4337,7 +4416,7 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriod(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( actor.GetProperty(index), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4345,7 +4424,7 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriod(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( actor.GetProperty(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*/); @@ -4353,36 +4432,30 @@ int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriod(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector3Component(void) +int UtcDaliAnimationAnimateToVector2P(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector3 property - Vector3 startValue(10.0f, 10.0f, 10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register a Vector2 property + 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(index), startValue, TEST_LOCATION ); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetValue(30.0f, 30.0f, 10.0f); - Vector3 relativeValue(targetValue - startValue); - float delay = 0.5f; - animation.AnimateTo(Property(actor, "test-property", 0), - 30.0f, - AlphaFunctions::Linear, - TimePeriod(delay, durationSeconds - delay)); - animation.AnimateTo(Property(actor, index, 1), - 30.0f, - AlphaFunctions::Linear, - TimePeriod(delay, durationSeconds - delay)); + Vector2 targetValue(50.0f, 50.0f); + Vector2 relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, index), targetValue); + + Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f); // Start the animation animation.Play(); @@ -4392,51 +4465,43 @@ int UtcDaliAnimationAnimateToVector3Component(void) 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 */); + application.Render(static_cast(durationSeconds*950.0f)/* 95% 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 ); + DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector4(void) +int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector4 property - Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register a Vector2 property + 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(index), startValue, TEST_LOCATION ); // Build the animation - float durationSeconds(2.0f); + float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f); - Vector4 relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, index), targetValue); + Vector2 targetValue(9000.0f, 9000.0f); + Vector2 relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT); - Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f); // Start the animation animation.Play(); @@ -4451,7 +4516,11 @@ int UtcDaliAnimationAnimateToVector4(void) // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); + + // The position should have moved more, than with a linear alpha function + Vector2 current(actor.GetProperty(index)); + DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); + DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); application.SendNotification(); application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); @@ -4459,30 +4528,31 @@ int UtcDaliAnimationAnimateToVector4(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector4AlphaFunction(void) +int UtcDaliAnimationAnimateToVector2TimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); - // Register a Vector4 property - Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + // Register a Vector2 property + 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(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f); - Vector4 relativeValue(targetValue - startValue); - animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut); - - Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f); + Vector2 targetValue(-10.0f, 20.0f); + Vector2 relativeValue(targetValue - startValue); + float delay = 0.5f; + animation.AnimateTo(Property(actor, index), + targetValue, + TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); @@ -4492,49 +4562,52 @@ int UtcDaliAnimationAnimateToVector4AlphaFunction(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% 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(); - - // The position should have moved more, than with a linear alpha function - Vector4 current(actor.GetProperty(index)); - DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); - DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); - // We did expect the animation to finish + // 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*/); + + // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector4TimePeriod(void) +int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(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( "test-property", startValue ); + // Register a Vector2 property + Vector2 startValue(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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f); - Vector4 relativeValue(targetValue - startValue); + Vector2 targetValue(30.0f, 30.0f); + Vector2 relativeValue(targetValue - startValue); float delay = 0.5f; animation.AnimateTo(Property(actor, index), targetValue, + AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay)); // Start the animation @@ -4550,7 +4623,7 @@ int UtcDaliAnimationAnimateToVector4TimePeriod(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( actor.GetProperty(index), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -4558,7 +4631,7 @@ int UtcDaliAnimationAnimateToVector4TimePeriod(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( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); @@ -4566,32 +4639,30 @@ int UtcDaliAnimationAnimateToVector4TimePeriod(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( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateToVector3P(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( "test-property", startValue ); + // Register a Vector3 property + 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 ); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(2.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, - AlphaFunctions::Linear, - TimePeriod(delay, durationSeconds - delay)); + Vector3 targetValue(50.0f, 50.0f, 50.0f); + Vector3 relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, index), targetValue); + + Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f); // Start the animation animation.Play(); @@ -4601,258 +4672,211 @@ int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriod(void) 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 */); + application.Render(static_cast(durationSeconds*950.0f)/* 95% 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 ); + DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorParentOrigin(void) +int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); + + // Register a Vector3 property + Vector3 startValue(1000.0f, 1000.0f, 1000.0f); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT); + Vector3 targetValue(9000.0f, 9000.0f, 9000.0f); + Vector3 relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT); - try - { - animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN), targetParentOrigin ); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION); - } - END_TEST; -} + Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f); -int UtcDaliAnimationAnimateToActorParentOriginX(void) -{ - TestApplication application; + // Start the animation + animation.Play(); - 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::PARENT_ORIGIN_X), startValue, TEST_LOCATION ); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - float targetX(1.0f); + application.SendNotification(); + application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); - try - { - animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_X), targetX ); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION); - } + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + + // The position should have moved more, than with a linear alpha function + Vector3 current(actor.GetProperty(index)); + DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); + DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); + DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorParentOriginY(void) +int UtcDaliAnimationAnimateToVector3TimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); + + // Register a Vector3 property + Vector3 startValue(10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::PARENT_ORIGIN_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetY(1.0f); + Vector3 targetValue(-10.0f, 20.0f, 100.0f); + Vector3 relativeValue(targetValue - startValue); + float delay = 0.5f; + animation.AnimateTo(Property(actor, index), + targetValue, + TimePeriod(delay, durationSeconds - delay)); - try - { - animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Y), targetY ); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION); - } - END_TEST; -} + // Start the animation + animation.Play(); -int UtcDaliAnimationAnimateToActorParentOriginZ(void) -{ - TestApplication application; + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); - 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::PARENT_ORIGIN_Z), startValue, TEST_LOCATION ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - float targetZ(1.0f); + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - try - { - animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Z), targetZ ); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", 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*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorAnchorPoint(void) +int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); + + // Register a Vector3 property + Vector3 startValue(10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT); + Vector3 targetValue(30.0f, 30.0f, 30.0f); + Vector3 relativeValue(targetValue - startValue); + float delay = 0.5f; + animation.AnimateTo(Property(actor, "testProperty"), + targetValue, + AlphaFunction::LINEAR, + TimePeriod(delay, durationSeconds - delay)); - try - { - animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT), targetAnchorPoint); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION); - } - END_TEST; -} + // Start the animation + animation.Play(); -int UtcDaliAnimationAnimateToActorAnchorPointX(void) -{ - TestApplication application; + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); - 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::ANCHOR_POINT_X), startValue, TEST_LOCATION ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - float targetX(1.0f); + // We didn't expect the animation to finish yet + application.SendNotification(); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); - try - { - animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_X), targetX ); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", 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*/); + + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorAnchorPointY(void) +int UtcDaliAnimationAnimateToVector3ComponentP(void) { TestApplication application; Actor actor = Actor::New(); + + // Register a Vector3 property + Vector3 startValue(10.0f, 10.0f, 10.0f); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - float startValue(0.5f); - DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::ANCHOR_POINT_Y), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetY(0.0f); - - try - { - animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Y), targetY ); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION); - } - END_TEST; -} - -int UtcDaliAnimationAnimateToActorAnchorPointZ(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::ANCHOR_POINT_Z), startValue, TEST_LOCATION ); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - float targetZ(100.0f); - - try - { - animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Z), targetZ ); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION); - } - END_TEST; -} - -int UtcDaliAnimationAnimateToActorSize(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::SIZE), targetSize ); - - Vector3 ninetyNinePercentProgress(targetSize * 0.99f); + Vector3 targetValue(30.0f, 30.0f, 10.0f); + Vector3 relativeValue(targetValue - startValue); + float delay = 0.5f; + animation.AnimateTo(Property(actor, "testProperty", 0), + 30.0f, + AlphaFunction::LINEAR, + TimePeriod(delay, durationSeconds - delay)); + animation.AnimateTo(Property(actor, index, 1), + 30.0f, + AlphaFunction::LINEAR, + TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); @@ -4862,107 +4886,51 @@ int UtcDaliAnimationAnimateToActorSize(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::SIZE), targetSize, AlphaFunctions::EaseIn); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% 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(); - - // 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::SIZE), targetSize, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay)); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + 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.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue+(relativeValue*0.5f), TEST_LOCATION ); 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(), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorSizeWidth(void) +int UtcDaliAnimationAnimateToVector4P(void) { TestApplication application; Actor actor = Actor::New(); + + // Register a Vector4 property + Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SIZE_WIDTH), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation - float durationSeconds(1.0f); + float durationSeconds(2.0f); Animation animation = Animation::New(durationSeconds); - float targetWidth(10.0f); - animation.AnimateTo( Property(actor, Actor::SIZE_WIDTH), targetWidth ); + Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f); + Vector4 relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, index), targetValue); - float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f); + Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f); // Start the animation animation.Play(); @@ -4972,42 +4940,43 @@ int UtcDaliAnimationAnimateToActorSizeWidth(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); // 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::SIZE_WIDTH), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), ninetyFivePercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*50.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::SIZE_WIDTH), targetWidth, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorSizeHeight(void) +int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); + + // Register a Vector4 property + Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); - float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SIZE_HEIGHT), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetHeight(-10.0f); - animation.AnimateTo( Property(actor, Actor::SIZE_HEIGHT), targetHeight ); + Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f); + Vector4 relativeValue(targetValue - startValue); + animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT); - float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f); + Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f); // Start the animation animation.Play(); @@ -5017,42 +4986,50 @@ int UtcDaliAnimationAnimateToActorSizeHeight(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); // 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::SIZE_HEIGHT), fiftyPercentProgress, TEST_LOCATION ); + + // The position should have moved more, than with a linear alpha function + Vector4 current(actor.GetProperty(index)); + DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); + DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); + DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); + DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + application.Render(static_cast(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/); // 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::SIZE_HEIGHT), targetHeight, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorSizeDepth(void) +int UtcDaliAnimationAnimateToVector4TimePeriodP(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); - float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SIZE_DEPTH), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, VECTOR4_EPSILON, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetDepth(-10.0f); - animation.AnimateTo( Property(actor, Actor::SIZE_DEPTH), targetDepth ); - - float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f); + Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f); + Vector4 relativeValue(targetValue - startValue); + float delay = 0.5f; + animation.AnimateTo(Property(actor, index), + targetValue, + TimePeriod(delay, durationSeconds - delay)); // Start the animation animation.Play(); @@ -5062,40 +5039,53 @@ int UtcDaliAnimationAnimateToActorSizeDepth(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.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SIZE_DEPTH), fiftyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, VECTOR4_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)/* 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), 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( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SIZE_DEPTH), targetDepth, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorPosition(void) +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.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), startValue, 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::POSITION), targetPosition); - - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + 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(); @@ -5105,12 +5095,20 @@ int UtcDaliAnimationAnimateToActorPosition(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(), seventyFivePercentProgress, TEST_LOCATION ); + 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*/); @@ -5118,283 +5116,237 @@ int UtcDaliAnimationAnimateToActorPosition(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(index), targetValue, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorPositionX(void) +int UtcDaliAnimationAnimateToActorParentOriginP(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::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetX(1.0f); - animation.AnimateTo( Property(actor, Actor::POSITION_X), targetX ); - - float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); - - // 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% 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::POSITION_X), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Z), startValue, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT); - // 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::POSITION_X), targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Z), startValue, TEST_LOCATION ); + 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 UtcDaliAnimationAnimateToActorPositionY(void) +int UtcDaliAnimationAnimateToActorParentOriginXP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Z), startValue, TEST_LOCATION ); + 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 targetY(10.0f); - animation.AnimateTo( Property(actor, Actor::POSITION_Y), targetY ); - - float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); - - // 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% 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::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Y), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Z), startValue, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + float targetX(1.0f); - // 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::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Y), targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Z), startValue, TEST_LOCATION ); + 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 UtcDaliAnimationAnimateToActorPositionZ(void) +int UtcDaliAnimationAnimateToActorParentOriginYP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); float startValue(0.0f); - DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Z), startValue, TEST_LOCATION ); + 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 targetZ(-5.0f); - animation.AnimateTo( Property(actor, Actor::POSITION_Z), targetZ ); - - float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); - - // 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% 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::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Z), fiftyPercentProgress, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + float targetY(1.0f); - // 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::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::POSITION_Z), targetZ, TEST_LOCATION ); + 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 UtcDaliAnimationAnimateToActorPositionAlphaFunction(void) +int UtcDaliAnimationAnimateToActorParentOriginZP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, 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); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - animation.AnimateTo(Property(actor, Actor::POSITION), targetPosition, AlphaFunctions::EaseIn); - - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); - - // Start the animation - animation.Play(); - - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + float targetZ(1.0f); - application.SendNotification(); - application.Render(static_cast(durationSeconds*750.0f)/* 75% progress */); + 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; +} - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); +int UtcDaliAnimationAnimateToActorAnchorPointP(void) +{ + TestApplication application; - // 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 ); + Actor actor = Actor::New(); + Stage::GetCurrent().Add(actor); + DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + 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; } -int UtcDaliAnimationAnimateToActorPositionTimePeriod(void) +int UtcDaliAnimationAnimateToActorAnchorPointXP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, 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); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - float delay = 0.5f; - animation.AnimateTo( Property(actor, Actor::POSITION), - targetPosition, - TimePeriod( delay, durationSeconds - delay ) ); + float targetX(1.0f); - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + 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; +} - // Start the animation - animation.Play(); +int UtcDaliAnimationAnimateToActorAnchorPointYP(void) +{ + TestApplication application; - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + 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 ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + float targetY(0.0f); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + 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); + } + END_TEST; +} - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */); +int UtcDaliAnimationAnimateToActorAnchorPointZP(void) +{ + TestApplication application; - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); + 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 ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/); + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + float targetZ(100.0f); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + 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); + } END_TEST; } -int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateToActorSizeP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, 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::POSITION), - targetPosition, - AlphaFunctions::Linear, - TimePeriod( delay, durationSeconds - delay ) ); + Vector3 targetSize(100.0f, 100.0f, 100.0f); + animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize ); - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + Vector3 ninetyNinePercentProgress(targetSize * 0.99f); // Start the animation animation.Play(); @@ -5404,161 +5356,107 @@ int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriod(void) 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.GetCurrentPosition(), Vector3::ZERO, 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*990.0f)/* 99% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/); + 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 ); - END_TEST; -} - -int UtcDaliAnimationAnimateToActorRotationAngleAxis(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, 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); - animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) ); + DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); - // Start the animation - animation.Play(); + // Reset everything + finishCheck.Reset(); + actor.SetSize(Vector3::ZERO); + application.SendNotification(); + application.Render(0); + DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); + // 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*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.GetCurrentRotation(), Quaternion(targetRotationRadians * 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.GetCurrentRotation(), 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.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + // 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*250.0f) + 1u/*just beyond the animation duration*/); + 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.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliAnimationAnimateToActorRotationQuaternion(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, 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); - Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS); - animation.AnimateTo( Property(actor, Actor::ROTATION), targetRotation ); - - // 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.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); + // Reset everything + finishCheck.Reset(); + actor.SetSize(Vector3::ZERO); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + application.Render(0); + DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, 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*250.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.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, 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.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorRotationAlphaFunction(void) +int UtcDaliAnimationAnimateToActorSizeWidthP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn); + float targetWidth(10.0f); + animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth ); + + float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f); // Start the animation animation.Play(); @@ -5568,55 +5466,41 @@ int UtcDaliAnimationAnimateToActorRotationAlphaFunction(void) 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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().width, 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.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorRotationTimePeriod(void) +int UtcDaliAnimationAnimateToActorSizeHeightP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - float delay(0.1f); - animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay)); + float targetHeight(-10.0f); + animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight ); + + float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f); // Start the animation animation.Play(); @@ -5626,58 +5510,41 @@ int UtcDaliAnimationAnimateToActorRotationTimePeriod(void) 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(); - float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, 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(); - progress = max(0.0f, 0.5f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, 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(); - progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().height, 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.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorRotationAlphaFunctionTimePeriod(void) +int UtcDaliAnimationAnimateToActorSizeDepthP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - float delay(0.1f); - animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn, TimePeriod(delay, durationSeconds - delay)); + float targetDepth(-10.0f); + animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth ); + + float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f); // Start the animation animation.Play(); @@ -5687,57 +5554,39 @@ int UtcDaliAnimationAnimateToActorRotationAlphaFunctionTimePeriod(void) 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(); - float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% 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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), 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(); - progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().depth, 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.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorScale(void) +int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, 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::SCALE), targetScale ); + Vector3 targetSize(100.0f, 100.0f, 100.0f); + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize ); - Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f); + Vector3 ninetyNinePercentProgress(targetSize * 0.99f); // Start the animation animation.Play(); @@ -5752,7 +5601,7 @@ int UtcDaliAnimationAnimateToActorScale(void) // 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.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); @@ -5760,18 +5609,19 @@ int UtcDaliAnimationAnimateToActorScale(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); // Reset everything finishCheck.Reset(); - actor.SetScale(Vector3::ONE); + actor.SetSize(Vector3::ZERO); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); + 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::SCALE), targetScale, AlphaFunctions::EaseIn); + 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(); @@ -5782,14 +5632,12 @@ int UtcDaliAnimationAnimateToActorScale(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); - // The scale should have grown less, than with a linear alpha function - Vector3 current(actor.GetCurrentScale()); - DALI_TEST_CHECK( current.x > 1.0f ); - DALI_TEST_CHECK( current.y > 1.0f ); - DALI_TEST_CHECK( current.z > 1.0f ); + // 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 ); - DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z ); application.SendNotification(); application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); @@ -5797,19 +5645,21 @@ int UtcDaliAnimationAnimateToActorScale(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, 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(); - actor.SetScale(Vector3::ONE); + actor.SetSize(Vector3::ZERO); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); + 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::SCALE), targetScale, AlphaFunctions::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(); @@ -5819,7 +5669,7 @@ int UtcDaliAnimationAnimateToActorScale(void) // 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.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -5827,29 +5677,26 @@ int UtcDaliAnimationAnimateToActorScale(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, 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 UtcDaliAnimationAnimateToActorScaleX(void) +int UtcDaliAnimationAnimateToActorPositionP(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::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_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(10.0f); - animation.AnimateTo( Property(actor, Actor::SCALE_X), targetX ); + Vector3 targetPosition(200.0f, 200.0f, 200.0f); + animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition); - float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); + Vector3 seventyFivePercentProgress(targetPosition * 0.75f); // Start the animation animation.Play(); @@ -5859,48 +5706,42 @@ int UtcDaliAnimationAnimateToActorScaleX(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); + 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.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_X), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); 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.GetCurrentScale().x, targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_X), targetX, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Z), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorScaleY(void) +int UtcDaliAnimationAnimateToActorPositionXP(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::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Z), startValue, TEST_LOCATION ); + 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetY(1000.0f); - animation.AnimateTo( Property(actor, Actor::SCALE_Y), targetY ); + float targetX(1.0f); + animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX ); - float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); // Start the animation animation.Play(); @@ -5915,10 +5756,7 @@ int UtcDaliAnimationAnimateToActorScaleY(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::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Y), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Z), startValue, 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*/); @@ -5926,32 +5764,32 @@ int UtcDaliAnimationAnimateToActorScaleY(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::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Y), targetY, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Z), startValue, 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 UtcDaliAnimationAnimateToActorScaleZ(void) +int UtcDaliAnimationAnimateToActorPositionYP(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::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Z), startValue, TEST_LOCATION ); + 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - float targetZ(-1000.0f); - animation.AnimateTo( Property(actor, Actor::SCALE_Z), targetZ ); + float targetY(10.0f); + animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY ); - float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); + float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); // Start the animation animation.Play(); @@ -5966,10 +5804,7 @@ int UtcDaliAnimationAnimateToActorScaleZ(void) // 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::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Z), 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*/); @@ -5977,29 +5812,32 @@ int UtcDaliAnimationAnimateToActorScaleZ(void) // 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::SCALE_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::SCALE_Z), targetZ, 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 UtcDaliAnimationAnimateToActorColor(void) +int UtcDaliAnimationAnimateToActorPositionZP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); + 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector4 targetColor(Color::RED); - animation.AnimateTo( Property(actor, Actor::COLOR), targetColor ); + float targetZ(-5.0f); + animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ ); - Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f)); - Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f)); + float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); // Start the animation animation.Play(); @@ -6009,118 +5847,146 @@ int UtcDaliAnimationAnimateToActorColor(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 10% 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.GetCurrentColor(), tenPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*900.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.GetCurrentColor(), targetColor, 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; +} - // Reset everything - finishCheck.Reset(); - actor.SetColor(Color::WHITE); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); +int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void) +{ + TestApplication application; - // Repeat with a different (ease-in) alpha function - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::EaseIn); - animation.FinishedSignal().Connect(&application, finishCheck); + 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, AlphaFunction::EASE_IN); + + Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + + // Start the animation animation.Play(); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); + application.Render(static_cast(durationSeconds*750.0f)/* 75% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - // The color should have changed less, than with a linear alpha function - Vector4 current(actor.GetCurrentColor()); - DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change - DALI_TEST_CHECK( current.y < 1.0f ); - DALI_TEST_CHECK( current.y > tenPercentProgress.y ); - DALI_TEST_CHECK( current.z < 1.0f ); - DALI_TEST_CHECK( current.z > tenPercentProgress.z ); - DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change + // 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*900.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.GetCurrentColor(), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + END_TEST; +} - // Reset everything - finishCheck.Reset(); - actor.SetColor(Color::WHITE); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); +int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void) +{ + TestApplication application; - // Repeat with a shorter animator duration - float animatorDuration = 0.5f; - animation = Animation::New(durationSeconds); - animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::Linear, TimePeriod(animatorDuration)); - animation.FinishedSignal().Connect(&application, finishCheck); + 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); + float delay = 0.5f; + animation.AnimateTo( Property(actor, Actor::Property::POSITION), + targetPosition, + TimePeriod( delay, durationSeconds - delay ) ); + + Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + + // Start the animation animation.Play(); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); - application.Render(static_cast(durationSeconds*100.0f)/* 10% animation progress, 20% animator 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.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */); + 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.GetCurrentColor(), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, 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.25) + 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 ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorColorRed(void) +int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 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 targetRed(0.5f); - animation.AnimateTo( Property(actor, Actor::COLOR_RED), targetRed ); + 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 + (targetRed - startValue)*0.5f); + Vector3 seventyFivePercentProgress(targetPosition * 0.75f); // Start the animation animation.Play(); @@ -6130,51 +5996,46 @@ int UtcDaliAnimationAnimateToActorColorRed(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.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 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.GetCurrentColor().r, targetRed, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), targetRed, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorColorGreen(void) +int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void) { TestApplication application; Actor actor = Actor::New(); + actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 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 targetGreen(0.5f); - animation.AnimateTo( Property(actor, Actor::COLOR_GREEN), targetGreen ); - - float fiftyPercentProgress(startValue + (targetGreen - 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(); @@ -6184,51 +6045,55 @@ int UtcDaliAnimationAnimateToActorColorGreen(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.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 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.GetCurrentColor().g, targetGreen, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), targetGreen, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorColorBlue(void) +int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void) { TestApplication application; Actor actor = Actor::New(); + actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 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 targetBlue(0.5f); - animation.AnimateTo( Property(actor, Actor::COLOR_BLUE), targetBlue ); - - float fiftyPercentProgress(startValue + (targetBlue - 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(); @@ -6238,51 +6103,54 @@ int UtcDaliAnimationAnimateToActorColorBlue(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.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 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.GetCurrentColor().b, targetBlue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), targetBlue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationAnimateToActorColorAlpha(void) +int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); + actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) ); Stage::GetCurrent().Add(actor); - float startValue(1.0f); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), startValue, 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); - float targetAlpha(0.5f); - animation.AnimateTo( Property(actor, Actor::COLOR_ALPHA), targetAlpha ); - - float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f); + 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(); @@ -6292,236 +6160,176 @@ int UtcDaliAnimationAnimateToActorColorAlpha(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.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION ); + 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*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*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*/); // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), targetAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } - - -int UtcDaliAnimationKeyFrames01(void) +int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void) { TestApplication application; - KeyFrames keyFrames = KeyFrames::New(); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); + 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 ); - 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); + // 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)); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION); + // Start the animation + animation.Play(); - try - { - keyFrames.Add(1.9f, false); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "mType == value.GetType()", 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(); + 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*250.0f)/* 50% 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, 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(); + 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.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationKeyFrames02(void) +int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(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) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION); - } - END_TEST; -} - - -int UtcDaliAnimationKeyFrames03(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) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION); - } - END_TEST; -} - - -int UtcDaliAnimationKeyFrames04(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) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION); - } - END_TEST; -} + 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 ); -int UtcDaliAnimationKeyFrames05(void) -{ - TestApplication application; + // 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)); - KeyFrames keyFrames = KeyFrames::New(); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); + // Start the animation + animation.Play(); - 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)); + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION); + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); - try - { - keyFrames.Add(0.7f, Quaternion(1.717f, Vector3::XAXIS)); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION); - } - END_TEST; -} + // 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 ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); -int UtcDaliAnimationKeyFrames06(void) -{ - TestApplication application; + // 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 ); - KeyFrames keyFrames = KeyFrames::New(); - DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); - keyFrames.Add(0.0f, Quaternion(1.717f, Vector3::XAXIS)); - keyFrames.Add(0.2f, Quaternion(2.0f, Vector3::XAXIS)); - keyFrames.Add(0.4f, Quaternion(3.0f, Vector3::ZAXIS)); - keyFrames.Add(0.6f, Quaternion(4.0f, Vector3(1.0f, 1.0f, 1.0f))); - keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS)); - keyFrames.Add(1.0f, Quaternion(3.0f, Vector3::YAXIS)); + // 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(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION); + application.SendNotification(); + application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); - try - { - keyFrames.Add(0.7f, 1.1f); - } - catch (Dali::DaliException& e) - { - tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str()); - DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION); - } + // 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 UtcDaliAnimationAnimateBetweenActorColorAlpha(void) +int UtcDaliAnimationAnimateToActorScaleP(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::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); + Vector3 targetScale(2.0f, 2.0f, 2.0f); + animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale ); - 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::COLOR_ALPHA), keyFrames ); + Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f); // Start the animation animation.Play(); @@ -6529,92 +6337,111 @@ int UtcDaliAnimationAnimateBetweenActorColorAlpha(void) bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); - application.Render(0); + 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.GetCurrentColor().a, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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*10.0f) + 1u/*just beyond the animation duration*/); - application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); + // We did expect the animation to finish application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*100.0f)/* 40% progress */); + // Reset everything + finishCheck.Reset(); + actor.SetScale(Vector3::ONE); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION ); + 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.Render(static_cast(durationSeconds*400.0f)/* 80% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); - application.Render(static_cast(durationSeconds*100.0f)/* 90% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + + // The scale should have grown less, than with a linear alpha function + Vector3 current(actor.GetCurrentScale()); + DALI_TEST_CHECK( current.x > 1.0f ); + DALI_TEST_CHECK( current.y > 1.0f ); + DALI_TEST_CHECK( current.z > 1.0f ); + DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x ); + DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y ); + DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z ); - application.Render(static_cast(durationSeconds*100.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION ); + 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.GetCurrentScale(), Vector3::ONE, 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.GetCurrentScale(), targetScale, TEST_LOCATION ); END_TEST; } - -int UtcDaliAnimationAnimateBetweenActorColor(void) +int UtcDaliAnimationAnimateToActorScaleXP(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::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), startValue, 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 ); // 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 ); - 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::COLOR), keyFrames ); + float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); // Start the animation animation.Play(); @@ -6622,75 +6449,50 @@ int UtcDaliAnimationAnimateBetweenActorColor(void) bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); - application.Render(0); - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION ); + 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 ); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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_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 ); END_TEST; } -int UtcDaliAnimationAnimateBetweenActorVisible01(void) +int UtcDaliAnimationAnimateToActorScaleYP(void) { TestApplication application; Actor actor = Actor::New(); - AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetRotation(aa.angle, aa.axis); Stage::GetCurrent().Add(actor); - - application.SendNotification(); - application.Render(0); - - DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION ); + 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 ); // 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 ); - KeyFrames keyFrames = KeyFrames::New(); - keyFrames.Add(0.0f, false); - keyFrames.Add(0.2f, true); - keyFrames.Add(0.4f, true); - keyFrames.Add(0.8f, false); - keyFrames.Add(1.0f, true); - - animation.AnimateBetween( Property(actor, Actor::VISIBLE), keyFrames ); + float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); // Start the animation animation.Play(); @@ -6698,40 +6500,50 @@ int UtcDaliAnimationAnimateBetweenActorVisible01(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.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); + 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 ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); - DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION); + // 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 ); END_TEST; } -int UtcDaliAnimationAnimateBetweenActorRotation01(void) +int UtcDaliAnimationAnimateToActorScaleZP(void) { TestApplication application; Actor actor = Actor::New(); - AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetRotation(aa.angle, aa.axis); Stage::GetCurrent().Add(actor); - - application.SendNotification(); - application.Render(0); - Quaternion start(Radian(aa.angle), aa.axis); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, 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 ); // 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 keyFrames = KeyFrames::New(); - keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS)); - - animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames ); + float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); // Start the animation animation.Play(); @@ -6739,44 +6551,47 @@ int UtcDaliAnimationAnimateBetweenActorRotation01(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.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)+1); - 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 ); - Quaternion check = Quaternion::FromAxisAngle(Vector4::ZAXIS, Radian(Degree(60))); + application.SendNotification(); + application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, 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 ); END_TEST; } -int UtcDaliAnimationAnimateBetweenActorRotation02(void) +int UtcDaliAnimationAnimateToActorColorP(void) { TestApplication application; Actor actor = Actor::New(); - AngleAxis aa(Degree(90), Vector3::XAXIS); - actor.SetRotation(aa.angle, aa.axis); - application.SendNotification(); - application.Render(0); Stage::GetCurrent().Add(actor); - - Quaternion start(Radian(aa.angle), aa.axis); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); + Vector4 targetColor(Color::RED); + animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor ); - KeyFrames keyFrames = KeyFrames::New(); - keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS)); - keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS)); - keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS)); - - animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames ); + 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(); @@ -6784,106 +6599,120 @@ int UtcDaliAnimationAnimateBetweenActorRotation02(void) bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); - application.Render(0); + 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 ); - Quaternion check(Radian(Degree(60)), Vector3::XAXIS); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION ); + application.SendNotification(); + application.Render(static_cast(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + // We did expect the animation to finish application.SendNotification(); - check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(90))); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION ); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + // Reset everything + finishCheck.Reset(); + actor.SetColor(Color::WHITE); application.SendNotification(); - check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(120))); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION ); + 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.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - check = Quaternion::FromAxisAngle(Vector4(0.5f, 0.5f, 0.0f, 0.0f), Radian(Degree(101.5))); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*100.0f)/* 10% progress */); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - check = Quaternion::FromAxisAngle(Vector4::YAXIS, Radian(Degree(120))); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); - // We did expect the animation to finish + // 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 - finishCheck.CheckSignalReceived(); - END_TEST; -} + application.SendNotification(); + application.Render(static_cast(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/); -int UtcDaliAnimationMoveByFloat3(void) -{ - TestApplication application; + // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION ); - Actor actor = Actor::New(); - Vector3 startPosition(10.0f, 10.0f, 10.0f); - actor.SetPosition(startPosition); - Stage::GetCurrent().Add(actor); + // Reset everything + finishCheck.Reset(); + actor.SetColor(Color::WHITE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION ); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(20.0f, 20.0f, 20.0f); - Vector3 relativePosition(targetPosition - startPosition); - animation.MoveBy(actor, relativePosition.x, relativePosition.y, relativePosition.z); - - Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); + DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); - // Start the animation + // 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(); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); + application.Render(static_cast(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION ); + + application.SendNotification(); + 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(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION ); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.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.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationMoveByVector3Alpha(void) +int UtcDaliAnimationAnimateToActorColorRedP(void) { TestApplication application; Actor actor = Actor::New(); - Vector3 startPosition(10.0f, 10.0f, 10.0f); - actor.SetPosition(startPosition); Stage::GetCurrent().Add(actor); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(20.0f, 20.0f, 20.0f); - Vector3 relativePosition(targetPosition - startPosition); - animation.MoveBy(actor, relativePosition, AlphaFunctions::EaseOut); + float targetRed(0.5f); + animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed ); - Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); + float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f); // Start the animation animation.Play(); @@ -6893,49 +6722,51 @@ int UtcDaliAnimationMoveByVector3Alpha(void) animation.FinishedSignal().Connect(&application, finishCheck); application.SendNotification(); - application.Render(static_cast(durationSeconds*950.0f)/* 95% progress */); + application.Render(static_cast(durationSeconds*500.0f)/* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - - // The position should have moved more, than with a linear alpha function - Vector3 current(actor.GetCurrentPosition()); - DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x ); - DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y ); - DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z ); + 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 ); application.SendNotification(); - application.Render(static_cast(durationSeconds*50.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.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + 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 UtcDaliAnimationMoveByVector3AlphaFloat2(void) +int UtcDaliAnimationAnimateToActorColorGreenP(void) { TestApplication application; Actor actor = Actor::New(); - Vector3 startPosition(10.0f, 10.0f, 10.0f); - actor.SetPosition(startPosition); Stage::GetCurrent().Add(actor); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION ); + 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); - Vector3 targetPosition(20.0f, 20.0f, 20.0f); - Vector3 relativePosition(targetPosition - startPosition); - float delay = 0.5f; - animation.MoveBy(actor, relativePosition, AlphaFunctions::Linear, delay, durationSeconds - delay); + float targetGreen(0.5f); + animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen ); - Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f); + float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f); // Start the animation animation.Play(); @@ -6945,12 +6776,16 @@ int UtcDaliAnimationMoveByVector3AlphaFloat2(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*500.0f)/* 50% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION ); + 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 ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -6958,25 +6793,34 @@ int UtcDaliAnimationMoveByVector3AlphaFloat2(void) // We did expect the animation to finish application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + 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 UtcDaliAnimationMoveToFloat3(void) +int UtcDaliAnimationAnimateToActorColorBlueP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + float startValue(1.0f); + 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - animation.MoveTo(actor, targetPosition.x, targetPosition.y, targetPosition.z); + float targetBlue(0.5f); + animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue ); - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f); // Start the animation animation.Play(); @@ -6986,38 +6830,51 @@ int UtcDaliAnimationMoveToFloat3(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% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); + 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 ); 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.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + 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 UtcDaliAnimationMoveToVector3Alpha(void) +int UtcDaliAnimationAnimateToActorColorAlphaP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - animation.MoveTo(actor, targetPosition, AlphaFunctions::EaseIn); + float targetAlpha(0.5f); + animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha ); - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f); // Start the animation animation.Play(); @@ -7027,153 +6884,254 @@ int UtcDaliAnimationMoveToVector3Alpha(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% progress */); // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - - // 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 ); + 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 ); 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.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + 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 UtcDaliAnimationMoveToVector3AlphaFloat2(void) +int UtcDaliAnimationKeyFrames01P(void) { TestApplication application; - Actor actor = Actor::New(); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, 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); - Vector3 targetPosition(200.0f, 200.0f, 200.0f); - float delay = 0.5f; - animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear, delay, durationSeconds - delay); + keyFrames.Add(0.0f, 0.1f); - Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + 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% animation progress, 0% animator 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.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + END_TEST; +} - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */); +int UtcDaliAnimationKeyFrames02P(void) +{ + TestApplication application; - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION ); + KeyFrames keyFrames = KeyFrames::New(); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/); + 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); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION ); + 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 UtcDaliAnimationRotateByDegreeVector3(void) +int UtcDaliAnimationKeyFrames03P(void) { TestApplication application; - Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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); - Degree relativeRotationDegrees(360.0f); - Radian relativeRotationRadians(relativeRotationDegrees); - animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS); + 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); - // Start the animation - animation.Play(); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION); - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); + 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; +} - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); +int UtcDaliAnimationKeyFrames04P(void) +{ + TestApplication application; - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + KeyFrames keyFrames = KeyFrames::New(); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + 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)); - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION); - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + 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; +} - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); +int UtcDaliAnimationKeyFrames05P(void) +{ + TestApplication application; - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + KeyFrames keyFrames = KeyFrames::New(); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f)); + keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f)); + keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f)); + keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f)); + keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f)); + keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f)); + + DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION); + + try + { + keyFrames.Add(0.7f, 1.0f); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliAnimationKeyFrames06P(void) +{ + TestApplication application; + + KeyFrames keyFrames = KeyFrames::New(); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); + + keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); + keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f)); + keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f)); + keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f)); + keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f)); + + DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION); + + try + { + keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS)); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION); + } + END_TEST; +} + +int UtcDaliAnimationKeyFrames07P(void) +{ + TestApplication application; + + KeyFrames keyFrames = KeyFrames::New(); + DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION); + + keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS)); + keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS)); + keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS)); + keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f))); + keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS)); + keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS)); + + DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION); + + try + { + keyFrames.Add(0.7f, 1.1f); + } + catch (Dali::DaliException& e) + { + DALI_TEST_PRINT_ASSERT( e ); + DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION); + } END_TEST; } -int UtcDaliAnimationRotateByRadianVector3(void) +int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(360.0f); - Radian relativeRotationRadians(relativeRotationDegrees); - animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS); + + 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(); @@ -7181,113 +7139,186 @@ int UtcDaliAnimationRotateByRadianVector3(void) 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.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, 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*250.0f)/* 50% progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, 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), 0.25f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*100.0f)/* 40% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*400.0f)/* 80% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, 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), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION ); + + 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(static_cast(durationSeconds*100.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateByDegreeVector3Alpha(void) +int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(360.0f); - Radian relativeRotationRadians(relativeRotationDegrees); - animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn); - // Start the animation - animation.Play(); + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, 0.1f); + keyFrames.Add(0.2f, 0.5f); + keyFrames.Add(0.4f, 0.0f); + keyFrames.Add(0.6f, 1.0f); + keyFrames.Add(0.8f, 0.7f); + keyFrames.Add(1.0f, 0.9f); + + animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic ); + + // Start the animation + animation.Play(); bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); - - // We didn't expect the animation to finish yet + application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, 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*250.0f)/* 50% progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*200.0f)/* 30% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, 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), 0.21f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*100.0f)/* 40% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*400.0f)/* 80% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, 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), 0.7f, 0.01f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*100.0f)/* 90% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + 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 ); - // We did expect the animation to finish + application.Render(static_cast(durationSeconds*100.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 ); + + // We did expect the animation to finish + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateByRadianVector3Alpha(void) +int UtcDaliAnimationAnimateBetweenActorColorP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(360.0f); - Radian relativeRotationRadians(relativeRotationDegrees); - animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn); + + 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(); @@ -7295,57 +7326,74 @@ int UtcDaliAnimationRotateByRadianVector3Alpha(void) 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.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + 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 ); - // 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.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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.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.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateByDegreeVector3AlphaFloat2(void) +int UtcDaliAnimationAnimateBetweenActorColorCubicP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(360.0f); - Radian relativeRotationRadians(relativeRotationDegrees); - float delay = 0.3f; - animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay); + + 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(); @@ -7353,61 +7401,75 @@ int UtcDaliAnimationRotateByDegreeVector3AlphaFloat2(void) 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.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.5f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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.SendNotification(); 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.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 ); + application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } - -int UtcDaliAnimationRotateByRadianVector3AlphaFloat2(void) +int UtcDaliAnimationAnimateBetweenActorVisibleP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(0); + + DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree relativeRotationDegrees(360.0f); - Radian relativeRotationRadians(relativeRotationDegrees); - float delay = 0.3f; - animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, false); + keyFrames.Add(0.2f, true); + keyFrames.Add(0.4f, true); + keyFrames.Add(0.8f, false); + keyFrames.Add(1.0f, true); + + animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames ); // Start the animation animation.Play(); @@ -7415,59 +7477,45 @@ int UtcDaliAnimationRotateByRadianVector3AlphaFloat2(void) 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(); - float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), 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(); - progress = max(0.0f, 0.5f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), 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.Render(static_cast(durationSeconds*500.0f)); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - + application.Render(static_cast(durationSeconds*500.0f)+1); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); - // We did expect the animation to finish - application.SendNotification(); + DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateToDegreeVector3(void) +int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(0); + + DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, false); + keyFrames.Add(0.2f, true); + keyFrames.Add(0.4f, true); + keyFrames.Add(0.8f, false); + keyFrames.Add(1.0f, true); + + //Cubic interpolation for boolean values should be ignored + animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic ); // Start the animation animation.Play(); @@ -7475,56 +7523,40 @@ int UtcDaliAnimationRotateToDegreeVector3(void) 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.GetCurrentRotation(), Quaternion(targetRotationRadians * 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.GetCurrentRotation(), 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.Render(static_cast(durationSeconds*500.0f)); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - + application.Render(static_cast(durationSeconds*500.0f)+1); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); - // We did expect the animation to finish - application.SendNotification(); + DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateToRadianVector3(void) +int UtcDaliAnimationAnimateBetweenActorOrientation01P(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(0); + Quaternion start(Radian(aa.angle), aa.axis); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS)); + + animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames ); // Start the animation animation.Play(); @@ -7532,57 +7564,44 @@ int UtcDaliAnimationRotateToRadianVector3(void) 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.GetCurrentRotation(), Quaternion(targetRotationRadians * 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.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - + application.Render(static_cast(durationSeconds*500.0f)); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); - - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*500.0f)+1); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), 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*/); + Quaternion check( Radian(Degree(60)), Vector3::ZAXIS ); - // We did expect the animation to finish - application.SendNotification(); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateToQuaternion(void) +int UtcDaliAnimationAnimateBetweenActorOrientation02P(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + 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.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS); - animation.RotateTo(actor, targetRotation/*Quaternion version*/); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS)); + keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS)); + keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS)); + + animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames ); // Start the animation animation.Play(); @@ -7590,56 +7609,63 @@ int UtcDaliAnimationRotateToQuaternion(void) 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.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + Quaternion check(Radian(Degree(60)), Vector3::XAXIS); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + check = Quaternion( Radian(Degree(90)), Vector3::XAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + check = Quaternion( Radian(Degree(120)), Vector3::XAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, 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*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + check = Quaternion( Radian(Degree(120)), Vector3::YAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); // We did expect the animation to finish - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateToDegreeVector3Alpha(void) +int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + + application.SendNotification(); + application.Render(0); + Quaternion start(Radian(aa.angle), aa.axis); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn); + + 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(); @@ -7647,56 +7673,111 @@ int UtcDaliAnimationRotateToDegreeVector3Alpha(void) 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(); + + Quaternion check( Radian(Degree(60)), Vector3::ZAXIS ); + + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + finishCheck.CheckSignalReceived(); + END_TEST; +} + +int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void) +{ + TestApplication application; + Actor actor = Actor::New(); + AngleAxis aa(Degree(90), Vector3::XAXIS); + actor.SetOrientation(aa.angle, aa.axis); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + application.Render(0); + Stage::GetCurrent().Add(actor); - // We didn't expect the animation to finish yet + Quaternion start(Radian(aa.angle), aa.axis); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION ); + + // Build the animation + float durationSeconds(1.0f); + Animation animation = Animation::New(durationSeconds); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS)); + keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS)); + keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS)); + + //Cubic interpolation should be ignored for quaternions + animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic ); + + // Start the animation + animation.Play(); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); + application.SendNotification(); + application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + Quaternion check(Radian(Degree(60)), Vector3::XAXIS); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + check = Quaternion( Radian(Degree(90)), Vector3::XAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + check = Quaternion( Radian(Degree(120)), Vector3::XAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, 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*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + check = Quaternion( Radian(Degree(120)), Vector3::YAXIS ); + DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION ); // We did expect the animation to finish - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateToRadianVector3Alpha(void) +int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f)); + keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); + keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); + + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR ); // Start the animation animation.Play(); @@ -7704,57 +7785,74 @@ int UtcDaliAnimationRotateToRadianVector3Alpha(void) 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.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + 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 ); - // 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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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.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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateToQuaternionAlpha(void) +int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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 ); // 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.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f)); + keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); + keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); + + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic ); // Start the animation animation.Play(); @@ -7762,57 +7860,75 @@ int UtcDaliAnimationRotateToQuaternionAlpha(void) 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.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + 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 ); - // 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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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.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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 ); + application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateToDegreeVector3AlphaFloat2(void) +int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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 ); // Build the animation float durationSeconds(1.0f); + float delay = 0.5f; Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - float delay(0.1f); - animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f)); + keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); + keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); + + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) ); // Start the animation animation.Play(); @@ -7820,60 +7936,76 @@ int UtcDaliAnimationRotateToDegreeVector3AlphaFloat2(void) 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.Render(static_cast(delay*1000.0f)/* 0% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 25% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.5f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 ); + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 - delay)*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateToRadianVector3AlphaFloat2(void) +int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void) { TestApplication application; + float startValue(1.0f); Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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 ); // Build the animation float durationSeconds(1.0f); + float delay = 0.5f; Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - float delay(0.1f); - animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f)); + keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); + keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); + + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic ); // Start the animation animation.Play(); @@ -7881,61 +8013,76 @@ int UtcDaliAnimationRotateToRadianVector3AlphaFloat2(void) 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.Render(static_cast(delay*1000.0f)/* 0% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 - delay)*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% 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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 ); + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 ); + application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationRotateToQuaternionAlphaFloat2(void) +int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void) { TestApplication application; + float startValue(1.0f); + float delay = 0.5f; Actor actor = Actor::New(); - actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS)); + actor.SetColor(Vector4(startValue, startValue, startValue, startValue)); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, 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 ); // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); - Degree targetRotationDegrees(90.0f); - Radian targetRotationRadians(targetRotationDegrees); - float delay(0.1f); - Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS); - animation.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn, delay, durationSeconds - delay); + + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f)); + keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); + keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); + + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) ); // Start the animation animation.Play(); @@ -7943,60 +8090,76 @@ int UtcDaliAnimationRotateToQuaternionAlphaFloat2(void) 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.Render(static_cast(delay*1000.0f)/* 0% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - float progress = max(0.0f, 0.25f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 - delay)*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 50% 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.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 ); + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - progress = max(0.0f, 0.75f - delay) / (1.0f - delay); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + 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 - delay)*250.0f)+1/* 100% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/); + 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 - application.SendNotification(); + finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationScaleBy(void) +int P(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.GetCurrentScale(), Vector3::ONE, 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 ); // Build the animation float durationSeconds(1.0f); + float delay = 0.5f; Animation animation = Animation::New(durationSeconds); - Vector3 targetScale(2.0f, 2.0f, 2.0f); - Vector3 relativeScale(targetScale - Vector3::ONE); - animation.ScaleBy(actor, relativeScale.x, relativeScale.y, relativeScale.z); - Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f); + KeyFrames keyFrames = KeyFrames::New(); + keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f)); + keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); + keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); + + animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic ); // Start the animation animation.Play(); @@ -8004,107 +8167,79 @@ int UtcDaliAnimationScaleBy(void) 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.Render(static_cast(delay*1000.0f)/* 0% progress */); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION ); + 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 - delay)*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/); + 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 ); - // We did expect the animation to finish + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 50% progress */); application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); + 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 ); - // Reset everything - finishCheck.Reset(); - actor.SetScale(Vector3::ONE); + application.Render(static_cast((durationSeconds - delay)*250.0f)/* 75% progress */); application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); - - // Repeat with a different (ease-in) alpha function - animation = Animation::New(durationSeconds); - animation.ScaleBy(actor, relativeScale, AlphaFunctions::EaseIn); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); + 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 ); + application.Render(static_cast((durationSeconds - delay)*250.0f)+1/* 100% progress */); 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 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*10.0f) + 1u/*just beyond the animation duration*/); + 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 - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetScale(Vector3::ONE); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); - - // Repeat with a delay - float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.ScaleBy(actor, relativeScale, AlphaFunctions::Linear, delay, durationSeconds - delay); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); - // We did expect the animation to finish - application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationScaleTo(void) +int UtcDaliAnimationAnimateP(void) { TestApplication application; Actor actor = Actor::New(); Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, 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); + + Dali::Path path = Dali::Path::New(); + path.AddPoint(position0); + path.AddPoint(position1); + path.AddPoint(position2); + + //Control points for first segment + path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); + path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + + //Control points for second segment + path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); // Build the animation - float durationSeconds(1.0f); + float durationSeconds( 1.0f ); Animation animation = Animation::New(durationSeconds); - Vector3 targetScale(2.0f, 2.0f, 2.0f); - animation.ScaleTo(actor, targetScale.x, targetScale.y, targetScale.z); - - Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f); + animation.Animate(actor, path, Vector3::XAXIS); // Start the animation animation.Play(); @@ -8112,959 +8247,236 @@ int UtcDaliAnimationScaleTo(void) 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.GetCurrentScale(), 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.GetCurrentScale(), targetScale, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetScale(Vector3::ONE); application.SendNotification(); application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); - - // Repeat with a different (ease-in) alpha function - animation = Animation::New(durationSeconds); - animation.ScaleTo(actor, targetScale, AlphaFunctions::EaseIn); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*990.0f)/* 99% progress */); - - // We didn't expect the animation to finish yet 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 ); - // 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*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.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); - - // Repeat with a delay - float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear, delay, durationSeconds - delay); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); + 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(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, 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(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + 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 ); - // We did expect the animation to finish - application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION ); END_TEST; } -int UtcDaliAnimationShow(void) +int UtcDaliAnimationAnimateAlphaFunctionP(void) { TestApplication application; Actor actor = Actor::New(); - actor.SetVisible(false); - application.SendNotification(); - application.Render(0); - DALI_TEST_CHECK( !actor.IsVisible() ); Stage::GetCurrent().Add(actor); - // Start the animation - float durationSeconds(10.0f); + //Build the path + Vector3 position0( 30.0, 80.0, 0.0); + Vector3 position1( 70.0, 120.0, 0.0); + Vector3 position2( 100.0, 100.0, 0.0); + + Dali::Path path = Dali::Path::New(); + path.AddPoint(position0); + path.AddPoint(position1); + path.AddPoint(position2); + + //Control points for first segment + path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); + path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + + //Control points for second segment + path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); + + // Build the animation + float durationSeconds( 1.0f ); Animation animation = Animation::New(durationSeconds); - animation.Show(actor, durationSeconds*0.5f); + animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR); + + // Start the animation animation.Play(); bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - application.Render(static_cast(durationSeconds*490.0f)); - - // We didn't expect the animation to finish yet + application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( !actor.IsVisible() ); + 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*10.0f)/*Should be shown now*/); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.IsVisible() ); + 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(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + 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 ); - // We did expect the animation to finish + 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(); - DALI_TEST_CHECK( actor.IsVisible() ); END_TEST; } -int UtcDaliAnimationHide(void) +int UtcDaliAnimationAnimateTimePeriodP(void) { TestApplication application; Actor actor = Actor::New(); - DALI_TEST_CHECK( actor.IsVisible() ); Stage::GetCurrent().Add(actor); - // Start the animation - float durationSeconds(10.0f); + //Build the path + Vector3 position0( 30.0, 80.0, 0.0); + Vector3 position1( 70.0, 120.0, 0.0); + Vector3 position2( 100.0, 100.0, 0.0); + + Dali::Path path = Dali::Path::New(); + path.AddPoint(position0); + path.AddPoint(position1); + path.AddPoint(position2); + + //Control points for first segment + path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) ); + path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) ); + + //Control points for second segment + path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); + + // Build the animation + float durationSeconds( 1.0f ); Animation animation = Animation::New(durationSeconds); - animation.Hide(actor, durationSeconds*0.5f); + animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f)); + + // Start the animation animation.Play(); bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); - application.SendNotification(); - application.Render(static_cast(durationSeconds*490.0f)); - - // We didn't expect the animation to finish yet + application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( actor.IsVisible() ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*10.0f)/*Should be hidden now*/); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_CHECK( !actor.IsVisible() ); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); - - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( !actor.IsVisible() ); - END_TEST; -} - -int UtcDaliAnimationShowHideAtEnd(void) -{ - // Test that show/hide delay can be the same as animation duration - // i.e. to show/hide at the end of the animation - - TestApplication application; - - Actor actor = Actor::New(); - DALI_TEST_CHECK( actor.IsVisible() ); - Stage::GetCurrent().Add(actor); - - // Start Hide animation - float durationSeconds(10.0f); - Animation animation = Animation::New(durationSeconds); - animation.Hide(actor, durationSeconds/*Hide at end*/); - animation.Play(); - - bool signalReceived(false); - AnimationFinishCheck finishCheck(signalReceived); - animation.FinishedSignal().Connect(&application, finishCheck); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); - - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( !actor.IsVisible() ); - - // Start Show animation - animation = Animation::New(durationSeconds); - animation.Show(actor, durationSeconds/*Show at end*/); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); - - // We did expect the animation to finish - application.SendNotification(); - finishCheck.CheckSignalReceived(); - DALI_TEST_CHECK( actor.IsVisible() ); - END_TEST; -} - -int UtcDaliAnimationOpacityBy(void) -{ - TestApplication application; - Actor actor = Actor::New(); - float startingOpacity(0.5f); - actor.SetOpacity(startingOpacity); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION ); - Stage::GetCurrent().Add(actor); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - float relativeOpacity(-0.5f); // target of zero - animation.OpacityBy(actor, relativeOpacity); - - float seventyFivePercentProgress((1.0f - 0.75f) * startingOpacity); - - // Start the animation - animation.Play(); - - 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.GetCurrentOpacity(), 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.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetOpacity(startingOpacity); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION ); - - // Repeat with a different (ease-in) alpha function - animation = Animation::New(durationSeconds); - animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::EaseIn); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); - - application.SendNotification(); - application.Render(static_cast(durationSeconds*750.0f)/* 75% progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - - // The opacity should reduce less, than with a linear alpha function - float current(actor.GetCurrentOpacity()); - DALI_TEST_CHECK( current < 1.0f ); - DALI_TEST_CHECK( current > seventyFivePercentProgress ); - - 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.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetOpacity(startingOpacity); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION ); - - // Repeat with a delay - float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::Linear, 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.GetCurrentOpacity(), startingOpacity, 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(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 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.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliAnimationOpacityTo(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - float targetOpacity(0.0f); - animation.OpacityTo(actor, targetOpacity); - - float ninetyNinePercentProgress(0.01f); - - // Start the animation - animation.Play(); - - 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.GetCurrentOpacity(), ninetyNinePercentProgress, 0.001f, 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.GetCurrentOpacity(), targetOpacity, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetOpacity(1.0f); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); - - // Repeat with a different (ease-in) alpha function - animation = Animation::New(durationSeconds); - animation.OpacityTo(actor, targetOpacity, AlphaFunctions::EaseIn); - 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 opacity should reduce less, than with a linear alpha function - float current(actor.GetCurrentOpacity()); - DALI_TEST_CHECK( current < 1.0f ); - DALI_TEST_CHECK( current > ninetyNinePercentProgress ); - - 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.GetCurrentOpacity(), targetOpacity, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetOpacity(1.0f); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION ); - - // Repeat with a delay - float delay = 0.5f; - animation = Animation::New(durationSeconds); - animation.OpacityTo(actor, targetOpacity, AlphaFunctions::Linear, 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.GetCurrentOpacity(), 1.0f, 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.GetCurrentOpacity(), targetOpacity, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliAnimationColorBy(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - actor.SetColor(Color::BLACK); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::BLACK, TEST_LOCATION ); - Stage::GetCurrent().Add(actor); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - Vector4 targetColor(Color::GREEN); - Vector4 relativeColor(Color::GREEN); // Note the alpha is automatically clamped <= 1.0f in world color - animation.ColorBy(actor, relativeColor); - - Vector4 tenPercentProgress(Vector4(0.0f, 0.1f, 0.0f, 1.0f)); - Vector4 twentyPercentProgress(Vector4(0.0f, 0.2f, 0.0f, 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*100.0f)/* 10% progress */); - - // We didn't expect the animation to finish yet - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), 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.GetCurrentWorldColor(), targetColor, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetColor(Color::BLACK); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION ); - - // Repeat with a different (ease-in) alpha function - animation = Animation::New(durationSeconds); - animation.ColorBy(actor, relativeColor, AlphaFunctions::EaseIn); - 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(); - - // The color should have changed less, than with a linear alpha function - Vector4 current(actor.GetCurrentWorldColor()); - DALI_TEST_CHECK( current.x == 0.0f ); // doesn't change - DALI_TEST_CHECK( current.y > 0.0f ); - DALI_TEST_CHECK( current.y < tenPercentProgress.y ); - DALI_TEST_CHECK( current.z == 0.0f ); // doesn't change - 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.GetCurrentWorldColor(), targetColor, TEST_LOCATION ); - - // Reset everything - finishCheck.Reset(); - actor.SetColor(Color::BLACK); - application.SendNotification(); - application.Render(0); - DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION ); - - // Repeat with a shorter animator duration - float animatorDuration = 0.5f; - animation = Animation::New(durationSeconds); - animation.ColorBy(actor, relativeColor, AlphaFunctions::Linear, 0, animatorDuration); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); - - application.SendNotification(); - 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(); - DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), twentyPercentProgress, TEST_LOCATION ); - - application.SendNotification(); - 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(); - DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, 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.GetCurrentWorldColor(), targetColor, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliAnimationColorTo(void) -{ - TestApplication application; - - Actor actor = Actor::New(); - Stage::GetCurrent().Add(actor); - DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - Vector4 targetColor(Color::RED); - animation.ColorTo(actor, 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(); - - 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.ColorTo(actor, targetColor, AlphaFunctions::EaseIn); - 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(); - - // 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.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.ColorTo(actor, targetColor, AlphaFunctions::Linear, 0, animatorDuration); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); - - application.SendNotification(); - 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(); - DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION ); - - application.SendNotification(); - 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(); - DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, 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.GetCurrentColor(), targetColor, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliAnimationResize(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.Resize(actor, targetSize); - - Vector3 ninetyNinePercentProgress(targetSize * 0.99f); - - // Start the animation - animation.Play(); - - 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.Resize(actor, targetSize, AlphaFunctions::EaseIn); - 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.Resize(actor, targetSize, AlphaFunctions::Linear, 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 UtcDaliKeyFramesCreateDestroy(void) -{ - tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()"); - - KeyFrames* keyFrames = new KeyFrames; - delete keyFrames; - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliKeyFramesDownCast(void) -{ - TestApplication application; - tet_infoline("Testing Dali::Animation::KeyFramesDownCast()"); - - KeyFrames keyFrames = KeyFrames::New(); - BaseHandle object(keyFrames); - - KeyFrames keyFrames2 = KeyFrames::DownCast(object); - DALI_TEST_CHECK(keyFrames2); - - KeyFrames keyFrames3 = DownCast< KeyFrames >(object); - DALI_TEST_CHECK(keyFrames3); - - BaseHandle unInitializedObject; - KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject); - DALI_TEST_CHECK(!keyFrames4); - - KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject); - DALI_TEST_CHECK(!keyFrames5); - END_TEST; -} - -int UtcDaliAnimationResizeByXY(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.Resize(actor, targetSize); - - Vector3 ninetyNinePercentProgress(targetSize * 0.99f); - - // Start the animation - animation.Play(); - - 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.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::EaseIn); - 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 ); + 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 ); - // Reset everything - finishCheck.Reset(); - actor.SetSize(Vector3::ZERO); + application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); 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.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::Linear, delay, durationSeconds - delay); - animation.FinishedSignal().Connect(&application, finishCheck); - animation.Play(); + 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(); - application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); + 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 ); - // We didn't expect the animation to finish yet + application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, 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(); - application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); + 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 ); - // We did expect the animation to finish - application.SendNotification(); finishCheck.CheckSignalReceived(); - DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION ); END_TEST; } - -int UtcDaliAnimationAnimateBetweenActorColorTimePeriod(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::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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) ); + + //Control points for second segment + path.AddControlPoint(Vector3( 78.0, 120.0, 0.0)); + path.AddControlPoint(Vector3( 93.0, 104.0, 0.0)); - animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, TimePeriod( 1.0f) ); + // 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(); @@ -9076,196 +8488,215 @@ int UtcDaliAnimationAnimateBetweenActorColorTimePeriod(void) application.Render(0); application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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 UtcDaliAnimationAnimateBetweenActorColorFunction(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::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), startValue, TEST_LOCATION ); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - - KeyFrames keyFrames = KeyFrames::New(); - keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f)); - keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); - keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - - animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear ); - // 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(0); - application.SendNotification(); - finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*490.0f)); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_CHECK( !actor.IsVisible() ); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*10.0f)/*Should be shown now*/); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_CHECK( actor.IsVisible() ); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::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 UtcDaliAnimationAnimateBetweenActorColorFunctionTimePeriod(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::COLOR_RED), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), startValue, TEST_LOCATION ); - - // Build the animation - float durationSeconds(1.0f); - Animation animation = Animation::New(durationSeconds); - - KeyFrames keyFrames = KeyFrames::New(); - keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f)); - keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f)); - keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f)); - - animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear, TimePeriod( 1.0f) ); - // 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(0); + application.Render(static_cast(durationSeconds*490.0f)); + + // We didn't expect the animation to finish yet application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION ); + DALI_TEST_CHECK( actor.IsVisible() ); - application.Render(static_cast(durationSeconds*250.0f)/* 25% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*10.0f)/*Should be hidden now*/); - application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); + // We didn't expect the animation to finish yet application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_CHECK( !actor.IsVisible() ); - application.Render(static_cast(durationSeconds*250.0f)/* 75% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 0.80f, 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 UtcDaliAnimationShowHideAtEndP(void) +{ + // Test that show/hide delay can be the same as animation duration + // i.e. to show/hide at the end of the animation + + TestApplication application; + + Actor actor = Actor::New(); + DALI_TEST_CHECK( actor.IsVisible() ); + Stage::GetCurrent().Add(actor); + + // Start Hide animation + float durationSeconds(10.0f); + Animation animation = Animation::New(durationSeconds); + animation.Hide(actor, durationSeconds/*Hide at end*/); + animation.Play(); + + bool signalReceived(false); + AnimationFinishCheck finishCheck(signalReceived); + animation.FinishedSignal().Connect(&application, finishCheck); - application.Render(static_cast(durationSeconds*250.0f)+1/* 100% progress */); application.SendNotification(); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION ); + application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); // We did expect the animation to finish + application.SendNotification(); + finishCheck.CheckSignalReceived(); + DALI_TEST_CHECK( !actor.IsVisible() ); + + // Start Show animation + animation = Animation::New(durationSeconds); + animation.Show(actor, durationSeconds/*Show at end*/); + animation.FinishedSignal().Connect(&application, finishCheck); + animation.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/); + // We did expect the animation to finish + application.SendNotification(); finishCheck.CheckSignalReceived(); + DALI_TEST_CHECK( actor.IsVisible() ); + END_TEST; +} + +int UtcDaliKeyFramesCreateDestroyP(void) +{ + tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()"); + + KeyFrames* keyFrames = new KeyFrames; + delete keyFrames; + DALI_TEST_CHECK( true ); + END_TEST; +} + +int UtcDaliKeyFramesDownCastP(void) +{ + TestApplication application; + tet_infoline("Testing Dali::Animation::KeyFramesDownCast()"); + + KeyFrames keyFrames = KeyFrames::New(); + BaseHandle object(keyFrames); + + KeyFrames keyFrames2 = KeyFrames::DownCast(object); + DALI_TEST_CHECK(keyFrames2); + + KeyFrames keyFrames3 = DownCast< KeyFrames >(object); + DALI_TEST_CHECK(keyFrames3); + + BaseHandle unInitializedObject; + KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject); + DALI_TEST_CHECK(!keyFrames4); + + KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject); + DALI_TEST_CHECK(!keyFrames5); END_TEST; } -int UtcDaliAnimationCreateDestroy(void) +int UtcDaliAnimationCreateDestroyP(void) { TestApplication application; Animation* animation = new Animation; @@ -9281,16 +8712,15 @@ struct UpdateManagerTestConstraint { } - Vector3 operator()(const Vector3& current) + void operator()( Vector3& current, const PropertyInputContainer& /* inputs */) { mApplication.SendNotification(); // Process events - return current; } TestApplication& mApplication; }; -int UtcDaliAnimationUpdateManager(void) +int UtcDaliAnimationUpdateManagerP(void) { TestApplication application; @@ -9305,12 +8735,12 @@ int UtcDaliAnimationUpdateManager(void) animation.FinishedSignal().Connect( &application, finishCheck ); Vector3 startValue(1.0f, 1.0f, 1.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); - Constraint constraint = Constraint::New( index, UpdateManagerTestConstraint( application ) ); - actor.ApplyConstraint( constraint ); + 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::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunctions::Linear ); + animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR ); animation.Play(); @@ -9326,7 +8756,7 @@ int UtcDaliAnimationUpdateManager(void) END_TEST; } -int UtcDaliAnimationSignalOrder(void) +int UtcDaliAnimationSignalOrderP(void) { TestApplication application; @@ -9344,9 +8774,9 @@ int UtcDaliAnimationSignalOrder(void) animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) ); // Apply animations to actor - animation1.AnimateTo( Property(actor, Actor::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunctions::Linear ); + animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR ); animation1.Play(); - animation2.AnimateTo( Property(actor, Actor::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunctions::Linear ); + animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR ); animation2.Play(); DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION ); @@ -9379,7 +8809,7 @@ int UtcDaliAnimationSignalOrder(void) END_TEST; } -int UtcDaliAnimationExtendDuration(void) +int UtcDaliAnimationExtendDurationP(void) { TestApplication application; @@ -9387,7 +8817,7 @@ int UtcDaliAnimationExtendDuration(void) // Register a float property float startValue(10.0f); - Property::Index index = actor.RegisterProperty( "test-property", startValue ); + Property::Index index = actor.RegisterProperty( "testProperty", startValue ); Stage::GetCurrent().Add(actor); DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); @@ -9440,35 +8870,21 @@ int UtcDaliAnimationExtendDuration(void) END_TEST; } -int UtcDaliAnimationPath(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( actor.GetProperty(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, AlphaFunctions::Linear, TimePeriod(0.0f, 1.0f )); + animation.AnimateTo( Property(actor, index), 20 ); // Start the animation animation.Play(); @@ -9476,45 +8892,22 @@ int UtcDaliAnimationPath(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.GetCurrentRotation(), 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.GetCurrentRotation(), 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.GetCurrentRotation(), rotation, TEST_LOCATION ); + finishCheck.CheckSignalNotReceived(); + DALI_TEST_EQUALS( actor.GetProperty(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.GetCurrentRotation(), 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.GetCurrentRotation(), rotation, TEST_LOCATION ); - finishCheck.CheckSignalReceived(); + DALI_TEST_EQUALS( actor.GetProperty(index), 20, TEST_LOCATION ); END_TEST; } +