+ animation.Show(actor, durationSeconds/*Show at end*/);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ END_TEST;
+}
+
+int UtcDaliKeyFramesCreateDestroyP(void)
+{
+ tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
+
+ KeyFrames* keyFrames = new KeyFrames;
+ delete keyFrames;
+ DALI_TEST_CHECK( true );
+ END_TEST;
+}
+
+int UtcDaliKeyFramesDownCastP(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
+
+ KeyFrames keyFrames = KeyFrames::New();
+ BaseHandle object(keyFrames);
+
+ KeyFrames keyFrames2 = KeyFrames::DownCast(object);
+ DALI_TEST_CHECK(keyFrames2);
+
+ KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
+ DALI_TEST_CHECK(keyFrames3);
+
+ BaseHandle unInitializedObject;
+ KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
+ DALI_TEST_CHECK(!keyFrames4);
+
+ KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
+ DALI_TEST_CHECK(!keyFrames5);
+ END_TEST;
+}
+
+int UtcDaliAnimationCreateDestroyP(void)
+{
+ TestApplication application;
+ Animation* animation = new Animation;
+ DALI_TEST_CHECK( animation );
+ delete animation;
+ END_TEST;
+}
+
+struct UpdateManagerTestConstraint
+{
+ UpdateManagerTestConstraint(TestApplication& application)
+ : mApplication(application)
+ {
+ }
+
+ void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
+ {
+ mApplication.SendNotification(); // Process events
+ }
+
+ TestApplication& mApplication;
+};
+
+int UtcDaliAnimationUpdateManagerP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add( actor );
+
+ // Build the animation
+ Animation animation = Animation::New( 0.0f );
+
+ bool signalReceived = false;
+ AnimationFinishCheck finishCheck( signalReceived );
+ animation.FinishedSignal().Connect( &application, finishCheck );
+
+ Vector3 startValue(1.0f, 1.0f, 1.0f);
+ Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
+ constraint.Apply();
+
+ // Apply animation to actor
+ animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
+ animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
+
+ animation.Play();
+
+ application.SendNotification();
+ application.UpdateOnly( 16 );
+
+ finishCheck.CheckSignalNotReceived();
+
+ application.SendNotification(); // Process events
+
+ finishCheck.CheckSignalReceived();
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSignalOrderP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add( actor );
+
+ // Build the animations
+ Animation animation1 = Animation::New( 0.0f ); // finishes first frame
+ Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
+
+ bool signal1Received = false;
+ animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
+
+ bool signal2Received = false;
+ animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
+
+ // Apply animations to actor
+ animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
+ animation1.Play();
+ animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
+ animation2.Play();
+
+ DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
+
+ application.SendNotification();
+ application.UpdateOnly( 10 ); // 10ms progress
+
+ // no notifications yet
+ DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
+
+ application.SendNotification();
+
+ // first completed
+ DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
+ signal1Received = false;
+
+ // 1st animation is complete now, do another update with no ProcessEvents in between
+ application.UpdateOnly( 20 ); // 20ms progress
+
+ // ProcessEvents
+ application.SendNotification();
+
+ // 2nd should complete now
+ DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationExtendDurationP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ // Register a float property
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float initialDurationSeconds(1.0f);
+ float animatorDelay = 5.0f;
+ float animatorDurationSeconds(5.0f);
+ float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
+ Animation animation = Animation::New(initialDurationSeconds);
+ float targetValue(30.0f);
+ float relativeValue(targetValue - startValue);
+
+ animation.AnimateTo(Property(actor, index),
+ targetValue,
+ TimePeriod(animatorDelay, animatorDurationSeconds));
+
+ // The duration should have been extended
+ DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
+
+ // Start the animation
+ animation.Play();
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+
+ // We didn't expect the animation to finish yet, but cached value should be the final one
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(extendedDurationSeconds*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.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationCustomIntProperty(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ int startValue(0u);
+
+ Property::Index index = actor.RegisterProperty("anIndex", startValue);
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ animation.AnimateTo( Property(actor, index), 20 );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
+
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationDuration(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ Animation animation = Animation::New( 0.0f );
+ DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
+
+ // The animation duration should automatically increase depending on the animator time period
+
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
+ DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
+
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
+ DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ // Register an integer property
+ int startValue(1);
+ Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
+
+ DALI_TEST_ASSERTION(
+ {
+ // Build the animation
+ Animation animation = Animation::New( 2.0f );
+ std::string relativeValue = "relative string";
+ animation.AnimateBy( Property(actor, index), relativeValue );
+ tet_result(TET_FAIL);
+ }, "Target value is not animatable" );
+
+ END_TEST;
+}
+
+
+int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ // Register an integer property
+ int startValue(1);
+ Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
+
+ DALI_TEST_ASSERTION(
+ {
+ // Build the animation
+ Animation animation = Animation::New( 2.0f );
+ std::string relativeValue = "relative string";
+ animation.AnimateTo( Property(actor, index), relativeValue );
+ }, "Target value is not animatable" );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ // Register an integer property
+ int startValue(1);
+ Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
+
+ DALI_TEST_ASSERTION(
+ {
+ // Build the animation
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add( 0.0f, std::string("relative string1") );
+ keyFrames.Add( 1.0f, std::string("relative string2") );
+ // no need to really create the animation as keyframes do the check
+ }, "Property type is not animatable" );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
+{
+ tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
+
+ TestApplication application;
+
+ tet_infoline("Set initial position and set up animation to re-position actor");
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ Vector3 initialPosition(0.0f, 0.0f, 0.0f);
+ actor.SetProperty( Actor::Property::POSITION, initialPosition );
+
+ // Build the animation
+ Animation animation = Animation::New(2.0f);
+
+ //Test GetCurrentProgress return 0.0 as the duration is 0.0
+ DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+
+ tet_infoline("Set target position in animation without intiating play");
+
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline("Ensure position of actor is still at intial value");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
+
+ tet_infoline("Play animation and ensure actor position is now target");
+
+ animation.Play();
+ application.SendNotification();
+ application.Render(1000u);
+
+ tet_infoline("Ensure position of actor is at target value when aninmation half way");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
+
+ tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x );
+
+ application.Render(2000u);
+
+ tet_infoline("Ensure position of actor is still at target value when aninmation complete");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
+{
+ tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
+
+ TestApplication application;
+
+ std::vector<Vector3> targetPositions;
+
+ targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
+ targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
+ targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
+
+ tet_infoline("Set initial position and set up animation to re-position actor");
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ Vector3 initialPosition(0.0f, 0.0f, 0.0f);
+ actor.SetProperty( Actor::Property::POSITION, initialPosition );
+
+ // Build the animation
+ Animation animation = Animation::New(2.0f);
+
+ //Test GetCurrentProgress return 0.0 as the duration is 0.0
+ DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+
+ tet_infoline("Set target position in animation without intiating play");
+
+ for ( unsigned int i = 0; i < targetPositions.size(); i++ )
+ {
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
+ }
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline("Ensure position of actor is still at intial value");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
+
+ tet_infoline("Play animation and ensure actor position is now target");
+
+ animation.Play();
+ application.SendNotification();
+ application.Render(1000u);
+
+ tet_infoline("Ensure position of actor is at target value when aninmation half way");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
+
+ tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x );
+
+ application.Render(2000u);
+
+ tet_infoline("Ensure position of actor is still at target value when aninmation complete");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
+{
+ tet_infoline("Setting up an animation should not effect it's size property until the animation plays even with mulitple animators of different Property Indexes");
+
+ TestApplication application;
+
+ std::vector<Vector3> targetSizes;
+ std::vector<Vector3> targetPositions;
+
+ targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
+ targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
+
+ targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
+
+ tet_infoline("Set initial position and set up animation to re-position actor");
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ Vector3 initialSize( 10.0f, 10.0f, 10.0f);
+ Vector3 initialPosition(10.0f, 10.0f, 10.0f);
+
+ actor.SetProperty( Actor::Property::SIZE, initialSize );
+ actor.SetProperty( Actor::Property::POSITION, initialPosition );
+
+ // Build the animation
+ Animation animation = Animation::New(2.0f);
+
+ tet_infoline("Set target size in animation without intiating play");
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
+ tet_infoline("Set target position in animation without intiating play");
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline("Ensure position of actor is still at intial size and position");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
+
+ tet_infoline("Play animation and ensure actor position and size is now matches targets");
+
+ animation.Play();
+ application.SendNotification();
+ application.Render(2000u);
+
+ tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
+{
+ tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
+
+ TestApplication application;
+
+ std::vector<Vector3> targetSizes;
+ std::vector<float> targetColors;
+
+ targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
+ targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
+
+ targetColors.push_back( 1.0f );
+
+ tet_infoline("Set initial position and set up animation to re-position actor");
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ Vector3 initialSize( 10.0f, 5.0f, 10.0f);
+
+ actor.SetProperty( Actor::Property::SIZE, initialSize );
+
+ // Build the animation
+ Animation animation = Animation::New(2.0f);
+
+ tet_infoline("Set target size in animation without initiating play");
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
+ tet_infoline("Set target position in animation without intiating play");
+ animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
+
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline("Ensure position of actor is still at initial size and position");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
+
+ tet_infoline("Play animation and ensure actor position and size is now matches targets");
+
+ animation.Play();
+ application.SendNotification();
+ application.Render(2000u);
+
+ tet_infoline("Ensure position and size of actor is at target value when animation playing");
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationTimePeriodOrder(void)
+{
+ tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
+
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
+ //////////////////////////////////////////////////////////////////////////////////
+
+ tet_infoline( "With two AnimateTo calls" );
+
+ Animation animation = Animation::New( 0.0f );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
+ animation.Play();
+
+ tet_infoline( "The target position should change instantly" );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(5000); // After the animation is complete
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+
+ //////////////////////////////////////////////////////////////////////////////////
+
+ tet_infoline( "Same animation again but in a different order - should yield the same result" );
+
+ actor.SetX( 0.0f );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
+ animation = Animation::New( 0.0f );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
+ animation.Play();
+
+ tet_infoline( "The target position should change instantly" );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(5000); // After the animation is complete
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
+{
+ tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls" );
+
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
+ //////////////////////////////////////////////////////////////////////////////////
+
+ tet_infoline( "" );
+
+ Animation animation = Animation::New( 0.0f );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
+ animation.Play();
+
+ tet_infoline( "The target position should change instantly" );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(14000); // After the animation is complete
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+
+ //////////////////////////////////////////////////////////////////////////////////
+
+ tet_infoline( "Same animation again but in a different order - should end up at the same point" );
+
+ actor.SetX( 0.0f );
+
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+
+ animation = Animation::New( 0.0f );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
+ animation.Play();
+
+ tet_infoline( "The target position should change instantly" );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(14000); // After the animation is complete
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenIntegerP(void)
+{
+ TestApplication application;
+
+ int startValue(1);
+ Actor actor = Actor::New();
+ const Property::Index index = actor.RegisterProperty("customProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, 10);
+ keyFrames.Add(0.2f, 20);
+ keyFrames.Add(0.4f, 30);
+ keyFrames.Add(0.6f, 40);
+ keyFrames.Add(0.8f, 50);
+ keyFrames.Add(1.0f, 60);
+
+ animation.AnimateBetween( Property(actor, index ), keyFrames );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should change to the last key-frame's value straight away
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenVector2P(void)
+{
+ TestApplication application;
+
+ Vector2 startValue( 10.0f, 20.0f );
+ Actor actor = Actor::New();
+ const Property::Index index = actor.RegisterProperty("customProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
+ keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
+ keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
+ keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
+ keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
+ keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
+
+ animation.AnimateBetween( Property(actor, index ), keyFrames );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should change to the last key-frame's value straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationProgressCallbackP(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 finishedSignalReceived(false);
+ bool progressSignalReceived(false);
+
+ AnimationFinishCheck finishCheck(finishedSignalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
+
+ AnimationProgressCheck progressCheck(progressSignalReceived);
+ DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
+ application.SendNotification();
+
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+
+ tet_infoline( "Animation Progress notification set to 30%" );
+ DevelAnimation::SetProgressNotification( animation, 0.3f );
+
+ application.SendNotification();
+ application.Render( );
+
+ DALI_TEST_EQUALS( 0.3f, DevelAnimation::GetProgressNotification( animation ), TEST_LOCATION );
+
+ progressCheck.CheckSignalNotReceived();
+
+ // Start the animation from 10% progress
+ animation.SetCurrentProgress( 0.1f );
+ animation.Play();
+
+ tet_infoline( "Animation Playing from 10%" );
+
+ application.SendNotification();
+ application.Render(0); // start animation
+ application.Render(durationSeconds*100.0f ); // 20% progress
+
+ tet_infoline( "Animation at 20%" );
+
+ progressCheck.CheckSignalNotReceived();
+
+ application.SendNotification();
+ application.Render(durationSeconds*200.0f ); // 40% progress
+ application.SendNotification();
+ tet_infoline( "Animation at 40%" );
+ DALI_TEST_EQUALS( 0.4f, animation.GetCurrentProgress(), TEST_LOCATION );
+
+ progressCheck.CheckSignalReceived();
+
+ tet_infoline( "Progress check reset" );
+ progressCheck.Reset();
+
+ application.Render(durationSeconds*100.0f ); // 50% progress
+ tet_infoline( "Animation at 50%" );
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
+
+ progressCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
+ application.SendNotification();
+
+ tet_infoline( "Animation at 60%" );
+
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.SendNotification();
+ DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline( "Animation at 80%" );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ tet_infoline( "Animation finished" );
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationPlayAfterP(void)
+{
+ TestApplication application;
+
+ tet_printf("Testing that playing after 2 seconds\n");
+
+ {
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(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, TimePeriod( 0.5f, 0.5f ) );
+
+ // Play animation after the initial delay time
+ animation.PlayAfter( 0.2f );
+ application.SendNotification();
+ application.Render(0); // start animation
+
+ application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
+
+ application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ // Check that nothing has changed after a couple of buffer swaps
+ application.Render(0);
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ }
+
+ tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
+ // SpeedFactor < 0
+ {
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ animation.SetSpeedFactor( -1.0f ); // Set SpeedFactor as < 0
+
+ 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, TimePeriod( 0.5f, 0.5f ) );
+
+ // Play animation after the initial delay time
+ animation.PlayAfter( 0.2f );
+ application.SendNotification();
+ application.Render(0); // start animation
+
+ application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
+
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) + 1u/*just beyond the animation duration*/ );
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of Timeperiod in seconds
+
+ // Check that nothing has changed after a couple of buffer swaps
+ application.Render(0);
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliAnimationPlayAfterP2(void)
+{
+ TestApplication application;
+
+ tet_printf("Testing that playing after 2 seconds before looping\n");
+
+ {
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ animation.SetLooping( true );
+
+ 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, TimePeriod( 0.5f, 0.5f ) );
+
+ // Play animation after the initial delay time
+ animation.PlayAfter( 0.2f );
+ application.SendNotification();
+ application.Render(0); // start animation
+
+ for( int iterations = 0; iterations < 3; ++iterations )
+ {
+ // The initial delay time of PlayAfter() applies only once in looping mode.
+ if( iterations == 0 )
+ {
+ application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
+ }
+
+ application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) /* 100% progress */ );
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ }
+
+ animation.SetLooping(false);
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ }
+
+ tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
+ // SpeedFactor < 0
+ {
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ animation.SetLooping( true );
+ animation.SetSpeedFactor( -1.0f ); //Set SpeedFactor as < 0
+
+ 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, TimePeriod( 0.5f, 0.5f ) );
+
+ // Play animation after the initial delay time
+ animation.PlayAfter( 0.2f );
+ application.SendNotification();
+ application.Render(0); // start animation
+
+ for( int iterations = 0; iterations < 3; ++iterations )
+ {
+ // The initial delay time of PlayAfter() applies only once in looping mode.
+ if( iterations == 0 )
+ {
+ application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
+ }
+
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) /* 100% progress */ );
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in second
+ }
+
+ animation.SetLooping(false);
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliAnimationPlayAfterP3(void)
+{
+ TestApplication application;
+
+ tet_printf("Testing that PlayAfter with the negative delay seconds\n");
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(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, TimePeriod( 0.5f, 0.5f ) );
+
+ // When the delay time is negative value, it would treat as play immediately.
+ animation.PlayAfter( -2.0f );
+ application.SendNotification();
+ application.Render(0); // start animation
+
+ application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ // Check that nothing has changed after a couple of buffer swaps
+ application.Render(0);
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationPlayAfterP4(void)
+{
+ TestApplication application;
+
+ tet_printf("Testing that PlayAfter with progress value\n");
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(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, TimePeriod( 0.5f, 0.5f ) );
+
+ // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
+ animation.PlayAfter( durationSeconds * 0.3f );
+ application.SendNotification();
+ application.Render(0); // start animation
+
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 5/6 delay progress, 0% animation progress, 0% animator progress */ );
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of PlayAfter
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 20% animation progress, 0% animator progress */ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 45% animation progress, 0% animator progress */ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 70% animation progress, 40% animator progress */ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.4f ), TEST_LOCATION ); // 40% of animator progress
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 95% animation progress, 90% animator progress */ );
+
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.9f ), TEST_LOCATION ); // 90% of animator progress
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 50.0f ) + 1u/*just beyond the animation duration*/ );
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ // Check that nothing has changed after a couple of buffer swaps
+ application.Render(0);
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliAnimationSetLoopingModeP(void)
+{
+ // Test Loop forever and Loop mode being set
+ TestApplication application;
+ Stage stage( Stage::GetCurrent() );
+
+ // Default: LoopingMode::RESTART
+ {
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New( durationSeconds );
+ DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
+
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+
+ // Start the animation
+ animation.Play();
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
+
+ actor.Unparent();
+
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ }
+
+ // LoopingMode::AUTO_REVERSE
+ {
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New( durationSeconds );
+ animation.SetLooping( true );
+
+ 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 );
+
+ animation.SetLoopingMode( Animation::LoopingMode::AUTO_REVERSE );
+ DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+
+ // Start the animation
+ animation.Play();
+ application.SendNotification();
+ application.Render(0);
+
+ for( int iterations = 0; iterations < 3; ++iterations )
+ {
+ application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
+ // and arrives at the beginning.
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ }
+
+ animation.SetLooping( false );
+ application.SendNotification();
+ application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
+
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ }
+
+ // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
+ {
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New( durationSeconds );
+ animation.SetLooping( true );
+
+ bool signalReceived( false );
+ AnimationFinishCheck finishCheck( signalReceived );
+ animation.FinishedSignal().Connect( &application, finishCheck );
+ application.SendNotification();
+
+ // Specify a negative multiplier to play the animation in reverse
+ animation.SetSpeedFactor( -1.0f );
+
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+
+ animation.SetLoopingMode( Animation::AUTO_REVERSE );
+ DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+
+ // Start the animation
+ animation.Play();
+ application.SendNotification();
+ application.Render(0);
+
+ for( int iterations = 0; iterations < 3; ++iterations )
+ {
+ application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ // Setting a negative speed factor is to play the animation in reverse.
+ // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
+ // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ }
+
+ animation.SetLooping( false );
+ application.SendNotification();
+ application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
+
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSetLoopingModeP2(void)
+{
+ // Test Loop Count and Loop mode being set
+ TestApplication application;
+ Stage stage( Stage::GetCurrent() );
+
+ // LoopingMode::AUTO_REVERSE
+ {
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New( durationSeconds );
+ animation.SetLoopCount(3);
+ DALI_TEST_CHECK(animation.IsLooping());
+
+ 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 );
+
+ animation.SetLoopingMode( Animation::AUTO_REVERSE );
+ DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+
+ // Start the animation
+ animation.Play();
+
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+
+ // Loop
+ float intervalSeconds = 3.0f;
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
+ // and arrives at the beginning.
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ finishCheck.Reset();
+ }
+
+ // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
+ {
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New( durationSeconds );
+ animation.SetLoopCount(3);
+ DALI_TEST_CHECK(animation.IsLooping());
+
+ bool signalReceived( false );
+ AnimationFinishCheck finishCheck( signalReceived );
+ animation.FinishedSignal().Connect( &application, finishCheck );
+ application.SendNotification();
+
+ // Specify a negative multiplier to play the animation in reverse
+ animation.SetSpeedFactor( -1.0f );
+
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+
+ animation.SetLoopingMode( Animation::AUTO_REVERSE );
+ DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+
+ // Start the animation
+ animation.Play();
+
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+
+ // Loop
+ float intervalSeconds = 3.0f;
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ // Setting a negative speed factor is to play the animation in reverse.
+ // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
+ // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ finishCheck.Reset();
+ }
+
+ END_TEST;
+}
+
+int UtcDaliAnimationSetLoopingModeP3(void)
+{
+ // Test Loop Count is 1 (== default) and Loop mode being set
+ TestApplication application;
+ Stage stage( Stage::GetCurrent() );
+
+ // LoopingMode::AUTO_REVERSE
+ {
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New( durationSeconds );
+ DALI_TEST_CHECK(1 == animation.GetLoopCount());
+
+ 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 );
+
+ animation.SetLoopingMode( Animation::AUTO_REVERSE );
+ DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+
+ // Start the animation
+ animation.Play();
+ application.Render(0);
+ application.SendNotification();
+
+ application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
+ // and arrives at the beginning.
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
+
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
+
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ // After all animation finished, arrives at the beginning.
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ finishCheck.Reset();
+ }
+
+ // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
+ {
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ float durationSeconds( 1.0f );
+ Animation animation = Animation::New( durationSeconds );
+ DALI_TEST_CHECK(1 == animation.GetLoopCount());
+
+ bool signalReceived( false );
+ AnimationFinishCheck finishCheck( signalReceived );
+ animation.FinishedSignal().Connect( &application, finishCheck );
+ application.SendNotification();
+
+ // Specify a negative multiplier to play the animation in reverse
+ animation.SetSpeedFactor( -1.0f );
+
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+
+ animation.SetLoopingMode( Animation::AUTO_REVERSE );
+ DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+
+ // Start the animation
+ animation.Play();
+ application.Render(0);
+ application.SendNotification();
+
+ application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ // Setting a negative speed factor is to play the animation in reverse.
+ // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
+ // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
+
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
+
+ application.SendNotification();
+ application.Render(0);
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ // After all animation finished, arrives at the target.
+ DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
+ finishCheck.Reset();
+ }
+
+ END_TEST;
+}
+
+int UtcDaliAnimationGetLoopingModeP(void)
+{
+ TestApplication application;
+
+ Animation animation = Animation::New(1.0f);
+
+ // default mode
+ DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
+
+ animation.SetLoopingMode( Animation::AUTO_REVERSE );
+ DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
+{
+ TestApplication application;
+
+ tet_infoline( "Connect to ProgressReachedSignal but do not set a required Progress marker" );
+
+ 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 finishedSignalReceived(false);
+ bool progressSignalReceived(false);
+
+ AnimationFinishCheck finishCheck(finishedSignalReceived);