2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
21 #include <dali/dali.h>
22 #include <dali-test-suite-utils.h>
27 void utc_dali_animation_startup(void)
29 test_return_value = TET_UNDEF;
32 void utc_dali_animation_cleanup(void)
34 test_return_value = TET_PASS;
40 static const float ROTATION_EPSILON = 0.0001f;
41 static const float VECTOR4_EPSILON = 0.0001f;
43 // Functor to test whether a Finish signal is emitted
44 struct AnimationFinishCheck
46 AnimationFinishCheck(bool& signalReceived)
47 : mSignalReceived(signalReceived)
51 void operator()(Animation& animation)
53 mSignalReceived = true;
58 mSignalReceived = false;
61 void CheckSignalReceived()
65 tet_printf("Expected Finish signal was not received\n");
74 void CheckSignalNotReceived()
78 tet_printf("Unexpected Finish signal was received\n");
87 bool& mSignalReceived; // owned by individual tests
90 static bool ReturnFalseAfterProgressOne( float alpha, const bool& current )
95 struct AnimateFloatTestFunctor
97 AnimateFloatTestFunctor( float start, float end )
103 float operator()( float alpha, const float& current )
105 return mStart + ((mEnd - mStart) * alpha );
112 struct AnimateVector2TestFunctor
114 AnimateVector2TestFunctor( Vector2 start, Vector2 end )
120 Vector2 operator()( float alpha, const Vector2& current )
122 return mStart + ((mEnd - mStart) * alpha );
129 struct AnimateVector4TestFunctor
131 AnimateVector4TestFunctor( Vector4 start, Vector4 end )
137 Vector4 operator()( float alpha, const Vector4& current )
139 return mStart + ((mEnd - mStart) * alpha );
146 struct AnimateQuaternionTestFunctor
148 AnimateQuaternionTestFunctor( Quaternion start, Quaternion end )
154 Quaternion operator()( float alpha, const Quaternion& current )
156 return Quaternion::Slerp(mStart, mEnd, alpha);
165 BounceFunc(float x, float y, float z)
166 : mDistance(Vector3(x, y, z))
169 Vector3 operator()(float alpha, const Vector3& current)
171 if (alpha>0.001f && alpha<1.0f)
173 const float flip = 0.5f - cosf(alpha * Math::PI * 2.0f) * 0.5f;
174 Vector3 newTranslation(current);
175 newTranslation += mDistance * flip;
176 return newTranslation;
186 TumbleFunc(Vector3 axis) : tumbleAxis(axis){}
187 Quaternion operator()(float alpha, const Quaternion& current)
189 if (alpha>0.001f && alpha<1.0f)
191 Quaternion tumbleRotation(alpha * Math::PI * 2.0f, tumbleAxis);
192 return tumbleRotation * current;
201 int UtcDaliAnimationNew01(void)
203 TestApplication application;
206 DALI_TEST_CHECK(!animation);
208 animation = Animation::New(1.0f);
210 DALI_TEST_CHECK(animation);
214 int UtcDaliAnimationNew02(void)
216 TestApplication application;
219 DALI_TEST_CHECK(!animation);
222 animation = Animation::New(0.0f);
224 catch (Dali::DaliException& e)
226 // TODO: Determine why catch doesn't.
229 // Tests that a negative test of an assertion succeeds
230 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
231 DALI_TEST_EQUALS(e.mCondition, "durationSeconds > 0.0f", TEST_LOCATION);
236 int UtcDaliAnimationDownCast(void)
238 TestApplication application;
239 tet_infoline("Testing Dali::Animation::DownCast()");
241 float durationSeconds(1.0f);
242 Animation animation = Animation::New(durationSeconds);
244 BaseHandle object(animation);
246 Animation animation2 = Animation::DownCast(object);
247 DALI_TEST_CHECK(animation2);
249 Animation animation3 = DownCast< Animation >(object);
250 DALI_TEST_CHECK(animation3);
252 BaseHandle unInitializedObject;
253 Animation animation4 = Animation::DownCast(unInitializedObject);
254 DALI_TEST_CHECK(!animation4);
256 Animation animation5 = DownCast< Animation >(unInitializedObject);
257 DALI_TEST_CHECK(!animation5);
261 int UtcDaliAnimationSetDuration(void)
263 TestApplication application;
265 Actor actor = Actor::New();
266 Stage::GetCurrent().Add(actor);
268 // Build the animation
269 float durationSeconds(1.0f);
270 Animation animation = Animation::New(durationSeconds);
271 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
273 // Start the animation
274 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
275 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
278 bool signalReceived(false);
279 AnimationFinishCheck finishCheck(signalReceived);
280 animation.FinishedSignal().Connect(&application, finishCheck);
282 application.SendNotification();
283 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
285 // We didn't expect the animation to finish yet
286 application.SendNotification();
287 finishCheck.CheckSignalNotReceived();
289 application.Render(2u/*just beyond the animation duration*/);
291 // We did expect the animation to finish
292 application.SendNotification();
293 finishCheck.CheckSignalReceived();
294 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
296 // Restart the animation, with a different duration
298 actor.SetPosition(Vector3::ZERO);
299 durationSeconds = 3.5f;
300 animation.SetDuration(durationSeconds);
301 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
304 application.SendNotification();
305 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
307 // We didn't expect the animation to finish yet
308 application.SendNotification();
309 finishCheck.CheckSignalNotReceived();
311 application.Render(2u/*just beyond the animation duration*/);
313 // We did expect the animation to finish
314 application.SendNotification();
315 finishCheck.CheckSignalReceived();
316 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
318 // Check that nothing has changed after a couple of buffer swaps
319 application.Render(0);
320 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
321 application.Render(0);
322 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
326 int UtcDaliAnimationGetDuration(void)
328 TestApplication application;
330 Animation animation = Animation::New(1.0f);
331 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
333 animation.SetDuration(2.0f);
334 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
338 int UtcDaliAnimationSetLooping(void)
340 TestApplication application;
342 Actor actor = Actor::New();
343 Stage::GetCurrent().Add(actor);
345 // Build the animation
346 float durationSeconds(1.0f);
347 Animation animation = Animation::New(durationSeconds);
348 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
349 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
351 // Start the animation
352 animation.SetLooping(true);
353 DALI_TEST_CHECK(animation.IsLooping());
356 bool signalReceived(false);
357 AnimationFinishCheck finishCheck(signalReceived);
358 animation.FinishedSignal().Connect(&application, finishCheck);
360 application.SendNotification();
363 float intervalSeconds = 0.25f;
364 float progress = 0.0f;
365 for (int iterations = 0; iterations < 5;)
367 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
369 progress += intervalSeconds;
370 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
372 if (progress >= 1.0f)
374 progress = progress - 1.0f;
379 // We didn't expect the animation to finish yet
380 application.SendNotification();
381 finishCheck.CheckSignalNotReceived();
383 animation.SetLooping(false);
384 DALI_TEST_CHECK(!animation.IsLooping());
386 application.SendNotification();
387 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
389 // We did expect the animation to finish
390 application.SendNotification();
391 finishCheck.CheckSignalReceived();
392 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
394 // Check that nothing has changed after a couple of buffer swaps
395 application.Render(0);
396 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
397 application.Render(0);
398 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
402 int UtcDaliAnimationIsLooping(void)
404 TestApplication application;
406 Animation animation = Animation::New(1.0f);
407 DALI_TEST_CHECK(!animation.IsLooping());
409 animation.SetLooping(true);
410 DALI_TEST_CHECK(animation.IsLooping());
414 int UtcDaliAnimationSetEndAction(void)
416 TestApplication application;
418 Actor actor = Actor::New();
419 Stage::GetCurrent().Add(actor);
421 // Build the animation
422 float durationSeconds(1.0f);
423 Animation animation = Animation::New(durationSeconds);
424 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
426 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
427 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
429 // Start the animation
432 bool signalReceived(false);
433 AnimationFinishCheck finishCheck(signalReceived);
434 animation.FinishedSignal().Connect(&application, finishCheck);
436 application.SendNotification();
437 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
439 // We did expect the animation to finish
440 application.SendNotification();
441 finishCheck.CheckSignalReceived();
442 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
444 // Go back to the start
445 actor.SetPosition(Vector3::ZERO);
446 application.SendNotification();
447 application.Render(0);
448 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
450 // Test BakeFinal, animate again, for half the duration
452 animation.SetEndAction(Animation::BakeFinal);
453 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
456 application.SendNotification();
457 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
459 // Stop the animation early
462 // We did NOT expect the animation to finish
463 application.SendNotification();
464 finishCheck.CheckSignalNotReceived();
465 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
467 // Go back to the start
468 actor.SetPosition(Vector3::ZERO);
469 application.SendNotification();
470 application.Render(0);
471 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
473 // Test EndAction::Discard, animate again, but don't bake this time
475 animation.SetEndAction(Animation::Discard);
476 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
479 application.SendNotification();
480 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
482 // We did expect the animation to finish
483 application.SendNotification();
484 finishCheck.CheckSignalReceived();
485 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
487 // The position should be discarded in the next frame
488 application.Render(0);
489 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
491 // Check that nothing has changed after a couple of buffer swaps
492 application.Render(0);
493 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
494 application.Render(0);
495 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
499 int UtcDaliAnimationGetEndAction(void)
501 TestApplication application;
503 Animation animation = Animation::New(1.0f);
504 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
506 animation.SetEndAction(Animation::Discard);
507 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
509 animation.SetEndAction(Animation::BakeFinal);
510 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
515 int UtcDaliAnimationGetDestroyAction(void)
517 TestApplication application;
518 Animation animation = Animation::New(1.0f);
519 DALI_TEST_CHECK(animation.GetDestroyAction() == Animation::Bake); // default!
521 animation.SetDestroyAction(Animation::Discard);
522 DALI_TEST_CHECK(animation.GetDestroyAction() == Animation::Discard);
524 animation.SetDestroyAction(Animation::BakeFinal);
525 DALI_TEST_CHECK(animation.GetDestroyAction() == Animation::BakeFinal);
530 int UtcDaliAnimationSetDefaultAlphaFunction(void)
532 TestApplication application;
534 Animation animation = Animation::New(1.0f);
535 AlphaFunction func = animation.GetDefaultAlphaFunction();
536 DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
538 animation.SetDefaultAlphaFunction(AlphaFunctions::EaseIn);
539 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
540 DALI_TEST_CHECK(func2(0.1f) < AlphaFunctions::Linear(0.1f)); // less progress when easing-in
544 int UtcDaliAnimationGetDefaultAlphaFunction(void)
546 TestApplication application;
548 Animation animation = Animation::New(1.0f);
549 AlphaFunction func = animation.GetDefaultAlphaFunction();
551 // Test that the default is linear
552 DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
556 int UtcDaliAnimationPlay(void)
558 TestApplication application;
560 Actor actor = Actor::New();
561 Stage::GetCurrent().Add(actor);
563 // Build the animation
564 float durationSeconds(1.0f);
565 Animation animation = Animation::New(durationSeconds);
566 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
567 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
569 // Start the animation
572 bool signalReceived(false);
573 AnimationFinishCheck finishCheck(signalReceived);
574 animation.FinishedSignal().Connect(&application, finishCheck);
576 application.SendNotification();
577 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
579 // We didn't expect the animation to finish yet
580 application.SendNotification();
581 finishCheck.CheckSignalNotReceived();
582 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
584 animation.Play(); // Test that calling play has no effect, when animation is already playing
585 application.SendNotification();
586 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
588 // We didn't expect the animation to finish yet
589 application.SendNotification();
590 finishCheck.CheckSignalNotReceived();
591 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
593 animation.Play(); // Test that calling play has no effect, when animation is already playing
594 application.SendNotification();
595 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
597 // We didn't expect the animation to finish yet
598 application.SendNotification();
599 finishCheck.CheckSignalNotReceived();
600 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
602 animation.Play(); // Test that calling play has no effect, when animation is already playing
603 application.SendNotification();
604 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
606 // We didn't expect the animation to finish yet
607 application.SendNotification();
608 finishCheck.CheckSignalNotReceived();
609 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
611 animation.Play(); // Test that calling play has no effect, when animation is already playing
612 application.SendNotification();
613 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
615 // We did expect the animation to finish
616 application.SendNotification();
617 finishCheck.CheckSignalReceived();
618 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
620 // Check that nothing has changed after a couple of buffer swaps
621 application.Render(0);
622 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
623 application.Render(0);
624 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
628 int UtcDaliAnimationPlayOffStage(void)
630 // Test that an animation can be played, when the actor is off-stage.
631 // When the actor is added to the stage, it should appear at the current position
632 // i.e. where it would have been anyway, if on-stage from the beginning.
634 TestApplication application;
636 Actor actor = Actor::New();
637 Vector3 basePosition(Vector3::ZERO);
638 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
639 // Not added to the stage!
641 // Build the animation
642 float durationSeconds(1.0f);
643 Animation animation = Animation::New(durationSeconds);
644 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
645 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
647 // Start the animation
650 bool signalReceived(false);
651 AnimationFinishCheck finishCheck(signalReceived);
652 animation.FinishedSignal().Connect(&application, finishCheck);
654 application.SendNotification();
655 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
657 // We didn't expect the animation to finish yet
658 application.SendNotification();
659 finishCheck.CheckSignalNotReceived();
660 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
663 Stage::GetCurrent().Add(actor);
665 application.SendNotification();
666 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
668 // We didn't expect the animation to finish yet
669 application.SendNotification();
670 finishCheck.CheckSignalNotReceived();
671 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
672 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
674 // Remove from the stage
675 Stage::GetCurrent().Remove(actor);
677 application.SendNotification();
678 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
680 // We didn't expect the animation to finish yet
681 application.SendNotification();
682 finishCheck.CheckSignalNotReceived();
683 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
686 Stage::GetCurrent().Add(actor);
688 application.SendNotification();
689 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
691 // We didn't expect the animation to finish yet
692 application.SendNotification();
693 finishCheck.CheckSignalNotReceived();
694 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
695 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
697 application.SendNotification();
698 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
700 // We did expect the animation to finish
701 application.SendNotification();
702 finishCheck.CheckSignalReceived();
703 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
705 // Check that nothing has changed after a couple of buffer swaps
706 application.Render(0);
707 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
708 application.Render(0);
709 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
713 int UtcDaliAnimationPlayDiscardHandle(void)
715 TestApplication application;
717 Actor actor = Actor::New();
718 Stage::GetCurrent().Add(actor);
720 // Build the animation
721 float durationSeconds(1.0f);
722 Animation animation = Animation::New(durationSeconds);
723 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
724 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
726 bool signalReceived(false);
727 AnimationFinishCheck finishCheck(signalReceived);
728 animation.FinishedSignal().Connect(&application, finishCheck);
730 // Start the animation
733 // This is a test of the "Fire and Forget" behaviour
734 // Discard the animation handle!
736 DALI_TEST_CHECK( !animation );
738 application.SendNotification();
739 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
741 // We didn't expect the animation to finish yet
742 application.SendNotification();
743 finishCheck.CheckSignalNotReceived();
744 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
746 application.SendNotification();
747 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
749 // We didn't expect the animation to finish yet
750 application.SendNotification();
751 finishCheck.CheckSignalNotReceived();
752 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
754 application.SendNotification();
755 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
757 // We didn't expect the animation to finish yet
758 application.SendNotification();
759 finishCheck.CheckSignalNotReceived();
760 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
762 application.SendNotification();
763 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
765 // We didn't expect the animation to finish yet
766 application.SendNotification();
767 finishCheck.CheckSignalNotReceived();
768 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
770 application.SendNotification();
771 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
773 // We did expect the animation to finish
774 application.SendNotification();
775 finishCheck.CheckSignalReceived();
776 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
778 // Check that nothing has changed after a couple of buffer swaps
779 application.Render(0);
780 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
781 application.Render(0);
782 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
786 int UtcDaliAnimationPlayStopDiscardHandle(void)
788 TestApplication application;
790 Actor actor = Actor::New();
791 Stage::GetCurrent().Add(actor);
793 // Build the animation
794 float durationSeconds(1.0f);
795 Animation animation = Animation::New(durationSeconds);
796 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
797 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
799 // Start the animation
802 bool signalReceived(false);
803 AnimationFinishCheck finishCheck(signalReceived);
804 animation.FinishedSignal().Connect(&application, finishCheck);
806 application.SendNotification();
807 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
809 // We didn't expect the animation to finish yet
810 application.SendNotification();
811 finishCheck.CheckSignalNotReceived();
812 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
814 // This is a test of the "Fire and Forget" behaviour
815 // Stop the animation, and Discard the animation handle!
818 DALI_TEST_CHECK( !animation );
820 application.SendNotification();
821 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
823 // We expect the animation to finish at 20% progress
824 application.SendNotification();
825 finishCheck.CheckSignalReceived();
827 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
829 application.SendNotification();
830 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
832 // Check that nothing has changed
833 application.SendNotification();
834 finishCheck.CheckSignalNotReceived();
835 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
837 application.SendNotification();
838 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
840 // Check that nothing has changed
841 application.SendNotification();
842 finishCheck.CheckSignalNotReceived();
843 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
845 application.SendNotification();
846 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
848 // Check that nothing has changed
849 application.SendNotification();
850 finishCheck.CheckSignalNotReceived();
851 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
855 int UtcDaliAnimationPause(void)
857 TestApplication application;
859 Actor actor = Actor::New();
860 Stage::GetCurrent().Add(actor);
862 // Build the animation
863 float durationSeconds(1.0f);
864 Animation animation = Animation::New(durationSeconds);
865 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
866 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
868 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
870 // Start the animation
873 bool signalReceived(false);
874 AnimationFinishCheck finishCheck(signalReceived);
875 animation.FinishedSignal().Connect(&application, finishCheck);
877 application.SendNotification();
878 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
880 // We didn't expect the animation to finish yet
881 application.SendNotification();
882 finishCheck.CheckSignalNotReceived();
883 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
885 // Pause the animation
887 application.SendNotification();
890 for (int i=0; i<5; ++i)
892 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
894 // We didn't expect the animation to finish yet
895 application.SendNotification();
896 finishCheck.CheckSignalNotReceived();
897 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
902 application.SendNotification();
903 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
905 // We didn't expect the animation to finish yet
906 application.SendNotification();
907 finishCheck.CheckSignalNotReceived();
909 application.SendNotification();
910 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
912 // We did expect the animation to finish
913 application.SendNotification();
914 finishCheck.CheckSignalReceived();
915 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
917 // Check that nothing has changed after a couple of buffer swaps
918 application.Render(0);
919 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
920 application.Render(0);
921 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
925 int UtcDaliAnimationStop(void)
927 TestApplication application;
929 Actor actor = Actor::New();
930 Stage::GetCurrent().Add(actor);
932 // Build the animation
933 float durationSeconds(1.0f);
934 Animation animation = Animation::New(durationSeconds);
935 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
936 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
938 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
940 // Start the animation
943 bool signalReceived(false);
944 AnimationFinishCheck finishCheck(signalReceived);
945 animation.FinishedSignal().Connect(&application, finishCheck);
947 application.SendNotification();
948 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
950 // We didn't expect the animation to finish yet
951 application.SendNotification();
952 finishCheck.CheckSignalNotReceived();
953 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
955 // Stop the animation
957 application.SendNotification();
960 for (int i=0; i<5; ++i)
962 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
964 // We did expect the animation to finish
965 application.SendNotification();
966 finishCheck.CheckSignalReceived();
967 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
972 int UtcDaliAnimationStopSetPosition(void)
974 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
975 // i.e. to check that the animation does not interfere with the position set.
977 TestApplication application;
979 Actor actor = Actor::New();
980 Stage::GetCurrent().Add(actor);
982 // Build the animation
983 float durationSeconds(1.0f);
984 Animation animation = Animation::New(durationSeconds);
985 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
986 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
988 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
990 // Start the animation
993 bool signalReceived(false);
994 AnimationFinishCheck finishCheck(signalReceived);
995 animation.FinishedSignal().Connect(&application, finishCheck);
997 application.SendNotification();
998 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1000 // We didn't expect the animation to finish yet
1001 application.SendNotification();
1002 finishCheck.CheckSignalNotReceived();
1003 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1005 // Stop the animation
1007 Vector3 positionSet(2.0f, 3.0f, 4.0f);
1008 actor.SetPosition(positionSet);
1009 application.SendNotification();
1012 for (int i=0; i<5; ++i)
1014 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1016 // We did expect the animation to finish
1017 application.SendNotification();
1018 finishCheck.CheckSignalReceived();
1019 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
1024 int UtcDaliAnimationClear(void)
1026 TestApplication application;
1028 Actor actor = Actor::New();
1029 Stage::GetCurrent().Add(actor);
1031 // Build the animation
1032 float durationSeconds(1.0f);
1033 Animation animation = Animation::New(durationSeconds);
1034 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1035 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
1037 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1039 // Start the animation
1042 bool signalReceived(false);
1043 AnimationFinishCheck finishCheck(signalReceived);
1044 animation.FinishedSignal().Connect(&application, finishCheck);
1046 application.SendNotification();
1047 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1049 // We didn't expect the animation to finish yet
1050 application.SendNotification();
1051 finishCheck.CheckSignalNotReceived();
1052 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1054 // Clear the animation
1056 application.SendNotification();
1058 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1060 // We don't expect the animation to finish now
1061 application.SendNotification();
1062 finishCheck.CheckSignalNotReceived();
1063 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
1065 // Restart as a scale animation; this should not move the actor's position
1066 finishCheck.Reset();
1067 actor.SetPosition(Vector3::ZERO);
1068 Vector3 targetScale(3.0f, 3.0f, 3.0f);
1069 animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear);
1072 application.SendNotification();
1073 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1075 // We didn't expect the animation to finish yet
1076 application.SendNotification();
1077 finishCheck.CheckSignalNotReceived();
1078 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1079 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
1081 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1083 // We did expect the animation to finish
1084 application.SendNotification();
1085 finishCheck.CheckSignalReceived();
1086 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1087 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
1091 int UtcDaliAnimationSignalFinish(void)
1093 TestApplication application;
1095 // Start the empty animation
1096 float durationSeconds(1.0f);
1097 Animation animation = Animation::New(durationSeconds);
1100 bool signalReceived(false);
1101 AnimationFinishCheck finishCheck(signalReceived);
1102 animation.FinishedSignal().Connect(&application, finishCheck);
1104 application.SendNotification();
1105 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
1107 // We did expect the animation to finish
1108 application.SendNotification();
1109 finishCheck.CheckSignalReceived();
1113 int UtcDaliAnimationAnimateByBoolean(void)
1115 TestApplication application;
1117 Actor actor = Actor::New();
1119 // Register a boolean property
1120 bool startValue(false);
1121 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1122 Stage::GetCurrent().Add(actor);
1123 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1125 // Build the animation
1126 float durationSeconds(2.0f);
1127 Animation animation = Animation::New(durationSeconds);
1128 const bool relativeValue(true);
1129 const bool finalValue( false || relativeValue );
1130 animation.AnimateBy(Property(actor, index), relativeValue);
1132 // Start the animation
1135 bool signalReceived(false);
1136 AnimationFinishCheck finishCheck(signalReceived);
1137 animation.FinishedSignal().Connect(&application, finishCheck);
1139 application.SendNotification();
1140 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1142 // We didn't expect the animation to finish yet
1143 application.SendNotification();
1144 finishCheck.CheckSignalNotReceived();
1145 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1147 application.SendNotification();
1148 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1150 // We did expect the animation to finish
1151 application.SendNotification();
1152 finishCheck.CheckSignalReceived();
1153 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1155 // Check that nothing has changed after a couple of buffer swaps
1156 application.Render(0);
1157 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1158 application.Render(0);
1159 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1161 // Repeat with relative value "false" - this should be an NOOP
1162 animation = Animation::New(durationSeconds);
1163 bool noOpValue(false);
1164 animation.AnimateBy(Property(actor, index), noOpValue);
1166 // Start the animation
1169 finishCheck.Reset();
1170 animation.FinishedSignal().Connect(&application, finishCheck);
1172 application.SendNotification();
1173 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1175 // We didn't expect the animation to finish yet
1176 application.SendNotification();
1177 finishCheck.CheckSignalNotReceived();
1178 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1180 application.SendNotification();
1181 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1183 // We did expect the animation to finish
1184 application.SendNotification();
1185 finishCheck.CheckSignalReceived();
1186 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1188 // Check that nothing has changed after a couple of buffer swaps
1189 application.Render(0);
1190 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1191 application.Render(0);
1192 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1196 int UtcDaliAnimationAnimateByBooleanAlphaFunction(void)
1198 TestApplication application;
1200 Actor actor = Actor::New();
1202 // Register a boolean property
1203 bool startValue(false);
1204 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1205 Stage::GetCurrent().Add(actor);
1206 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1208 // Build the animation
1209 float durationSeconds(2.0f);
1210 Animation animation = Animation::New(durationSeconds);
1211 bool relativeValue(true);
1212 bool finalValue( false || relativeValue );
1213 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseIn);
1215 // Start the animation
1218 bool signalReceived(false);
1219 AnimationFinishCheck finishCheck(signalReceived);
1220 animation.FinishedSignal().Connect(&application, finishCheck);
1222 application.SendNotification();
1223 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1225 // We didn't expect the animation to finish yet
1226 application.SendNotification();
1227 finishCheck.CheckSignalNotReceived();
1228 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1230 application.SendNotification();
1231 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1233 // We did expect the animation to finish
1234 application.SendNotification();
1235 finishCheck.CheckSignalReceived();
1236 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1238 // Check that nothing has changed after a couple of buffer swaps
1239 application.Render(0);
1240 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1241 application.Render(0);
1242 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1244 // Repeat with relative value "false" - this should be an NOOP
1245 animation = Animation::New(durationSeconds);
1246 bool noOpValue(false);
1247 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunctions::EaseIn);
1249 // Start the animation
1252 finishCheck.Reset();
1253 animation.FinishedSignal().Connect(&application, finishCheck);
1255 application.SendNotification();
1256 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1258 // We didn't expect the animation to finish yet
1259 application.SendNotification();
1260 finishCheck.CheckSignalNotReceived();
1261 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1263 application.SendNotification();
1264 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1266 // We did expect the animation to finish
1267 application.SendNotification();
1268 finishCheck.CheckSignalReceived();
1269 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1273 int UtcDaliAnimationAnimateByBooleanTimePeriod(void)
1275 TestApplication application;
1277 Actor actor = Actor::New();
1279 // Register a boolean property
1280 bool startValue(false);
1281 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1282 Stage::GetCurrent().Add(actor);
1283 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1285 // Build the animation
1286 float durationSeconds(2.0f);
1287 Animation animation = Animation::New(durationSeconds);
1288 bool relativeValue(true);
1289 bool finalValue( false || relativeValue );
1290 float animatorDurationSeconds(durationSeconds * 0.5f);
1291 animation.AnimateBy( Property(actor, index),
1293 TimePeriod( animatorDurationSeconds ) );
1295 // Start the animation
1298 bool signalReceived(false);
1299 AnimationFinishCheck finishCheck(signalReceived);
1300 animation.FinishedSignal().Connect(&application, finishCheck);
1302 application.SendNotification();
1303 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
1305 // We didn't expect the animation to finish yet
1306 application.SendNotification();
1307 finishCheck.CheckSignalNotReceived();
1308 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1310 application.SendNotification();
1311 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
1313 // We didn't expect the animation to finish yet...
1314 application.SendNotification();
1315 finishCheck.CheckSignalNotReceived();
1317 // ...however we should have reached the final value
1318 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1320 application.SendNotification();
1321 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
1323 // We did expect the animation to finish
1324 application.SendNotification();
1325 finishCheck.CheckSignalReceived();
1326 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1328 // Check that nothing has changed after a couple of buffer swaps
1329 application.Render(0);
1330 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1331 application.Render(0);
1332 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1336 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriod(void)
1338 TestApplication application;
1340 Actor actor = Actor::New();
1342 // Register a boolean property
1343 bool startValue(false);
1344 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1345 Stage::GetCurrent().Add(actor);
1346 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1348 // Build the animation
1349 float durationSeconds(2.0f);
1350 Animation animation = Animation::New(durationSeconds);
1351 bool relativeValue(true);
1352 bool finalValue( false || relativeValue );
1353 float animatorDurationSeconds(durationSeconds * 0.5f);
1354 animation.AnimateBy( Property(actor, index),
1356 AlphaFunctions::EaseInOut,
1357 TimePeriod( animatorDurationSeconds ) );
1359 // Start the animation
1362 bool signalReceived(false);
1363 AnimationFinishCheck finishCheck(signalReceived);
1364 animation.FinishedSignal().Connect(&application, finishCheck);
1366 application.SendNotification();
1367 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
1369 // We didn't expect the animation to finish yet
1370 application.SendNotification();
1371 finishCheck.CheckSignalNotReceived();
1372 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1374 application.SendNotification();
1375 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
1377 // We didn't expect the animation to finish yet...
1378 application.SendNotification();
1379 finishCheck.CheckSignalNotReceived();
1381 // ...however we should have reached the final value
1382 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1384 application.SendNotification();
1385 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
1387 // We did expect the animation to finish
1388 application.SendNotification();
1389 finishCheck.CheckSignalReceived();
1390 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1392 // Check that nothing has changed after a couple of buffer swaps
1393 application.Render(0);
1394 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1395 application.Render(0);
1396 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1400 int UtcDaliAnimationAnimateByFloat(void)
1402 TestApplication application;
1404 Actor actor = Actor::New();
1406 // Register a float property
1407 float startValue(10.0f);
1408 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1409 Stage::GetCurrent().Add(actor);
1410 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1412 // Build the animation
1413 float durationSeconds(2.0f);
1414 Animation animation = Animation::New(durationSeconds);
1415 float targetValue(50.0f);
1416 float relativeValue(targetValue - startValue);
1417 animation.AnimateBy(Property(actor, index), relativeValue);
1419 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1421 // Start the animation
1424 bool signalReceived(false);
1425 AnimationFinishCheck finishCheck(signalReceived);
1426 animation.FinishedSignal().Connect(&application, finishCheck);
1428 application.SendNotification();
1429 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1431 // We didn't expect the animation to finish yet
1432 application.SendNotification();
1433 finishCheck.CheckSignalNotReceived();
1434 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
1436 application.SendNotification();
1437 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1439 // We did expect the animation to finish
1440 application.SendNotification();
1441 finishCheck.CheckSignalReceived();
1442 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1444 // Check that nothing has changed after a couple of buffer swaps
1445 application.Render(0);
1446 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1447 application.Render(0);
1448 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1452 int UtcDaliAnimationAnimateByFloatAlphaFunction(void)
1454 TestApplication application;
1456 Actor actor = Actor::New();
1458 // Register a float property
1459 float startValue(10.0f);
1460 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1461 Stage::GetCurrent().Add(actor);
1462 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1464 // Build the animation
1465 float durationSeconds(1.0f);
1466 Animation animation = Animation::New(durationSeconds);
1467 float targetValue(90.0f);
1468 float relativeValue(targetValue - startValue);
1469 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1471 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1473 // Start the animation
1476 bool signalReceived(false);
1477 AnimationFinishCheck finishCheck(signalReceived);
1478 animation.FinishedSignal().Connect(&application, finishCheck);
1480 application.SendNotification();
1481 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1483 // We didn't expect the animation to finish yet
1484 application.SendNotification();
1485 finishCheck.CheckSignalNotReceived();
1487 // The position should have moved more, than with a linear alpha function
1488 float current(actor.GetProperty<float>(index));
1489 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
1491 application.SendNotification();
1492 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1494 // We did expect the animation to finish
1495 application.SendNotification();
1496 finishCheck.CheckSignalReceived();
1497 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1499 // Check that nothing has changed after a couple of buffer swaps
1500 application.Render(0);
1501 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1502 application.Render(0);
1503 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1507 int UtcDaliAnimationAnimateByFloatTimePeriod(void)
1509 TestApplication application;
1511 Actor actor = Actor::New();
1513 // Register a float property
1514 float startValue(10.0f);
1515 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1516 Stage::GetCurrent().Add(actor);
1517 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1519 // Build the animation
1520 float durationSeconds(1.0f);
1521 Animation animation = Animation::New(durationSeconds);
1522 float targetValue(30.0f);
1523 float relativeValue(targetValue - startValue);
1525 animation.AnimateBy(Property(actor, index),
1527 TimePeriod(delay, durationSeconds - delay));
1529 // Start the animation
1532 bool signalReceived(false);
1533 AnimationFinishCheck finishCheck(signalReceived);
1534 animation.FinishedSignal().Connect(&application, finishCheck);
1536 application.SendNotification();
1537 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1539 // We didn't expect the animation to finish yet
1540 application.SendNotification();
1541 finishCheck.CheckSignalNotReceived();
1542 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1544 application.SendNotification();
1545 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1547 // We didn't expect the animation to finish yet
1548 application.SendNotification();
1549 finishCheck.CheckSignalNotReceived();
1550 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1552 application.SendNotification();
1553 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1555 // We did expect the animation to finish
1556 application.SendNotification();
1557 finishCheck.CheckSignalReceived();
1558 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1560 // Check that nothing has changed after a couple of buffer swaps
1561 application.Render(0);
1562 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1563 application.Render(0);
1564 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1568 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriod(void)
1570 TestApplication application;
1572 Actor actor = Actor::New();
1574 // Register a float property
1575 float startValue(10.0f);
1576 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1577 Stage::GetCurrent().Add(actor);
1578 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1580 // Build the animation
1581 float durationSeconds(1.0f);
1582 Animation animation = Animation::New(durationSeconds);
1583 float targetValue(30.0f);
1584 float relativeValue(targetValue - startValue);
1586 animation.AnimateBy(Property(actor, index),
1588 AlphaFunctions::Linear,
1589 TimePeriod(delay, durationSeconds - delay));
1591 // Start the animation
1594 bool signalReceived(false);
1595 AnimationFinishCheck finishCheck(signalReceived);
1596 animation.FinishedSignal().Connect(&application, finishCheck);
1598 application.SendNotification();
1599 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1601 // We didn't expect the animation to finish yet
1602 application.SendNotification();
1603 finishCheck.CheckSignalNotReceived();
1604 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1606 application.SendNotification();
1607 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1609 // We didn't expect the animation to finish yet
1610 application.SendNotification();
1611 finishCheck.CheckSignalNotReceived();
1612 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1614 application.SendNotification();
1615 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1617 // We did expect the animation to finish
1618 application.SendNotification();
1619 finishCheck.CheckSignalReceived();
1620 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1622 // Check that nothing has changed after a couple of buffer swaps
1623 application.Render(0);
1624 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1625 application.Render(0);
1626 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1630 int UtcDaliAnimationAnimateByVector2(void)
1632 TestApplication application;
1634 Actor actor = Actor::New();
1636 // Register a Vector2 property
1637 Vector2 startValue(10.0f, 10.0f);
1638 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1639 Stage::GetCurrent().Add(actor);
1640 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1642 // Build the animation
1643 float durationSeconds(2.0f);
1644 Animation animation = Animation::New(durationSeconds);
1645 Vector2 targetValue(60.0f, 60.0f);
1646 Vector2 relativeValue(targetValue - startValue);
1647 animation.AnimateBy(Property(actor, index), relativeValue);
1649 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1651 // Start the animation
1654 bool signalReceived(false);
1655 AnimationFinishCheck finishCheck(signalReceived);
1656 animation.FinishedSignal().Connect(&application, finishCheck);
1658 application.SendNotification();
1659 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1661 // We didn't expect the animation to finish yet
1662 application.SendNotification();
1663 finishCheck.CheckSignalNotReceived();
1664 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
1666 application.SendNotification();
1667 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1669 // We did expect the animation to finish
1670 application.SendNotification();
1671 finishCheck.CheckSignalReceived();
1672 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1674 // Check that nothing has changed after a couple of buffer swaps
1675 application.Render(0);
1676 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1677 application.Render(0);
1678 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1682 int UtcDaliAnimationAnimateByVector2AlphaFunction(void)
1684 TestApplication application;
1686 Actor actor = Actor::New();
1688 // Register a Vector2 property
1689 Vector2 startValue(100.0f, 100.0f);
1690 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1691 Stage::GetCurrent().Add(actor);
1692 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1694 // Build the animation
1695 float durationSeconds(1.0f);
1696 Animation animation = Animation::New(durationSeconds);
1697 Vector2 targetValue(20.0f, 20.0f);
1698 Vector2 relativeValue(targetValue - startValue);
1699 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1701 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1703 // Start the animation
1706 bool signalReceived(false);
1707 AnimationFinishCheck finishCheck(signalReceived);
1708 animation.FinishedSignal().Connect(&application, finishCheck);
1710 application.SendNotification();
1711 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1713 // We didn't expect the animation to finish yet
1714 application.SendNotification();
1715 finishCheck.CheckSignalNotReceived();
1717 // The position should have moved more, than with a linear alpha function
1718 Vector2 current(actor.GetProperty<Vector2>(index));
1719 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
1720 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
1722 application.SendNotification();
1723 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1725 // We did expect the animation to finish
1726 application.SendNotification();
1727 finishCheck.CheckSignalReceived();
1728 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1730 // Check that nothing has changed after a couple of buffer swaps
1731 application.Render(0);
1732 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1733 application.Render(0);
1734 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1738 int UtcDaliAnimationAnimateByVector2TimePeriod(void)
1740 TestApplication application;
1742 Actor actor = Actor::New();
1744 // Register a Vector2 property
1745 Vector2 startValue(10.0f, 10.0f);
1746 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1747 Stage::GetCurrent().Add(actor);
1748 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1750 // Build the animation
1751 float durationSeconds(1.0f);
1752 Animation animation = Animation::New(durationSeconds);
1753 Vector2 targetValue(30.0f, 30.0f);
1754 Vector2 relativeValue(targetValue - startValue);
1756 animation.AnimateBy(Property(actor, index),
1758 TimePeriod(delay, durationSeconds - delay));
1760 // Start the animation
1763 bool signalReceived(false);
1764 AnimationFinishCheck finishCheck(signalReceived);
1765 animation.FinishedSignal().Connect(&application, finishCheck);
1767 application.SendNotification();
1768 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1770 // We didn't expect the animation to finish yet
1771 application.SendNotification();
1772 finishCheck.CheckSignalNotReceived();
1773 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1775 application.SendNotification();
1776 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1778 // We didn't expect the animation to finish yet
1779 application.SendNotification();
1780 finishCheck.CheckSignalNotReceived();
1781 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1783 application.SendNotification();
1784 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1786 // We did expect the animation to finish
1787 application.SendNotification();
1788 finishCheck.CheckSignalReceived();
1789 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1791 // Check that nothing has changed after a couple of buffer swaps
1792 application.Render(0);
1793 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1794 application.Render(0);
1795 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1799 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriod(void)
1801 TestApplication application;
1803 Actor actor = Actor::New();
1805 // Register a Vector2 property
1806 Vector2 startValue(5.0f, 5.0f);
1807 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1808 Stage::GetCurrent().Add(actor);
1809 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1811 // Build the animation
1812 float durationSeconds(1.0f);
1813 Animation animation = Animation::New(durationSeconds);
1814 Vector2 targetValue(10.0f, 10.0f);
1815 Vector2 relativeValue(targetValue - startValue);
1817 animation.AnimateBy(Property(actor, index),
1819 AlphaFunctions::Linear,
1820 TimePeriod(delay, durationSeconds - delay));
1822 // Start the animation
1825 bool signalReceived(false);
1826 AnimationFinishCheck finishCheck(signalReceived);
1827 animation.FinishedSignal().Connect(&application, finishCheck);
1829 application.SendNotification();
1830 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1832 // We didn't expect the animation to finish yet
1833 application.SendNotification();
1834 finishCheck.CheckSignalNotReceived();
1835 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1837 application.SendNotification();
1838 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1840 // We didn't expect the animation to finish yet
1841 application.SendNotification();
1842 finishCheck.CheckSignalNotReceived();
1843 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1845 application.SendNotification();
1846 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1848 // We did expect the animation to finish
1849 application.SendNotification();
1850 finishCheck.CheckSignalReceived();
1851 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1853 // Check that nothing has changed after a couple of buffer swaps
1854 application.Render(0);
1855 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1856 application.Render(0);
1857 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1861 int UtcDaliAnimationAnimateByVector3(void)
1863 TestApplication application;
1865 Actor actor = Actor::New();
1867 // Register a Vector3 property
1868 Vector3 startValue(10.0f, 10.0f, 10.0f);
1869 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1870 Stage::GetCurrent().Add(actor);
1871 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1873 // Build the animation
1874 float durationSeconds(2.0f);
1875 Animation animation = Animation::New(durationSeconds);
1876 Vector3 targetValue(60.0f, 60.0f, 60.0f);
1877 Vector3 relativeValue(targetValue - startValue);
1878 animation.AnimateBy(Property(actor, index), relativeValue);
1880 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1882 // Start the animation
1885 bool signalReceived(false);
1886 AnimationFinishCheck finishCheck(signalReceived);
1887 animation.FinishedSignal().Connect(&application, finishCheck);
1889 application.SendNotification();
1890 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1892 // We didn't expect the animation to finish yet
1893 application.SendNotification();
1894 finishCheck.CheckSignalNotReceived();
1895 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
1897 application.SendNotification();
1898 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1900 // We did expect the animation to finish
1901 application.SendNotification();
1902 finishCheck.CheckSignalReceived();
1903 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1905 // Check that nothing has changed after a couple of buffer swaps
1906 application.Render(0);
1907 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1908 application.Render(0);
1909 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1913 int UtcDaliAnimationAnimateByVector3AlphaFunction(void)
1915 TestApplication application;
1917 Actor actor = Actor::New();
1919 // Register a Vector3 property
1920 Vector3 startValue(100.0f, 100.0f, 100.0f);
1921 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1922 Stage::GetCurrent().Add(actor);
1923 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1925 // Build the animation
1926 float durationSeconds(1.0f);
1927 Animation animation = Animation::New(durationSeconds);
1928 Vector3 targetValue(20.0f, 20.0f, 20.0f);
1929 Vector3 relativeValue(targetValue - startValue);
1930 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1932 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1934 // Start the animation
1937 bool signalReceived(false);
1938 AnimationFinishCheck finishCheck(signalReceived);
1939 animation.FinishedSignal().Connect(&application, finishCheck);
1941 application.SendNotification();
1942 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1944 // We didn't expect the animation to finish yet
1945 application.SendNotification();
1946 finishCheck.CheckSignalNotReceived();
1948 // The position should have moved more, than with a linear alpha function
1949 Vector3 current(actor.GetProperty<Vector3>(index));
1950 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
1951 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
1952 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
1954 application.SendNotification();
1955 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1957 // We did expect the animation to finish
1958 application.SendNotification();
1959 finishCheck.CheckSignalReceived();
1960 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1962 // Check that nothing has changed after a couple of buffer swaps
1963 application.Render(0);
1964 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1965 application.Render(0);
1966 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1970 int UtcDaliAnimationAnimateByVector3TimePeriod(void)
1972 TestApplication application;
1974 Actor actor = Actor::New();
1976 // Register a Vector3 property
1977 Vector3 startValue(10.0f, 10.0f, 10.0f);
1978 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1979 Stage::GetCurrent().Add(actor);
1980 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1982 // Build the animation
1983 float durationSeconds(1.0f);
1984 Animation animation = Animation::New(durationSeconds);
1985 Vector3 targetValue(30.0f, 30.0f, 30.0f);
1986 Vector3 relativeValue(targetValue - startValue);
1988 animation.AnimateBy(Property(actor, index),
1990 TimePeriod(delay, durationSeconds - delay));
1992 // Start the animation
1995 bool signalReceived(false);
1996 AnimationFinishCheck finishCheck(signalReceived);
1997 animation.FinishedSignal().Connect(&application, finishCheck);
1999 application.SendNotification();
2000 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2002 // We didn't expect the animation to finish yet
2003 application.SendNotification();
2004 finishCheck.CheckSignalNotReceived();
2005 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2007 application.SendNotification();
2008 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2010 // We didn't expect the animation to finish yet
2011 application.SendNotification();
2012 finishCheck.CheckSignalNotReceived();
2013 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2015 application.SendNotification();
2016 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2018 // We did expect the animation to finish
2019 application.SendNotification();
2020 finishCheck.CheckSignalReceived();
2021 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2023 // Check that nothing has changed after a couple of buffer swaps
2024 application.Render(0);
2025 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2026 application.Render(0);
2027 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2031 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriod(void)
2033 TestApplication application;
2035 Actor actor = Actor::New();
2037 // Register a Vector3 property
2038 Vector3 startValue(5.0f, 5.0f, 5.0f);
2039 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2040 Stage::GetCurrent().Add(actor);
2041 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2043 // Build the animation
2044 float durationSeconds(1.0f);
2045 Animation animation = Animation::New(durationSeconds);
2046 Vector3 targetValue(10.0f, 10.0f, 10.0f);
2047 Vector3 relativeValue(targetValue - startValue);
2049 animation.AnimateBy(Property(actor, index),
2051 AlphaFunctions::Linear,
2052 TimePeriod(delay, durationSeconds - delay));
2054 // Start the animation
2057 bool signalReceived(false);
2058 AnimationFinishCheck finishCheck(signalReceived);
2059 animation.FinishedSignal().Connect(&application, finishCheck);
2061 application.SendNotification();
2062 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2064 // We didn't expect the animation to finish yet
2065 application.SendNotification();
2066 finishCheck.CheckSignalNotReceived();
2067 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2069 application.SendNotification();
2070 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2072 // We didn't expect the animation to finish yet
2073 application.SendNotification();
2074 finishCheck.CheckSignalNotReceived();
2075 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2077 application.SendNotification();
2078 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2080 // We did expect the animation to finish
2081 application.SendNotification();
2082 finishCheck.CheckSignalReceived();
2083 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2085 // Check that nothing has changed after a couple of buffer swaps
2086 application.Render(0);
2087 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2088 application.Render(0);
2089 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2093 int UtcDaliAnimationAnimateByVector4(void)
2095 TestApplication application;
2097 Actor actor = Actor::New();
2099 // Register a Vector4 property
2100 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
2101 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2102 Stage::GetCurrent().Add(actor);
2103 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2105 // Build the animation
2106 float durationSeconds(2.0f);
2107 Animation animation = Animation::New(durationSeconds);
2108 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
2109 Vector4 relativeValue(targetValue - startValue);
2110 animation.AnimateBy(Property(actor, index), relativeValue);
2112 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2114 // Start the animation
2117 bool signalReceived(false);
2118 AnimationFinishCheck finishCheck(signalReceived);
2119 animation.FinishedSignal().Connect(&application, finishCheck);
2121 application.SendNotification();
2122 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2124 // We didn't expect the animation to finish yet
2125 application.SendNotification();
2126 finishCheck.CheckSignalNotReceived();
2127 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
2129 application.SendNotification();
2130 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2132 // We did expect the animation to finish
2133 application.SendNotification();
2134 finishCheck.CheckSignalReceived();
2135 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2137 // Check that nothing has changed after a couple of buffer swaps
2138 application.Render(0);
2139 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2140 application.Render(0);
2141 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2145 int UtcDaliAnimationAnimateByVector4AlphaFunction(void)
2147 TestApplication application;
2149 Actor actor = Actor::New();
2151 // Register a Vector4 property
2152 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
2153 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2154 Stage::GetCurrent().Add(actor);
2155 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2157 // Build the animation
2158 float durationSeconds(1.0f);
2159 Animation animation = Animation::New(durationSeconds);
2160 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
2161 Vector4 relativeValue(targetValue - startValue);
2162 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
2164 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2166 // Start the animation
2169 bool signalReceived(false);
2170 AnimationFinishCheck finishCheck(signalReceived);
2171 animation.FinishedSignal().Connect(&application, finishCheck);
2173 application.SendNotification();
2174 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2176 // We didn't expect the animation to finish yet
2177 application.SendNotification();
2178 finishCheck.CheckSignalNotReceived();
2180 // The position should have moved more, than with a linear alpha function
2181 Vector4 current(actor.GetProperty<Vector4>(index));
2182 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
2183 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
2184 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
2185 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
2187 application.SendNotification();
2188 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2190 // We did expect the animation to finish
2191 application.SendNotification();
2192 finishCheck.CheckSignalReceived();
2193 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2195 // Check that nothing has changed after a couple of buffer swaps
2196 application.Render(0);
2197 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2198 application.Render(0);
2199 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2203 int UtcDaliAnimationAnimateByVector4TimePeriod(void)
2205 TestApplication application;
2207 Actor actor = Actor::New();
2209 // Register a Vector4 property
2210 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
2211 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2212 Stage::GetCurrent().Add(actor);
2213 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2215 // Build the animation
2216 float durationSeconds(1.0f);
2217 Animation animation = Animation::New(durationSeconds);
2218 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
2219 Vector4 relativeValue(targetValue - startValue);
2221 animation.AnimateBy(Property(actor, index),
2223 TimePeriod(delay, durationSeconds - delay));
2225 // Start the animation
2228 bool signalReceived(false);
2229 AnimationFinishCheck finishCheck(signalReceived);
2230 animation.FinishedSignal().Connect(&application, finishCheck);
2232 application.SendNotification();
2233 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2235 // We didn't expect the animation to finish yet
2236 application.SendNotification();
2237 finishCheck.CheckSignalNotReceived();
2238 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2240 application.SendNotification();
2241 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2243 // We didn't expect the animation to finish yet
2244 application.SendNotification();
2245 finishCheck.CheckSignalNotReceived();
2246 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2248 application.SendNotification();
2249 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2251 // We did expect the animation to finish
2252 application.SendNotification();
2253 finishCheck.CheckSignalReceived();
2254 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2256 // Check that nothing has changed after a couple of buffer swaps
2257 application.Render(0);
2258 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2259 application.Render(0);
2260 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2264 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriod(void)
2266 TestApplication application;
2268 Actor actor = Actor::New();
2270 // Register a Vector4 property
2271 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
2272 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2273 Stage::GetCurrent().Add(actor);
2274 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2276 // Build the animation
2277 float durationSeconds(1.0f);
2278 Animation animation = Animation::New(durationSeconds);
2279 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
2280 Vector4 relativeValue(targetValue - startValue);
2282 animation.AnimateBy(Property(actor, index),
2284 AlphaFunctions::Linear,
2285 TimePeriod(delay, durationSeconds - delay));
2287 // Start the animation
2290 bool signalReceived(false);
2291 AnimationFinishCheck finishCheck(signalReceived);
2292 animation.FinishedSignal().Connect(&application, finishCheck);
2294 application.SendNotification();
2295 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2297 // We didn't expect the animation to finish yet
2298 application.SendNotification();
2299 finishCheck.CheckSignalNotReceived();
2300 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2302 application.SendNotification();
2303 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2305 // We didn't expect the animation to finish yet
2306 application.SendNotification();
2307 finishCheck.CheckSignalNotReceived();
2308 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2310 application.SendNotification();
2311 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2313 // We did expect the animation to finish
2314 application.SendNotification();
2315 finishCheck.CheckSignalReceived();
2316 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2318 // Check that nothing has changed after a couple of buffer swaps
2319 application.Render(0);
2320 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2321 application.Render(0);
2322 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2326 int UtcDaliAnimationAnimateByActorPosition(void)
2328 TestApplication application;
2330 Actor actor = Actor::New();
2331 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2332 actor.SetPosition(startPosition);
2333 Stage::GetCurrent().Add(actor);
2334 application.SendNotification();
2335 application.Render(0);
2336 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2338 // Build the animation
2339 float durationSeconds(1.0f);
2340 Animation animation = Animation::New(durationSeconds);
2341 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2342 Vector3 relativePosition(targetPosition - startPosition);
2343 animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition);
2345 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2347 // Start the animation
2350 bool signalReceived(false);
2351 AnimationFinishCheck finishCheck(signalReceived);
2352 animation.FinishedSignal().Connect(&application, finishCheck);
2354 application.SendNotification();
2355 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2357 // We didn't expect the animation to finish yet
2358 application.SendNotification();
2359 finishCheck.CheckSignalNotReceived();
2360 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
2362 application.SendNotification();
2363 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2365 // We did expect the animation to finish
2366 application.SendNotification();
2367 finishCheck.CheckSignalReceived();
2368 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2370 // Check that nothing has changed after a couple of buffer swaps
2371 application.Render(0);
2372 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2373 application.Render(0);
2374 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2378 int UtcDaliAnimationAnimateByActorPositionAlphaFunction(void)
2380 TestApplication application;
2382 Actor actor = Actor::New();
2383 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2384 actor.SetPosition(startPosition);
2385 Stage::GetCurrent().Add(actor);
2386 application.SendNotification();
2387 application.Render(0);
2388 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2390 // Build the animation
2391 float durationSeconds(1.0f);
2392 Animation animation = Animation::New(durationSeconds);
2393 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2394 Vector3 relativePosition(targetPosition - startPosition);
2395 animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition, AlphaFunctions::EaseOut);
2397 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2399 // Start the animation
2402 bool signalReceived(false);
2403 AnimationFinishCheck finishCheck(signalReceived);
2404 animation.FinishedSignal().Connect(&application, finishCheck);
2406 application.SendNotification();
2407 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2409 // We didn't expect the animation to finish yet
2410 application.SendNotification();
2411 finishCheck.CheckSignalNotReceived();
2413 // The position should have moved more, than with a linear alpha function
2414 Vector3 current(actor.GetCurrentPosition());
2415 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
2416 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
2417 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
2419 application.SendNotification();
2420 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2422 // We did expect the animation to finish
2423 application.SendNotification();
2424 finishCheck.CheckSignalReceived();
2425 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2427 // Check that nothing has changed after a couple of buffer swaps
2428 application.Render(0);
2429 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2430 application.Render(0);
2431 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2435 int UtcDaliAnimationAnimateByActorPositionTimePeriod(void)
2437 TestApplication application;
2439 Actor actor = Actor::New();
2440 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2441 actor.SetPosition(startPosition);
2442 Stage::GetCurrent().Add(actor);
2443 application.SendNotification();
2444 application.Render(0);
2445 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2447 // Build the animation
2448 float durationSeconds(1.0f);
2449 Animation animation = Animation::New(durationSeconds);
2450 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2451 Vector3 relativePosition(targetPosition - startPosition);
2453 animation.AnimateBy(Property(actor, Actor::POSITION),
2455 TimePeriod(delay, durationSeconds - delay));
2457 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2459 // Start the animation
2462 bool signalReceived(false);
2463 AnimationFinishCheck finishCheck(signalReceived);
2464 animation.FinishedSignal().Connect(&application, finishCheck);
2466 application.SendNotification();
2467 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2469 // We didn't expect the animation to finish yet
2470 application.SendNotification();
2471 finishCheck.CheckSignalNotReceived();
2472 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2474 application.SendNotification();
2475 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2477 // We did expect the animation to finish
2478 application.SendNotification();
2479 finishCheck.CheckSignalReceived();
2480 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2482 // Check that nothing has changed after a couple of buffer swaps
2483 application.Render(0);
2484 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2485 application.Render(0);
2486 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2490 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriod(void)
2492 TestApplication application;
2494 Actor actor = Actor::New();
2495 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2496 actor.SetPosition(startPosition);
2497 Stage::GetCurrent().Add(actor);
2498 application.SendNotification();
2499 application.Render(0);
2500 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2502 // Build the animation
2503 float durationSeconds(1.0f);
2504 Animation animation = Animation::New(durationSeconds);
2505 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2506 Vector3 relativePosition(targetPosition - startPosition);
2508 animation.AnimateBy(Property(actor, Actor::POSITION),
2510 AlphaFunctions::Linear,
2511 TimePeriod(delay, durationSeconds - delay));
2513 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2515 // Start the animation
2518 bool signalReceived(false);
2519 AnimationFinishCheck finishCheck(signalReceived);
2520 animation.FinishedSignal().Connect(&application, finishCheck);
2522 application.SendNotification();
2523 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2525 // We didn't expect the animation to finish yet
2526 application.SendNotification();
2527 finishCheck.CheckSignalNotReceived();
2528 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2530 application.SendNotification();
2531 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2533 // We did expect the animation to finish
2534 application.SendNotification();
2535 finishCheck.CheckSignalReceived();
2536 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2538 // Check that nothing has changed after a couple of buffer swaps
2539 application.Render(0);
2540 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2541 application.Render(0);
2542 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2546 int UtcDaliAnimationAnimateToBoolean(void)
2548 TestApplication application;
2550 Actor actor = Actor::New();
2552 // Register a boolean property
2553 const bool startValue(false);
2554 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2555 Stage::GetCurrent().Add(actor);
2556 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2558 // Build the animation
2559 float durationSeconds(2.0f);
2560 Animation animation = Animation::New(durationSeconds);
2561 const bool targetValue( !startValue );
2562 animation.AnimateTo(Property(actor, index), targetValue);
2564 // Start the animation
2567 bool signalReceived(false);
2568 AnimationFinishCheck finishCheck(signalReceived);
2569 animation.FinishedSignal().Connect(&application, finishCheck);
2571 application.SendNotification();
2572 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2574 // We didn't expect the animation to finish yet
2575 application.SendNotification();
2576 finishCheck.CheckSignalNotReceived();
2577 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2579 application.SendNotification();
2580 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2582 // We did expect the animation to finish
2583 application.SendNotification();
2584 finishCheck.CheckSignalReceived();
2585 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2587 // Check that nothing has changed after a couple of buffer swaps
2588 application.Render(0);
2589 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2590 application.Render(0);
2591 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2593 // Repeat with target value "false"
2594 animation = Animation::New(durationSeconds);
2595 const bool finalValue( !targetValue );
2596 animation.AnimateTo(Property(actor, index), finalValue);
2598 // Start the animation
2601 finishCheck.Reset();
2602 animation.FinishedSignal().Connect(&application, finishCheck);
2604 application.SendNotification();
2605 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2607 // We didn't expect the animation to finish yet
2608 application.SendNotification();
2609 finishCheck.CheckSignalNotReceived();
2610 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2612 application.SendNotification();
2613 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2615 // We did expect the animation to finish
2616 application.SendNotification();
2617 finishCheck.CheckSignalReceived();
2618 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2620 // Check that nothing has changed after a couple of buffer swaps
2621 application.Render(0);
2622 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2623 application.Render(0);
2624 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2628 int UtcDaliAnimationAnimateToBooleanAlphaFunction(void)
2630 TestApplication application;
2632 Actor actor = Actor::New();
2634 // Register a boolean property
2635 const bool startValue(false);
2636 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2637 Stage::GetCurrent().Add(actor);
2638 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2640 // Build the animation
2641 float durationSeconds(2.0f);
2642 Animation animation = Animation::New(durationSeconds);
2643 const bool targetValue( !startValue );
2644 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
2646 // Start the animation
2649 bool signalReceived(false);
2650 AnimationFinishCheck finishCheck(signalReceived);
2651 animation.FinishedSignal().Connect(&application, finishCheck);
2653 application.SendNotification();
2654 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2656 // We didn't expect the animation to finish yet
2657 application.SendNotification();
2658 finishCheck.CheckSignalNotReceived();
2659 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2661 application.SendNotification();
2662 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2664 // We did expect the animation to finish
2665 application.SendNotification();
2666 finishCheck.CheckSignalReceived();
2667 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2669 // Check that nothing has changed after a couple of buffer swaps
2670 application.Render(0);
2671 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2672 application.Render(0);
2673 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2675 // Repeat with target value "false"
2676 animation = Animation::New(durationSeconds);
2677 const bool finalValue( !targetValue );
2678 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunctions::EaseOut);
2680 // Start the animation
2683 finishCheck.Reset();
2684 animation.FinishedSignal().Connect(&application, finishCheck);
2686 application.SendNotification();
2687 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2689 // We didn't expect the animation to finish yet
2690 application.SendNotification();
2691 finishCheck.CheckSignalNotReceived();
2692 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2694 application.SendNotification();
2695 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2697 // We did expect the animation to finish
2698 application.SendNotification();
2699 finishCheck.CheckSignalReceived();
2700 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2702 // Check that nothing has changed after a couple of buffer swaps
2703 application.Render(0);
2704 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2705 application.Render(0);
2706 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2710 int UtcDaliAnimationAnimateToBooleanTimePeriod(void)
2712 TestApplication application;
2714 Actor actor = Actor::New();
2716 // Register a boolean property
2717 bool startValue(false);
2718 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2719 Stage::GetCurrent().Add(actor);
2720 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2722 // Build the animation
2723 float durationSeconds(2.0f);
2724 Animation animation = Animation::New(durationSeconds);
2725 bool finalValue( !startValue );
2726 float animatorDurationSeconds(durationSeconds * 0.5f);
2727 animation.AnimateTo( Property(actor, index),
2729 TimePeriod( animatorDurationSeconds ) );
2731 // Start the animation
2734 bool signalReceived(false);
2735 AnimationFinishCheck finishCheck(signalReceived);
2736 animation.FinishedSignal().Connect(&application, finishCheck);
2738 application.SendNotification();
2739 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2741 // We didn't expect the animation to finish yet
2742 application.SendNotification();
2743 finishCheck.CheckSignalNotReceived();
2744 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2746 application.SendNotification();
2747 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2749 // We didn't expect the animation to finish yet...
2750 application.SendNotification();
2751 finishCheck.CheckSignalNotReceived();
2753 // ...however we should have reached the final value
2754 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2756 application.SendNotification();
2757 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2759 // We did expect the animation to finish
2760 application.SendNotification();
2761 finishCheck.CheckSignalReceived();
2762 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2764 // Check that nothing has changed after a couple of buffer swaps
2765 application.Render(0);
2766 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2767 application.Render(0);
2768 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2772 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriod(void)
2774 TestApplication application;
2776 Actor actor = Actor::New();
2778 // Register a boolean property
2779 bool startValue(false);
2780 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2781 Stage::GetCurrent().Add(actor);
2782 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2784 // Build the animation
2785 float durationSeconds(2.0f);
2786 Animation animation = Animation::New(durationSeconds);
2787 bool finalValue( !startValue );
2788 float animatorDurationSeconds(durationSeconds * 0.5f);
2789 animation.AnimateTo( Property(actor, index),
2791 AlphaFunctions::Linear,
2792 TimePeriod( animatorDurationSeconds ) );
2794 // Start the animation
2797 bool signalReceived(false);
2798 AnimationFinishCheck finishCheck(signalReceived);
2799 animation.FinishedSignal().Connect(&application, finishCheck);
2801 application.SendNotification();
2802 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2804 // We didn't expect the animation to finish yet
2805 application.SendNotification();
2806 finishCheck.CheckSignalNotReceived();
2807 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2809 application.SendNotification();
2810 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2812 // We didn't expect the animation to finish yet...
2813 application.SendNotification();
2814 finishCheck.CheckSignalNotReceived();
2816 // ...however we should have reached the final value
2817 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2819 application.SendNotification();
2820 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2822 // We did expect the animation to finish
2823 application.SendNotification();
2824 finishCheck.CheckSignalReceived();
2825 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2827 // Check that nothing has changed after a couple of buffer swaps
2828 application.Render(0);
2829 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2830 application.Render(0);
2831 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2835 int UtcDaliAnimationAnimateToFloat(void)
2837 TestApplication application;
2839 Actor actor = Actor::New();
2841 // Register a float property
2842 float startValue(10.0f);
2843 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2844 Stage::GetCurrent().Add(actor);
2845 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2847 // Build the animation
2848 float durationSeconds(2.0f);
2849 Animation animation = Animation::New(durationSeconds);
2850 float targetValue(50.0f);
2851 float relativeValue(targetValue - startValue);
2852 animation.AnimateTo(Property(actor, "test-property"), targetValue);
2854 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2856 // Start the animation
2859 bool signalReceived(false);
2860 AnimationFinishCheck finishCheck(signalReceived);
2861 animation.FinishedSignal().Connect(&application, finishCheck);
2863 application.SendNotification();
2864 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2866 // We didn't expect the animation to finish yet
2867 application.SendNotification();
2868 finishCheck.CheckSignalNotReceived();
2869 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
2871 application.SendNotification();
2872 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2874 // We did expect the animation to finish
2875 application.SendNotification();
2876 finishCheck.CheckSignalReceived();
2877 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2881 int UtcDaliAnimationAnimateToFloatAlphaFunction(void)
2883 TestApplication application;
2885 Actor actor = Actor::New();
2887 // Register a float property
2888 float startValue(10.0f);
2889 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2890 Stage::GetCurrent().Add(actor);
2891 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2893 // Build the animation
2894 float durationSeconds(1.0f);
2895 Animation animation = Animation::New(durationSeconds);
2896 float targetValue(90.0f);
2897 float relativeValue(targetValue - startValue);
2898 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
2900 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2902 // Start the animation
2905 bool signalReceived(false);
2906 AnimationFinishCheck finishCheck(signalReceived);
2907 animation.FinishedSignal().Connect(&application, finishCheck);
2909 application.SendNotification();
2910 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2912 // We didn't expect the animation to finish yet
2913 application.SendNotification();
2914 finishCheck.CheckSignalNotReceived();
2916 // The position should have moved more, than with a linear alpha function
2917 float current(actor.GetProperty<float>(index));
2918 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2920 application.SendNotification();
2921 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2923 // We did expect the animation to finish
2924 application.SendNotification();
2925 finishCheck.CheckSignalReceived();
2926 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2930 int UtcDaliAnimationAnimateToFloatTimePeriod(void)
2932 TestApplication application;
2934 Actor actor = Actor::New();
2936 // Register a float property
2937 float startValue(10.0f);
2938 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2939 Stage::GetCurrent().Add(actor);
2940 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2942 // Build the animation
2943 float durationSeconds(1.0f);
2944 Animation animation = Animation::New(durationSeconds);
2945 float targetValue(30.0f);
2946 float relativeValue(targetValue - startValue);
2948 animation.AnimateTo(Property(actor, index),
2950 TimePeriod(delay, durationSeconds - delay));
2952 // Start the animation
2955 bool signalReceived(false);
2956 AnimationFinishCheck finishCheck(signalReceived);
2957 animation.FinishedSignal().Connect(&application, finishCheck);
2959 application.SendNotification();
2960 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2962 // We didn't expect the animation to finish yet
2963 application.SendNotification();
2964 finishCheck.CheckSignalNotReceived();
2965 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2967 application.SendNotification();
2968 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2970 // We didn't expect the animation to finish yet
2971 application.SendNotification();
2972 finishCheck.CheckSignalNotReceived();
2973 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2975 application.SendNotification();
2976 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2978 // We did expect the animation to finish
2979 application.SendNotification();
2980 finishCheck.CheckSignalReceived();
2981 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2985 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriod(void)
2987 TestApplication application;
2989 Actor actor = Actor::New();
2991 // Register a float property
2992 float startValue(10.0f);
2993 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2994 Stage::GetCurrent().Add(actor);
2995 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2997 // Build the animation
2998 float durationSeconds(1.0f);
2999 Animation animation = Animation::New(durationSeconds);
3000 float targetValue(30.0f);
3001 float relativeValue(targetValue - startValue);
3003 animation.AnimateTo(Property(actor, index),
3005 AlphaFunctions::Linear,
3006 TimePeriod(delay, durationSeconds - delay));
3008 // Start the animation
3011 bool signalReceived(false);
3012 AnimationFinishCheck finishCheck(signalReceived);
3013 animation.FinishedSignal().Connect(&application, finishCheck);
3015 application.SendNotification();
3016 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3018 // We didn't expect the animation to finish yet
3019 application.SendNotification();
3020 finishCheck.CheckSignalNotReceived();
3021 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3023 application.SendNotification();
3024 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3026 // We didn't expect the animation to finish yet
3027 application.SendNotification();
3028 finishCheck.CheckSignalNotReceived();
3029 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3031 application.SendNotification();
3032 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3034 // We did expect the animation to finish
3035 application.SendNotification();
3036 finishCheck.CheckSignalReceived();
3037 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3041 int UtcDaliAnimationAnimateToVector2(void)
3043 TestApplication application;
3045 Actor actor = Actor::New();
3047 // Register a Vector2 property
3048 Vector2 startValue(-50.0f, -50.0f);
3049 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3050 Stage::GetCurrent().Add(actor);
3051 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3053 // Build the animation
3054 float durationSeconds(2.0f);
3055 Animation animation = Animation::New(durationSeconds);
3056 Vector2 targetValue(50.0f, 50.0f);
3057 Vector2 relativeValue(targetValue - startValue);
3058 animation.AnimateTo(Property(actor, index), targetValue);
3060 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3062 // Start the animation
3065 bool signalReceived(false);
3066 AnimationFinishCheck finishCheck(signalReceived);
3067 animation.FinishedSignal().Connect(&application, finishCheck);
3069 application.SendNotification();
3070 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3072 // We didn't expect the animation to finish yet
3073 application.SendNotification();
3074 finishCheck.CheckSignalNotReceived();
3075 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
3077 application.SendNotification();
3078 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3080 // We did expect the animation to finish
3081 application.SendNotification();
3082 finishCheck.CheckSignalReceived();
3083 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3087 int UtcDaliAnimationAnimateToVector2AlphaFunction(void)
3089 TestApplication application;
3091 Actor actor = Actor::New();
3093 // Register a Vector2 property
3094 Vector2 startValue(1000.0f, 1000.0f);
3095 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3096 Stage::GetCurrent().Add(actor);
3097 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3099 // Build the animation
3100 float durationSeconds(1.0f);
3101 Animation animation = Animation::New(durationSeconds);
3102 Vector2 targetValue(9000.0f, 9000.0f);
3103 Vector2 relativeValue(targetValue - startValue);
3104 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
3106 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3108 // Start the animation
3111 bool signalReceived(false);
3112 AnimationFinishCheck finishCheck(signalReceived);
3113 animation.FinishedSignal().Connect(&application, finishCheck);
3115 application.SendNotification();
3116 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3118 // We didn't expect the animation to finish yet
3119 application.SendNotification();
3120 finishCheck.CheckSignalNotReceived();
3122 // The position should have moved more, than with a linear alpha function
3123 Vector2 current(actor.GetProperty<Vector2>(index));
3124 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3125 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3127 application.SendNotification();
3128 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3130 // We did expect the animation to finish
3131 application.SendNotification();
3132 finishCheck.CheckSignalReceived();
3133 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3137 int UtcDaliAnimationAnimateToVector2TimePeriod(void)
3139 TestApplication application;
3141 Actor actor = Actor::New();
3143 // Register a Vector2 property
3144 Vector2 startValue(10.0f, 10.0f);
3145 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3146 Stage::GetCurrent().Add(actor);
3147 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3149 // Build the animation
3150 float durationSeconds(1.0f);
3151 Animation animation = Animation::New(durationSeconds);
3152 Vector2 targetValue(-10.0f, 20.0f);
3153 Vector2 relativeValue(targetValue - startValue);
3155 animation.AnimateTo(Property(actor, index),
3157 TimePeriod(delay, durationSeconds - delay));
3159 // Start the animation
3162 bool signalReceived(false);
3163 AnimationFinishCheck finishCheck(signalReceived);
3164 animation.FinishedSignal().Connect(&application, finishCheck);
3166 application.SendNotification();
3167 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3169 // We didn't expect the animation to finish yet
3170 application.SendNotification();
3171 finishCheck.CheckSignalNotReceived();
3172 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3174 application.SendNotification();
3175 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3177 // We didn't expect the animation to finish yet
3178 application.SendNotification();
3179 finishCheck.CheckSignalNotReceived();
3180 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3182 application.SendNotification();
3183 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3185 // We did expect the animation to finish
3186 application.SendNotification();
3187 finishCheck.CheckSignalReceived();
3188 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3192 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriod(void)
3194 TestApplication application;
3196 Actor actor = Actor::New();
3198 // Register a Vector2 property
3199 Vector2 startValue(10.0f, 10.0f);
3200 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3201 Stage::GetCurrent().Add(actor);
3202 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3204 // Build the animation
3205 float durationSeconds(1.0f);
3206 Animation animation = Animation::New(durationSeconds);
3207 Vector2 targetValue(30.0f, 30.0f);
3208 Vector2 relativeValue(targetValue - startValue);
3210 animation.AnimateTo(Property(actor, index),
3212 AlphaFunctions::Linear,
3213 TimePeriod(delay, durationSeconds - delay));
3215 // Start the animation
3218 bool signalReceived(false);
3219 AnimationFinishCheck finishCheck(signalReceived);
3220 animation.FinishedSignal().Connect(&application, finishCheck);
3222 application.SendNotification();
3223 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3225 // We didn't expect the animation to finish yet
3226 application.SendNotification();
3227 finishCheck.CheckSignalNotReceived();
3228 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3230 application.SendNotification();
3231 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3233 // We didn't expect the animation to finish yet
3234 application.SendNotification();
3235 finishCheck.CheckSignalNotReceived();
3236 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3238 application.SendNotification();
3239 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3241 // We did expect the animation to finish
3242 application.SendNotification();
3243 finishCheck.CheckSignalReceived();
3244 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3248 int UtcDaliAnimationAnimateToVector3(void)
3250 TestApplication application;
3252 Actor actor = Actor::New();
3254 // Register a Vector3 property
3255 Vector3 startValue(-50.0f, -50.0f, -50.0f);
3256 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3257 Stage::GetCurrent().Add(actor);
3258 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3260 // Build the animation
3261 float durationSeconds(2.0f);
3262 Animation animation = Animation::New(durationSeconds);
3263 Vector3 targetValue(50.0f, 50.0f, 50.0f);
3264 Vector3 relativeValue(targetValue - startValue);
3265 animation.AnimateTo(Property(actor, index), targetValue);
3267 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3269 // Start the animation
3272 bool signalReceived(false);
3273 AnimationFinishCheck finishCheck(signalReceived);
3274 animation.FinishedSignal().Connect(&application, finishCheck);
3276 application.SendNotification();
3277 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3279 // We didn't expect the animation to finish yet
3280 application.SendNotification();
3281 finishCheck.CheckSignalNotReceived();
3282 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
3284 application.SendNotification();
3285 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3287 // We did expect the animation to finish
3288 application.SendNotification();
3289 finishCheck.CheckSignalReceived();
3290 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3294 int UtcDaliAnimationAnimateToVector3AlphaFunction(void)
3296 TestApplication application;
3298 Actor actor = Actor::New();
3300 // Register a Vector3 property
3301 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
3302 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3303 Stage::GetCurrent().Add(actor);
3304 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3306 // Build the animation
3307 float durationSeconds(1.0f);
3308 Animation animation = Animation::New(durationSeconds);
3309 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
3310 Vector3 relativeValue(targetValue - startValue);
3311 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
3313 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3315 // Start the animation
3318 bool signalReceived(false);
3319 AnimationFinishCheck finishCheck(signalReceived);
3320 animation.FinishedSignal().Connect(&application, finishCheck);
3322 application.SendNotification();
3323 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3325 // We didn't expect the animation to finish yet
3326 application.SendNotification();
3327 finishCheck.CheckSignalNotReceived();
3329 // The position should have moved more, than with a linear alpha function
3330 Vector3 current(actor.GetProperty<Vector3>(index));
3331 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3332 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3333 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3335 application.SendNotification();
3336 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3338 // We did expect the animation to finish
3339 application.SendNotification();
3340 finishCheck.CheckSignalReceived();
3341 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3345 int UtcDaliAnimationAnimateToVector3TimePeriod(void)
3347 TestApplication application;
3349 Actor actor = Actor::New();
3351 // Register a Vector3 property
3352 Vector3 startValue(10.0f, 10.0f, 10.0f);
3353 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3354 Stage::GetCurrent().Add(actor);
3355 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3357 // Build the animation
3358 float durationSeconds(1.0f);
3359 Animation animation = Animation::New(durationSeconds);
3360 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
3361 Vector3 relativeValue(targetValue - startValue);
3363 animation.AnimateTo(Property(actor, index),
3365 TimePeriod(delay, durationSeconds - delay));
3367 // Start the animation
3370 bool signalReceived(false);
3371 AnimationFinishCheck finishCheck(signalReceived);
3372 animation.FinishedSignal().Connect(&application, finishCheck);
3374 application.SendNotification();
3375 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3377 // We didn't expect the animation to finish yet
3378 application.SendNotification();
3379 finishCheck.CheckSignalNotReceived();
3380 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3382 application.SendNotification();
3383 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3385 // We didn't expect the animation to finish yet
3386 application.SendNotification();
3387 finishCheck.CheckSignalNotReceived();
3388 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3390 application.SendNotification();
3391 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3393 // We did expect the animation to finish
3394 application.SendNotification();
3395 finishCheck.CheckSignalReceived();
3396 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3400 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriod(void)
3402 TestApplication application;
3404 Actor actor = Actor::New();
3406 // Register a Vector3 property
3407 Vector3 startValue(10.0f, 10.0f, 10.0f);
3408 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3409 Stage::GetCurrent().Add(actor);
3410 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3412 // Build the animation
3413 float durationSeconds(1.0f);
3414 Animation animation = Animation::New(durationSeconds);
3415 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3416 Vector3 relativeValue(targetValue - startValue);
3418 animation.AnimateTo(Property(actor, "test-property"),
3420 AlphaFunctions::Linear,
3421 TimePeriod(delay, durationSeconds - delay));
3423 // Start the animation
3426 bool signalReceived(false);
3427 AnimationFinishCheck finishCheck(signalReceived);
3428 animation.FinishedSignal().Connect(&application, finishCheck);
3430 application.SendNotification();
3431 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3433 // We didn't expect the animation to finish yet
3434 application.SendNotification();
3435 finishCheck.CheckSignalNotReceived();
3436 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3438 application.SendNotification();
3439 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3441 // We didn't expect the animation to finish yet
3442 application.SendNotification();
3443 finishCheck.CheckSignalNotReceived();
3444 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3446 application.SendNotification();
3447 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3449 // We did expect the animation to finish
3450 application.SendNotification();
3451 finishCheck.CheckSignalReceived();
3452 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3456 int UtcDaliAnimationAnimateToVector3Component(void)
3458 TestApplication application;
3460 Actor actor = Actor::New();
3462 // Register a Vector3 property
3463 Vector3 startValue(10.0f, 10.0f, 10.0f);
3464 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3465 Stage::GetCurrent().Add(actor);
3466 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3468 // Build the animation
3469 float durationSeconds(1.0f);
3470 Animation animation = Animation::New(durationSeconds);
3471 Vector3 targetValue(30.0f, 30.0f, 10.0f);
3472 Vector3 relativeValue(targetValue - startValue);
3474 animation.AnimateTo(Property(actor, "test-property", 0),
3476 AlphaFunctions::Linear,
3477 TimePeriod(delay, durationSeconds - delay));
3478 animation.AnimateTo(Property(actor, index, 1),
3480 AlphaFunctions::Linear,
3481 TimePeriod(delay, durationSeconds - delay));
3483 // Start the animation
3486 bool signalReceived(false);
3487 AnimationFinishCheck finishCheck(signalReceived);
3488 animation.FinishedSignal().Connect(&application, finishCheck);
3490 application.SendNotification();
3491 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3493 // We didn't expect the animation to finish yet
3494 application.SendNotification();
3495 finishCheck.CheckSignalNotReceived();
3496 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3498 application.SendNotification();
3499 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3501 // We didn't expect the animation to finish yet
3502 application.SendNotification();
3503 finishCheck.CheckSignalNotReceived();
3504 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3506 application.SendNotification();
3507 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3509 // We did expect the animation to finish
3510 application.SendNotification();
3511 finishCheck.CheckSignalReceived();
3512 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3516 int UtcDaliAnimationAnimateToVector4(void)
3518 TestApplication application;
3520 Actor actor = Actor::New();
3522 // Register a Vector4 property
3523 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
3524 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3525 Stage::GetCurrent().Add(actor);
3526 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3528 // Build the animation
3529 float durationSeconds(2.0f);
3530 Animation animation = Animation::New(durationSeconds);
3531 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
3532 Vector4 relativeValue(targetValue - startValue);
3533 animation.AnimateTo(Property(actor, index), targetValue);
3535 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3537 // Start the animation
3540 bool signalReceived(false);
3541 AnimationFinishCheck finishCheck(signalReceived);
3542 animation.FinishedSignal().Connect(&application, finishCheck);
3544 application.SendNotification();
3545 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3547 // We didn't expect the animation to finish yet
3548 application.SendNotification();
3549 finishCheck.CheckSignalNotReceived();
3550 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
3552 application.SendNotification();
3553 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3555 // We did expect the animation to finish
3556 application.SendNotification();
3557 finishCheck.CheckSignalReceived();
3558 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3562 int UtcDaliAnimationAnimateToVector4AlphaFunction(void)
3564 TestApplication application;
3566 Actor actor = Actor::New();
3568 // Register a Vector4 property
3569 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
3570 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3571 Stage::GetCurrent().Add(actor);
3572 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3574 // Build the animation
3575 float durationSeconds(1.0f);
3576 Animation animation = Animation::New(durationSeconds);
3577 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
3578 Vector4 relativeValue(targetValue - startValue);
3579 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
3581 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3583 // Start the animation
3586 bool signalReceived(false);
3587 AnimationFinishCheck finishCheck(signalReceived);
3588 animation.FinishedSignal().Connect(&application, finishCheck);
3590 application.SendNotification();
3591 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3593 // We didn't expect the animation to finish yet
3594 application.SendNotification();
3595 finishCheck.CheckSignalNotReceived();
3597 // The position should have moved more, than with a linear alpha function
3598 Vector4 current(actor.GetProperty<Vector4>(index));
3599 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3600 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3601 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3602 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
3604 application.SendNotification();
3605 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3607 // We did expect the animation to finish
3608 application.SendNotification();
3609 finishCheck.CheckSignalReceived();
3610 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3614 int UtcDaliAnimationAnimateToVector4TimePeriod(void)
3616 TestApplication application;
3618 Actor actor = Actor::New();
3620 // Register a Vector4 property
3621 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3622 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3623 Stage::GetCurrent().Add(actor);
3624 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
3626 // Build the animation
3627 float durationSeconds(1.0f);
3628 Animation animation = Animation::New(durationSeconds);
3629 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
3630 Vector4 relativeValue(targetValue - startValue);
3632 animation.AnimateTo(Property(actor, index),
3634 TimePeriod(delay, durationSeconds - delay));
3636 // Start the animation
3639 bool signalReceived(false);
3640 AnimationFinishCheck finishCheck(signalReceived);
3641 animation.FinishedSignal().Connect(&application, finishCheck);
3643 application.SendNotification();
3644 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3646 // We didn't expect the animation to finish yet
3647 application.SendNotification();
3648 finishCheck.CheckSignalNotReceived();
3649 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
3651 application.SendNotification();
3652 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3654 // We didn't expect the animation to finish yet
3655 application.SendNotification();
3656 finishCheck.CheckSignalNotReceived();
3657 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
3659 application.SendNotification();
3660 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3662 // We did expect the animation to finish
3663 application.SendNotification();
3664 finishCheck.CheckSignalReceived();
3665 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
3669 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriod(void)
3671 TestApplication application;
3673 Actor actor = Actor::New();
3675 // Register a Vector4 property
3676 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3677 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3678 Stage::GetCurrent().Add(actor);
3679 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3681 // Build the animation
3682 float durationSeconds(1.0f);
3683 Animation animation = Animation::New(durationSeconds);
3684 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
3685 Vector4 relativeValue(targetValue - startValue);
3687 animation.AnimateTo(Property(actor, index),
3689 AlphaFunctions::Linear,
3690 TimePeriod(delay, durationSeconds - delay));
3692 // Start the animation
3695 bool signalReceived(false);
3696 AnimationFinishCheck finishCheck(signalReceived);
3697 animation.FinishedSignal().Connect(&application, finishCheck);
3699 application.SendNotification();
3700 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3702 // We didn't expect the animation to finish yet
3703 application.SendNotification();
3704 finishCheck.CheckSignalNotReceived();
3705 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3707 application.SendNotification();
3708 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3710 // We didn't expect the animation to finish yet
3711 application.SendNotification();
3712 finishCheck.CheckSignalNotReceived();
3713 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3715 application.SendNotification();
3716 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3718 // We did expect the animation to finish
3719 application.SendNotification();
3720 finishCheck.CheckSignalReceived();
3721 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3725 int UtcDaliAnimationAnimateToActorParentOrigin(void)
3727 TestApplication application;
3729 Actor actor = Actor::New();
3730 Stage::GetCurrent().Add(actor);
3731 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3733 // Build the animation
3734 float durationSeconds(1.0f);
3735 Animation animation = Animation::New(durationSeconds);
3736 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
3740 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN), targetParentOrigin );
3742 catch (Dali::DaliException& e)
3744 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3745 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3750 int UtcDaliAnimationAnimateToActorParentOriginX(void)
3752 TestApplication application;
3754 Actor actor = Actor::New();
3755 Stage::GetCurrent().Add(actor);
3756 float startValue(0.0f);
3757 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
3758 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
3760 // Build the animation
3761 float durationSeconds(1.0f);
3762 Animation animation = Animation::New(durationSeconds);
3763 float targetX(1.0f);
3767 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_X), targetX );
3769 catch (Dali::DaliException& e)
3771 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3772 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3777 int UtcDaliAnimationAnimateToActorParentOriginY(void)
3779 TestApplication application;
3781 Actor actor = Actor::New();
3782 Stage::GetCurrent().Add(actor);
3783 float startValue(0.0f);
3784 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
3785 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
3787 // Build the animation
3788 float durationSeconds(1.0f);
3789 Animation animation = Animation::New(durationSeconds);
3790 float targetY(1.0f);
3794 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Y), targetY );
3796 catch (Dali::DaliException& e)
3798 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3799 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3804 int UtcDaliAnimationAnimateToActorParentOriginZ(void)
3806 TestApplication application;
3808 Actor actor = Actor::New();
3809 Stage::GetCurrent().Add(actor);
3810 float startValue(0.5f);
3811 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
3812 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
3814 // Build the animation
3815 float durationSeconds(1.0f);
3816 Animation animation = Animation::New(durationSeconds);
3817 float targetZ(1.0f);
3821 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Z), targetZ );
3823 catch (Dali::DaliException& e)
3825 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3826 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3831 int UtcDaliAnimationAnimateToActorAnchorPoint(void)
3833 TestApplication application;
3835 Actor actor = Actor::New();
3836 Stage::GetCurrent().Add(actor);
3837 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
3839 // Build the animation
3840 float durationSeconds(1.0f);
3841 Animation animation = Animation::New(durationSeconds);
3842 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
3846 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT), targetAnchorPoint);
3848 catch (Dali::DaliException& e)
3850 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3851 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3856 int UtcDaliAnimationAnimateToActorAnchorPointX(void)
3858 TestApplication application;
3860 Actor actor = Actor::New();
3861 Stage::GetCurrent().Add(actor);
3862 float startValue(0.5f);
3863 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
3864 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_X), startValue, TEST_LOCATION );
3866 // Build the animation
3867 float durationSeconds(1.0f);
3868 Animation animation = Animation::New(durationSeconds);
3869 float targetX(1.0f);
3873 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_X), targetX );
3875 catch (Dali::DaliException& e)
3877 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3878 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3883 int UtcDaliAnimationAnimateToActorAnchorPointY(void)
3885 TestApplication application;
3887 Actor actor = Actor::New();
3888 Stage::GetCurrent().Add(actor);
3889 float startValue(0.5f);
3890 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
3891 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
3893 // Build the animation
3894 float durationSeconds(1.0f);
3895 Animation animation = Animation::New(durationSeconds);
3896 float targetY(0.0f);
3900 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Y), targetY );
3902 catch (Dali::DaliException& e)
3904 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3905 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3910 int UtcDaliAnimationAnimateToActorAnchorPointZ(void)
3912 TestApplication application;
3914 Actor actor = Actor::New();
3915 Stage::GetCurrent().Add(actor);
3916 float startValue(0.5f);
3917 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
3918 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
3920 // Build the animation
3921 float durationSeconds(1.0f);
3922 Animation animation = Animation::New(durationSeconds);
3923 float targetZ(100.0f);
3927 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Z), targetZ );
3929 catch (Dali::DaliException& e)
3931 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3932 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3937 int UtcDaliAnimationAnimateToActorSize(void)
3939 TestApplication application;
3941 Actor actor = Actor::New();
3942 Stage::GetCurrent().Add(actor);
3943 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
3945 // Build the animation
3946 float durationSeconds(1.0f);
3947 Animation animation = Animation::New(durationSeconds);
3948 Vector3 targetSize(100.0f, 100.0f, 100.0f);
3949 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize );
3951 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
3953 // Start the animation
3956 bool signalReceived(false);
3957 AnimationFinishCheck finishCheck(signalReceived);
3958 animation.FinishedSignal().Connect(&application, finishCheck);
3960 application.SendNotification();
3961 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
3963 // We didn't expect the animation to finish yet
3964 application.SendNotification();
3965 finishCheck.CheckSignalNotReceived();
3966 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
3968 application.SendNotification();
3969 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
3971 // We did expect the animation to finish
3972 application.SendNotification();
3973 finishCheck.CheckSignalReceived();
3974 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
3977 finishCheck.Reset();
3978 actor.SetSize(Vector3::ZERO);
3979 application.SendNotification();
3980 application.Render(0);
3981 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
3983 // Repeat with a different (ease-in) alpha function
3984 animation = Animation::New(durationSeconds);
3985 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize, AlphaFunctions::EaseIn);
3986 animation.FinishedSignal().Connect(&application, finishCheck);
3989 application.SendNotification();
3990 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
3992 // We didn't expect the animation to finish yet
3993 application.SendNotification();
3994 finishCheck.CheckSignalNotReceived();
3996 // The size should have travelled less, than with a linear alpha function
3997 Vector3 current(actor.GetCurrentSize());
3998 DALI_TEST_CHECK( current.x > 0.0f );
3999 DALI_TEST_CHECK( current.y > 0.0f );
4000 DALI_TEST_CHECK( current.z > 0.0f );
4001 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4002 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4003 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4005 application.SendNotification();
4006 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4008 // We did expect the animation to finish
4009 application.SendNotification();
4010 finishCheck.CheckSignalReceived();
4011 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
4014 finishCheck.Reset();
4015 actor.SetSize(Vector3::ZERO);
4016 application.SendNotification();
4017 application.Render(0);
4018 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
4020 // Repeat with a delay
4022 animation = Animation::New(durationSeconds);
4023 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
4024 animation.FinishedSignal().Connect(&application, finishCheck);
4027 application.SendNotification();
4028 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4030 // We didn't expect the animation to finish yet
4031 application.SendNotification();
4032 finishCheck.CheckSignalNotReceived();
4033 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
4035 application.SendNotification();
4036 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4038 // We did expect the animation to finish
4039 application.SendNotification();
4040 finishCheck.CheckSignalReceived();
4041 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
4045 int UtcDaliAnimationAnimateToActorSizeWidth(void)
4047 TestApplication application;
4049 Actor actor = Actor::New();
4050 Stage::GetCurrent().Add(actor);
4051 float startValue(0.0f);
4052 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
4053 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), startValue, TEST_LOCATION );
4055 // Build the animation
4056 float durationSeconds(1.0f);
4057 Animation animation = Animation::New(durationSeconds);
4058 float targetWidth(10.0f);
4059 animation.AnimateTo( Property(actor, Actor::SIZE_WIDTH), targetWidth );
4061 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
4063 // Start the animation
4066 bool signalReceived(false);
4067 AnimationFinishCheck finishCheck(signalReceived);
4068 animation.FinishedSignal().Connect(&application, finishCheck);
4070 application.SendNotification();
4071 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4073 // We didn't expect the animation to finish yet
4074 application.SendNotification();
4075 finishCheck.CheckSignalNotReceived();
4076 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
4077 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), fiftyPercentProgress, TEST_LOCATION );
4079 application.SendNotification();
4080 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4082 // We did expect the animation to finish
4083 application.SendNotification();
4084 finishCheck.CheckSignalReceived();
4085 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
4086 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), targetWidth, TEST_LOCATION );
4090 int UtcDaliAnimationAnimateToActorSizeHeight(void)
4092 TestApplication application;
4094 Actor actor = Actor::New();
4095 Stage::GetCurrent().Add(actor);
4096 float startValue(0.0f);
4097 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
4098 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), startValue, TEST_LOCATION );
4100 // Build the animation
4101 float durationSeconds(1.0f);
4102 Animation animation = Animation::New(durationSeconds);
4103 float targetHeight(-10.0f);
4104 animation.AnimateTo( Property(actor, Actor::SIZE_HEIGHT), targetHeight );
4106 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
4108 // Start the animation
4111 bool signalReceived(false);
4112 AnimationFinishCheck finishCheck(signalReceived);
4113 animation.FinishedSignal().Connect(&application, finishCheck);
4115 application.SendNotification();
4116 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4118 // We didn't expect the animation to finish yet
4119 application.SendNotification();
4120 finishCheck.CheckSignalNotReceived();
4121 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
4122 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), fiftyPercentProgress, TEST_LOCATION );
4124 application.SendNotification();
4125 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4127 // We did expect the animation to finish
4128 application.SendNotification();
4129 finishCheck.CheckSignalReceived();
4130 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
4131 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
4135 int UtcDaliAnimationAnimateToActorSizeDepth(void)
4137 TestApplication application;
4139 Actor actor = Actor::New();
4140 Stage::GetCurrent().Add(actor);
4141 float startValue(0.0f);
4142 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
4143 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), startValue, TEST_LOCATION );
4145 // Build the animation
4146 float durationSeconds(1.0f);
4147 Animation animation = Animation::New(durationSeconds);
4148 float targetDepth(-10.0f);
4149 animation.AnimateTo( Property(actor, Actor::SIZE_DEPTH), targetDepth );
4151 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
4153 // Start the animation
4156 bool signalReceived(false);
4157 AnimationFinishCheck finishCheck(signalReceived);
4158 animation.FinishedSignal().Connect(&application, finishCheck);
4160 application.SendNotification();
4161 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4163 // We didn't expect the animation to finish yet
4164 application.SendNotification();
4165 finishCheck.CheckSignalNotReceived();
4166 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
4167 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), fiftyPercentProgress, TEST_LOCATION );
4169 application.SendNotification();
4170 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4172 // We did expect the animation to finish
4173 application.SendNotification();
4174 finishCheck.CheckSignalReceived();
4175 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
4176 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), targetDepth, TEST_LOCATION );
4180 int UtcDaliAnimationAnimateToActorPosition(void)
4182 TestApplication application;
4184 Actor actor = Actor::New();
4185 Stage::GetCurrent().Add(actor);
4186 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4188 // Build the animation
4189 float durationSeconds(1.0f);
4190 Animation animation = Animation::New(durationSeconds);
4191 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4192 animation.AnimateTo(Property(actor, Actor::POSITION), targetPosition);
4194 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4196 // Start the animation
4199 bool signalReceived(false);
4200 AnimationFinishCheck finishCheck(signalReceived);
4201 animation.FinishedSignal().Connect(&application, finishCheck);
4203 application.SendNotification();
4204 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
4206 // We didn't expect the animation to finish yet
4207 application.SendNotification();
4208 finishCheck.CheckSignalNotReceived();
4209 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
4211 application.SendNotification();
4212 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4214 // We did expect the animation to finish
4215 application.SendNotification();
4216 finishCheck.CheckSignalReceived();
4217 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4221 int UtcDaliAnimationAnimateToActorPositionX(void)
4223 TestApplication application;
4225 Actor actor = Actor::New();
4226 Stage::GetCurrent().Add(actor);
4227 float startValue(0.0f);
4228 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
4229 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4230 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4231 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4233 // Build the animation
4234 float durationSeconds(1.0f);
4235 Animation animation = Animation::New(durationSeconds);
4236 float targetX(1.0f);
4237 animation.AnimateTo( Property(actor, Actor::POSITION_X), targetX );
4239 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
4241 // Start the animation
4244 bool signalReceived(false);
4245 AnimationFinishCheck finishCheck(signalReceived);
4246 animation.FinishedSignal().Connect(&application, finishCheck);
4248 application.SendNotification();
4249 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4251 // We didn't expect the animation to finish yet
4252 application.SendNotification();
4253 finishCheck.CheckSignalNotReceived();
4254 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
4255 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), fiftyPercentProgress, TEST_LOCATION );
4256 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4257 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4259 application.SendNotification();
4260 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4262 // We did expect the animation to finish
4263 application.SendNotification();
4264 finishCheck.CheckSignalReceived();
4265 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
4266 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), targetX, TEST_LOCATION );
4267 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4268 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4272 int UtcDaliAnimationAnimateToActorPositionY(void)
4274 TestApplication application;
4276 Actor actor = Actor::New();
4277 Stage::GetCurrent().Add(actor);
4278 float startValue(0.0f);
4279 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
4280 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4281 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4282 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4284 // Build the animation
4285 float durationSeconds(1.0f);
4286 Animation animation = Animation::New(durationSeconds);
4287 float targetY(10.0f);
4288 animation.AnimateTo( Property(actor, Actor::POSITION_Y), targetY );
4290 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
4292 // Start the animation
4295 bool signalReceived(false);
4296 AnimationFinishCheck finishCheck(signalReceived);
4297 animation.FinishedSignal().Connect(&application, finishCheck);
4299 application.SendNotification();
4300 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4302 // We didn't expect the animation to finish yet
4303 application.SendNotification();
4304 finishCheck.CheckSignalNotReceived();
4305 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
4306 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4307 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), fiftyPercentProgress, TEST_LOCATION );
4308 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4310 application.SendNotification();
4311 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4313 // We did expect the animation to finish
4314 application.SendNotification();
4315 finishCheck.CheckSignalReceived();
4316 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
4317 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4318 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), targetY, TEST_LOCATION );
4319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4323 int UtcDaliAnimationAnimateToActorPositionZ(void)
4325 TestApplication application;
4327 Actor actor = Actor::New();
4328 Stage::GetCurrent().Add(actor);
4329 float startValue(0.0f);
4330 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
4331 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4332 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4333 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4335 // Build the animation
4336 float durationSeconds(1.0f);
4337 Animation animation = Animation::New(durationSeconds);
4338 float targetZ(-5.0f);
4339 animation.AnimateTo( Property(actor, Actor::POSITION_Z), targetZ );
4341 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
4343 // Start the animation
4346 bool signalReceived(false);
4347 AnimationFinishCheck finishCheck(signalReceived);
4348 animation.FinishedSignal().Connect(&application, finishCheck);
4350 application.SendNotification();
4351 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4353 // We didn't expect the animation to finish yet
4354 application.SendNotification();
4355 finishCheck.CheckSignalNotReceived();
4356 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
4357 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4358 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4359 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), fiftyPercentProgress, TEST_LOCATION );
4361 application.SendNotification();
4362 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4364 // We did expect the animation to finish
4365 application.SendNotification();
4366 finishCheck.CheckSignalReceived();
4367 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
4368 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4369 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4370 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), targetZ, TEST_LOCATION );
4374 int UtcDaliAnimationAnimateToActorPositionAlphaFunction(void)
4376 TestApplication application;
4378 Actor actor = Actor::New();
4379 Stage::GetCurrent().Add(actor);
4380 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4382 // Build the animation
4383 float durationSeconds(1.0f);
4384 Animation animation = Animation::New(durationSeconds);
4385 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4386 animation.AnimateTo(Property(actor, Actor::POSITION), targetPosition, AlphaFunctions::EaseIn);
4388 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4390 // Start the animation
4393 bool signalReceived(false);
4394 AnimationFinishCheck finishCheck(signalReceived);
4395 animation.FinishedSignal().Connect(&application, finishCheck);
4397 application.SendNotification();
4398 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
4400 // We didn't expect the animation to finish yet
4401 application.SendNotification();
4402 finishCheck.CheckSignalNotReceived();
4404 // The position should have moved less, than with a linear alpha function
4405 Vector3 current(actor.GetCurrentPosition());
4406 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
4407 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
4408 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
4409 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
4410 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
4411 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
4413 application.SendNotification();
4414 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4416 // We did expect the animation to finish
4417 application.SendNotification();
4418 finishCheck.CheckSignalReceived();
4419 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4423 int UtcDaliAnimationAnimateToActorPositionTimePeriod(void)
4425 TestApplication application;
4427 Actor actor = Actor::New();
4428 Stage::GetCurrent().Add(actor);
4429 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4431 // Build the animation
4432 float durationSeconds(1.0f);
4433 Animation animation = Animation::New(durationSeconds);
4434 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4436 animation.AnimateTo( Property(actor, Actor::POSITION),
4438 TimePeriod( delay, durationSeconds - delay ) );
4440 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4442 // Start the animation
4445 bool signalReceived(false);
4446 AnimationFinishCheck finishCheck(signalReceived);
4447 animation.FinishedSignal().Connect(&application, finishCheck);
4449 application.SendNotification();
4450 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4452 // We didn't expect the animation to finish yet
4453 application.SendNotification();
4454 finishCheck.CheckSignalNotReceived();
4455 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4457 application.SendNotification();
4458 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
4460 // We didn't expect the animation to finish yet
4461 application.SendNotification();
4462 finishCheck.CheckSignalNotReceived();
4463 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
4465 application.SendNotification();
4466 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
4468 // We did expect the animation to finish
4469 application.SendNotification();
4470 finishCheck.CheckSignalReceived();
4471 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4475 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriod(void)
4477 TestApplication application;
4479 Actor actor = Actor::New();
4480 Stage::GetCurrent().Add(actor);
4481 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4483 // Build the animation
4484 float durationSeconds(1.0f);
4485 Animation animation = Animation::New(durationSeconds);
4486 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4488 animation.AnimateTo( Property(actor, Actor::POSITION),
4490 AlphaFunctions::Linear,
4491 TimePeriod( delay, durationSeconds - delay ) );
4493 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4495 // Start the animation
4498 bool signalReceived(false);
4499 AnimationFinishCheck finishCheck(signalReceived);
4500 animation.FinishedSignal().Connect(&application, finishCheck);
4502 application.SendNotification();
4503 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4505 // We didn't expect the animation to finish yet
4506 application.SendNotification();
4507 finishCheck.CheckSignalNotReceived();
4508 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4510 application.SendNotification();
4511 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
4513 // We didn't expect the animation to finish yet
4514 application.SendNotification();
4515 finishCheck.CheckSignalNotReceived();
4516 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
4518 application.SendNotification();
4519 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
4521 // We did expect the animation to finish
4522 application.SendNotification();
4523 finishCheck.CheckSignalReceived();
4524 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4528 int UtcDaliAnimationAnimateToActorRotationAngleAxis(void)
4530 TestApplication application;
4532 Actor actor = Actor::New();
4533 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4534 Stage::GetCurrent().Add(actor);
4535 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4537 // Build the animation
4538 float durationSeconds(1.0f);
4539 Animation animation = Animation::New(durationSeconds);
4540 Degree targetRotationDegrees(90.0f);
4541 Radian targetRotationRadians(targetRotationDegrees);
4542 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
4544 // Start the animation
4547 bool signalReceived(false);
4548 AnimationFinishCheck finishCheck(signalReceived);
4549 animation.FinishedSignal().Connect(&application, finishCheck);
4551 application.SendNotification();
4552 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4554 // We didn't expect the animation to finish yet
4555 application.SendNotification();
4556 finishCheck.CheckSignalNotReceived();
4557 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4559 application.SendNotification();
4560 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4562 // We didn't expect the animation to finish yet
4563 application.SendNotification();
4564 finishCheck.CheckSignalNotReceived();
4565 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4567 application.SendNotification();
4568 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4570 // We didn't expect the animation to finish yet
4571 application.SendNotification();
4572 finishCheck.CheckSignalNotReceived();
4573 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4575 application.SendNotification();
4576 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4578 // We did expect the animation to finish
4579 application.SendNotification();
4580 finishCheck.CheckSignalReceived();
4581 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4585 int UtcDaliAnimationAnimateToActorRotationQuaternion(void)
4587 TestApplication application;
4589 Actor actor = Actor::New();
4590 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4591 Stage::GetCurrent().Add(actor);
4592 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4594 // Build the animation
4595 float durationSeconds(1.0f);
4596 Animation animation = Animation::New(durationSeconds);
4597 Degree targetRotationDegrees(90.0f);
4598 Radian targetRotationRadians(targetRotationDegrees);
4599 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
4600 animation.AnimateTo( Property(actor, Actor::ROTATION), targetRotation );
4602 // Start the animation
4605 bool signalReceived(false);
4606 AnimationFinishCheck finishCheck(signalReceived);
4607 animation.FinishedSignal().Connect(&application, finishCheck);
4609 application.SendNotification();
4610 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4612 // We didn't expect the animation to finish yet
4613 application.SendNotification();
4614 finishCheck.CheckSignalNotReceived();
4615 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4617 application.SendNotification();
4618 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4620 // We didn't expect the animation to finish yet
4621 application.SendNotification();
4622 finishCheck.CheckSignalNotReceived();
4623 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4625 application.SendNotification();
4626 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4628 // We didn't expect the animation to finish yet
4629 application.SendNotification();
4630 finishCheck.CheckSignalNotReceived();
4631 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4633 application.SendNotification();
4634 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4636 // We did expect the animation to finish
4637 application.SendNotification();
4638 finishCheck.CheckSignalReceived();
4639 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4643 int UtcDaliAnimationAnimateToActorRotationAlphaFunction(void)
4645 TestApplication application;
4647 Actor actor = Actor::New();
4648 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4649 Stage::GetCurrent().Add(actor);
4650 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4652 // Build the animation
4653 float durationSeconds(1.0f);
4654 Animation animation = Animation::New(durationSeconds);
4655 Degree targetRotationDegrees(90.0f);
4656 Radian targetRotationRadians(targetRotationDegrees);
4657 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn);
4659 // Start the animation
4662 bool signalReceived(false);
4663 AnimationFinishCheck finishCheck(signalReceived);
4664 animation.FinishedSignal().Connect(&application, finishCheck);
4666 application.SendNotification();
4667 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4669 // We didn't expect the animation to finish yet
4670 application.SendNotification();
4671 finishCheck.CheckSignalNotReceived();
4672 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4674 application.SendNotification();
4675 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4677 // We didn't expect the animation to finish yet
4678 application.SendNotification();
4679 finishCheck.CheckSignalNotReceived();
4680 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4682 application.SendNotification();
4683 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4685 // We didn't expect the animation to finish yet
4686 application.SendNotification();
4687 finishCheck.CheckSignalNotReceived();
4688 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4690 application.SendNotification();
4691 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4693 // We did expect the animation to finish
4694 application.SendNotification();
4695 finishCheck.CheckSignalReceived();
4696 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4700 int UtcDaliAnimationAnimateToActorRotationTimePeriod(void)
4702 TestApplication application;
4704 Actor actor = Actor::New();
4705 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4706 Stage::GetCurrent().Add(actor);
4707 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4709 // Build the animation
4710 float durationSeconds(1.0f);
4711 Animation animation = Animation::New(durationSeconds);
4712 Degree targetRotationDegrees(90.0f);
4713 Radian targetRotationRadians(targetRotationDegrees);
4715 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
4717 // Start the animation
4720 bool signalReceived(false);
4721 AnimationFinishCheck finishCheck(signalReceived);
4722 animation.FinishedSignal().Connect(&application, finishCheck);
4724 application.SendNotification();
4725 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4727 // We didn't expect the animation to finish yet
4728 application.SendNotification();
4729 finishCheck.CheckSignalNotReceived();
4730 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4731 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4733 application.SendNotification();
4734 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4736 // We didn't expect the animation to finish yet
4737 application.SendNotification();
4738 finishCheck.CheckSignalNotReceived();
4739 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4740 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4742 application.SendNotification();
4743 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4745 // We didn't expect the animation to finish yet
4746 application.SendNotification();
4747 finishCheck.CheckSignalNotReceived();
4748 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4749 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4751 application.SendNotification();
4752 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4754 // We did expect the animation to finish
4755 application.SendNotification();
4756 finishCheck.CheckSignalReceived();
4757 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4761 int UtcDaliAnimationAnimateToActorRotationAlphaFunctionTimePeriod(void)
4763 TestApplication application;
4765 Actor actor = Actor::New();
4766 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4767 Stage::GetCurrent().Add(actor);
4768 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4770 // Build the animation
4771 float durationSeconds(1.0f);
4772 Animation animation = Animation::New(durationSeconds);
4773 Degree targetRotationDegrees(90.0f);
4774 Radian targetRotationRadians(targetRotationDegrees);
4776 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn, TimePeriod(delay, durationSeconds - delay));
4778 // Start the animation
4781 bool signalReceived(false);
4782 AnimationFinishCheck finishCheck(signalReceived);
4783 animation.FinishedSignal().Connect(&application, finishCheck);
4785 application.SendNotification();
4786 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4788 // We didn't expect the animation to finish yet
4789 application.SendNotification();
4790 finishCheck.CheckSignalNotReceived();
4791 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4792 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4794 application.SendNotification();
4795 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4797 // We didn't expect the animation to finish yet
4798 application.SendNotification();
4799 finishCheck.CheckSignalNotReceived();
4800 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4801 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4803 application.SendNotification();
4804 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4806 // We didn't expect the animation to finish yet
4807 application.SendNotification();
4808 finishCheck.CheckSignalNotReceived();
4809 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4810 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4812 application.SendNotification();
4813 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4815 // We did expect the animation to finish
4816 application.SendNotification();
4817 finishCheck.CheckSignalReceived();
4818 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4822 int UtcDaliAnimationAnimateToActorScale(void)
4824 TestApplication application;
4826 Actor actor = Actor::New();
4827 Stage::GetCurrent().Add(actor);
4828 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4830 // Build the animation
4831 float durationSeconds(1.0f);
4832 Animation animation = Animation::New(durationSeconds);
4833 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4834 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale );
4836 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
4838 // Start the animation
4841 bool signalReceived(false);
4842 AnimationFinishCheck finishCheck(signalReceived);
4843 animation.FinishedSignal().Connect(&application, finishCheck);
4845 application.SendNotification();
4846 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4848 // We didn't expect the animation to finish yet
4849 application.SendNotification();
4850 finishCheck.CheckSignalNotReceived();
4851 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4853 application.SendNotification();
4854 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4856 // We did expect the animation to finish
4857 application.SendNotification();
4858 finishCheck.CheckSignalReceived();
4859 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4862 finishCheck.Reset();
4863 actor.SetScale(Vector3::ONE);
4864 application.SendNotification();
4865 application.Render(0);
4866 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4868 // Repeat with a different (ease-in) alpha function
4869 animation = Animation::New(durationSeconds);
4870 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale, AlphaFunctions::EaseIn);
4871 animation.FinishedSignal().Connect(&application, finishCheck);
4874 application.SendNotification();
4875 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4877 // We didn't expect the animation to finish yet
4878 application.SendNotification();
4879 finishCheck.CheckSignalNotReceived();
4881 // The scale should have grown less, than with a linear alpha function
4882 Vector3 current(actor.GetCurrentScale());
4883 DALI_TEST_CHECK( current.x > 1.0f );
4884 DALI_TEST_CHECK( current.y > 1.0f );
4885 DALI_TEST_CHECK( current.z > 1.0f );
4886 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4887 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4888 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4890 application.SendNotification();
4891 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4893 // We did expect the animation to finish
4894 application.SendNotification();
4895 finishCheck.CheckSignalReceived();
4896 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4899 finishCheck.Reset();
4900 actor.SetScale(Vector3::ONE);
4901 application.SendNotification();
4902 application.Render(0);
4903 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4905 // Repeat with a delay
4907 animation = Animation::New(durationSeconds);
4908 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
4909 animation.FinishedSignal().Connect(&application, finishCheck);
4912 application.SendNotification();
4913 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4915 // We didn't expect the animation to finish yet
4916 application.SendNotification();
4917 finishCheck.CheckSignalNotReceived();
4918 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4920 application.SendNotification();
4921 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4923 // We did expect the animation to finish
4924 application.SendNotification();
4925 finishCheck.CheckSignalReceived();
4926 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4930 int UtcDaliAnimationAnimateToActorScaleX(void)
4932 TestApplication application;
4934 Actor actor = Actor::New();
4935 Stage::GetCurrent().Add(actor);
4936 float startValue(1.0f);
4937 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
4938 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
4939 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4940 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4942 // Build the animation
4943 float durationSeconds(1.0f);
4944 Animation animation = Animation::New(durationSeconds);
4945 float targetX(10.0f);
4946 animation.AnimateTo( Property(actor, Actor::SCALE_X), targetX );
4948 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
4950 // Start the animation
4953 bool signalReceived(false);
4954 AnimationFinishCheck finishCheck(signalReceived);
4955 animation.FinishedSignal().Connect(&application, finishCheck);
4957 application.SendNotification();
4958 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4960 // We didn't expect the animation to finish yet
4961 application.SendNotification();
4962 finishCheck.CheckSignalNotReceived();
4963 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
4964 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
4965 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4968 application.SendNotification();
4969 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4971 // We did expect the animation to finish
4972 application.SendNotification();
4973 finishCheck.CheckSignalReceived();
4974 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
4975 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), targetX, TEST_LOCATION );
4976 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4977 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4981 int UtcDaliAnimationAnimateToActorScaleY(void)
4983 TestApplication application;
4985 Actor actor = Actor::New();
4986 Stage::GetCurrent().Add(actor);
4987 float startValue(1.0f);
4988 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
4989 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
4990 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4991 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4993 // Build the animation
4994 float durationSeconds(1.0f);
4995 Animation animation = Animation::New(durationSeconds);
4996 float targetY(1000.0f);
4997 animation.AnimateTo( Property(actor, Actor::SCALE_Y), targetY );
4999 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
5001 // Start the animation
5004 bool signalReceived(false);
5005 AnimationFinishCheck finishCheck(signalReceived);
5006 animation.FinishedSignal().Connect(&application, finishCheck);
5008 application.SendNotification();
5009 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5011 // We didn't expect the animation to finish yet
5012 application.SendNotification();
5013 finishCheck.CheckSignalNotReceived();
5014 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
5015 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
5017 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5019 application.SendNotification();
5020 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5022 // We did expect the animation to finish
5023 application.SendNotification();
5024 finishCheck.CheckSignalReceived();
5025 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
5026 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5027 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), targetY, TEST_LOCATION );
5028 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5032 int UtcDaliAnimationAnimateToActorScaleZ(void)
5034 TestApplication application;
5036 Actor actor = Actor::New();
5037 Stage::GetCurrent().Add(actor);
5038 float startValue(1.0f);
5039 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
5040 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5041 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5042 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5044 // Build the animation
5045 float durationSeconds(1.0f);
5046 Animation animation = Animation::New(durationSeconds);
5047 float targetZ(-1000.0f);
5048 animation.AnimateTo( Property(actor, Actor::SCALE_Z), targetZ );
5050 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
5052 // Start the animation
5055 bool signalReceived(false);
5056 AnimationFinishCheck finishCheck(signalReceived);
5057 animation.FinishedSignal().Connect(&application, finishCheck);
5059 application.SendNotification();
5060 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5062 // We didn't expect the animation to finish yet
5063 application.SendNotification();
5064 finishCheck.CheckSignalNotReceived();
5065 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
5066 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5067 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5068 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
5070 application.SendNotification();
5071 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5073 // We did expect the animation to finish
5074 application.SendNotification();
5075 finishCheck.CheckSignalReceived();
5076 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
5077 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5079 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), targetZ, TEST_LOCATION );
5083 int UtcDaliAnimationAnimateToActorColor(void)
5085 TestApplication application;
5087 Actor actor = Actor::New();
5088 Stage::GetCurrent().Add(actor);
5089 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5091 // Build the animation
5092 float durationSeconds(1.0f);
5093 Animation animation = Animation::New(durationSeconds);
5094 Vector4 targetColor(Color::RED);
5095 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor );
5097 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
5098 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
5100 // Start the animation
5103 bool signalReceived(false);
5104 AnimationFinishCheck finishCheck(signalReceived);
5105 animation.FinishedSignal().Connect(&application, finishCheck);
5107 application.SendNotification();
5108 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
5110 // We didn't expect the animation to finish yet
5111 application.SendNotification();
5112 finishCheck.CheckSignalNotReceived();
5113 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
5115 application.SendNotification();
5116 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
5118 // We did expect the animation to finish
5119 application.SendNotification();
5120 finishCheck.CheckSignalReceived();
5121 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5124 finishCheck.Reset();
5125 actor.SetColor(Color::WHITE);
5126 application.SendNotification();
5127 application.Render(0);
5128 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5130 // Repeat with a different (ease-in) alpha function
5131 animation = Animation::New(durationSeconds);
5132 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::EaseIn);
5133 animation.FinishedSignal().Connect(&application, finishCheck);
5136 application.SendNotification();
5137 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
5139 // We didn't expect the animation to finish yet
5140 application.SendNotification();
5141 finishCheck.CheckSignalNotReceived();
5143 // The color should have changed less, than with a linear alpha function
5144 Vector4 current(actor.GetCurrentColor());
5145 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
5146 DALI_TEST_CHECK( current.y < 1.0f );
5147 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
5148 DALI_TEST_CHECK( current.z < 1.0f );
5149 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
5150 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
5152 application.SendNotification();
5153 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
5155 // We did expect the animation to finish
5156 application.SendNotification();
5157 finishCheck.CheckSignalReceived();
5158 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5161 finishCheck.Reset();
5162 actor.SetColor(Color::WHITE);
5163 application.SendNotification();
5164 application.Render(0);
5165 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5167 // Repeat with a shorter animator duration
5168 float animatorDuration = 0.5f;
5169 animation = Animation::New(durationSeconds);
5170 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::Linear, TimePeriod(animatorDuration));
5171 animation.FinishedSignal().Connect(&application, finishCheck);
5174 application.SendNotification();
5175 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
5177 // We didn't expect the animation to finish yet
5178 application.SendNotification();
5179 finishCheck.CheckSignalNotReceived();
5180 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
5182 application.SendNotification();
5183 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
5185 // We didn't expect the animation to finish yet
5186 application.SendNotification();
5187 finishCheck.CheckSignalNotReceived();
5188 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5190 application.SendNotification();
5191 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5193 // We did expect the animation to finish
5194 application.SendNotification();
5195 finishCheck.CheckSignalReceived();
5196 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5200 int UtcDaliAnimationAnimateToActorColorRed(void)
5202 TestApplication application;
5204 Actor actor = Actor::New();
5205 Stage::GetCurrent().Add(actor);
5206 float startValue(1.0f);
5207 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
5208 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5209 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5210 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5211 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5213 // Build the animation
5214 float durationSeconds(1.0f);
5215 Animation animation = Animation::New(durationSeconds);
5216 float targetRed(0.5f);
5217 animation.AnimateTo( Property(actor, Actor::COLOR_RED), targetRed );
5219 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
5221 // Start the animation
5224 bool signalReceived(false);
5225 AnimationFinishCheck finishCheck(signalReceived);
5226 animation.FinishedSignal().Connect(&application, finishCheck);
5228 application.SendNotification();
5229 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5231 // We didn't expect the animation to finish yet
5232 application.SendNotification();
5233 finishCheck.CheckSignalNotReceived();
5234 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
5235 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
5236 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5237 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5238 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5240 application.SendNotification();
5241 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5243 // We did expect the animation to finish
5244 application.SendNotification();
5245 finishCheck.CheckSignalReceived();
5246 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
5247 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), targetRed, TEST_LOCATION );
5248 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5249 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5250 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5254 int UtcDaliAnimationAnimateToActorColorGreen(void)
5256 TestApplication application;
5258 Actor actor = Actor::New();
5259 Stage::GetCurrent().Add(actor);
5260 float startValue(1.0f);
5261 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
5262 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5263 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5264 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5265 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5267 // Build the animation
5268 float durationSeconds(1.0f);
5269 Animation animation = Animation::New(durationSeconds);
5270 float targetGreen(0.5f);
5271 animation.AnimateTo( Property(actor, Actor::COLOR_GREEN), targetGreen );
5273 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
5275 // Start the animation
5278 bool signalReceived(false);
5279 AnimationFinishCheck finishCheck(signalReceived);
5280 animation.FinishedSignal().Connect(&application, finishCheck);
5282 application.SendNotification();
5283 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5285 // We didn't expect the animation to finish yet
5286 application.SendNotification();
5287 finishCheck.CheckSignalNotReceived();
5288 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
5289 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5290 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
5291 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5292 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5294 application.SendNotification();
5295 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5297 // We did expect the animation to finish
5298 application.SendNotification();
5299 finishCheck.CheckSignalReceived();
5300 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
5301 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), targetGreen, TEST_LOCATION );
5303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5308 int UtcDaliAnimationAnimateToActorColorBlue(void)
5310 TestApplication application;
5312 Actor actor = Actor::New();
5313 Stage::GetCurrent().Add(actor);
5314 float startValue(1.0f);
5315 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
5316 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5317 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5318 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5321 // Build the animation
5322 float durationSeconds(1.0f);
5323 Animation animation = Animation::New(durationSeconds);
5324 float targetBlue(0.5f);
5325 animation.AnimateTo( Property(actor, Actor::COLOR_BLUE), targetBlue );
5327 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
5329 // Start the animation
5332 bool signalReceived(false);
5333 AnimationFinishCheck finishCheck(signalReceived);
5334 animation.FinishedSignal().Connect(&application, finishCheck);
5336 application.SendNotification();
5337 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5339 // We didn't expect the animation to finish yet
5340 application.SendNotification();
5341 finishCheck.CheckSignalNotReceived();
5342 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
5343 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5344 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5345 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
5346 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5348 application.SendNotification();
5349 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5351 // We did expect the animation to finish
5352 application.SendNotification();
5353 finishCheck.CheckSignalReceived();
5354 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
5355 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5356 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5357 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), targetBlue, TEST_LOCATION );
5358 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5362 int UtcDaliAnimationAnimateToActorColorAlpha(void)
5364 TestApplication application;
5366 Actor actor = Actor::New();
5367 Stage::GetCurrent().Add(actor);
5368 float startValue(1.0f);
5369 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
5370 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5371 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5372 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5373 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5375 // Build the animation
5376 float durationSeconds(1.0f);
5377 Animation animation = Animation::New(durationSeconds);
5378 float targetAlpha(0.5f);
5379 animation.AnimateTo( Property(actor, Actor::COLOR_ALPHA), targetAlpha );
5381 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
5383 // Start the animation
5386 bool signalReceived(false);
5387 AnimationFinishCheck finishCheck(signalReceived);
5388 animation.FinishedSignal().Connect(&application, finishCheck);
5390 application.SendNotification();
5391 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5393 // We didn't expect the animation to finish yet
5394 application.SendNotification();
5395 finishCheck.CheckSignalNotReceived();
5396 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
5397 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5398 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5399 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5400 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
5402 application.SendNotification();
5403 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5405 // We did expect the animation to finish
5406 application.SendNotification();
5407 finishCheck.CheckSignalReceived();
5408 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
5409 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5410 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5411 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5412 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
5418 int UtcDaliAnimationKeyFrames01(void)
5420 TestApplication application;
5422 KeyFrames keyFrames = KeyFrames::New();
5423 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5425 keyFrames.Add(0.0f, 0.1f);
5426 keyFrames.Add(0.2f, 0.5f);
5427 keyFrames.Add(0.4f, 0.0f);
5428 keyFrames.Add(0.6f, 1.0f);
5429 keyFrames.Add(0.8f, 0.7f);
5430 keyFrames.Add(1.0f, 0.9f);
5432 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
5436 keyFrames.Add(1.9f, false);
5438 catch (Dali::DaliException& e)
5440 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5441 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5446 int UtcDaliAnimationKeyFrames02(void)
5448 TestApplication application;
5450 KeyFrames keyFrames = KeyFrames::New();
5451 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5453 keyFrames.Add(0.0f, true);
5454 keyFrames.Add(0.2f, false);
5455 keyFrames.Add(0.4f, false);
5456 keyFrames.Add(0.6f, true);
5457 keyFrames.Add(0.8f, true);
5458 keyFrames.Add(1.0f, false);
5460 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
5464 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
5466 catch (Dali::DaliException& e)
5468 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5469 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5475 int UtcDaliAnimationKeyFrames03(void)
5477 TestApplication application;
5479 KeyFrames keyFrames = KeyFrames::New();
5480 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5482 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
5483 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
5484 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
5485 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
5486 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
5487 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
5489 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
5493 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
5495 catch (Dali::DaliException& e)
5497 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5498 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5504 int UtcDaliAnimationKeyFrames04(void)
5506 TestApplication application;
5508 KeyFrames keyFrames = KeyFrames::New();
5509 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5511 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
5512 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
5513 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
5514 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
5515 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
5516 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
5518 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
5522 keyFrames.Add(0.7f, 1.0f);
5524 catch (Dali::DaliException& e)
5526 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5527 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5532 int UtcDaliAnimationKeyFrames05(void)
5534 TestApplication application;
5536 KeyFrames keyFrames = KeyFrames::New();
5537 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5539 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
5540 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
5541 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
5542 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
5543 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
5544 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
5546 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
5550 keyFrames.Add(0.7f, Quaternion(1.717f, Vector3::XAXIS));
5552 catch (Dali::DaliException& e)
5554 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5555 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5561 int UtcDaliAnimationKeyFrames06(void)
5563 TestApplication application;
5565 KeyFrames keyFrames = KeyFrames::New();
5566 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5568 keyFrames.Add(0.0f, Quaternion(1.717f, Vector3::XAXIS));
5569 keyFrames.Add(0.2f, Quaternion(2.0f, Vector3::XAXIS));
5570 keyFrames.Add(0.4f, Quaternion(3.0f, Vector3::ZAXIS));
5571 keyFrames.Add(0.6f, Quaternion(4.0f, Vector3(1.0f, 1.0f, 1.0f)));
5572 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
5573 keyFrames.Add(1.0f, Quaternion(3.0f, Vector3::YAXIS));
5575 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
5579 keyFrames.Add(0.7f, 1.1f);
5581 catch (Dali::DaliException& e)
5583 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5584 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5593 int UtcDaliAnimationAnimateBetweenActorColorAlpha(void)
5595 TestApplication application;
5597 float startValue(1.0f);
5598 Actor actor = Actor::New();
5599 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
5600 Stage::GetCurrent().Add(actor);
5602 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
5603 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5604 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5608 // Build the animation
5609 float durationSeconds(1.0f);
5610 Animation animation = Animation::New(durationSeconds);
5612 KeyFrames keyFrames = KeyFrames::New();
5613 keyFrames.Add(0.0f, 0.1f);
5614 keyFrames.Add(0.2f, 0.5f);
5615 keyFrames.Add(0.4f, 0.0f);
5616 keyFrames.Add(0.6f, 1.0f);
5617 keyFrames.Add(0.8f, 0.7f);
5618 keyFrames.Add(1.0f, 0.9f);
5620 animation.AnimateBetween( Property(actor, Actor::COLOR_ALPHA), keyFrames );
5622 // Start the animation
5625 bool signalReceived(false);
5626 AnimationFinishCheck finishCheck(signalReceived);
5627 animation.FinishedSignal().Connect(&application, finishCheck);
5628 application.SendNotification();
5629 application.Render(0);
5630 application.SendNotification();
5631 finishCheck.CheckSignalNotReceived();
5632 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
5634 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
5635 application.SendNotification();
5636 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5637 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5638 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5639 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
5640 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
5642 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
5643 application.SendNotification();
5644 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5645 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5646 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5647 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
5648 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
5650 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
5651 application.SendNotification();
5652 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5653 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5654 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5655 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
5656 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
5658 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
5659 application.SendNotification();
5660 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5661 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5663 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
5664 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
5666 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
5667 application.SendNotification();
5668 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5669 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5670 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5671 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
5672 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
5674 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
5675 application.SendNotification();
5676 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5677 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5678 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5679 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
5680 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
5682 // We did expect the animation to finish
5684 finishCheck.CheckSignalReceived();
5689 int UtcDaliAnimationAnimateBetweenActorColor(void)
5691 TestApplication application;
5693 float startValue(1.0f);
5694 Actor actor = Actor::New();
5695 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
5696 Stage::GetCurrent().Add(actor);
5698 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
5699 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5700 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5701 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5702 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5704 // Build the animation
5705 float durationSeconds(1.0f);
5706 Animation animation = Animation::New(durationSeconds);
5708 KeyFrames keyFrames = KeyFrames::New();
5709 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
5710 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
5711 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
5713 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames );
5715 // Start the animation
5718 bool signalReceived(false);
5719 AnimationFinishCheck finishCheck(signalReceived);
5720 animation.FinishedSignal().Connect(&application, finishCheck);
5721 application.SendNotification();
5722 application.Render(0);
5723 application.SendNotification();
5724 finishCheck.CheckSignalNotReceived();
5725 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
5726 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
5727 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
5728 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
5730 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5731 application.SendNotification();
5732 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
5733 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
5734 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
5735 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
5737 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5738 application.SendNotification();
5739 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
5740 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
5741 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
5742 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
5744 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5745 application.SendNotification();
5746 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
5747 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
5748 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
5749 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
5751 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
5752 application.SendNotification();
5753 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
5754 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
5755 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
5756 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
5758 // We did expect the animation to finish
5760 finishCheck.CheckSignalReceived();
5764 int UtcDaliAnimationAnimateBetweenActorVisible01(void)
5766 TestApplication application;
5768 Actor actor = Actor::New();
5769 AngleAxis aa(Degree(90), Vector3::XAXIS);
5770 actor.SetRotation(aa.angle, aa.axis);
5771 Stage::GetCurrent().Add(actor);
5773 application.SendNotification();
5774 application.Render(0);
5776 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5778 // Build the animation
5779 float durationSeconds(1.0f);
5780 Animation animation = Animation::New(durationSeconds);
5782 KeyFrames keyFrames = KeyFrames::New();
5783 keyFrames.Add(0.0f, false);
5784 keyFrames.Add(0.2f, true);
5785 keyFrames.Add(0.4f, true);
5786 keyFrames.Add(0.8f, false);
5787 keyFrames.Add(1.0f, true);
5789 animation.AnimateBetween( Property(actor, Actor::VISIBLE), keyFrames );
5791 // Start the animation
5794 bool signalReceived(false);
5795 AnimationFinishCheck finishCheck(signalReceived);
5796 animation.FinishedSignal().Connect(&application, finishCheck);
5797 application.SendNotification();
5798 application.SendNotification();
5799 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
5800 application.SendNotification();
5801 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
5802 application.SendNotification();
5804 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
5805 finishCheck.CheckSignalReceived();
5809 int UtcDaliAnimationAnimateBetweenActorRotation01(void)
5811 TestApplication application;
5813 Actor actor = Actor::New();
5814 AngleAxis aa(Degree(90), Vector3::XAXIS);
5815 actor.SetRotation(aa.angle, aa.axis);
5816 Stage::GetCurrent().Add(actor);
5818 application.SendNotification();
5819 application.Render(0);
5820 Quaternion start(Radian(aa.angle), aa.axis);
5821 DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, TEST_LOCATION );
5823 // Build the animation
5824 float durationSeconds(1.0f);
5825 Animation animation = Animation::New(durationSeconds);
5827 KeyFrames keyFrames = KeyFrames::New();
5828 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
5830 animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames );
5832 // Start the animation
5835 bool signalReceived(false);
5836 AnimationFinishCheck finishCheck(signalReceived);
5837 animation.FinishedSignal().Connect(&application, finishCheck);
5838 application.SendNotification();
5839 application.SendNotification();
5840 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
5841 application.SendNotification();
5842 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
5843 application.SendNotification();
5845 Quaternion check = Quaternion::FromAxisAngle(Vector4::ZAXIS, Radian(Degree(60)));
5847 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5848 finishCheck.CheckSignalReceived();
5852 int UtcDaliAnimationAnimateBetweenActorRotation02(void)
5854 TestApplication application;
5856 Actor actor = Actor::New();
5857 AngleAxis aa(Degree(90), Vector3::XAXIS);
5858 actor.SetRotation(aa.angle, aa.axis);
5859 application.SendNotification();
5860 application.Render(0);
5861 Stage::GetCurrent().Add(actor);
5863 Quaternion start(Radian(aa.angle), aa.axis);
5864 DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, TEST_LOCATION );
5866 // Build the animation
5867 float durationSeconds(1.0f);
5868 Animation animation = Animation::New(durationSeconds);
5870 KeyFrames keyFrames = KeyFrames::New();
5871 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
5872 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
5873 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
5875 animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames );
5877 // Start the animation
5880 bool signalReceived(false);
5881 AnimationFinishCheck finishCheck(signalReceived);
5882 animation.FinishedSignal().Connect(&application, finishCheck);
5883 application.SendNotification();
5884 application.Render(0);
5885 application.SendNotification();
5886 finishCheck.CheckSignalNotReceived();
5888 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
5889 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5891 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5892 application.SendNotification();
5893 check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(90)));
5894 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5896 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5897 application.SendNotification();
5898 check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(120)));
5899 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5901 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5902 application.SendNotification();
5903 check = Quaternion::FromAxisAngle(Vector4(0.5f, 0.5f, 0.0f, 0.0f), Radian(Degree(101.5)));
5904 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5906 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
5907 application.SendNotification();
5908 check = Quaternion::FromAxisAngle(Vector4::YAXIS, Radian(Degree(120)));
5909 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5911 // We did expect the animation to finish
5913 finishCheck.CheckSignalReceived();
5917 int UtcDaliAnimationMoveByFloat3(void)
5919 TestApplication application;
5921 Actor actor = Actor::New();
5922 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5923 actor.SetPosition(startPosition);
5924 Stage::GetCurrent().Add(actor);
5925 application.SendNotification();
5926 application.Render(0);
5927 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
5929 // Build the animation
5930 float durationSeconds(1.0f);
5931 Animation animation = Animation::New(durationSeconds);
5932 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5933 Vector3 relativePosition(targetPosition - startPosition);
5934 animation.MoveBy(actor, relativePosition.x, relativePosition.y, relativePosition.z);
5936 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
5938 // Start the animation
5941 bool signalReceived(false);
5942 AnimationFinishCheck finishCheck(signalReceived);
5943 animation.FinishedSignal().Connect(&application, finishCheck);
5945 application.SendNotification();
5946 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5948 // We didn't expect the animation to finish yet
5949 application.SendNotification();
5950 finishCheck.CheckSignalNotReceived();
5951 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
5953 application.SendNotification();
5954 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5956 // We did expect the animation to finish
5957 application.SendNotification();
5958 finishCheck.CheckSignalReceived();
5959 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5963 int UtcDaliAnimationMoveByVector3Alpha(void)
5965 TestApplication application;
5967 Actor actor = Actor::New();
5968 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5969 actor.SetPosition(startPosition);
5970 Stage::GetCurrent().Add(actor);
5971 application.SendNotification();
5972 application.Render(0);
5973 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
5975 // Build the animation
5976 float durationSeconds(1.0f);
5977 Animation animation = Animation::New(durationSeconds);
5978 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5979 Vector3 relativePosition(targetPosition - startPosition);
5980 animation.MoveBy(actor, relativePosition, AlphaFunctions::EaseOut);
5982 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
5984 // Start the animation
5987 bool signalReceived(false);
5988 AnimationFinishCheck finishCheck(signalReceived);
5989 animation.FinishedSignal().Connect(&application, finishCheck);
5991 application.SendNotification();
5992 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5994 // We didn't expect the animation to finish yet
5995 application.SendNotification();
5996 finishCheck.CheckSignalNotReceived();
5998 // The position should have moved more, than with a linear alpha function
5999 Vector3 current(actor.GetCurrentPosition());
6000 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6001 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6002 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6004 application.SendNotification();
6005 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6007 // We did expect the animation to finish
6008 application.SendNotification();
6009 finishCheck.CheckSignalReceived();
6010 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6014 int UtcDaliAnimationMoveByVector3AlphaFloat2(void)
6016 TestApplication application;
6018 Actor actor = Actor::New();
6019 Vector3 startPosition(10.0f, 10.0f, 10.0f);
6020 actor.SetPosition(startPosition);
6021 Stage::GetCurrent().Add(actor);
6022 application.SendNotification();
6023 application.Render(0);
6024 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
6026 // Build the animation
6027 float durationSeconds(1.0f);
6028 Animation animation = Animation::New(durationSeconds);
6029 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
6030 Vector3 relativePosition(targetPosition - startPosition);
6032 animation.MoveBy(actor, relativePosition, AlphaFunctions::Linear, delay, durationSeconds - delay);
6034 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
6036 // Start the animation
6039 bool signalReceived(false);
6040 AnimationFinishCheck finishCheck(signalReceived);
6041 animation.FinishedSignal().Connect(&application, finishCheck);
6043 application.SendNotification();
6044 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6046 // We didn't expect the animation to finish yet
6047 application.SendNotification();
6048 finishCheck.CheckSignalNotReceived();
6049 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
6051 application.SendNotification();
6052 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6054 // We did expect the animation to finish
6055 application.SendNotification();
6056 finishCheck.CheckSignalReceived();
6057 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6061 int UtcDaliAnimationMoveToFloat3(void)
6063 TestApplication application;
6065 Actor actor = Actor::New();
6066 Stage::GetCurrent().Add(actor);
6067 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6069 // Build the animation
6070 float durationSeconds(1.0f);
6071 Animation animation = Animation::New(durationSeconds);
6072 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6073 animation.MoveTo(actor, targetPosition.x, targetPosition.y, targetPosition.z);
6075 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6077 // Start the animation
6080 bool signalReceived(false);
6081 AnimationFinishCheck finishCheck(signalReceived);
6082 animation.FinishedSignal().Connect(&application, finishCheck);
6084 application.SendNotification();
6085 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6087 // We didn't expect the animation to finish yet
6088 application.SendNotification();
6089 finishCheck.CheckSignalNotReceived();
6090 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6092 application.SendNotification();
6093 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6095 // We did expect the animation to finish
6096 application.SendNotification();
6097 finishCheck.CheckSignalReceived();
6098 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6102 int UtcDaliAnimationMoveToVector3Alpha(void)
6104 TestApplication application;
6106 Actor actor = Actor::New();
6107 Stage::GetCurrent().Add(actor);
6108 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6110 // Build the animation
6111 float durationSeconds(1.0f);
6112 Animation animation = Animation::New(durationSeconds);
6113 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6114 animation.MoveTo(actor, targetPosition, AlphaFunctions::EaseIn);
6116 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6118 // Start the animation
6121 bool signalReceived(false);
6122 AnimationFinishCheck finishCheck(signalReceived);
6123 animation.FinishedSignal().Connect(&application, finishCheck);
6125 application.SendNotification();
6126 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6128 // We didn't expect the animation to finish yet
6129 application.SendNotification();
6130 finishCheck.CheckSignalNotReceived();
6132 // The position should have moved less, than with a linear alpha function
6133 Vector3 current(actor.GetCurrentPosition());
6134 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
6135 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
6136 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
6137 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
6138 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
6139 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
6141 application.SendNotification();
6142 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6144 // We did expect the animation to finish
6145 application.SendNotification();
6146 finishCheck.CheckSignalReceived();
6147 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6151 int UtcDaliAnimationMoveToVector3AlphaFloat2(void)
6153 TestApplication application;
6155 Actor actor = Actor::New();
6156 Stage::GetCurrent().Add(actor);
6157 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6159 // Build the animation
6160 float durationSeconds(1.0f);
6161 Animation animation = Animation::New(durationSeconds);
6162 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6164 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear, delay, durationSeconds - delay);
6166 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6168 // Start the animation
6171 bool signalReceived(false);
6172 AnimationFinishCheck finishCheck(signalReceived);
6173 animation.FinishedSignal().Connect(&application, finishCheck);
6175 application.SendNotification();
6176 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6178 // We didn't expect the animation to finish yet
6179 application.SendNotification();
6180 finishCheck.CheckSignalNotReceived();
6181 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6183 application.SendNotification();
6184 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6186 // We didn't expect the animation to finish yet
6187 application.SendNotification();
6188 finishCheck.CheckSignalNotReceived();
6189 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6191 application.SendNotification();
6192 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6194 // We did expect the animation to finish
6195 application.SendNotification();
6196 finishCheck.CheckSignalReceived();
6197 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6201 int UtcDaliAnimationMove(void)
6203 TestApplication application;
6205 Actor actor = Actor::New();
6206 Vector3 initialPosition(Vector3::ZERO);
6207 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
6208 Stage::GetCurrent().Add(actor);
6210 // Build the animation
6211 float durationSeconds(10.0f);
6212 Animation animation = Animation::New(durationSeconds);
6213 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6214 BounceFunc func(0.0f, 0.0f, -100.0f);
6215 animation.Move(actor, func, AlphaFunctions::Linear, 0.0f, durationSeconds);
6217 // Start the animation
6220 bool signalReceived(false);
6221 AnimationFinishCheck finishCheck(signalReceived);
6222 animation.FinishedSignal().Connect(&application, finishCheck);
6224 application.SendNotification();
6225 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6227 // We didn't expect the animation to finish yet
6228 application.SendNotification();
6229 finishCheck.CheckSignalNotReceived();
6230 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.25f, initialPosition), TEST_LOCATION );
6232 application.SendNotification();
6233 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6235 // We didn't expect the animation to finish yet
6236 application.SendNotification();
6237 finishCheck.CheckSignalNotReceived();
6238 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.5f, initialPosition), TEST_LOCATION );
6240 application.SendNotification();
6241 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6243 // We didn't expect the animation to finish yet
6244 application.SendNotification();
6245 finishCheck.CheckSignalNotReceived();
6246 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.75f, initialPosition), TEST_LOCATION );
6248 application.SendNotification();
6249 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6251 // We did expect the animation to finish
6252 application.SendNotification();
6253 finishCheck.CheckSignalReceived();
6254 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
6258 int UtcDaliAnimationRotateByDegreeVector3(void)
6260 TestApplication application;
6262 Actor actor = Actor::New();
6263 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6264 Stage::GetCurrent().Add(actor);
6265 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6267 // Build the animation
6268 float durationSeconds(1.0f);
6269 Animation animation = Animation::New(durationSeconds);
6270 Degree relativeRotationDegrees(360.0f);
6271 Radian relativeRotationRadians(relativeRotationDegrees);
6272 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS);
6274 // Start the animation
6277 bool signalReceived(false);
6278 AnimationFinishCheck finishCheck(signalReceived);
6279 animation.FinishedSignal().Connect(&application, finishCheck);
6281 application.SendNotification();
6282 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6284 // We didn't expect the animation to finish yet
6285 application.SendNotification();
6286 finishCheck.CheckSignalNotReceived();
6287 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6289 application.SendNotification();
6290 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6292 // We didn't expect the animation to finish yet
6293 application.SendNotification();
6294 finishCheck.CheckSignalNotReceived();
6295 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6297 application.SendNotification();
6298 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6300 // We didn't expect the animation to finish yet
6301 application.SendNotification();
6302 finishCheck.CheckSignalNotReceived();
6303 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6305 application.SendNotification();
6306 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6308 // We did expect the animation to finish
6309 application.SendNotification();
6310 finishCheck.CheckSignalReceived();
6311 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6315 int UtcDaliAnimationRotateByRadianVector3(void)
6317 TestApplication application;
6319 Actor actor = Actor::New();
6320 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6321 Stage::GetCurrent().Add(actor);
6322 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6324 // Build the animation
6325 float durationSeconds(1.0f);
6326 Animation animation = Animation::New(durationSeconds);
6327 Degree relativeRotationDegrees(360.0f);
6328 Radian relativeRotationRadians(relativeRotationDegrees);
6329 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS);
6331 // Start the animation
6334 bool signalReceived(false);
6335 AnimationFinishCheck finishCheck(signalReceived);
6336 animation.FinishedSignal().Connect(&application, finishCheck);
6338 application.SendNotification();
6339 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6341 // We didn't expect the animation to finish yet
6342 application.SendNotification();
6343 finishCheck.CheckSignalNotReceived();
6344 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6346 application.SendNotification();
6347 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6349 // We didn't expect the animation to finish yet
6350 application.SendNotification();
6351 finishCheck.CheckSignalNotReceived();
6352 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6354 application.SendNotification();
6355 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6357 // We didn't expect the animation to finish yet
6358 application.SendNotification();
6359 finishCheck.CheckSignalNotReceived();
6360 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6362 application.SendNotification();
6363 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6365 // We did expect the animation to finish
6366 application.SendNotification();
6367 finishCheck.CheckSignalReceived();
6368 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6372 int UtcDaliAnimationRotateByDegreeVector3Alpha(void)
6374 TestApplication application;
6376 Actor actor = Actor::New();
6377 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6378 Stage::GetCurrent().Add(actor);
6379 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6381 // Build the animation
6382 float durationSeconds(1.0f);
6383 Animation animation = Animation::New(durationSeconds);
6384 Degree relativeRotationDegrees(360.0f);
6385 Radian relativeRotationRadians(relativeRotationDegrees);
6386 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6388 // Start the animation
6391 bool signalReceived(false);
6392 AnimationFinishCheck finishCheck(signalReceived);
6393 animation.FinishedSignal().Connect(&application, finishCheck);
6395 application.SendNotification();
6396 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6398 // We didn't expect the animation to finish yet
6399 application.SendNotification();
6400 finishCheck.CheckSignalNotReceived();
6401 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6403 application.SendNotification();
6404 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6406 // We didn't expect the animation to finish yet
6407 application.SendNotification();
6408 finishCheck.CheckSignalNotReceived();
6409 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6411 application.SendNotification();
6412 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6414 // We didn't expect the animation to finish yet
6415 application.SendNotification();
6416 finishCheck.CheckSignalNotReceived();
6417 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6419 application.SendNotification();
6420 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6422 // We did expect the animation to finish
6423 application.SendNotification();
6424 finishCheck.CheckSignalReceived();
6425 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6429 int UtcDaliAnimationRotateByRadianVector3Alpha(void)
6431 TestApplication application;
6433 Actor actor = Actor::New();
6434 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6435 Stage::GetCurrent().Add(actor);
6436 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6438 // Build the animation
6439 float durationSeconds(1.0f);
6440 Animation animation = Animation::New(durationSeconds);
6441 Degree relativeRotationDegrees(360.0f);
6442 Radian relativeRotationRadians(relativeRotationDegrees);
6443 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6445 // Start the animation
6448 bool signalReceived(false);
6449 AnimationFinishCheck finishCheck(signalReceived);
6450 animation.FinishedSignal().Connect(&application, finishCheck);
6452 application.SendNotification();
6453 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6455 // We didn't expect the animation to finish yet
6456 application.SendNotification();
6457 finishCheck.CheckSignalNotReceived();
6458 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6460 application.SendNotification();
6461 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6463 // We didn't expect the animation to finish yet
6464 application.SendNotification();
6465 finishCheck.CheckSignalNotReceived();
6466 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6468 application.SendNotification();
6469 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6471 // We didn't expect the animation to finish yet
6472 application.SendNotification();
6473 finishCheck.CheckSignalNotReceived();
6474 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6476 application.SendNotification();
6477 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6479 // We did expect the animation to finish
6480 application.SendNotification();
6481 finishCheck.CheckSignalReceived();
6482 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6486 int UtcDaliAnimationRotateByDegreeVector3AlphaFloat2(void)
6488 TestApplication application;
6490 Actor actor = Actor::New();
6491 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6492 Stage::GetCurrent().Add(actor);
6493 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6495 // Build the animation
6496 float durationSeconds(1.0f);
6497 Animation animation = Animation::New(durationSeconds);
6498 Degree relativeRotationDegrees(360.0f);
6499 Radian relativeRotationRadians(relativeRotationDegrees);
6501 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
6503 // Start the animation
6506 bool signalReceived(false);
6507 AnimationFinishCheck finishCheck(signalReceived);
6508 animation.FinishedSignal().Connect(&application, finishCheck);
6510 application.SendNotification();
6511 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6513 // We didn't expect the animation to finish yet
6514 application.SendNotification();
6515 finishCheck.CheckSignalNotReceived();
6516 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6517 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6519 application.SendNotification();
6520 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6522 // We didn't expect the animation to finish yet
6523 application.SendNotification();
6524 finishCheck.CheckSignalNotReceived();
6525 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6526 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6528 application.SendNotification();
6529 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6531 // We didn't expect the animation to finish yet
6532 application.SendNotification();
6533 finishCheck.CheckSignalNotReceived();
6534 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6535 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6537 application.SendNotification();
6538 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6540 // We did expect the animation to finish
6541 application.SendNotification();
6542 finishCheck.CheckSignalReceived();
6543 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6548 int UtcDaliAnimationRotateByRadianVector3AlphaFloat2(void)
6550 TestApplication application;
6552 Actor actor = Actor::New();
6553 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6554 Stage::GetCurrent().Add(actor);
6555 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6557 // Build the animation
6558 float durationSeconds(1.0f);
6559 Animation animation = Animation::New(durationSeconds);
6560 Degree relativeRotationDegrees(360.0f);
6561 Radian relativeRotationRadians(relativeRotationDegrees);
6563 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
6565 // Start the animation
6568 bool signalReceived(false);
6569 AnimationFinishCheck finishCheck(signalReceived);
6570 animation.FinishedSignal().Connect(&application, finishCheck);
6572 application.SendNotification();
6573 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6575 // We didn't expect the animation to finish yet
6576 application.SendNotification();
6577 finishCheck.CheckSignalNotReceived();
6578 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6579 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6581 application.SendNotification();
6582 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6584 // We didn't expect the animation to finish yet
6585 application.SendNotification();
6586 finishCheck.CheckSignalNotReceived();
6587 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6588 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6590 application.SendNotification();
6591 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6593 // We didn't expect the animation to finish yet
6594 application.SendNotification();
6595 finishCheck.CheckSignalNotReceived();
6596 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6597 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6599 application.SendNotification();
6600 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6602 // We did expect the animation to finish
6603 application.SendNotification();
6604 finishCheck.CheckSignalReceived();
6605 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6609 int UtcDaliAnimationRotateToDegreeVector3(void)
6611 TestApplication application;
6613 Actor actor = Actor::New();
6614 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6615 Stage::GetCurrent().Add(actor);
6616 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6618 // Build the animation
6619 float durationSeconds(1.0f);
6620 Animation animation = Animation::New(durationSeconds);
6621 Degree targetRotationDegrees(90.0f);
6622 Radian targetRotationRadians(targetRotationDegrees);
6623 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS);
6625 // Start the animation
6628 bool signalReceived(false);
6629 AnimationFinishCheck finishCheck(signalReceived);
6630 animation.FinishedSignal().Connect(&application, finishCheck);
6632 application.SendNotification();
6633 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6635 // We didn't expect the animation to finish yet
6636 application.SendNotification();
6637 finishCheck.CheckSignalNotReceived();
6638 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6640 application.SendNotification();
6641 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6643 // We didn't expect the animation to finish yet
6644 application.SendNotification();
6645 finishCheck.CheckSignalNotReceived();
6646 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6648 application.SendNotification();
6649 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6651 // We didn't expect the animation to finish yet
6652 application.SendNotification();
6653 finishCheck.CheckSignalNotReceived();
6654 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6656 application.SendNotification();
6657 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6659 // We did expect the animation to finish
6660 application.SendNotification();
6661 finishCheck.CheckSignalReceived();
6662 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6666 int UtcDaliAnimationRotateToRadianVector3(void)
6668 TestApplication application;
6670 Actor actor = Actor::New();
6671 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6672 Stage::GetCurrent().Add(actor);
6673 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6675 // Build the animation
6676 float durationSeconds(1.0f);
6677 Animation animation = Animation::New(durationSeconds);
6678 Degree targetRotationDegrees(90.0f);
6679 Radian targetRotationRadians(targetRotationDegrees);
6680 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS);
6682 // Start the animation
6685 bool signalReceived(false);
6686 AnimationFinishCheck finishCheck(signalReceived);
6687 animation.FinishedSignal().Connect(&application, finishCheck);
6689 application.SendNotification();
6690 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6692 // We didn't expect the animation to finish yet
6693 application.SendNotification();
6694 finishCheck.CheckSignalNotReceived();
6695 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6697 application.SendNotification();
6698 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6700 // We didn't expect the animation to finish yet
6701 application.SendNotification();
6702 finishCheck.CheckSignalNotReceived();
6703 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6705 application.SendNotification();
6706 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6708 // We didn't expect the animation to finish yet
6709 application.SendNotification();
6710 finishCheck.CheckSignalNotReceived();
6711 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6713 application.SendNotification();
6714 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6716 // We did expect the animation to finish
6717 application.SendNotification();
6718 finishCheck.CheckSignalReceived();
6719 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6723 int UtcDaliAnimationRotateToQuaternion(void)
6725 TestApplication application;
6727 Actor actor = Actor::New();
6728 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6729 Stage::GetCurrent().Add(actor);
6730 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6732 // Build the animation
6733 float durationSeconds(1.0f);
6734 Animation animation = Animation::New(durationSeconds);
6735 Degree targetRotationDegrees(90.0f);
6736 Radian targetRotationRadians(targetRotationDegrees);
6737 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6738 animation.RotateTo(actor, targetRotation/*Quaternion version*/);
6740 // Start the animation
6743 bool signalReceived(false);
6744 AnimationFinishCheck finishCheck(signalReceived);
6745 animation.FinishedSignal().Connect(&application, finishCheck);
6747 application.SendNotification();
6748 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6750 // We didn't expect the animation to finish yet
6751 application.SendNotification();
6752 finishCheck.CheckSignalNotReceived();
6753 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6755 application.SendNotification();
6756 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6758 // We didn't expect the animation to finish yet
6759 application.SendNotification();
6760 finishCheck.CheckSignalNotReceived();
6761 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6763 application.SendNotification();
6764 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6766 // We didn't expect the animation to finish yet
6767 application.SendNotification();
6768 finishCheck.CheckSignalNotReceived();
6769 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6771 application.SendNotification();
6772 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6774 // We did expect the animation to finish
6775 application.SendNotification();
6776 finishCheck.CheckSignalReceived();
6777 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6781 int UtcDaliAnimationRotateToDegreeVector3Alpha(void)
6783 TestApplication application;
6785 Actor actor = Actor::New();
6786 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6787 Stage::GetCurrent().Add(actor);
6788 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6790 // Build the animation
6791 float durationSeconds(1.0f);
6792 Animation animation = Animation::New(durationSeconds);
6793 Degree targetRotationDegrees(90.0f);
6794 Radian targetRotationRadians(targetRotationDegrees);
6795 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6797 // Start the animation
6800 bool signalReceived(false);
6801 AnimationFinishCheck finishCheck(signalReceived);
6802 animation.FinishedSignal().Connect(&application, finishCheck);
6804 application.SendNotification();
6805 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6807 // We didn't expect the animation to finish yet
6808 application.SendNotification();
6809 finishCheck.CheckSignalNotReceived();
6810 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6812 application.SendNotification();
6813 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6815 // We didn't expect the animation to finish yet
6816 application.SendNotification();
6817 finishCheck.CheckSignalNotReceived();
6818 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6820 application.SendNotification();
6821 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6823 // We didn't expect the animation to finish yet
6824 application.SendNotification();
6825 finishCheck.CheckSignalNotReceived();
6826 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6828 application.SendNotification();
6829 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6831 // We did expect the animation to finish
6832 application.SendNotification();
6833 finishCheck.CheckSignalReceived();
6834 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6838 int UtcDaliAnimationRotateToRadianVector3Alpha(void)
6840 TestApplication application;
6842 Actor actor = Actor::New();
6843 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6844 Stage::GetCurrent().Add(actor);
6845 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6847 // Build the animation
6848 float durationSeconds(1.0f);
6849 Animation animation = Animation::New(durationSeconds);
6850 Degree targetRotationDegrees(90.0f);
6851 Radian targetRotationRadians(targetRotationDegrees);
6852 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6854 // Start the animation
6857 bool signalReceived(false);
6858 AnimationFinishCheck finishCheck(signalReceived);
6859 animation.FinishedSignal().Connect(&application, finishCheck);
6861 application.SendNotification();
6862 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6864 // We didn't expect the animation to finish yet
6865 application.SendNotification();
6866 finishCheck.CheckSignalNotReceived();
6867 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6869 application.SendNotification();
6870 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6872 // We didn't expect the animation to finish yet
6873 application.SendNotification();
6874 finishCheck.CheckSignalNotReceived();
6875 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6877 application.SendNotification();
6878 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6880 // We didn't expect the animation to finish yet
6881 application.SendNotification();
6882 finishCheck.CheckSignalNotReceived();
6883 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6885 application.SendNotification();
6886 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6888 // We did expect the animation to finish
6889 application.SendNotification();
6890 finishCheck.CheckSignalReceived();
6891 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6895 int UtcDaliAnimationRotateToQuaternionAlpha(void)
6897 TestApplication application;
6899 Actor actor = Actor::New();
6900 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6901 Stage::GetCurrent().Add(actor);
6902 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6904 // Build the animation
6905 float durationSeconds(1.0f);
6906 Animation animation = Animation::New(durationSeconds);
6907 Degree targetRotationDegrees(90.0f);
6908 Radian targetRotationRadians(targetRotationDegrees);
6909 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6910 animation.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn);
6912 // Start the animation
6915 bool signalReceived(false);
6916 AnimationFinishCheck finishCheck(signalReceived);
6917 animation.FinishedSignal().Connect(&application, finishCheck);
6919 application.SendNotification();
6920 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6922 // We didn't expect the animation to finish yet
6923 application.SendNotification();
6924 finishCheck.CheckSignalNotReceived();
6925 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6927 application.SendNotification();
6928 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6930 // We didn't expect the animation to finish yet
6931 application.SendNotification();
6932 finishCheck.CheckSignalNotReceived();
6933 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6935 application.SendNotification();
6936 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6938 // We didn't expect the animation to finish yet
6939 application.SendNotification();
6940 finishCheck.CheckSignalNotReceived();
6941 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6943 application.SendNotification();
6944 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6946 // We did expect the animation to finish
6947 application.SendNotification();
6948 finishCheck.CheckSignalReceived();
6949 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6953 int UtcDaliAnimationRotateToDegreeVector3AlphaFloat2(void)
6955 TestApplication application;
6957 Actor actor = Actor::New();
6958 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6959 Stage::GetCurrent().Add(actor);
6960 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6962 // Build the animation
6963 float durationSeconds(1.0f);
6964 Animation animation = Animation::New(durationSeconds);
6965 Degree targetRotationDegrees(90.0f);
6966 Radian targetRotationRadians(targetRotationDegrees);
6968 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
6970 // Start the animation
6973 bool signalReceived(false);
6974 AnimationFinishCheck finishCheck(signalReceived);
6975 animation.FinishedSignal().Connect(&application, finishCheck);
6977 application.SendNotification();
6978 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6980 // We didn't expect the animation to finish yet
6981 application.SendNotification();
6982 finishCheck.CheckSignalNotReceived();
6983 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6984 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6986 application.SendNotification();
6987 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6989 // We didn't expect the animation to finish yet
6990 application.SendNotification();
6991 finishCheck.CheckSignalNotReceived();
6992 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6993 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6995 application.SendNotification();
6996 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6998 // We didn't expect the animation to finish yet
6999 application.SendNotification();
7000 finishCheck.CheckSignalNotReceived();
7001 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7002 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7004 application.SendNotification();
7005 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7007 // We did expect the animation to finish
7008 application.SendNotification();
7009 finishCheck.CheckSignalReceived();
7010 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7014 int UtcDaliAnimationRotateToRadianVector3AlphaFloat2(void)
7016 TestApplication application;
7018 Actor actor = Actor::New();
7019 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7020 Stage::GetCurrent().Add(actor);
7021 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7023 // Build the animation
7024 float durationSeconds(1.0f);
7025 Animation animation = Animation::New(durationSeconds);
7026 Degree targetRotationDegrees(90.0f);
7027 Radian targetRotationRadians(targetRotationDegrees);
7029 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7031 // Start the animation
7034 bool signalReceived(false);
7035 AnimationFinishCheck finishCheck(signalReceived);
7036 animation.FinishedSignal().Connect(&application, finishCheck);
7038 application.SendNotification();
7039 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7041 // We didn't expect the animation to finish yet
7042 application.SendNotification();
7043 finishCheck.CheckSignalNotReceived();
7044 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7045 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7047 application.SendNotification();
7048 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7050 // We didn't expect the animation to finish yet
7051 application.SendNotification();
7052 finishCheck.CheckSignalNotReceived();
7053 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7054 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7056 application.SendNotification();
7057 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7059 // We didn't expect the animation to finish yet
7060 application.SendNotification();
7061 finishCheck.CheckSignalNotReceived();
7062 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7063 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7065 application.SendNotification();
7066 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7068 // We did expect the animation to finish
7069 application.SendNotification();
7070 finishCheck.CheckSignalReceived();
7071 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7075 int UtcDaliAnimationRotateToQuaternionAlphaFloat2(void)
7077 TestApplication application;
7079 Actor actor = Actor::New();
7080 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7081 Stage::GetCurrent().Add(actor);
7082 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7084 // Build the animation
7085 float durationSeconds(1.0f);
7086 Animation animation = Animation::New(durationSeconds);
7087 Degree targetRotationDegrees(90.0f);
7088 Radian targetRotationRadians(targetRotationDegrees);
7090 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7091 animation.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7093 // Start the animation
7096 bool signalReceived(false);
7097 AnimationFinishCheck finishCheck(signalReceived);
7098 animation.FinishedSignal().Connect(&application, finishCheck);
7100 application.SendNotification();
7101 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7103 // We didn't expect the animation to finish yet
7104 application.SendNotification();
7105 finishCheck.CheckSignalNotReceived();
7106 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7107 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7109 application.SendNotification();
7110 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7112 // We didn't expect the animation to finish yet
7113 application.SendNotification();
7114 finishCheck.CheckSignalNotReceived();
7115 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7116 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7118 application.SendNotification();
7119 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7121 // We didn't expect the animation to finish yet
7122 application.SendNotification();
7123 finishCheck.CheckSignalNotReceived();
7124 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7125 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7127 application.SendNotification();
7128 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7130 // We did expect the animation to finish
7131 application.SendNotification();
7132 finishCheck.CheckSignalReceived();
7133 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7137 int UtcDaliAnimationRotate(void)
7139 TestApplication application;
7141 Actor actor = Actor::New();
7142 Quaternion initialRotation(0.0f, Vector3::YAXIS);
7143 actor.SetRotation(initialRotation);
7144 Stage::GetCurrent().Add(actor);
7145 DALI_TEST_EQUALS( actor.GetCurrentRotation(), initialRotation, ROTATION_EPSILON, TEST_LOCATION );
7147 // Build the animation
7148 float durationSeconds(1.0f);
7149 Animation animation = Animation::New(durationSeconds);
7150 TumbleFunc func(Vector3::YAXIS);
7151 animation.Rotate(actor, func, AlphaFunctions::Linear, 0.0f, durationSeconds);
7153 // Start the animation
7156 bool signalReceived(false);
7157 AnimationFinishCheck finishCheck(signalReceived);
7158 animation.FinishedSignal().Connect(&application, finishCheck);
7160 application.SendNotification();
7161 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7163 // We didn't expect the animation to finish yet
7164 application.SendNotification();
7165 finishCheck.CheckSignalNotReceived();
7166 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.25f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7168 application.SendNotification();
7169 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7171 // We didn't expect the animation to finish yet
7172 application.SendNotification();
7173 finishCheck.CheckSignalNotReceived();
7174 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.5f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7176 application.SendNotification();
7177 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7179 // We didn't expect the animation to finish yet
7180 application.SendNotification();
7181 finishCheck.CheckSignalNotReceived();
7182 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.75f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7184 application.SendNotification();
7185 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7187 // We did expect the animation to finish
7188 application.SendNotification();
7189 finishCheck.CheckSignalReceived();
7190 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(1.0f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7194 int UtcDaliAnimationScaleBy(void)
7196 TestApplication application;
7198 Actor actor = Actor::New();
7199 Stage::GetCurrent().Add(actor);
7200 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7202 // Build the animation
7203 float durationSeconds(1.0f);
7204 Animation animation = Animation::New(durationSeconds);
7205 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7206 Vector3 relativeScale(targetScale - Vector3::ONE);
7207 animation.ScaleBy(actor, relativeScale.x, relativeScale.y, relativeScale.z);
7209 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
7211 // Start the animation
7214 bool signalReceived(false);
7215 AnimationFinishCheck finishCheck(signalReceived);
7216 animation.FinishedSignal().Connect(&application, finishCheck);
7218 application.SendNotification();
7219 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7221 // We didn't expect the animation to finish yet
7222 application.SendNotification();
7223 finishCheck.CheckSignalNotReceived();
7224 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7226 application.SendNotification();
7227 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7229 // We did expect the animation to finish
7230 application.SendNotification();
7231 finishCheck.CheckSignalReceived();
7232 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7235 finishCheck.Reset();
7236 actor.SetScale(Vector3::ONE);
7237 application.SendNotification();
7238 application.Render(0);
7239 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7241 // Repeat with a different (ease-in) alpha function
7242 animation = Animation::New(durationSeconds);
7243 animation.ScaleBy(actor, relativeScale, AlphaFunctions::EaseIn);
7244 animation.FinishedSignal().Connect(&application, finishCheck);
7247 application.SendNotification();
7248 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7250 // We didn't expect the animation to finish yet
7251 application.SendNotification();
7252 finishCheck.CheckSignalNotReceived();
7254 // The scale should have grown less, than with a linear alpha function
7255 Vector3 current(actor.GetCurrentScale());
7256 DALI_TEST_CHECK( current.x > 1.0f );
7257 DALI_TEST_CHECK( current.y > 1.0f );
7258 DALI_TEST_CHECK( current.z > 1.0f );
7259 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7260 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7261 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7263 application.SendNotification();
7264 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7266 // We did expect the animation to finish
7267 application.SendNotification();
7268 finishCheck.CheckSignalReceived();
7269 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7272 finishCheck.Reset();
7273 actor.SetScale(Vector3::ONE);
7274 application.SendNotification();
7275 application.Render(0);
7276 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7278 // Repeat with a delay
7280 animation = Animation::New(durationSeconds);
7281 animation.ScaleBy(actor, relativeScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
7282 animation.FinishedSignal().Connect(&application, finishCheck);
7285 application.SendNotification();
7286 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7288 // We didn't expect the animation to finish yet
7289 application.SendNotification();
7290 finishCheck.CheckSignalNotReceived();
7291 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7293 application.SendNotification();
7294 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7296 // We did expect the animation to finish
7297 application.SendNotification();
7298 finishCheck.CheckSignalReceived();
7299 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7303 int UtcDaliAnimationScaleTo(void)
7305 TestApplication application;
7307 Actor actor = Actor::New();
7308 Stage::GetCurrent().Add(actor);
7309 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7311 // Build the animation
7312 float durationSeconds(1.0f);
7313 Animation animation = Animation::New(durationSeconds);
7314 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7315 animation.ScaleTo(actor, targetScale.x, targetScale.y, targetScale.z);
7317 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7319 // Start the animation
7322 bool signalReceived(false);
7323 AnimationFinishCheck finishCheck(signalReceived);
7324 animation.FinishedSignal().Connect(&application, finishCheck);
7326 application.SendNotification();
7327 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7329 // We didn't expect the animation to finish yet
7330 application.SendNotification();
7331 finishCheck.CheckSignalNotReceived();
7332 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7334 application.SendNotification();
7335 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7337 // We did expect the animation to finish
7338 application.SendNotification();
7339 finishCheck.CheckSignalReceived();
7340 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7343 finishCheck.Reset();
7344 actor.SetScale(Vector3::ONE);
7345 application.SendNotification();
7346 application.Render(0);
7347 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7349 // Repeat with a different (ease-in) alpha function
7350 animation = Animation::New(durationSeconds);
7351 animation.ScaleTo(actor, targetScale, AlphaFunctions::EaseIn);
7352 animation.FinishedSignal().Connect(&application, finishCheck);
7355 application.SendNotification();
7356 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7358 // We didn't expect the animation to finish yet
7359 application.SendNotification();
7360 finishCheck.CheckSignalNotReceived();
7362 // The scale should have grown less, than with a linear alpha function
7363 Vector3 current(actor.GetCurrentScale());
7364 DALI_TEST_CHECK( current.x > 1.0f );
7365 DALI_TEST_CHECK( current.y > 1.0f );
7366 DALI_TEST_CHECK( current.z > 1.0f );
7367 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7368 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7369 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7371 application.SendNotification();
7372 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7374 // We did expect the animation to finish
7375 application.SendNotification();
7376 finishCheck.CheckSignalReceived();
7377 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7380 finishCheck.Reset();
7381 actor.SetScale(Vector3::ONE);
7382 application.SendNotification();
7383 application.Render(0);
7384 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7386 // Repeat with a delay
7388 animation = Animation::New(durationSeconds);
7389 animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
7390 animation.FinishedSignal().Connect(&application, finishCheck);
7393 application.SendNotification();
7394 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7396 // We didn't expect the animation to finish yet
7397 application.SendNotification();
7398 finishCheck.CheckSignalNotReceived();
7399 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7401 application.SendNotification();
7402 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7404 // We did expect the animation to finish
7405 application.SendNotification();
7406 finishCheck.CheckSignalReceived();
7407 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7411 int UtcDaliAnimationShow(void)
7413 TestApplication application;
7415 Actor actor = Actor::New();
7416 actor.SetVisible(false);
7417 application.SendNotification();
7418 application.Render(0);
7419 DALI_TEST_CHECK( !actor.IsVisible() );
7420 Stage::GetCurrent().Add(actor);
7422 // Start the animation
7423 float durationSeconds(10.0f);
7424 Animation animation = Animation::New(durationSeconds);
7425 animation.Show(actor, durationSeconds*0.5f);
7428 bool signalReceived(false);
7429 AnimationFinishCheck finishCheck(signalReceived);
7430 animation.FinishedSignal().Connect(&application, finishCheck);
7432 application.SendNotification();
7433 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
7435 // We didn't expect the animation to finish yet
7436 application.SendNotification();
7437 finishCheck.CheckSignalNotReceived();
7438 DALI_TEST_CHECK( !actor.IsVisible() );
7440 application.SendNotification();
7441 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
7443 // We didn't expect the animation to finish yet
7444 application.SendNotification();
7445 finishCheck.CheckSignalNotReceived();
7446 DALI_TEST_CHECK( actor.IsVisible() );
7448 application.SendNotification();
7449 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7451 // We did expect the animation to finish
7452 application.SendNotification();
7453 finishCheck.CheckSignalReceived();
7454 DALI_TEST_CHECK( actor.IsVisible() );
7458 int UtcDaliAnimationHide(void)
7460 TestApplication application;
7462 Actor actor = Actor::New();
7463 DALI_TEST_CHECK( actor.IsVisible() );
7464 Stage::GetCurrent().Add(actor);
7466 // Start the animation
7467 float durationSeconds(10.0f);
7468 Animation animation = Animation::New(durationSeconds);
7469 animation.Hide(actor, durationSeconds*0.5f);
7472 bool signalReceived(false);
7473 AnimationFinishCheck finishCheck(signalReceived);
7474 animation.FinishedSignal().Connect(&application, finishCheck);
7476 application.SendNotification();
7477 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
7479 // We didn't expect the animation to finish yet
7480 application.SendNotification();
7481 finishCheck.CheckSignalNotReceived();
7482 DALI_TEST_CHECK( actor.IsVisible() );
7484 application.SendNotification();
7485 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
7487 // We didn't expect the animation to finish yet
7488 application.SendNotification();
7489 finishCheck.CheckSignalNotReceived();
7490 DALI_TEST_CHECK( !actor.IsVisible() );
7492 application.SendNotification();
7493 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7495 // We did expect the animation to finish
7496 application.SendNotification();
7497 finishCheck.CheckSignalReceived();
7498 DALI_TEST_CHECK( !actor.IsVisible() );
7502 int UtcDaliAnimationShowHideAtEnd(void)
7504 // Test that show/hide delay can be the same as animation duration
7505 // i.e. to show/hide at the end of the animation
7507 TestApplication application;
7509 Actor actor = Actor::New();
7510 DALI_TEST_CHECK( actor.IsVisible() );
7511 Stage::GetCurrent().Add(actor);
7513 // Start Hide animation
7514 float durationSeconds(10.0f);
7515 Animation animation = Animation::New(durationSeconds);
7516 animation.Hide(actor, durationSeconds/*Hide at end*/);
7519 bool signalReceived(false);
7520 AnimationFinishCheck finishCheck(signalReceived);
7521 animation.FinishedSignal().Connect(&application, finishCheck);
7523 application.SendNotification();
7524 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
7526 // We did expect the animation to finish
7527 application.SendNotification();
7528 finishCheck.CheckSignalReceived();
7529 DALI_TEST_CHECK( !actor.IsVisible() );
7531 // Start Show animation
7532 animation = Animation::New(durationSeconds);
7533 animation.Show(actor, durationSeconds/*Show at end*/);
7534 animation.FinishedSignal().Connect(&application, finishCheck);
7537 application.SendNotification();
7538 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
7540 // We did expect the animation to finish
7541 application.SendNotification();
7542 finishCheck.CheckSignalReceived();
7543 DALI_TEST_CHECK( actor.IsVisible() );
7547 int UtcDaliAnimationOpacityBy(void)
7549 TestApplication application;
7550 Actor actor = Actor::New();
7551 float startingOpacity(0.5f);
7552 actor.SetOpacity(startingOpacity);
7553 application.SendNotification();
7554 application.Render(0);
7555 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7556 Stage::GetCurrent().Add(actor);
7558 // Build the animation
7559 float durationSeconds(1.0f);
7560 Animation animation = Animation::New(durationSeconds);
7561 float relativeOpacity(-0.5f); // target of zero
7562 animation.OpacityBy(actor, relativeOpacity);
7564 float seventyFivePercentProgress((1.0f - 0.75f) * startingOpacity);
7566 // Start the animation
7569 bool signalReceived(false);
7570 AnimationFinishCheck finishCheck(signalReceived);
7571 animation.FinishedSignal().Connect(&application, finishCheck);
7573 application.SendNotification();
7574 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7576 // We didn't expect the animation to finish yet
7577 application.SendNotification();
7578 finishCheck.CheckSignalNotReceived();
7579 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), seventyFivePercentProgress, TEST_LOCATION );
7581 application.SendNotification();
7582 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7584 // We did expect the animation to finish
7585 application.SendNotification();
7586 finishCheck.CheckSignalReceived();
7587 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
7590 finishCheck.Reset();
7591 actor.SetOpacity(startingOpacity);
7592 application.SendNotification();
7593 application.Render(0);
7594 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7596 // Repeat with a different (ease-in) alpha function
7597 animation = Animation::New(durationSeconds);
7598 animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::EaseIn);
7599 animation.FinishedSignal().Connect(&application, finishCheck);
7602 application.SendNotification();
7603 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7605 // We didn't expect the animation to finish yet
7606 application.SendNotification();
7607 finishCheck.CheckSignalNotReceived();
7609 // The opacity should reduce less, than with a linear alpha function
7610 float current(actor.GetCurrentOpacity());
7611 DALI_TEST_CHECK( current < 1.0f );
7612 DALI_TEST_CHECK( current > seventyFivePercentProgress );
7614 application.SendNotification();
7615 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7617 // We did expect the animation to finish
7618 application.SendNotification();
7619 finishCheck.CheckSignalReceived();
7620 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
7623 finishCheck.Reset();
7624 actor.SetOpacity(startingOpacity);
7625 application.SendNotification();
7626 application.Render(0);
7627 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7629 // Repeat with a delay
7631 animation = Animation::New(durationSeconds);
7632 animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::Linear, delay, durationSeconds - delay);
7633 animation.FinishedSignal().Connect(&application, finishCheck);
7636 application.SendNotification();
7637 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7639 // We didn't expect the animation to finish yet
7640 application.SendNotification();
7641 finishCheck.CheckSignalNotReceived();
7642 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7644 application.SendNotification();
7645 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7647 // We didn't expect the animation to finish yet
7648 application.SendNotification();
7649 finishCheck.CheckSignalNotReceived();
7650 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), seventyFivePercentProgress, TEST_LOCATION );
7652 application.SendNotification();
7653 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7655 // We did expect the animation to finish
7656 application.SendNotification();
7657 finishCheck.CheckSignalReceived();
7658 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
7662 int UtcDaliAnimationOpacityTo(void)
7664 TestApplication application;
7666 Actor actor = Actor::New();
7667 Stage::GetCurrent().Add(actor);
7668 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7670 // Build the animation
7671 float durationSeconds(1.0f);
7672 Animation animation = Animation::New(durationSeconds);
7673 float targetOpacity(0.0f);
7674 animation.OpacityTo(actor, targetOpacity);
7676 float ninetyNinePercentProgress(0.01f);
7678 // Start the animation
7681 bool signalReceived(false);
7682 AnimationFinishCheck finishCheck(signalReceived);
7683 animation.FinishedSignal().Connect(&application, finishCheck);
7685 application.SendNotification();
7686 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7688 // We didn't expect the animation to finish yet
7689 application.SendNotification();
7690 finishCheck.CheckSignalNotReceived();
7691 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), ninetyNinePercentProgress, 0.001f, TEST_LOCATION );
7693 application.SendNotification();
7694 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7696 // We did expect the animation to finish
7697 application.SendNotification();
7698 finishCheck.CheckSignalReceived();
7699 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
7702 finishCheck.Reset();
7703 actor.SetOpacity(1.0f);
7704 application.SendNotification();
7705 application.Render(0);
7706 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7708 // Repeat with a different (ease-in) alpha function
7709 animation = Animation::New(durationSeconds);
7710 animation.OpacityTo(actor, targetOpacity, AlphaFunctions::EaseIn);
7711 animation.FinishedSignal().Connect(&application, finishCheck);
7714 application.SendNotification();
7715 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7717 // We didn't expect the animation to finish yet
7718 application.SendNotification();
7719 finishCheck.CheckSignalNotReceived();
7721 // The opacity should reduce less, than with a linear alpha function
7722 float current(actor.GetCurrentOpacity());
7723 DALI_TEST_CHECK( current < 1.0f );
7724 DALI_TEST_CHECK( current > ninetyNinePercentProgress );
7726 application.SendNotification();
7727 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7729 // We did expect the animation to finish
7730 application.SendNotification();
7731 finishCheck.CheckSignalReceived();
7732 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
7735 finishCheck.Reset();
7736 actor.SetOpacity(1.0f);
7737 application.SendNotification();
7738 application.Render(0);
7739 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7741 // Repeat with a delay
7743 animation = Animation::New(durationSeconds);
7744 animation.OpacityTo(actor, targetOpacity, AlphaFunctions::Linear, delay, durationSeconds - delay);
7745 animation.FinishedSignal().Connect(&application, finishCheck);
7748 application.SendNotification();
7749 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7751 // We didn't expect the animation to finish yet
7752 application.SendNotification();
7753 finishCheck.CheckSignalNotReceived();
7754 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7756 application.SendNotification();
7757 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7759 // We did expect the animation to finish
7760 application.SendNotification();
7761 finishCheck.CheckSignalReceived();
7762 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
7766 int UtcDaliAnimationColorBy(void)
7768 TestApplication application;
7770 Actor actor = Actor::New();
7771 actor.SetColor(Color::BLACK);
7772 application.SendNotification();
7773 application.Render(0);
7774 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::BLACK, TEST_LOCATION );
7775 Stage::GetCurrent().Add(actor);
7777 // Build the animation
7778 float durationSeconds(1.0f);
7779 Animation animation = Animation::New(durationSeconds);
7780 Vector4 targetColor(Color::GREEN);
7781 Vector4 relativeColor(Color::GREEN); // Note the alpha is automatically clamped <= 1.0f in world color
7782 animation.ColorBy(actor, relativeColor);
7784 Vector4 tenPercentProgress(Vector4(0.0f, 0.1f, 0.0f, 1.0f));
7785 Vector4 twentyPercentProgress(Vector4(0.0f, 0.2f, 0.0f, 1.0f));
7787 // Start the animation
7790 bool signalReceived(false);
7791 AnimationFinishCheck finishCheck(signalReceived);
7792 animation.FinishedSignal().Connect(&application, finishCheck);
7794 application.SendNotification();
7795 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7797 // We didn't expect the animation to finish yet
7798 application.SendNotification();
7799 finishCheck.CheckSignalNotReceived();
7800 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), tenPercentProgress, TEST_LOCATION );
7802 application.SendNotification();
7803 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7805 // We did expect the animation to finish
7806 application.SendNotification();
7807 finishCheck.CheckSignalReceived();
7808 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7811 finishCheck.Reset();
7812 actor.SetColor(Color::BLACK);
7813 application.SendNotification();
7814 application.Render(0);
7815 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION );
7817 // Repeat with a different (ease-in) alpha function
7818 animation = Animation::New(durationSeconds);
7819 animation.ColorBy(actor, relativeColor, AlphaFunctions::EaseIn);
7820 animation.FinishedSignal().Connect(&application, finishCheck);
7823 application.SendNotification();
7824 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7826 // We didn't expect the animation to finish yet
7827 application.SendNotification();
7828 finishCheck.CheckSignalNotReceived();
7830 // The color should have changed less, than with a linear alpha function
7831 Vector4 current(actor.GetCurrentWorldColor());
7832 DALI_TEST_CHECK( current.x == 0.0f ); // doesn't change
7833 DALI_TEST_CHECK( current.y > 0.0f );
7834 DALI_TEST_CHECK( current.y < tenPercentProgress.y );
7835 DALI_TEST_CHECK( current.z == 0.0f ); // doesn't change
7836 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7838 application.SendNotification();
7839 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7841 // We did expect the animation to finish
7842 application.SendNotification();
7843 finishCheck.CheckSignalReceived();
7844 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7847 finishCheck.Reset();
7848 actor.SetColor(Color::BLACK);
7849 application.SendNotification();
7850 application.Render(0);
7851 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION );
7853 // Repeat with a shorter animator duration
7854 float animatorDuration = 0.5f;
7855 animation = Animation::New(durationSeconds);
7856 animation.ColorBy(actor, relativeColor, AlphaFunctions::Linear, 0, animatorDuration);
7857 animation.FinishedSignal().Connect(&application, finishCheck);
7860 application.SendNotification();
7861 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7863 // We didn't expect the animation to finish yet
7864 application.SendNotification();
7865 finishCheck.CheckSignalNotReceived();
7866 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), twentyPercentProgress, TEST_LOCATION );
7868 application.SendNotification();
7869 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7871 // We didn't expect the animation to finish yet
7872 application.SendNotification();
7873 finishCheck.CheckSignalNotReceived();
7874 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7876 application.SendNotification();
7877 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7879 // We did expect the animation to finish
7880 application.SendNotification();
7881 finishCheck.CheckSignalReceived();
7882 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7886 int UtcDaliAnimationColorTo(void)
7888 TestApplication application;
7890 Actor actor = Actor::New();
7891 Stage::GetCurrent().Add(actor);
7892 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7894 // Build the animation
7895 float durationSeconds(1.0f);
7896 Animation animation = Animation::New(durationSeconds);
7897 Vector4 targetColor(Color::RED);
7898 animation.ColorTo(actor, targetColor);
7900 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7901 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7903 // Start the animation
7906 bool signalReceived(false);
7907 AnimationFinishCheck finishCheck(signalReceived);
7908 animation.FinishedSignal().Connect(&application, finishCheck);
7910 application.SendNotification();
7911 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7913 // We didn't expect the animation to finish yet
7914 application.SendNotification();
7915 finishCheck.CheckSignalNotReceived();
7916 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7918 application.SendNotification();
7919 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7921 // We did expect the animation to finish
7922 application.SendNotification();
7923 finishCheck.CheckSignalReceived();
7924 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7927 finishCheck.Reset();
7928 actor.SetColor(Color::WHITE);
7929 application.SendNotification();
7930 application.Render(0);
7931 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7933 // Repeat with a different (ease-in) alpha function
7934 animation = Animation::New(durationSeconds);
7935 animation.ColorTo(actor, targetColor, AlphaFunctions::EaseIn);
7936 animation.FinishedSignal().Connect(&application, finishCheck);
7939 application.SendNotification();
7940 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7942 // We didn't expect the animation to finish yet
7943 application.SendNotification();
7944 finishCheck.CheckSignalNotReceived();
7946 // The color should have changed less, than with a linear alpha function
7947 Vector4 current(actor.GetCurrentColor());
7948 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7949 DALI_TEST_CHECK( current.y < 1.0f );
7950 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7951 DALI_TEST_CHECK( current.z < 1.0f );
7952 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7953 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7955 application.SendNotification();
7956 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7958 // We did expect the animation to finish
7959 application.SendNotification();
7960 finishCheck.CheckSignalReceived();
7961 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7964 finishCheck.Reset();
7965 actor.SetColor(Color::WHITE);
7966 application.SendNotification();
7967 application.Render(0);
7968 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7970 // Repeat with a shorter animator duration
7971 float animatorDuration = 0.5f;
7972 animation = Animation::New(durationSeconds);
7973 animation.ColorTo(actor, targetColor, AlphaFunctions::Linear, 0, animatorDuration);
7974 animation.FinishedSignal().Connect(&application, finishCheck);
7977 application.SendNotification();
7978 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7980 // We didn't expect the animation to finish yet
7981 application.SendNotification();
7982 finishCheck.CheckSignalNotReceived();
7983 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7985 application.SendNotification();
7986 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7988 // We didn't expect the animation to finish yet
7989 application.SendNotification();
7990 finishCheck.CheckSignalNotReceived();
7991 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7993 application.SendNotification();
7994 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7996 // We did expect the animation to finish
7997 application.SendNotification();
7998 finishCheck.CheckSignalReceived();
7999 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8003 int UtcDaliAnimationResize(void)
8005 TestApplication application;
8007 Actor actor = Actor::New();
8008 Stage::GetCurrent().Add(actor);
8009 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8011 // Build the animation
8012 float durationSeconds(1.0f);
8013 Animation animation = Animation::New(durationSeconds);
8014 Vector3 targetSize(100.0f, 100.0f, 100.0f);
8015 animation.Resize(actor, targetSize);
8017 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
8019 // Start the animation
8022 bool signalReceived(false);
8023 AnimationFinishCheck finishCheck(signalReceived);
8024 animation.FinishedSignal().Connect(&application, finishCheck);
8026 application.SendNotification();
8027 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8029 // We didn't expect the animation to finish yet
8030 application.SendNotification();
8031 finishCheck.CheckSignalNotReceived();
8032 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
8034 application.SendNotification();
8035 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8037 // We did expect the animation to finish
8038 application.SendNotification();
8039 finishCheck.CheckSignalReceived();
8040 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8043 finishCheck.Reset();
8044 actor.SetSize(Vector3::ZERO);
8045 application.SendNotification();
8046 application.Render(0);
8047 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8049 // Repeat with a different (ease-in) alpha function
8050 animation = Animation::New(durationSeconds);
8051 animation.Resize(actor, targetSize, AlphaFunctions::EaseIn);
8052 animation.FinishedSignal().Connect(&application, finishCheck);
8055 application.SendNotification();
8056 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8058 // We didn't expect the animation to finish yet
8059 application.SendNotification();
8060 finishCheck.CheckSignalNotReceived();
8062 // The size should have travelled less, than with a linear alpha function
8063 Vector3 current(actor.GetCurrentSize());
8064 DALI_TEST_CHECK( current.x > 0.0f );
8065 DALI_TEST_CHECK( current.y > 0.0f );
8066 DALI_TEST_CHECK( current.z > 0.0f );
8067 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8068 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8069 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8071 application.SendNotification();
8072 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8074 // We did expect the animation to finish
8075 application.SendNotification();
8076 finishCheck.CheckSignalReceived();
8077 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8080 finishCheck.Reset();
8081 actor.SetSize(Vector3::ZERO);
8082 application.SendNotification();
8083 application.Render(0);
8084 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8086 // Repeat with a delay
8088 animation = Animation::New(durationSeconds);
8089 animation.Resize(actor, targetSize, AlphaFunctions::Linear, delay, durationSeconds - delay);
8090 animation.FinishedSignal().Connect(&application, finishCheck);
8093 application.SendNotification();
8094 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8096 // We didn't expect the animation to finish yet
8097 application.SendNotification();
8098 finishCheck.CheckSignalNotReceived();
8099 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8101 application.SendNotification();
8102 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8104 // We did expect the animation to finish
8105 application.SendNotification();
8106 finishCheck.CheckSignalReceived();
8107 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8111 int UtcDaliAnimationAnimateBool(void)
8113 TestApplication application;
8115 Actor actor = Actor::New();
8116 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8117 Stage::GetCurrent().Add(actor);
8119 // Build the animation
8120 float durationSeconds(10.0f);
8121 Animation animation = Animation::New(durationSeconds);
8122 animation.Animate<bool>( Property(actor, Actor::VISIBLE), ReturnFalseAfterProgressOne, TimePeriod(durationSeconds*0.25f/*delay*/, durationSeconds*0.1f) );
8124 // Start the animation
8127 bool signalReceived(false);
8128 AnimationFinishCheck finishCheck(signalReceived);
8129 animation.FinishedSignal().Connect(&application, finishCheck);
8131 application.SendNotification();
8132 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8134 // We didn't expect the animation to finish yet
8135 application.SendNotification();
8136 finishCheck.CheckSignalNotReceived();
8138 // Should still be visible
8139 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8141 application.SendNotification();
8142 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8144 // We didn't expect the animation to finish yet
8145 application.SendNotification();
8146 finishCheck.CheckSignalNotReceived();
8148 // Now animate functor should have hidden the actor
8149 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
8151 application.SendNotification();
8152 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8154 // We did expect the animation to finish
8155 application.SendNotification();
8156 finishCheck.CheckSignalReceived();
8157 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
8161 int UtcDaliAnimationAnimateFloat(void)
8163 TestApplication application;
8165 Actor actor = Actor::New();
8166 Stage::GetCurrent().Add(actor);
8168 // Register a float property
8169 float startValue(10.0f);
8170 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8171 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
8173 // Build the animation
8174 float durationSeconds(10.0f);
8175 Animation animation = Animation::New(durationSeconds);
8176 float targetPosition(0.0f);
8177 AnimateFloatTestFunctor func( 100, targetPosition );
8178 animation.Animate<float>( Property(actor, index), func );
8180 // Start the animation
8183 bool signalReceived(false);
8184 AnimationFinishCheck finishCheck(signalReceived);
8185 animation.FinishedSignal().Connect(&application, finishCheck);
8187 application.SendNotification();
8188 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8190 // We didn't expect the animation to finish yet
8191 application.SendNotification();
8192 finishCheck.CheckSignalNotReceived();
8193 DALI_TEST_EQUALS( actor.GetProperty<float>(index), 75.0f, TEST_LOCATION );
8195 application.SendNotification();
8196 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8198 // We didn't expect the animation to finish yet
8199 application.SendNotification();
8200 finishCheck.CheckSignalNotReceived();
8201 DALI_TEST_EQUALS( actor.GetProperty<float>(index), 50.0f, TEST_LOCATION );
8203 application.SendNotification();
8204 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8206 // We didn't expect the animation to finish yet
8207 application.SendNotification();
8208 finishCheck.CheckSignalNotReceived();
8209 DALI_TEST_EQUALS( actor.GetProperty<float>(index), 25.0f, TEST_LOCATION );
8211 application.SendNotification();
8212 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8214 // We did expect the animation to finish
8215 application.SendNotification();
8216 finishCheck.CheckSignalReceived();
8217 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetPosition, TEST_LOCATION );
8221 int UtcDaliAnimationAnimateVector2(void)
8223 TestApplication application;
8225 Actor actor = Actor::New();
8226 Stage::GetCurrent().Add(actor);
8228 // Register a Vector2 property
8229 Vector2 startValue(10.0f, 10.0f);
8230 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8231 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
8233 // Build the animation
8234 float durationSeconds(10.0f);
8235 Animation animation = Animation::New(durationSeconds);
8236 Vector2 targetPosition(0.0f, 0.0f);
8237 AnimateVector2TestFunctor func( Vector2(100,100), targetPosition );
8238 animation.Animate<Vector2>( Property(actor, index), func );
8240 // Start the animation
8243 bool signalReceived(false);
8244 AnimationFinishCheck finishCheck(signalReceived);
8245 animation.FinishedSignal().Connect(&application, finishCheck);
8247 application.SendNotification();
8248 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8250 // We didn't expect the animation to finish yet
8251 application.SendNotification();
8252 finishCheck.CheckSignalNotReceived();
8253 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), Vector2(75,75), TEST_LOCATION );
8255 application.SendNotification();
8256 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8258 // We didn't expect the animation to finish yet
8259 application.SendNotification();
8260 finishCheck.CheckSignalNotReceived();
8261 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), Vector2(50,50), TEST_LOCATION );
8263 application.SendNotification();
8264 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8266 // We didn't expect the animation to finish yet
8267 application.SendNotification();
8268 finishCheck.CheckSignalNotReceived();
8269 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), Vector2(25,25), TEST_LOCATION );
8271 application.SendNotification();
8272 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8274 // We did expect the animation to finish
8275 application.SendNotification();
8276 finishCheck.CheckSignalReceived();
8277 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetPosition, TEST_LOCATION );
8281 int UtcDaliAnimationAnimateVector3(void)
8283 TestApplication application;
8285 Actor actor = Actor::New();
8286 Vector3 initialPosition(Vector3::ZERO);
8287 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8288 Stage::GetCurrent().Add(actor);
8290 // Build the animation
8291 float durationSeconds(10.0f);
8292 Animation animation = Animation::New(durationSeconds);
8293 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8294 BounceFunc func(0.0f, 0.0f, -100.0f);
8295 animation.Animate<Vector3>( Property(actor, Actor::POSITION), func, AlphaFunctions::Linear, durationSeconds );
8297 // Start the animation
8300 bool signalReceived(false);
8301 AnimationFinishCheck finishCheck(signalReceived);
8302 animation.FinishedSignal().Connect(&application, finishCheck);
8304 application.SendNotification();
8305 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8307 // We didn't expect the animation to finish yet
8308 application.SendNotification();
8309 finishCheck.CheckSignalNotReceived();
8310 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.25f, initialPosition), TEST_LOCATION );
8312 application.SendNotification();
8313 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8315 // We didn't expect the animation to finish yet
8316 application.SendNotification();
8317 finishCheck.CheckSignalNotReceived();
8318 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.5f, initialPosition), TEST_LOCATION );
8320 application.SendNotification();
8321 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8323 // We didn't expect the animation to finish yet
8324 application.SendNotification();
8325 finishCheck.CheckSignalNotReceived();
8326 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.75f, initialPosition), TEST_LOCATION );
8328 application.SendNotification();
8329 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8331 // We did expect the animation to finish
8332 application.SendNotification();
8333 finishCheck.CheckSignalReceived();
8334 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8338 int UtcDaliAnimationAnimateVector4(void)
8340 TestApplication application;
8342 Actor actor = Actor::New();
8343 Stage::GetCurrent().Add(actor);
8345 // Register a Vector4 property
8346 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
8347 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8348 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
8350 // Build the animation
8351 float durationSeconds(10.0f);
8352 Animation animation = Animation::New(durationSeconds);
8353 Vector4 targetPosition(200,400,0,-1000);
8354 AnimateVector4TestFunctor func( Vector4(1000,1000,1000,1000), targetPosition );
8355 animation.Animate<Vector4>( Property(actor, index), func );
8357 // Start the animation
8360 bool signalReceived(false);
8361 AnimationFinishCheck finishCheck(signalReceived);
8362 animation.FinishedSignal().Connect(&application, finishCheck);
8364 application.SendNotification();
8365 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8367 // We didn't expect the animation to finish yet
8368 application.SendNotification();
8369 finishCheck.CheckSignalNotReceived();
8370 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), Vector4(800,850,750,500), TEST_LOCATION );
8372 application.SendNotification();
8373 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8375 // We didn't expect the animation to finish yet
8376 application.SendNotification();
8377 finishCheck.CheckSignalNotReceived();
8378 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), Vector4(600,700,500,0), TEST_LOCATION );
8380 application.SendNotification();
8381 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8383 // We didn't expect the animation to finish yet
8384 application.SendNotification();
8385 finishCheck.CheckSignalNotReceived();
8386 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), Vector4(400,550,250,-500), TEST_LOCATION );
8388 application.SendNotification();
8389 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8391 // We did expect the animation to finish
8392 application.SendNotification();
8393 finishCheck.CheckSignalReceived();
8394 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetPosition, TEST_LOCATION );
8398 int UtcDaliAnimationAnimateQuaternion(void)
8400 TestApplication application;
8402 Actor actor = Actor::New();
8403 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
8404 Stage::GetCurrent().Add(actor);
8405 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8407 // Build the animation
8408 float durationSeconds(1.0f);
8409 Animation animation = Animation::New(durationSeconds);
8411 Degree sourceRotationDegrees(90.0f);
8412 Radian sourceRotationRadians(sourceRotationDegrees);
8413 Quaternion sourceRotation(sourceRotationRadians, Vector3::YAXIS);
8415 Degree targetRotationDegrees(150.0f);
8416 Radian targetRotationRadians(targetRotationDegrees);
8417 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8419 AnimateQuaternionTestFunctor func( sourceRotation, targetRotation );
8420 animation.Animate<Quaternion>( Property(actor, Actor::ROTATION), func );
8422 // Start the animation
8425 bool signalReceived(false);
8426 AnimationFinishCheck finishCheck(signalReceived);
8427 animation.FinishedSignal().Connect(&application, finishCheck);
8429 application.SendNotification();
8430 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8432 // We didn't expect the animation to finish yet
8433 application.SendNotification();
8434 finishCheck.CheckSignalNotReceived();
8435 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(Radian(Degree(105)), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8437 application.SendNotification();
8438 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8440 // We didn't expect the animation to finish yet
8441 application.SendNotification();
8442 finishCheck.CheckSignalNotReceived();
8443 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(Radian(Degree(120)), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8445 application.SendNotification();
8446 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8448 // We didn't expect the animation to finish yet
8449 application.SendNotification();
8450 finishCheck.CheckSignalNotReceived();
8451 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(Radian(Degree(135)), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8453 application.SendNotification();
8454 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8456 // We did expect the animation to finish
8457 application.SendNotification();
8458 finishCheck.CheckSignalReceived();
8459 DALI_TEST_EQUALS( actor.GetCurrentRotation(), targetRotation, ROTATION_EPSILON, TEST_LOCATION );
8463 int UtcDaliKeyFramesCreateDestroy(void)
8465 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
8467 KeyFrames* keyFrames = new KeyFrames;
8469 DALI_TEST_CHECK( true );
8473 int UtcDaliKeyFramesDownCast(void)
8475 TestApplication application;
8476 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
8478 KeyFrames keyFrames = KeyFrames::New();
8479 BaseHandle object(keyFrames);
8481 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
8482 DALI_TEST_CHECK(keyFrames2);
8484 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
8485 DALI_TEST_CHECK(keyFrames3);
8487 BaseHandle unInitializedObject;
8488 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
8489 DALI_TEST_CHECK(!keyFrames4);
8491 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
8492 DALI_TEST_CHECK(!keyFrames5);
8496 int UtcDaliAnimationResizeByXY(void)
8498 TestApplication application;
8500 Actor actor = Actor::New();
8501 Stage::GetCurrent().Add(actor);
8502 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8504 // Build the animation
8505 float durationSeconds(1.0f);
8506 Animation animation = Animation::New(durationSeconds);
8507 Vector3 targetSize(100.0f, 100.0f, 100.0f);
8508 animation.Resize(actor, targetSize);
8510 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
8512 // Start the animation
8515 bool signalReceived(false);
8516 AnimationFinishCheck finishCheck(signalReceived);
8517 animation.FinishedSignal().Connect(&application, finishCheck);
8519 application.SendNotification();
8520 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8522 // We didn't expect the animation to finish yet
8523 application.SendNotification();
8524 finishCheck.CheckSignalNotReceived();
8525 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
8527 application.SendNotification();
8528 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8530 // We did expect the animation to finish
8531 application.SendNotification();
8532 finishCheck.CheckSignalReceived();
8533 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8536 finishCheck.Reset();
8537 actor.SetSize(Vector3::ZERO);
8538 application.SendNotification();
8539 application.Render(0);
8540 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8542 // Repeat with a different (ease-in) alpha function
8543 animation = Animation::New(durationSeconds);
8544 animation.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::EaseIn);
8545 animation.FinishedSignal().Connect(&application, finishCheck);
8548 application.SendNotification();
8549 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8551 // We didn't expect the animation to finish yet
8552 application.SendNotification();
8553 finishCheck.CheckSignalNotReceived();
8555 // The size should have travelled less, than with a linear alpha function
8556 Vector3 current(actor.GetCurrentSize());
8557 DALI_TEST_CHECK( current.x > 0.0f );
8558 DALI_TEST_CHECK( current.y > 0.0f );
8559 DALI_TEST_CHECK( current.z > 0.0f );
8560 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8561 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8562 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8564 application.SendNotification();
8565 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8567 // We did expect the animation to finish
8568 application.SendNotification();
8569 finishCheck.CheckSignalReceived();
8570 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8573 finishCheck.Reset();
8574 actor.SetSize(Vector3::ZERO);
8575 application.SendNotification();
8576 application.Render(0);
8577 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8579 // Repeat with a delay
8581 animation = Animation::New(durationSeconds);
8582 animation.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::Linear, delay, durationSeconds - delay);
8583 animation.FinishedSignal().Connect(&application, finishCheck);
8586 application.SendNotification();
8587 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8589 // We didn't expect the animation to finish yet
8590 application.SendNotification();
8591 finishCheck.CheckSignalNotReceived();
8592 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8594 application.SendNotification();
8595 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8597 // We did expect the animation to finish
8598 application.SendNotification();
8599 finishCheck.CheckSignalReceived();
8600 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8605 int UtcDaliAnimationAnimateBetweenActorColorTimePeriod(void)
8607 TestApplication application;
8609 float startValue(1.0f);
8610 Actor actor = Actor::New();
8611 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8612 Stage::GetCurrent().Add(actor);
8614 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8615 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
8616 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
8617 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
8618 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
8620 // Build the animation
8621 float durationSeconds(1.0f);
8622 Animation animation = Animation::New(durationSeconds);
8624 KeyFrames keyFrames = KeyFrames::New();
8625 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8626 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8627 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8629 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, TimePeriod( 1.0f) );
8631 // Start the animation
8634 bool signalReceived(false);
8635 AnimationFinishCheck finishCheck(signalReceived);
8636 animation.FinishedSignal().Connect(&application, finishCheck);
8637 application.SendNotification();
8638 application.Render(0);
8639 application.SendNotification();
8640 finishCheck.CheckSignalNotReceived();
8641 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8642 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8643 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8644 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8646 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8647 application.SendNotification();
8648 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8649 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8650 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8651 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8653 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8654 application.SendNotification();
8655 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8656 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8657 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8660 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8661 application.SendNotification();
8662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8663 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8664 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8665 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8667 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8668 application.SendNotification();
8669 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8670 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8671 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8672 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8674 // We did expect the animation to finish
8676 finishCheck.CheckSignalReceived();
8680 int UtcDaliAnimationAnimateBetweenActorColorFunction(void)
8682 TestApplication application;
8684 float startValue(1.0f);
8685 Actor actor = Actor::New();
8686 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8687 Stage::GetCurrent().Add(actor);
8689 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8690 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
8691 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
8692 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
8693 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
8695 // Build the animation
8696 float durationSeconds(1.0f);
8697 Animation animation = Animation::New(durationSeconds);
8699 KeyFrames keyFrames = KeyFrames::New();
8700 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8701 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8702 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8704 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear );
8706 // Start the animation
8709 bool signalReceived(false);
8710 AnimationFinishCheck finishCheck(signalReceived);
8711 animation.FinishedSignal().Connect(&application, finishCheck);
8712 application.SendNotification();
8713 application.Render(0);
8714 application.SendNotification();
8715 finishCheck.CheckSignalNotReceived();
8716 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8717 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8718 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8719 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8721 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8722 application.SendNotification();
8723 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8724 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8725 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8726 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8728 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8729 application.SendNotification();
8730 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8731 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8732 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8733 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8735 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8736 application.SendNotification();
8737 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8738 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8739 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8740 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8742 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8743 application.SendNotification();
8744 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8745 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8746 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8747 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8749 // We did expect the animation to finish
8751 finishCheck.CheckSignalReceived();
8755 int UtcDaliAnimationAnimateBetweenActorColorFunctionTimePeriod(void)
8757 TestApplication application;
8759 float startValue(1.0f);
8760 Actor actor = Actor::New();
8761 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8762 Stage::GetCurrent().Add(actor);
8764 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8765 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
8766 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
8767 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
8768 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
8770 // Build the animation
8771 float durationSeconds(1.0f);
8772 Animation animation = Animation::New(durationSeconds);
8774 KeyFrames keyFrames = KeyFrames::New();
8775 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8776 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8777 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8779 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear, TimePeriod( 1.0f) );
8781 // Start the animation
8784 bool signalReceived(false);
8785 AnimationFinishCheck finishCheck(signalReceived);
8786 animation.FinishedSignal().Connect(&application, finishCheck);
8787 application.SendNotification();
8788 application.Render(0);
8789 application.SendNotification();
8790 finishCheck.CheckSignalNotReceived();
8791 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8792 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8793 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8794 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8796 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8797 application.SendNotification();
8798 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8799 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8800 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8801 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8803 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8804 application.SendNotification();
8805 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8806 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8807 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8808 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8810 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8811 application.SendNotification();
8812 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8813 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8814 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8815 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8817 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8818 application.SendNotification();
8819 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8820 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8821 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8822 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8824 // We did expect the animation to finish
8826 finishCheck.CheckSignalReceived();
8830 int UtcDaliAnimationAnimateVector3Func(void)
8832 TestApplication application;
8834 Actor actor = Actor::New();
8835 Vector3 initialPosition(Vector3::ZERO);
8836 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8837 Stage::GetCurrent().Add(actor);
8839 // Build the animation
8840 float durationSeconds(10.0f);
8841 Animation animation = Animation::New(durationSeconds);
8842 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8843 BounceFunc func(0.0f, 0.0f, -100.0f);
8844 animation.Animate<Vector3>( Property(actor, Actor::POSITION), func, AlphaFunctions::Linear );
8846 // Start the animation
8849 bool signalReceived(false);
8850 AnimationFinishCheck finishCheck(signalReceived);
8851 animation.FinishedSignal().Connect(&application, finishCheck);
8853 application.SendNotification();
8854 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8856 // We didn't expect the animation to finish yet
8857 application.SendNotification();
8858 finishCheck.CheckSignalNotReceived();
8859 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.25f, initialPosition), TEST_LOCATION );
8861 application.SendNotification();
8862 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8864 // We didn't expect the animation to finish yet
8865 application.SendNotification();
8866 finishCheck.CheckSignalNotReceived();
8867 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.5f, initialPosition), TEST_LOCATION );
8869 application.SendNotification();
8870 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8872 // We didn't expect the animation to finish yet
8873 application.SendNotification();
8874 finishCheck.CheckSignalNotReceived();
8875 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.75f, initialPosition), TEST_LOCATION );
8877 application.SendNotification();
8878 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8880 // We did expect the animation to finish
8881 application.SendNotification();
8882 finishCheck.CheckSignalReceived();
8883 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8887 int UtcDaliAnimationCreateDestroy(void)
8889 TestApplication application;
8890 Animation* animation = new Animation;
8891 DALI_TEST_CHECK( animation );