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 // Animate again, but don't bake this time
452 animation.SetEndAction(Animation::Discard);
453 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
456 application.SendNotification();
457 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
459 // We did expect the animation to finish
460 application.SendNotification();
461 finishCheck.CheckSignalReceived();
462 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
464 // The position should be discarded in the next frame
465 application.Render(0);
466 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
468 // Check that nothing has changed after a couple of buffer swaps
469 application.Render(0);
470 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
471 application.Render(0);
472 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
476 int UtcDaliAnimationGetEndAction(void)
478 TestApplication application;
480 Animation animation = Animation::New(1.0f);
481 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
483 animation.SetEndAction(Animation::Discard);
484 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
488 int UtcDaliAnimationGetDestroyAction(void)
490 TestApplication application;
491 Animation animation = Animation::New(1.0f);
492 DALI_TEST_CHECK(animation.GetDestroyAction() == Animation::Bake); // default!
494 animation.SetDestroyAction(Animation::Discard);
495 DALI_TEST_CHECK(animation.GetDestroyAction() == Animation::Discard);
500 int UtcDaliAnimationSetDefaultAlphaFunction(void)
502 TestApplication application;
504 Animation animation = Animation::New(1.0f);
505 AlphaFunction func = animation.GetDefaultAlphaFunction();
506 DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
508 animation.SetDefaultAlphaFunction(AlphaFunctions::EaseIn);
509 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
510 DALI_TEST_CHECK(func2(0.1f) < AlphaFunctions::Linear(0.1f)); // less progress when easing-in
514 int UtcDaliAnimationGetDefaultAlphaFunction(void)
516 TestApplication application;
518 Animation animation = Animation::New(1.0f);
519 AlphaFunction func = animation.GetDefaultAlphaFunction();
521 // Test that the default is linear
522 DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
526 int UtcDaliAnimationPlay(void)
528 TestApplication application;
530 Actor actor = Actor::New();
531 Stage::GetCurrent().Add(actor);
533 // Build the animation
534 float durationSeconds(1.0f);
535 Animation animation = Animation::New(durationSeconds);
536 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
537 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
539 // Start the animation
542 bool signalReceived(false);
543 AnimationFinishCheck finishCheck(signalReceived);
544 animation.FinishedSignal().Connect(&application, finishCheck);
546 application.SendNotification();
547 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
549 // We didn't expect the animation to finish yet
550 application.SendNotification();
551 finishCheck.CheckSignalNotReceived();
552 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
554 animation.Play(); // Test that calling play has no effect, when animation is already playing
555 application.SendNotification();
556 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
558 // We didn't expect the animation to finish yet
559 application.SendNotification();
560 finishCheck.CheckSignalNotReceived();
561 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
563 animation.Play(); // Test that calling play has no effect, when animation is already playing
564 application.SendNotification();
565 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
567 // We didn't expect the animation to finish yet
568 application.SendNotification();
569 finishCheck.CheckSignalNotReceived();
570 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
572 animation.Play(); // Test that calling play has no effect, when animation is already playing
573 application.SendNotification();
574 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
576 // We didn't expect the animation to finish yet
577 application.SendNotification();
578 finishCheck.CheckSignalNotReceived();
579 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
581 animation.Play(); // Test that calling play has no effect, when animation is already playing
582 application.SendNotification();
583 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
585 // We did expect the animation to finish
586 application.SendNotification();
587 finishCheck.CheckSignalReceived();
588 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
590 // Check that nothing has changed after a couple of buffer swaps
591 application.Render(0);
592 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
593 application.Render(0);
594 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
598 int UtcDaliAnimationPlayOffStage(void)
600 // Test that an animation can be played, when the actor is off-stage.
601 // When the actor is added to the stage, it should appear at the current position
602 // i.e. where it would have been anyway, if on-stage from the beginning.
604 TestApplication application;
606 Actor actor = Actor::New();
607 Vector3 basePosition(Vector3::ZERO);
608 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
609 // Not added to the stage!
611 // Build the animation
612 float durationSeconds(1.0f);
613 Animation animation = Animation::New(durationSeconds);
614 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
615 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
617 // Start the animation
620 bool signalReceived(false);
621 AnimationFinishCheck finishCheck(signalReceived);
622 animation.FinishedSignal().Connect(&application, finishCheck);
624 application.SendNotification();
625 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
627 // We didn't expect the animation to finish yet
628 application.SendNotification();
629 finishCheck.CheckSignalNotReceived();
630 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
633 Stage::GetCurrent().Add(actor);
635 application.SendNotification();
636 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
638 // We didn't expect the animation to finish yet
639 application.SendNotification();
640 finishCheck.CheckSignalNotReceived();
641 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
642 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
644 // Remove from the stage
645 Stage::GetCurrent().Remove(actor);
647 application.SendNotification();
648 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
650 // We didn't expect the animation to finish yet
651 application.SendNotification();
652 finishCheck.CheckSignalNotReceived();
653 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
656 Stage::GetCurrent().Add(actor);
658 application.SendNotification();
659 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
661 // We didn't expect the animation to finish yet
662 application.SendNotification();
663 finishCheck.CheckSignalNotReceived();
664 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
665 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
667 application.SendNotification();
668 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
670 // We did expect the animation to finish
671 application.SendNotification();
672 finishCheck.CheckSignalReceived();
673 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
675 // Check that nothing has changed after a couple of buffer swaps
676 application.Render(0);
677 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
678 application.Render(0);
679 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
683 int UtcDaliAnimationPlayDiscardHandle(void)
685 TestApplication application;
687 Actor actor = Actor::New();
688 Stage::GetCurrent().Add(actor);
690 // Build the animation
691 float durationSeconds(1.0f);
692 Animation animation = Animation::New(durationSeconds);
693 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
694 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
696 bool signalReceived(false);
697 AnimationFinishCheck finishCheck(signalReceived);
698 animation.FinishedSignal().Connect(&application, finishCheck);
700 // Start the animation
703 // This is a test of the "Fire and Forget" behaviour
704 // Discard the animation handle!
706 DALI_TEST_CHECK( !animation );
708 application.SendNotification();
709 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
711 // We didn't expect the animation to finish yet
712 application.SendNotification();
713 finishCheck.CheckSignalNotReceived();
714 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
716 application.SendNotification();
717 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
719 // We didn't expect the animation to finish yet
720 application.SendNotification();
721 finishCheck.CheckSignalNotReceived();
722 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
724 application.SendNotification();
725 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
727 // We didn't expect the animation to finish yet
728 application.SendNotification();
729 finishCheck.CheckSignalNotReceived();
730 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
732 application.SendNotification();
733 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
735 // We didn't expect the animation to finish yet
736 application.SendNotification();
737 finishCheck.CheckSignalNotReceived();
738 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
740 application.SendNotification();
741 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
743 // We did expect the animation to finish
744 application.SendNotification();
745 finishCheck.CheckSignalReceived();
746 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
748 // Check that nothing has changed after a couple of buffer swaps
749 application.Render(0);
750 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
751 application.Render(0);
752 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
756 int UtcDaliAnimationPlayStopDiscardHandle(void)
758 TestApplication application;
760 Actor actor = Actor::New();
761 Stage::GetCurrent().Add(actor);
763 // Build the animation
764 float durationSeconds(1.0f);
765 Animation animation = Animation::New(durationSeconds);
766 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
767 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
769 // Start the animation
772 bool signalReceived(false);
773 AnimationFinishCheck finishCheck(signalReceived);
774 animation.FinishedSignal().Connect(&application, finishCheck);
776 application.SendNotification();
777 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
779 // We didn't expect the animation to finish yet
780 application.SendNotification();
781 finishCheck.CheckSignalNotReceived();
782 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
784 // This is a test of the "Fire and Forget" behaviour
785 // Stop the animation, and Discard the animation handle!
788 DALI_TEST_CHECK( !animation );
790 application.SendNotification();
791 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
793 // We expect the animation to finish at 20% progress
794 application.SendNotification();
795 finishCheck.CheckSignalReceived();
797 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
799 application.SendNotification();
800 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
802 // Check that nothing has changed
803 application.SendNotification();
804 finishCheck.CheckSignalNotReceived();
805 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
807 application.SendNotification();
808 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
810 // Check that nothing has changed
811 application.SendNotification();
812 finishCheck.CheckSignalNotReceived();
813 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
815 application.SendNotification();
816 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
818 // Check that nothing has changed
819 application.SendNotification();
820 finishCheck.CheckSignalNotReceived();
821 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
825 int UtcDaliAnimationPause(void)
827 TestApplication application;
829 Actor actor = Actor::New();
830 Stage::GetCurrent().Add(actor);
832 // Build the animation
833 float durationSeconds(1.0f);
834 Animation animation = Animation::New(durationSeconds);
835 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
836 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
838 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
840 // Start the animation
843 bool signalReceived(false);
844 AnimationFinishCheck finishCheck(signalReceived);
845 animation.FinishedSignal().Connect(&application, finishCheck);
847 application.SendNotification();
848 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
850 // We didn't expect the animation to finish yet
851 application.SendNotification();
852 finishCheck.CheckSignalNotReceived();
853 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
855 // Pause the animation
857 application.SendNotification();
860 for (int i=0; i<5; ++i)
862 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
864 // We didn't expect the animation to finish yet
865 application.SendNotification();
866 finishCheck.CheckSignalNotReceived();
867 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
872 application.SendNotification();
873 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
875 // We didn't expect the animation to finish yet
876 application.SendNotification();
877 finishCheck.CheckSignalNotReceived();
879 application.SendNotification();
880 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
882 // We did expect the animation to finish
883 application.SendNotification();
884 finishCheck.CheckSignalReceived();
885 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
887 // Check that nothing has changed after a couple of buffer swaps
888 application.Render(0);
889 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
890 application.Render(0);
891 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
895 int UtcDaliAnimationStop(void)
897 TestApplication application;
899 Actor actor = Actor::New();
900 Stage::GetCurrent().Add(actor);
902 // Build the animation
903 float durationSeconds(1.0f);
904 Animation animation = Animation::New(durationSeconds);
905 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
906 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
908 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
910 // Start the animation
913 bool signalReceived(false);
914 AnimationFinishCheck finishCheck(signalReceived);
915 animation.FinishedSignal().Connect(&application, finishCheck);
917 application.SendNotification();
918 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
920 // We didn't expect the animation to finish yet
921 application.SendNotification();
922 finishCheck.CheckSignalNotReceived();
923 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
925 // Stop the animation
927 application.SendNotification();
930 for (int i=0; i<5; ++i)
932 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
934 // We did expect the animation to finish
935 application.SendNotification();
936 finishCheck.CheckSignalReceived();
937 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
942 int UtcDaliAnimationStopSetPosition(void)
944 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
945 // i.e. to check that the animation does not interfere with the position set.
947 TestApplication application;
949 Actor actor = Actor::New();
950 Stage::GetCurrent().Add(actor);
952 // Build the animation
953 float durationSeconds(1.0f);
954 Animation animation = Animation::New(durationSeconds);
955 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
956 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
958 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
960 // Start the animation
963 bool signalReceived(false);
964 AnimationFinishCheck finishCheck(signalReceived);
965 animation.FinishedSignal().Connect(&application, finishCheck);
967 application.SendNotification();
968 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
970 // We didn't expect the animation to finish yet
971 application.SendNotification();
972 finishCheck.CheckSignalNotReceived();
973 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
975 // Stop the animation
977 Vector3 positionSet(2.0f, 3.0f, 4.0f);
978 actor.SetPosition(positionSet);
979 application.SendNotification();
982 for (int i=0; i<5; ++i)
984 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
986 // We did expect the animation to finish
987 application.SendNotification();
988 finishCheck.CheckSignalReceived();
989 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
994 int UtcDaliAnimationClear(void)
996 TestApplication application;
998 Actor actor = Actor::New();
999 Stage::GetCurrent().Add(actor);
1001 // Build the animation
1002 float durationSeconds(1.0f);
1003 Animation animation = Animation::New(durationSeconds);
1004 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1005 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
1007 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1009 // Start the animation
1012 bool signalReceived(false);
1013 AnimationFinishCheck finishCheck(signalReceived);
1014 animation.FinishedSignal().Connect(&application, finishCheck);
1016 application.SendNotification();
1017 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1019 // We didn't expect the animation to finish yet
1020 application.SendNotification();
1021 finishCheck.CheckSignalNotReceived();
1022 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1024 // Clear the animation
1026 application.SendNotification();
1028 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1030 // We don't expect the animation to finish now
1031 application.SendNotification();
1032 finishCheck.CheckSignalNotReceived();
1033 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
1035 // Restart as a scale animation; this should not move the actor's position
1036 finishCheck.Reset();
1037 actor.SetPosition(Vector3::ZERO);
1038 Vector3 targetScale(3.0f, 3.0f, 3.0f);
1039 animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear);
1042 application.SendNotification();
1043 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1045 // We didn't expect the animation to finish yet
1046 application.SendNotification();
1047 finishCheck.CheckSignalNotReceived();
1048 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1049 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
1051 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1053 // We did expect the animation to finish
1054 application.SendNotification();
1055 finishCheck.CheckSignalReceived();
1056 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1057 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
1061 int UtcDaliAnimationSignalFinish(void)
1063 TestApplication application;
1065 // Start the empty animation
1066 float durationSeconds(1.0f);
1067 Animation animation = Animation::New(durationSeconds);
1070 bool signalReceived(false);
1071 AnimationFinishCheck finishCheck(signalReceived);
1072 animation.FinishedSignal().Connect(&application, finishCheck);
1074 application.SendNotification();
1075 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
1077 // We did expect the animation to finish
1078 application.SendNotification();
1079 finishCheck.CheckSignalReceived();
1083 int UtcDaliAnimationAnimateByBoolean(void)
1085 TestApplication application;
1087 Actor actor = Actor::New();
1089 // Register a boolean property
1090 bool startValue(false);
1091 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1092 Stage::GetCurrent().Add(actor);
1093 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1095 // Build the animation
1096 float durationSeconds(2.0f);
1097 Animation animation = Animation::New(durationSeconds);
1098 const bool relativeValue(true);
1099 const bool finalValue( false || relativeValue );
1100 animation.AnimateBy(Property(actor, index), relativeValue);
1102 // Start the animation
1105 bool signalReceived(false);
1106 AnimationFinishCheck finishCheck(signalReceived);
1107 animation.FinishedSignal().Connect(&application, finishCheck);
1109 application.SendNotification();
1110 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1112 // We didn't expect the animation to finish yet
1113 application.SendNotification();
1114 finishCheck.CheckSignalNotReceived();
1115 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1117 application.SendNotification();
1118 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1120 // We did expect the animation to finish
1121 application.SendNotification();
1122 finishCheck.CheckSignalReceived();
1123 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1125 // Check that nothing has changed after a couple of buffer swaps
1126 application.Render(0);
1127 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1128 application.Render(0);
1129 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1131 // Repeat with relative value "false" - this should be an NOOP
1132 animation = Animation::New(durationSeconds);
1133 bool noOpValue(false);
1134 animation.AnimateBy(Property(actor, index), noOpValue);
1136 // Start the animation
1139 finishCheck.Reset();
1140 animation.FinishedSignal().Connect(&application, finishCheck);
1142 application.SendNotification();
1143 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1145 // We didn't expect the animation to finish yet
1146 application.SendNotification();
1147 finishCheck.CheckSignalNotReceived();
1148 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1150 application.SendNotification();
1151 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1153 // We did expect the animation to finish
1154 application.SendNotification();
1155 finishCheck.CheckSignalReceived();
1156 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1158 // Check that nothing has changed after a couple of buffer swaps
1159 application.Render(0);
1160 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1161 application.Render(0);
1162 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1166 int UtcDaliAnimationAnimateByBooleanAlphaFunction(void)
1168 TestApplication application;
1170 Actor actor = Actor::New();
1172 // Register a boolean property
1173 bool startValue(false);
1174 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1175 Stage::GetCurrent().Add(actor);
1176 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1178 // Build the animation
1179 float durationSeconds(2.0f);
1180 Animation animation = Animation::New(durationSeconds);
1181 bool relativeValue(true);
1182 bool finalValue( false || relativeValue );
1183 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseIn);
1185 // Start the animation
1188 bool signalReceived(false);
1189 AnimationFinishCheck finishCheck(signalReceived);
1190 animation.FinishedSignal().Connect(&application, finishCheck);
1192 application.SendNotification();
1193 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1195 // We didn't expect the animation to finish yet
1196 application.SendNotification();
1197 finishCheck.CheckSignalNotReceived();
1198 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1200 application.SendNotification();
1201 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1203 // We did expect the animation to finish
1204 application.SendNotification();
1205 finishCheck.CheckSignalReceived();
1206 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1208 // Check that nothing has changed after a couple of buffer swaps
1209 application.Render(0);
1210 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1211 application.Render(0);
1212 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1214 // Repeat with relative value "false" - this should be an NOOP
1215 animation = Animation::New(durationSeconds);
1216 bool noOpValue(false);
1217 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunctions::EaseIn);
1219 // Start the animation
1222 finishCheck.Reset();
1223 animation.FinishedSignal().Connect(&application, finishCheck);
1225 application.SendNotification();
1226 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1228 // We didn't expect the animation to finish yet
1229 application.SendNotification();
1230 finishCheck.CheckSignalNotReceived();
1231 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1233 application.SendNotification();
1234 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1236 // We did expect the animation to finish
1237 application.SendNotification();
1238 finishCheck.CheckSignalReceived();
1239 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1243 int UtcDaliAnimationAnimateByBooleanTimePeriod(void)
1245 TestApplication application;
1247 Actor actor = Actor::New();
1249 // Register a boolean property
1250 bool startValue(false);
1251 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1252 Stage::GetCurrent().Add(actor);
1253 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1255 // Build the animation
1256 float durationSeconds(2.0f);
1257 Animation animation = Animation::New(durationSeconds);
1258 bool relativeValue(true);
1259 bool finalValue( false || relativeValue );
1260 float animatorDurationSeconds(durationSeconds * 0.5f);
1261 animation.AnimateBy( Property(actor, index),
1263 TimePeriod( animatorDurationSeconds ) );
1265 // Start the animation
1268 bool signalReceived(false);
1269 AnimationFinishCheck finishCheck(signalReceived);
1270 animation.FinishedSignal().Connect(&application, finishCheck);
1272 application.SendNotification();
1273 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
1275 // We didn't expect the animation to finish yet
1276 application.SendNotification();
1277 finishCheck.CheckSignalNotReceived();
1278 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1280 application.SendNotification();
1281 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
1283 // We didn't expect the animation to finish yet...
1284 application.SendNotification();
1285 finishCheck.CheckSignalNotReceived();
1287 // ...however we should have reached the final value
1288 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1290 application.SendNotification();
1291 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
1293 // We did expect the animation to finish
1294 application.SendNotification();
1295 finishCheck.CheckSignalReceived();
1296 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1298 // Check that nothing has changed after a couple of buffer swaps
1299 application.Render(0);
1300 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1301 application.Render(0);
1302 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1306 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriod(void)
1308 TestApplication application;
1310 Actor actor = Actor::New();
1312 // Register a boolean property
1313 bool startValue(false);
1314 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1315 Stage::GetCurrent().Add(actor);
1316 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1318 // Build the animation
1319 float durationSeconds(2.0f);
1320 Animation animation = Animation::New(durationSeconds);
1321 bool relativeValue(true);
1322 bool finalValue( false || relativeValue );
1323 float animatorDurationSeconds(durationSeconds * 0.5f);
1324 animation.AnimateBy( Property(actor, index),
1326 AlphaFunctions::EaseInOut,
1327 TimePeriod( animatorDurationSeconds ) );
1329 // Start the animation
1332 bool signalReceived(false);
1333 AnimationFinishCheck finishCheck(signalReceived);
1334 animation.FinishedSignal().Connect(&application, finishCheck);
1336 application.SendNotification();
1337 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
1339 // We didn't expect the animation to finish yet
1340 application.SendNotification();
1341 finishCheck.CheckSignalNotReceived();
1342 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1344 application.SendNotification();
1345 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
1347 // We didn't expect the animation to finish yet...
1348 application.SendNotification();
1349 finishCheck.CheckSignalNotReceived();
1351 // ...however we should have reached the final value
1352 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1354 application.SendNotification();
1355 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
1357 // We did expect the animation to finish
1358 application.SendNotification();
1359 finishCheck.CheckSignalReceived();
1360 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1362 // Check that nothing has changed after a couple of buffer swaps
1363 application.Render(0);
1364 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1365 application.Render(0);
1366 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1370 int UtcDaliAnimationAnimateByFloat(void)
1372 TestApplication application;
1374 Actor actor = Actor::New();
1376 // Register a float property
1377 float startValue(10.0f);
1378 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1379 Stage::GetCurrent().Add(actor);
1380 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1382 // Build the animation
1383 float durationSeconds(2.0f);
1384 Animation animation = Animation::New(durationSeconds);
1385 float targetValue(50.0f);
1386 float relativeValue(targetValue - startValue);
1387 animation.AnimateBy(Property(actor, index), relativeValue);
1389 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1391 // Start the animation
1394 bool signalReceived(false);
1395 AnimationFinishCheck finishCheck(signalReceived);
1396 animation.FinishedSignal().Connect(&application, finishCheck);
1398 application.SendNotification();
1399 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1401 // We didn't expect the animation to finish yet
1402 application.SendNotification();
1403 finishCheck.CheckSignalNotReceived();
1404 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
1406 application.SendNotification();
1407 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1409 // We did expect the animation to finish
1410 application.SendNotification();
1411 finishCheck.CheckSignalReceived();
1412 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1414 // Check that nothing has changed after a couple of buffer swaps
1415 application.Render(0);
1416 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1417 application.Render(0);
1418 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1422 int UtcDaliAnimationAnimateByFloatAlphaFunction(void)
1424 TestApplication application;
1426 Actor actor = Actor::New();
1428 // Register a float property
1429 float startValue(10.0f);
1430 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1431 Stage::GetCurrent().Add(actor);
1432 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1434 // Build the animation
1435 float durationSeconds(1.0f);
1436 Animation animation = Animation::New(durationSeconds);
1437 float targetValue(90.0f);
1438 float relativeValue(targetValue - startValue);
1439 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1441 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1443 // Start the animation
1446 bool signalReceived(false);
1447 AnimationFinishCheck finishCheck(signalReceived);
1448 animation.FinishedSignal().Connect(&application, finishCheck);
1450 application.SendNotification();
1451 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1453 // We didn't expect the animation to finish yet
1454 application.SendNotification();
1455 finishCheck.CheckSignalNotReceived();
1457 // The position should have moved more, than with a linear alpha function
1458 float current(actor.GetProperty<float>(index));
1459 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
1461 application.SendNotification();
1462 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1464 // We did expect the animation to finish
1465 application.SendNotification();
1466 finishCheck.CheckSignalReceived();
1467 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1469 // Check that nothing has changed after a couple of buffer swaps
1470 application.Render(0);
1471 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1472 application.Render(0);
1473 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1477 int UtcDaliAnimationAnimateByFloatTimePeriod(void)
1479 TestApplication application;
1481 Actor actor = Actor::New();
1483 // Register a float property
1484 float startValue(10.0f);
1485 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1486 Stage::GetCurrent().Add(actor);
1487 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1489 // Build the animation
1490 float durationSeconds(1.0f);
1491 Animation animation = Animation::New(durationSeconds);
1492 float targetValue(30.0f);
1493 float relativeValue(targetValue - startValue);
1495 animation.AnimateBy(Property(actor, index),
1497 TimePeriod(delay, durationSeconds - delay));
1499 // Start the animation
1502 bool signalReceived(false);
1503 AnimationFinishCheck finishCheck(signalReceived);
1504 animation.FinishedSignal().Connect(&application, finishCheck);
1506 application.SendNotification();
1507 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1509 // We didn't expect the animation to finish yet
1510 application.SendNotification();
1511 finishCheck.CheckSignalNotReceived();
1512 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1514 application.SendNotification();
1515 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1517 // We didn't expect the animation to finish yet
1518 application.SendNotification();
1519 finishCheck.CheckSignalNotReceived();
1520 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1522 application.SendNotification();
1523 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1525 // We did expect the animation to finish
1526 application.SendNotification();
1527 finishCheck.CheckSignalReceived();
1528 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1530 // Check that nothing has changed after a couple of buffer swaps
1531 application.Render(0);
1532 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1533 application.Render(0);
1534 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1538 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriod(void)
1540 TestApplication application;
1542 Actor actor = Actor::New();
1544 // Register a float property
1545 float startValue(10.0f);
1546 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1547 Stage::GetCurrent().Add(actor);
1548 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1550 // Build the animation
1551 float durationSeconds(1.0f);
1552 Animation animation = Animation::New(durationSeconds);
1553 float targetValue(30.0f);
1554 float relativeValue(targetValue - startValue);
1556 animation.AnimateBy(Property(actor, index),
1558 AlphaFunctions::Linear,
1559 TimePeriod(delay, durationSeconds - delay));
1561 // Start the animation
1564 bool signalReceived(false);
1565 AnimationFinishCheck finishCheck(signalReceived);
1566 animation.FinishedSignal().Connect(&application, finishCheck);
1568 application.SendNotification();
1569 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1571 // We didn't expect the animation to finish yet
1572 application.SendNotification();
1573 finishCheck.CheckSignalNotReceived();
1574 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1576 application.SendNotification();
1577 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1579 // We didn't expect the animation to finish yet
1580 application.SendNotification();
1581 finishCheck.CheckSignalNotReceived();
1582 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1584 application.SendNotification();
1585 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1587 // We did expect the animation to finish
1588 application.SendNotification();
1589 finishCheck.CheckSignalReceived();
1590 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1592 // Check that nothing has changed after a couple of buffer swaps
1593 application.Render(0);
1594 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1595 application.Render(0);
1596 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1600 int UtcDaliAnimationAnimateByVector2(void)
1602 TestApplication application;
1604 Actor actor = Actor::New();
1606 // Register a Vector2 property
1607 Vector2 startValue(10.0f, 10.0f);
1608 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1609 Stage::GetCurrent().Add(actor);
1610 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1612 // Build the animation
1613 float durationSeconds(2.0f);
1614 Animation animation = Animation::New(durationSeconds);
1615 Vector2 targetValue(60.0f, 60.0f);
1616 Vector2 relativeValue(targetValue - startValue);
1617 animation.AnimateBy(Property(actor, index), relativeValue);
1619 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1621 // Start the animation
1624 bool signalReceived(false);
1625 AnimationFinishCheck finishCheck(signalReceived);
1626 animation.FinishedSignal().Connect(&application, finishCheck);
1628 application.SendNotification();
1629 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1631 // We didn't expect the animation to finish yet
1632 application.SendNotification();
1633 finishCheck.CheckSignalNotReceived();
1634 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
1636 application.SendNotification();
1637 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1639 // We did expect the animation to finish
1640 application.SendNotification();
1641 finishCheck.CheckSignalReceived();
1642 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1644 // Check that nothing has changed after a couple of buffer swaps
1645 application.Render(0);
1646 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1647 application.Render(0);
1648 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1652 int UtcDaliAnimationAnimateByVector2AlphaFunction(void)
1654 TestApplication application;
1656 Actor actor = Actor::New();
1658 // Register a Vector2 property
1659 Vector2 startValue(100.0f, 100.0f);
1660 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1661 Stage::GetCurrent().Add(actor);
1662 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1664 // Build the animation
1665 float durationSeconds(1.0f);
1666 Animation animation = Animation::New(durationSeconds);
1667 Vector2 targetValue(20.0f, 20.0f);
1668 Vector2 relativeValue(targetValue - startValue);
1669 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1671 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1673 // Start the animation
1676 bool signalReceived(false);
1677 AnimationFinishCheck finishCheck(signalReceived);
1678 animation.FinishedSignal().Connect(&application, finishCheck);
1680 application.SendNotification();
1681 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1683 // We didn't expect the animation to finish yet
1684 application.SendNotification();
1685 finishCheck.CheckSignalNotReceived();
1687 // The position should have moved more, than with a linear alpha function
1688 Vector2 current(actor.GetProperty<Vector2>(index));
1689 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
1690 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
1692 application.SendNotification();
1693 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1695 // We did expect the animation to finish
1696 application.SendNotification();
1697 finishCheck.CheckSignalReceived();
1698 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1700 // Check that nothing has changed after a couple of buffer swaps
1701 application.Render(0);
1702 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1703 application.Render(0);
1704 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1708 int UtcDaliAnimationAnimateByVector2TimePeriod(void)
1710 TestApplication application;
1712 Actor actor = Actor::New();
1714 // Register a Vector2 property
1715 Vector2 startValue(10.0f, 10.0f);
1716 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1717 Stage::GetCurrent().Add(actor);
1718 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1720 // Build the animation
1721 float durationSeconds(1.0f);
1722 Animation animation = Animation::New(durationSeconds);
1723 Vector2 targetValue(30.0f, 30.0f);
1724 Vector2 relativeValue(targetValue - startValue);
1726 animation.AnimateBy(Property(actor, index),
1728 TimePeriod(delay, durationSeconds - delay));
1730 // Start the animation
1733 bool signalReceived(false);
1734 AnimationFinishCheck finishCheck(signalReceived);
1735 animation.FinishedSignal().Connect(&application, finishCheck);
1737 application.SendNotification();
1738 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1740 // We didn't expect the animation to finish yet
1741 application.SendNotification();
1742 finishCheck.CheckSignalNotReceived();
1743 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1745 application.SendNotification();
1746 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1748 // We didn't expect the animation to finish yet
1749 application.SendNotification();
1750 finishCheck.CheckSignalNotReceived();
1751 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1753 application.SendNotification();
1754 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1756 // We did expect the animation to finish
1757 application.SendNotification();
1758 finishCheck.CheckSignalReceived();
1759 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1761 // Check that nothing has changed after a couple of buffer swaps
1762 application.Render(0);
1763 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1764 application.Render(0);
1765 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1769 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriod(void)
1771 TestApplication application;
1773 Actor actor = Actor::New();
1775 // Register a Vector2 property
1776 Vector2 startValue(5.0f, 5.0f);
1777 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1778 Stage::GetCurrent().Add(actor);
1779 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1781 // Build the animation
1782 float durationSeconds(1.0f);
1783 Animation animation = Animation::New(durationSeconds);
1784 Vector2 targetValue(10.0f, 10.0f);
1785 Vector2 relativeValue(targetValue - startValue);
1787 animation.AnimateBy(Property(actor, index),
1789 AlphaFunctions::Linear,
1790 TimePeriod(delay, durationSeconds - delay));
1792 // Start the animation
1795 bool signalReceived(false);
1796 AnimationFinishCheck finishCheck(signalReceived);
1797 animation.FinishedSignal().Connect(&application, finishCheck);
1799 application.SendNotification();
1800 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1802 // We didn't expect the animation to finish yet
1803 application.SendNotification();
1804 finishCheck.CheckSignalNotReceived();
1805 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1807 application.SendNotification();
1808 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1810 // We didn't expect the animation to finish yet
1811 application.SendNotification();
1812 finishCheck.CheckSignalNotReceived();
1813 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1815 application.SendNotification();
1816 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1818 // We did expect the animation to finish
1819 application.SendNotification();
1820 finishCheck.CheckSignalReceived();
1821 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1823 // Check that nothing has changed after a couple of buffer swaps
1824 application.Render(0);
1825 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1826 application.Render(0);
1827 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1831 int UtcDaliAnimationAnimateByVector3(void)
1833 TestApplication application;
1835 Actor actor = Actor::New();
1837 // Register a Vector3 property
1838 Vector3 startValue(10.0f, 10.0f, 10.0f);
1839 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1840 Stage::GetCurrent().Add(actor);
1841 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1843 // Build the animation
1844 float durationSeconds(2.0f);
1845 Animation animation = Animation::New(durationSeconds);
1846 Vector3 targetValue(60.0f, 60.0f, 60.0f);
1847 Vector3 relativeValue(targetValue - startValue);
1848 animation.AnimateBy(Property(actor, index), relativeValue);
1850 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1852 // Start the animation
1855 bool signalReceived(false);
1856 AnimationFinishCheck finishCheck(signalReceived);
1857 animation.FinishedSignal().Connect(&application, finishCheck);
1859 application.SendNotification();
1860 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1862 // We didn't expect the animation to finish yet
1863 application.SendNotification();
1864 finishCheck.CheckSignalNotReceived();
1865 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
1867 application.SendNotification();
1868 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1870 // We did expect the animation to finish
1871 application.SendNotification();
1872 finishCheck.CheckSignalReceived();
1873 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1875 // Check that nothing has changed after a couple of buffer swaps
1876 application.Render(0);
1877 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1878 application.Render(0);
1879 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1883 int UtcDaliAnimationAnimateByVector3AlphaFunction(void)
1885 TestApplication application;
1887 Actor actor = Actor::New();
1889 // Register a Vector3 property
1890 Vector3 startValue(100.0f, 100.0f, 100.0f);
1891 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1892 Stage::GetCurrent().Add(actor);
1893 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1895 // Build the animation
1896 float durationSeconds(1.0f);
1897 Animation animation = Animation::New(durationSeconds);
1898 Vector3 targetValue(20.0f, 20.0f, 20.0f);
1899 Vector3 relativeValue(targetValue - startValue);
1900 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1902 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1904 // Start the animation
1907 bool signalReceived(false);
1908 AnimationFinishCheck finishCheck(signalReceived);
1909 animation.FinishedSignal().Connect(&application, finishCheck);
1911 application.SendNotification();
1912 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1914 // We didn't expect the animation to finish yet
1915 application.SendNotification();
1916 finishCheck.CheckSignalNotReceived();
1918 // The position should have moved more, than with a linear alpha function
1919 Vector3 current(actor.GetProperty<Vector3>(index));
1920 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
1921 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
1922 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
1924 application.SendNotification();
1925 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1927 // We did expect the animation to finish
1928 application.SendNotification();
1929 finishCheck.CheckSignalReceived();
1930 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1932 // Check that nothing has changed after a couple of buffer swaps
1933 application.Render(0);
1934 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1935 application.Render(0);
1936 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1940 int UtcDaliAnimationAnimateByVector3TimePeriod(void)
1942 TestApplication application;
1944 Actor actor = Actor::New();
1946 // Register a Vector3 property
1947 Vector3 startValue(10.0f, 10.0f, 10.0f);
1948 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1949 Stage::GetCurrent().Add(actor);
1950 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1952 // Build the animation
1953 float durationSeconds(1.0f);
1954 Animation animation = Animation::New(durationSeconds);
1955 Vector3 targetValue(30.0f, 30.0f, 30.0f);
1956 Vector3 relativeValue(targetValue - startValue);
1958 animation.AnimateBy(Property(actor, index),
1960 TimePeriod(delay, durationSeconds - delay));
1962 // Start the animation
1965 bool signalReceived(false);
1966 AnimationFinishCheck finishCheck(signalReceived);
1967 animation.FinishedSignal().Connect(&application, finishCheck);
1969 application.SendNotification();
1970 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1972 // We didn't expect the animation to finish yet
1973 application.SendNotification();
1974 finishCheck.CheckSignalNotReceived();
1975 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1977 application.SendNotification();
1978 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1980 // We didn't expect the animation to finish yet
1981 application.SendNotification();
1982 finishCheck.CheckSignalNotReceived();
1983 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1985 application.SendNotification();
1986 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1988 // We did expect the animation to finish
1989 application.SendNotification();
1990 finishCheck.CheckSignalReceived();
1991 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1993 // Check that nothing has changed after a couple of buffer swaps
1994 application.Render(0);
1995 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1996 application.Render(0);
1997 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2001 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriod(void)
2003 TestApplication application;
2005 Actor actor = Actor::New();
2007 // Register a Vector3 property
2008 Vector3 startValue(5.0f, 5.0f, 5.0f);
2009 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2010 Stage::GetCurrent().Add(actor);
2011 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2013 // Build the animation
2014 float durationSeconds(1.0f);
2015 Animation animation = Animation::New(durationSeconds);
2016 Vector3 targetValue(10.0f, 10.0f, 10.0f);
2017 Vector3 relativeValue(targetValue - startValue);
2019 animation.AnimateBy(Property(actor, index),
2021 AlphaFunctions::Linear,
2022 TimePeriod(delay, durationSeconds - delay));
2024 // Start the animation
2027 bool signalReceived(false);
2028 AnimationFinishCheck finishCheck(signalReceived);
2029 animation.FinishedSignal().Connect(&application, finishCheck);
2031 application.SendNotification();
2032 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2034 // We didn't expect the animation to finish yet
2035 application.SendNotification();
2036 finishCheck.CheckSignalNotReceived();
2037 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2039 application.SendNotification();
2040 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2042 // We didn't expect the animation to finish yet
2043 application.SendNotification();
2044 finishCheck.CheckSignalNotReceived();
2045 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2047 application.SendNotification();
2048 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2050 // We did expect the animation to finish
2051 application.SendNotification();
2052 finishCheck.CheckSignalReceived();
2053 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2055 // Check that nothing has changed after a couple of buffer swaps
2056 application.Render(0);
2057 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2058 application.Render(0);
2059 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2063 int UtcDaliAnimationAnimateByVector4(void)
2065 TestApplication application;
2067 Actor actor = Actor::New();
2069 // Register a Vector4 property
2070 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
2071 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2072 Stage::GetCurrent().Add(actor);
2073 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2075 // Build the animation
2076 float durationSeconds(2.0f);
2077 Animation animation = Animation::New(durationSeconds);
2078 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
2079 Vector4 relativeValue(targetValue - startValue);
2080 animation.AnimateBy(Property(actor, index), relativeValue);
2082 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2084 // Start the animation
2087 bool signalReceived(false);
2088 AnimationFinishCheck finishCheck(signalReceived);
2089 animation.FinishedSignal().Connect(&application, finishCheck);
2091 application.SendNotification();
2092 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2094 // We didn't expect the animation to finish yet
2095 application.SendNotification();
2096 finishCheck.CheckSignalNotReceived();
2097 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
2099 application.SendNotification();
2100 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2102 // We did expect the animation to finish
2103 application.SendNotification();
2104 finishCheck.CheckSignalReceived();
2105 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2107 // Check that nothing has changed after a couple of buffer swaps
2108 application.Render(0);
2109 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2110 application.Render(0);
2111 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2115 int UtcDaliAnimationAnimateByVector4AlphaFunction(void)
2117 TestApplication application;
2119 Actor actor = Actor::New();
2121 // Register a Vector4 property
2122 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
2123 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2124 Stage::GetCurrent().Add(actor);
2125 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2127 // Build the animation
2128 float durationSeconds(1.0f);
2129 Animation animation = Animation::New(durationSeconds);
2130 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
2131 Vector4 relativeValue(targetValue - startValue);
2132 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
2134 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2136 // Start the animation
2139 bool signalReceived(false);
2140 AnimationFinishCheck finishCheck(signalReceived);
2141 animation.FinishedSignal().Connect(&application, finishCheck);
2143 application.SendNotification();
2144 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2146 // We didn't expect the animation to finish yet
2147 application.SendNotification();
2148 finishCheck.CheckSignalNotReceived();
2150 // The position should have moved more, than with a linear alpha function
2151 Vector4 current(actor.GetProperty<Vector4>(index));
2152 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
2153 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
2154 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
2155 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
2157 application.SendNotification();
2158 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2160 // We did expect the animation to finish
2161 application.SendNotification();
2162 finishCheck.CheckSignalReceived();
2163 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2165 // Check that nothing has changed after a couple of buffer swaps
2166 application.Render(0);
2167 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2168 application.Render(0);
2169 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2173 int UtcDaliAnimationAnimateByVector4TimePeriod(void)
2175 TestApplication application;
2177 Actor actor = Actor::New();
2179 // Register a Vector4 property
2180 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
2181 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2182 Stage::GetCurrent().Add(actor);
2183 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2185 // Build the animation
2186 float durationSeconds(1.0f);
2187 Animation animation = Animation::New(durationSeconds);
2188 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
2189 Vector4 relativeValue(targetValue - startValue);
2191 animation.AnimateBy(Property(actor, index),
2193 TimePeriod(delay, durationSeconds - delay));
2195 // Start the animation
2198 bool signalReceived(false);
2199 AnimationFinishCheck finishCheck(signalReceived);
2200 animation.FinishedSignal().Connect(&application, finishCheck);
2202 application.SendNotification();
2203 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2205 // We didn't expect the animation to finish yet
2206 application.SendNotification();
2207 finishCheck.CheckSignalNotReceived();
2208 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2210 application.SendNotification();
2211 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2213 // We didn't expect the animation to finish yet
2214 application.SendNotification();
2215 finishCheck.CheckSignalNotReceived();
2216 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2218 application.SendNotification();
2219 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2221 // We did expect the animation to finish
2222 application.SendNotification();
2223 finishCheck.CheckSignalReceived();
2224 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2226 // Check that nothing has changed after a couple of buffer swaps
2227 application.Render(0);
2228 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2229 application.Render(0);
2230 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2234 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriod(void)
2236 TestApplication application;
2238 Actor actor = Actor::New();
2240 // Register a Vector4 property
2241 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
2242 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2243 Stage::GetCurrent().Add(actor);
2244 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2246 // Build the animation
2247 float durationSeconds(1.0f);
2248 Animation animation = Animation::New(durationSeconds);
2249 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
2250 Vector4 relativeValue(targetValue - startValue);
2252 animation.AnimateBy(Property(actor, index),
2254 AlphaFunctions::Linear,
2255 TimePeriod(delay, durationSeconds - delay));
2257 // Start the animation
2260 bool signalReceived(false);
2261 AnimationFinishCheck finishCheck(signalReceived);
2262 animation.FinishedSignal().Connect(&application, finishCheck);
2264 application.SendNotification();
2265 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2267 // We didn't expect the animation to finish yet
2268 application.SendNotification();
2269 finishCheck.CheckSignalNotReceived();
2270 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2272 application.SendNotification();
2273 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2275 // We didn't expect the animation to finish yet
2276 application.SendNotification();
2277 finishCheck.CheckSignalNotReceived();
2278 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2280 application.SendNotification();
2281 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2283 // We did expect the animation to finish
2284 application.SendNotification();
2285 finishCheck.CheckSignalReceived();
2286 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2288 // Check that nothing has changed after a couple of buffer swaps
2289 application.Render(0);
2290 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2291 application.Render(0);
2292 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2296 int UtcDaliAnimationAnimateByActorPosition(void)
2298 TestApplication application;
2300 Actor actor = Actor::New();
2301 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2302 actor.SetPosition(startPosition);
2303 Stage::GetCurrent().Add(actor);
2304 application.SendNotification();
2305 application.Render(0);
2306 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2308 // Build the animation
2309 float durationSeconds(1.0f);
2310 Animation animation = Animation::New(durationSeconds);
2311 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2312 Vector3 relativePosition(targetPosition - startPosition);
2313 animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition);
2315 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2317 // Start the animation
2320 bool signalReceived(false);
2321 AnimationFinishCheck finishCheck(signalReceived);
2322 animation.FinishedSignal().Connect(&application, finishCheck);
2324 application.SendNotification();
2325 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2327 // We didn't expect the animation to finish yet
2328 application.SendNotification();
2329 finishCheck.CheckSignalNotReceived();
2330 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
2332 application.SendNotification();
2333 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2335 // We did expect the animation to finish
2336 application.SendNotification();
2337 finishCheck.CheckSignalReceived();
2338 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2340 // Check that nothing has changed after a couple of buffer swaps
2341 application.Render(0);
2342 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2343 application.Render(0);
2344 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2348 int UtcDaliAnimationAnimateByActorPositionAlphaFunction(void)
2350 TestApplication application;
2352 Actor actor = Actor::New();
2353 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2354 actor.SetPosition(startPosition);
2355 Stage::GetCurrent().Add(actor);
2356 application.SendNotification();
2357 application.Render(0);
2358 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2360 // Build the animation
2361 float durationSeconds(1.0f);
2362 Animation animation = Animation::New(durationSeconds);
2363 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2364 Vector3 relativePosition(targetPosition - startPosition);
2365 animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition, AlphaFunctions::EaseOut);
2367 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2369 // Start the animation
2372 bool signalReceived(false);
2373 AnimationFinishCheck finishCheck(signalReceived);
2374 animation.FinishedSignal().Connect(&application, finishCheck);
2376 application.SendNotification();
2377 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2379 // We didn't expect the animation to finish yet
2380 application.SendNotification();
2381 finishCheck.CheckSignalNotReceived();
2383 // The position should have moved more, than with a linear alpha function
2384 Vector3 current(actor.GetCurrentPosition());
2385 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
2386 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
2387 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
2389 application.SendNotification();
2390 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2392 // We did expect the animation to finish
2393 application.SendNotification();
2394 finishCheck.CheckSignalReceived();
2395 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2397 // Check that nothing has changed after a couple of buffer swaps
2398 application.Render(0);
2399 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2400 application.Render(0);
2401 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2405 int UtcDaliAnimationAnimateByActorPositionTimePeriod(void)
2407 TestApplication application;
2409 Actor actor = Actor::New();
2410 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2411 actor.SetPosition(startPosition);
2412 Stage::GetCurrent().Add(actor);
2413 application.SendNotification();
2414 application.Render(0);
2415 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2417 // Build the animation
2418 float durationSeconds(1.0f);
2419 Animation animation = Animation::New(durationSeconds);
2420 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2421 Vector3 relativePosition(targetPosition - startPosition);
2423 animation.AnimateBy(Property(actor, Actor::POSITION),
2425 TimePeriod(delay, durationSeconds - delay));
2427 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2429 // Start the animation
2432 bool signalReceived(false);
2433 AnimationFinishCheck finishCheck(signalReceived);
2434 animation.FinishedSignal().Connect(&application, finishCheck);
2436 application.SendNotification();
2437 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2439 // We didn't expect the animation to finish yet
2440 application.SendNotification();
2441 finishCheck.CheckSignalNotReceived();
2442 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2444 application.SendNotification();
2445 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2447 // We did expect the animation to finish
2448 application.SendNotification();
2449 finishCheck.CheckSignalReceived();
2450 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2452 // Check that nothing has changed after a couple of buffer swaps
2453 application.Render(0);
2454 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2455 application.Render(0);
2456 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2460 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriod(void)
2462 TestApplication application;
2464 Actor actor = Actor::New();
2465 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2466 actor.SetPosition(startPosition);
2467 Stage::GetCurrent().Add(actor);
2468 application.SendNotification();
2469 application.Render(0);
2470 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2472 // Build the animation
2473 float durationSeconds(1.0f);
2474 Animation animation = Animation::New(durationSeconds);
2475 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2476 Vector3 relativePosition(targetPosition - startPosition);
2478 animation.AnimateBy(Property(actor, Actor::POSITION),
2480 AlphaFunctions::Linear,
2481 TimePeriod(delay, durationSeconds - delay));
2483 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2485 // Start the animation
2488 bool signalReceived(false);
2489 AnimationFinishCheck finishCheck(signalReceived);
2490 animation.FinishedSignal().Connect(&application, finishCheck);
2492 application.SendNotification();
2493 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2495 // We didn't expect the animation to finish yet
2496 application.SendNotification();
2497 finishCheck.CheckSignalNotReceived();
2498 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2500 application.SendNotification();
2501 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2503 // We did expect the animation to finish
2504 application.SendNotification();
2505 finishCheck.CheckSignalReceived();
2506 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2508 // Check that nothing has changed after a couple of buffer swaps
2509 application.Render(0);
2510 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2511 application.Render(0);
2512 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2516 int UtcDaliAnimationAnimateToBoolean(void)
2518 TestApplication application;
2520 Actor actor = Actor::New();
2522 // Register a boolean property
2523 const bool startValue(false);
2524 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2525 Stage::GetCurrent().Add(actor);
2526 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2528 // Build the animation
2529 float durationSeconds(2.0f);
2530 Animation animation = Animation::New(durationSeconds);
2531 const bool targetValue( !startValue );
2532 animation.AnimateTo(Property(actor, index), targetValue);
2534 // Start the animation
2537 bool signalReceived(false);
2538 AnimationFinishCheck finishCheck(signalReceived);
2539 animation.FinishedSignal().Connect(&application, finishCheck);
2541 application.SendNotification();
2542 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2544 // We didn't expect the animation to finish yet
2545 application.SendNotification();
2546 finishCheck.CheckSignalNotReceived();
2547 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2549 application.SendNotification();
2550 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2552 // We did expect the animation to finish
2553 application.SendNotification();
2554 finishCheck.CheckSignalReceived();
2555 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2557 // Check that nothing has changed after a couple of buffer swaps
2558 application.Render(0);
2559 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2560 application.Render(0);
2561 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2563 // Repeat with target value "false"
2564 animation = Animation::New(durationSeconds);
2565 const bool finalValue( !targetValue );
2566 animation.AnimateTo(Property(actor, index), finalValue);
2568 // Start the animation
2571 finishCheck.Reset();
2572 animation.FinishedSignal().Connect(&application, finishCheck);
2574 application.SendNotification();
2575 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2577 // We didn't expect the animation to finish yet
2578 application.SendNotification();
2579 finishCheck.CheckSignalNotReceived();
2580 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2582 application.SendNotification();
2583 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2585 // We did expect the animation to finish
2586 application.SendNotification();
2587 finishCheck.CheckSignalReceived();
2588 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2590 // Check that nothing has changed after a couple of buffer swaps
2591 application.Render(0);
2592 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2593 application.Render(0);
2594 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2598 int UtcDaliAnimationAnimateToBooleanAlphaFunction(void)
2600 TestApplication application;
2602 Actor actor = Actor::New();
2604 // Register a boolean property
2605 const bool startValue(false);
2606 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2607 Stage::GetCurrent().Add(actor);
2608 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2610 // Build the animation
2611 float durationSeconds(2.0f);
2612 Animation animation = Animation::New(durationSeconds);
2613 const bool targetValue( !startValue );
2614 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
2616 // Start the animation
2619 bool signalReceived(false);
2620 AnimationFinishCheck finishCheck(signalReceived);
2621 animation.FinishedSignal().Connect(&application, finishCheck);
2623 application.SendNotification();
2624 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2626 // We didn't expect the animation to finish yet
2627 application.SendNotification();
2628 finishCheck.CheckSignalNotReceived();
2629 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2631 application.SendNotification();
2632 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2634 // We did expect the animation to finish
2635 application.SendNotification();
2636 finishCheck.CheckSignalReceived();
2637 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2639 // Check that nothing has changed after a couple of buffer swaps
2640 application.Render(0);
2641 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2642 application.Render(0);
2643 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2645 // Repeat with target value "false"
2646 animation = Animation::New(durationSeconds);
2647 const bool finalValue( !targetValue );
2648 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunctions::EaseOut);
2650 // Start the animation
2653 finishCheck.Reset();
2654 animation.FinishedSignal().Connect(&application, finishCheck);
2656 application.SendNotification();
2657 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2659 // We didn't expect the animation to finish yet
2660 application.SendNotification();
2661 finishCheck.CheckSignalNotReceived();
2662 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2664 application.SendNotification();
2665 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2667 // We did expect the animation to finish
2668 application.SendNotification();
2669 finishCheck.CheckSignalReceived();
2670 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2672 // Check that nothing has changed after a couple of buffer swaps
2673 application.Render(0);
2674 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2675 application.Render(0);
2676 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2680 int UtcDaliAnimationAnimateToBooleanTimePeriod(void)
2682 TestApplication application;
2684 Actor actor = Actor::New();
2686 // Register a boolean property
2687 bool startValue(false);
2688 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2689 Stage::GetCurrent().Add(actor);
2690 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2692 // Build the animation
2693 float durationSeconds(2.0f);
2694 Animation animation = Animation::New(durationSeconds);
2695 bool finalValue( !startValue );
2696 float animatorDurationSeconds(durationSeconds * 0.5f);
2697 animation.AnimateTo( Property(actor, index),
2699 TimePeriod( animatorDurationSeconds ) );
2701 // Start the animation
2704 bool signalReceived(false);
2705 AnimationFinishCheck finishCheck(signalReceived);
2706 animation.FinishedSignal().Connect(&application, finishCheck);
2708 application.SendNotification();
2709 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2711 // We didn't expect the animation to finish yet
2712 application.SendNotification();
2713 finishCheck.CheckSignalNotReceived();
2714 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2716 application.SendNotification();
2717 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2719 // We didn't expect the animation to finish yet...
2720 application.SendNotification();
2721 finishCheck.CheckSignalNotReceived();
2723 // ...however we should have reached the final value
2724 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2726 application.SendNotification();
2727 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2729 // We did expect the animation to finish
2730 application.SendNotification();
2731 finishCheck.CheckSignalReceived();
2732 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2734 // Check that nothing has changed after a couple of buffer swaps
2735 application.Render(0);
2736 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2737 application.Render(0);
2738 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2742 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriod(void)
2744 TestApplication application;
2746 Actor actor = Actor::New();
2748 // Register a boolean property
2749 bool startValue(false);
2750 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2751 Stage::GetCurrent().Add(actor);
2752 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2754 // Build the animation
2755 float durationSeconds(2.0f);
2756 Animation animation = Animation::New(durationSeconds);
2757 bool finalValue( !startValue );
2758 float animatorDurationSeconds(durationSeconds * 0.5f);
2759 animation.AnimateTo( Property(actor, index),
2761 AlphaFunctions::Linear,
2762 TimePeriod( animatorDurationSeconds ) );
2764 // Start the animation
2767 bool signalReceived(false);
2768 AnimationFinishCheck finishCheck(signalReceived);
2769 animation.FinishedSignal().Connect(&application, finishCheck);
2771 application.SendNotification();
2772 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2774 // We didn't expect the animation to finish yet
2775 application.SendNotification();
2776 finishCheck.CheckSignalNotReceived();
2777 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2779 application.SendNotification();
2780 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2782 // We didn't expect the animation to finish yet...
2783 application.SendNotification();
2784 finishCheck.CheckSignalNotReceived();
2786 // ...however we should have reached the final value
2787 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2789 application.SendNotification();
2790 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2792 // We did expect the animation to finish
2793 application.SendNotification();
2794 finishCheck.CheckSignalReceived();
2795 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2797 // Check that nothing has changed after a couple of buffer swaps
2798 application.Render(0);
2799 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2800 application.Render(0);
2801 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2805 int UtcDaliAnimationAnimateToFloat(void)
2807 TestApplication application;
2809 Actor actor = Actor::New();
2811 // Register a float property
2812 float startValue(10.0f);
2813 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2814 Stage::GetCurrent().Add(actor);
2815 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2817 // Build the animation
2818 float durationSeconds(2.0f);
2819 Animation animation = Animation::New(durationSeconds);
2820 float targetValue(50.0f);
2821 float relativeValue(targetValue - startValue);
2822 animation.AnimateTo(Property(actor, "test-property"), targetValue);
2824 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2826 // Start the animation
2829 bool signalReceived(false);
2830 AnimationFinishCheck finishCheck(signalReceived);
2831 animation.FinishedSignal().Connect(&application, finishCheck);
2833 application.SendNotification();
2834 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2836 // We didn't expect the animation to finish yet
2837 application.SendNotification();
2838 finishCheck.CheckSignalNotReceived();
2839 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
2841 application.SendNotification();
2842 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2844 // We did expect the animation to finish
2845 application.SendNotification();
2846 finishCheck.CheckSignalReceived();
2847 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2851 int UtcDaliAnimationAnimateToFloatAlphaFunction(void)
2853 TestApplication application;
2855 Actor actor = Actor::New();
2857 // Register a float property
2858 float startValue(10.0f);
2859 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2860 Stage::GetCurrent().Add(actor);
2861 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2863 // Build the animation
2864 float durationSeconds(1.0f);
2865 Animation animation = Animation::New(durationSeconds);
2866 float targetValue(90.0f);
2867 float relativeValue(targetValue - startValue);
2868 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
2870 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2872 // Start the animation
2875 bool signalReceived(false);
2876 AnimationFinishCheck finishCheck(signalReceived);
2877 animation.FinishedSignal().Connect(&application, finishCheck);
2879 application.SendNotification();
2880 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2882 // We didn't expect the animation to finish yet
2883 application.SendNotification();
2884 finishCheck.CheckSignalNotReceived();
2886 // The position should have moved more, than with a linear alpha function
2887 float current(actor.GetProperty<float>(index));
2888 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2890 application.SendNotification();
2891 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2893 // We did expect the animation to finish
2894 application.SendNotification();
2895 finishCheck.CheckSignalReceived();
2896 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2900 int UtcDaliAnimationAnimateToFloatTimePeriod(void)
2902 TestApplication application;
2904 Actor actor = Actor::New();
2906 // Register a float property
2907 float startValue(10.0f);
2908 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2909 Stage::GetCurrent().Add(actor);
2910 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2912 // Build the animation
2913 float durationSeconds(1.0f);
2914 Animation animation = Animation::New(durationSeconds);
2915 float targetValue(30.0f);
2916 float relativeValue(targetValue - startValue);
2918 animation.AnimateTo(Property(actor, index),
2920 TimePeriod(delay, durationSeconds - delay));
2922 // Start the animation
2925 bool signalReceived(false);
2926 AnimationFinishCheck finishCheck(signalReceived);
2927 animation.FinishedSignal().Connect(&application, finishCheck);
2929 application.SendNotification();
2930 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2932 // We didn't expect the animation to finish yet
2933 application.SendNotification();
2934 finishCheck.CheckSignalNotReceived();
2935 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2937 application.SendNotification();
2938 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2940 // We didn't expect the animation to finish yet
2941 application.SendNotification();
2942 finishCheck.CheckSignalNotReceived();
2943 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2945 application.SendNotification();
2946 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2948 // We did expect the animation to finish
2949 application.SendNotification();
2950 finishCheck.CheckSignalReceived();
2951 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2955 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriod(void)
2957 TestApplication application;
2959 Actor actor = Actor::New();
2961 // Register a float property
2962 float startValue(10.0f);
2963 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2964 Stage::GetCurrent().Add(actor);
2965 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2967 // Build the animation
2968 float durationSeconds(1.0f);
2969 Animation animation = Animation::New(durationSeconds);
2970 float targetValue(30.0f);
2971 float relativeValue(targetValue - startValue);
2973 animation.AnimateTo(Property(actor, index),
2975 AlphaFunctions::Linear,
2976 TimePeriod(delay, durationSeconds - delay));
2978 // Start the animation
2981 bool signalReceived(false);
2982 AnimationFinishCheck finishCheck(signalReceived);
2983 animation.FinishedSignal().Connect(&application, finishCheck);
2985 application.SendNotification();
2986 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2988 // We didn't expect the animation to finish yet
2989 application.SendNotification();
2990 finishCheck.CheckSignalNotReceived();
2991 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2993 application.SendNotification();
2994 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2996 // We didn't expect the animation to finish yet
2997 application.SendNotification();
2998 finishCheck.CheckSignalNotReceived();
2999 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3001 application.SendNotification();
3002 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3004 // We did expect the animation to finish
3005 application.SendNotification();
3006 finishCheck.CheckSignalReceived();
3007 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3011 int UtcDaliAnimationAnimateToVector2(void)
3013 TestApplication application;
3015 Actor actor = Actor::New();
3017 // Register a Vector2 property
3018 Vector2 startValue(-50.0f, -50.0f);
3019 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3020 Stage::GetCurrent().Add(actor);
3021 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3023 // Build the animation
3024 float durationSeconds(2.0f);
3025 Animation animation = Animation::New(durationSeconds);
3026 Vector2 targetValue(50.0f, 50.0f);
3027 Vector2 relativeValue(targetValue - startValue);
3028 animation.AnimateTo(Property(actor, index), targetValue);
3030 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3032 // Start the animation
3035 bool signalReceived(false);
3036 AnimationFinishCheck finishCheck(signalReceived);
3037 animation.FinishedSignal().Connect(&application, finishCheck);
3039 application.SendNotification();
3040 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3042 // We didn't expect the animation to finish yet
3043 application.SendNotification();
3044 finishCheck.CheckSignalNotReceived();
3045 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
3047 application.SendNotification();
3048 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3050 // We did expect the animation to finish
3051 application.SendNotification();
3052 finishCheck.CheckSignalReceived();
3053 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3057 int UtcDaliAnimationAnimateToVector2AlphaFunction(void)
3059 TestApplication application;
3061 Actor actor = Actor::New();
3063 // Register a Vector2 property
3064 Vector2 startValue(1000.0f, 1000.0f);
3065 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3066 Stage::GetCurrent().Add(actor);
3067 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3069 // Build the animation
3070 float durationSeconds(1.0f);
3071 Animation animation = Animation::New(durationSeconds);
3072 Vector2 targetValue(9000.0f, 9000.0f);
3073 Vector2 relativeValue(targetValue - startValue);
3074 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
3076 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3078 // Start the animation
3081 bool signalReceived(false);
3082 AnimationFinishCheck finishCheck(signalReceived);
3083 animation.FinishedSignal().Connect(&application, finishCheck);
3085 application.SendNotification();
3086 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3088 // We didn't expect the animation to finish yet
3089 application.SendNotification();
3090 finishCheck.CheckSignalNotReceived();
3092 // The position should have moved more, than with a linear alpha function
3093 Vector2 current(actor.GetProperty<Vector2>(index));
3094 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3095 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3097 application.SendNotification();
3098 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3100 // We did expect the animation to finish
3101 application.SendNotification();
3102 finishCheck.CheckSignalReceived();
3103 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3107 int UtcDaliAnimationAnimateToVector2TimePeriod(void)
3109 TestApplication application;
3111 Actor actor = Actor::New();
3113 // Register a Vector2 property
3114 Vector2 startValue(10.0f, 10.0f);
3115 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3116 Stage::GetCurrent().Add(actor);
3117 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3119 // Build the animation
3120 float durationSeconds(1.0f);
3121 Animation animation = Animation::New(durationSeconds);
3122 Vector2 targetValue(-10.0f, 20.0f);
3123 Vector2 relativeValue(targetValue - startValue);
3125 animation.AnimateTo(Property(actor, index),
3127 TimePeriod(delay, durationSeconds - delay));
3129 // Start the animation
3132 bool signalReceived(false);
3133 AnimationFinishCheck finishCheck(signalReceived);
3134 animation.FinishedSignal().Connect(&application, finishCheck);
3136 application.SendNotification();
3137 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3139 // We didn't expect the animation to finish yet
3140 application.SendNotification();
3141 finishCheck.CheckSignalNotReceived();
3142 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3144 application.SendNotification();
3145 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3147 // We didn't expect the animation to finish yet
3148 application.SendNotification();
3149 finishCheck.CheckSignalNotReceived();
3150 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3152 application.SendNotification();
3153 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3155 // We did expect the animation to finish
3156 application.SendNotification();
3157 finishCheck.CheckSignalReceived();
3158 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3162 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriod(void)
3164 TestApplication application;
3166 Actor actor = Actor::New();
3168 // Register a Vector2 property
3169 Vector2 startValue(10.0f, 10.0f);
3170 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3171 Stage::GetCurrent().Add(actor);
3172 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3174 // Build the animation
3175 float durationSeconds(1.0f);
3176 Animation animation = Animation::New(durationSeconds);
3177 Vector2 targetValue(30.0f, 30.0f);
3178 Vector2 relativeValue(targetValue - startValue);
3180 animation.AnimateTo(Property(actor, index),
3182 AlphaFunctions::Linear,
3183 TimePeriod(delay, durationSeconds - delay));
3185 // Start the animation
3188 bool signalReceived(false);
3189 AnimationFinishCheck finishCheck(signalReceived);
3190 animation.FinishedSignal().Connect(&application, finishCheck);
3192 application.SendNotification();
3193 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3195 // We didn't expect the animation to finish yet
3196 application.SendNotification();
3197 finishCheck.CheckSignalNotReceived();
3198 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3200 application.SendNotification();
3201 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3203 // We didn't expect the animation to finish yet
3204 application.SendNotification();
3205 finishCheck.CheckSignalNotReceived();
3206 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3208 application.SendNotification();
3209 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3211 // We did expect the animation to finish
3212 application.SendNotification();
3213 finishCheck.CheckSignalReceived();
3214 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3218 int UtcDaliAnimationAnimateToVector3(void)
3220 TestApplication application;
3222 Actor actor = Actor::New();
3224 // Register a Vector3 property
3225 Vector3 startValue(-50.0f, -50.0f, -50.0f);
3226 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3227 Stage::GetCurrent().Add(actor);
3228 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3230 // Build the animation
3231 float durationSeconds(2.0f);
3232 Animation animation = Animation::New(durationSeconds);
3233 Vector3 targetValue(50.0f, 50.0f, 50.0f);
3234 Vector3 relativeValue(targetValue - startValue);
3235 animation.AnimateTo(Property(actor, index), targetValue);
3237 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3239 // Start the animation
3242 bool signalReceived(false);
3243 AnimationFinishCheck finishCheck(signalReceived);
3244 animation.FinishedSignal().Connect(&application, finishCheck);
3246 application.SendNotification();
3247 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3249 // We didn't expect the animation to finish yet
3250 application.SendNotification();
3251 finishCheck.CheckSignalNotReceived();
3252 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
3254 application.SendNotification();
3255 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3257 // We did expect the animation to finish
3258 application.SendNotification();
3259 finishCheck.CheckSignalReceived();
3260 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3264 int UtcDaliAnimationAnimateToVector3AlphaFunction(void)
3266 TestApplication application;
3268 Actor actor = Actor::New();
3270 // Register a Vector3 property
3271 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
3272 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3273 Stage::GetCurrent().Add(actor);
3274 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3276 // Build the animation
3277 float durationSeconds(1.0f);
3278 Animation animation = Animation::New(durationSeconds);
3279 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
3280 Vector3 relativeValue(targetValue - startValue);
3281 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
3283 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3285 // Start the animation
3288 bool signalReceived(false);
3289 AnimationFinishCheck finishCheck(signalReceived);
3290 animation.FinishedSignal().Connect(&application, finishCheck);
3292 application.SendNotification();
3293 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3295 // We didn't expect the animation to finish yet
3296 application.SendNotification();
3297 finishCheck.CheckSignalNotReceived();
3299 // The position should have moved more, than with a linear alpha function
3300 Vector3 current(actor.GetProperty<Vector3>(index));
3301 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3302 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3303 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3305 application.SendNotification();
3306 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3308 // We did expect the animation to finish
3309 application.SendNotification();
3310 finishCheck.CheckSignalReceived();
3311 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3315 int UtcDaliAnimationAnimateToVector3TimePeriod(void)
3317 TestApplication application;
3319 Actor actor = Actor::New();
3321 // Register a Vector3 property
3322 Vector3 startValue(10.0f, 10.0f, 10.0f);
3323 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3324 Stage::GetCurrent().Add(actor);
3325 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3327 // Build the animation
3328 float durationSeconds(1.0f);
3329 Animation animation = Animation::New(durationSeconds);
3330 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
3331 Vector3 relativeValue(targetValue - startValue);
3333 animation.AnimateTo(Property(actor, index),
3335 TimePeriod(delay, durationSeconds - delay));
3337 // Start the animation
3340 bool signalReceived(false);
3341 AnimationFinishCheck finishCheck(signalReceived);
3342 animation.FinishedSignal().Connect(&application, finishCheck);
3344 application.SendNotification();
3345 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3347 // We didn't expect the animation to finish yet
3348 application.SendNotification();
3349 finishCheck.CheckSignalNotReceived();
3350 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3352 application.SendNotification();
3353 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3355 // We didn't expect the animation to finish yet
3356 application.SendNotification();
3357 finishCheck.CheckSignalNotReceived();
3358 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3360 application.SendNotification();
3361 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3363 // We did expect the animation to finish
3364 application.SendNotification();
3365 finishCheck.CheckSignalReceived();
3366 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3370 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriod(void)
3372 TestApplication application;
3374 Actor actor = Actor::New();
3376 // Register a Vector3 property
3377 Vector3 startValue(10.0f, 10.0f, 10.0f);
3378 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3379 Stage::GetCurrent().Add(actor);
3380 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3382 // Build the animation
3383 float durationSeconds(1.0f);
3384 Animation animation = Animation::New(durationSeconds);
3385 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3386 Vector3 relativeValue(targetValue - startValue);
3388 animation.AnimateTo(Property(actor, "test-property"),
3390 AlphaFunctions::Linear,
3391 TimePeriod(delay, durationSeconds - delay));
3393 // Start the animation
3396 bool signalReceived(false);
3397 AnimationFinishCheck finishCheck(signalReceived);
3398 animation.FinishedSignal().Connect(&application, finishCheck);
3400 application.SendNotification();
3401 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3403 // We didn't expect the animation to finish yet
3404 application.SendNotification();
3405 finishCheck.CheckSignalNotReceived();
3406 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3408 application.SendNotification();
3409 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3411 // We didn't expect the animation to finish yet
3412 application.SendNotification();
3413 finishCheck.CheckSignalNotReceived();
3414 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3416 application.SendNotification();
3417 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3419 // We did expect the animation to finish
3420 application.SendNotification();
3421 finishCheck.CheckSignalReceived();
3422 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3426 int UtcDaliAnimationAnimateToVector3Component(void)
3428 TestApplication application;
3430 Actor actor = Actor::New();
3432 // Register a Vector3 property
3433 Vector3 startValue(10.0f, 10.0f, 10.0f);
3434 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3435 Stage::GetCurrent().Add(actor);
3436 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3438 // Build the animation
3439 float durationSeconds(1.0f);
3440 Animation animation = Animation::New(durationSeconds);
3441 Vector3 targetValue(30.0f, 30.0f, 10.0f);
3442 Vector3 relativeValue(targetValue - startValue);
3444 animation.AnimateTo(Property(actor, "test-property", 0),
3446 AlphaFunctions::Linear,
3447 TimePeriod(delay, durationSeconds - delay));
3448 animation.AnimateTo(Property(actor, index, 1),
3450 AlphaFunctions::Linear,
3451 TimePeriod(delay, durationSeconds - delay));
3453 // Start the animation
3456 bool signalReceived(false);
3457 AnimationFinishCheck finishCheck(signalReceived);
3458 animation.FinishedSignal().Connect(&application, finishCheck);
3460 application.SendNotification();
3461 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3463 // We didn't expect the animation to finish yet
3464 application.SendNotification();
3465 finishCheck.CheckSignalNotReceived();
3466 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3468 application.SendNotification();
3469 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3471 // We didn't expect the animation to finish yet
3472 application.SendNotification();
3473 finishCheck.CheckSignalNotReceived();
3474 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3476 application.SendNotification();
3477 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3479 // We did expect the animation to finish
3480 application.SendNotification();
3481 finishCheck.CheckSignalReceived();
3482 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3486 int UtcDaliAnimationAnimateToVector4(void)
3488 TestApplication application;
3490 Actor actor = Actor::New();
3492 // Register a Vector4 property
3493 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
3494 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3495 Stage::GetCurrent().Add(actor);
3496 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3498 // Build the animation
3499 float durationSeconds(2.0f);
3500 Animation animation = Animation::New(durationSeconds);
3501 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
3502 Vector4 relativeValue(targetValue - startValue);
3503 animation.AnimateTo(Property(actor, index), targetValue);
3505 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3507 // Start the animation
3510 bool signalReceived(false);
3511 AnimationFinishCheck finishCheck(signalReceived);
3512 animation.FinishedSignal().Connect(&application, finishCheck);
3514 application.SendNotification();
3515 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3517 // We didn't expect the animation to finish yet
3518 application.SendNotification();
3519 finishCheck.CheckSignalNotReceived();
3520 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
3522 application.SendNotification();
3523 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3525 // We did expect the animation to finish
3526 application.SendNotification();
3527 finishCheck.CheckSignalReceived();
3528 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3532 int UtcDaliAnimationAnimateToVector4AlphaFunction(void)
3534 TestApplication application;
3536 Actor actor = Actor::New();
3538 // Register a Vector4 property
3539 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
3540 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3541 Stage::GetCurrent().Add(actor);
3542 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3544 // Build the animation
3545 float durationSeconds(1.0f);
3546 Animation animation = Animation::New(durationSeconds);
3547 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
3548 Vector4 relativeValue(targetValue - startValue);
3549 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
3551 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3553 // Start the animation
3556 bool signalReceived(false);
3557 AnimationFinishCheck finishCheck(signalReceived);
3558 animation.FinishedSignal().Connect(&application, finishCheck);
3560 application.SendNotification();
3561 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3563 // We didn't expect the animation to finish yet
3564 application.SendNotification();
3565 finishCheck.CheckSignalNotReceived();
3567 // The position should have moved more, than with a linear alpha function
3568 Vector4 current(actor.GetProperty<Vector4>(index));
3569 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3570 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3571 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3572 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
3574 application.SendNotification();
3575 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3577 // We did expect the animation to finish
3578 application.SendNotification();
3579 finishCheck.CheckSignalReceived();
3580 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3584 int UtcDaliAnimationAnimateToVector4TimePeriod(void)
3586 TestApplication application;
3588 Actor actor = Actor::New();
3590 // Register a Vector4 property
3591 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3592 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3593 Stage::GetCurrent().Add(actor);
3594 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
3596 // Build the animation
3597 float durationSeconds(1.0f);
3598 Animation animation = Animation::New(durationSeconds);
3599 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
3600 Vector4 relativeValue(targetValue - startValue);
3602 animation.AnimateTo(Property(actor, index),
3604 TimePeriod(delay, durationSeconds - delay));
3606 // Start the animation
3609 bool signalReceived(false);
3610 AnimationFinishCheck finishCheck(signalReceived);
3611 animation.FinishedSignal().Connect(&application, finishCheck);
3613 application.SendNotification();
3614 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3616 // We didn't expect the animation to finish yet
3617 application.SendNotification();
3618 finishCheck.CheckSignalNotReceived();
3619 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
3621 application.SendNotification();
3622 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3624 // We didn't expect the animation to finish yet
3625 application.SendNotification();
3626 finishCheck.CheckSignalNotReceived();
3627 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
3629 application.SendNotification();
3630 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3632 // We did expect the animation to finish
3633 application.SendNotification();
3634 finishCheck.CheckSignalReceived();
3635 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
3639 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriod(void)
3641 TestApplication application;
3643 Actor actor = Actor::New();
3645 // Register a Vector4 property
3646 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3647 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3648 Stage::GetCurrent().Add(actor);
3649 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3651 // Build the animation
3652 float durationSeconds(1.0f);
3653 Animation animation = Animation::New(durationSeconds);
3654 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
3655 Vector4 relativeValue(targetValue - startValue);
3657 animation.AnimateTo(Property(actor, index),
3659 AlphaFunctions::Linear,
3660 TimePeriod(delay, durationSeconds - delay));
3662 // Start the animation
3665 bool signalReceived(false);
3666 AnimationFinishCheck finishCheck(signalReceived);
3667 animation.FinishedSignal().Connect(&application, finishCheck);
3669 application.SendNotification();
3670 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3672 // We didn't expect the animation to finish yet
3673 application.SendNotification();
3674 finishCheck.CheckSignalNotReceived();
3675 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3677 application.SendNotification();
3678 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3680 // We didn't expect the animation to finish yet
3681 application.SendNotification();
3682 finishCheck.CheckSignalNotReceived();
3683 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3685 application.SendNotification();
3686 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3688 // We did expect the animation to finish
3689 application.SendNotification();
3690 finishCheck.CheckSignalReceived();
3691 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3695 int UtcDaliAnimationAnimateToActorParentOrigin(void)
3697 TestApplication application;
3699 Actor actor = Actor::New();
3700 Stage::GetCurrent().Add(actor);
3701 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3703 // Build the animation
3704 float durationSeconds(1.0f);
3705 Animation animation = Animation::New(durationSeconds);
3706 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
3710 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN), targetParentOrigin );
3712 catch (Dali::DaliException& e)
3714 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3715 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3720 int UtcDaliAnimationAnimateToActorParentOriginX(void)
3722 TestApplication application;
3724 Actor actor = Actor::New();
3725 Stage::GetCurrent().Add(actor);
3726 float startValue(0.0f);
3727 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
3728 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
3730 // Build the animation
3731 float durationSeconds(1.0f);
3732 Animation animation = Animation::New(durationSeconds);
3733 float targetX(1.0f);
3737 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_X), targetX );
3739 catch (Dali::DaliException& e)
3741 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3742 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3747 int UtcDaliAnimationAnimateToActorParentOriginY(void)
3749 TestApplication application;
3751 Actor actor = Actor::New();
3752 Stage::GetCurrent().Add(actor);
3753 float startValue(0.0f);
3754 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
3755 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
3757 // Build the animation
3758 float durationSeconds(1.0f);
3759 Animation animation = Animation::New(durationSeconds);
3760 float targetY(1.0f);
3764 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Y), targetY );
3766 catch (Dali::DaliException& e)
3768 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3769 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3774 int UtcDaliAnimationAnimateToActorParentOriginZ(void)
3776 TestApplication application;
3778 Actor actor = Actor::New();
3779 Stage::GetCurrent().Add(actor);
3780 float startValue(0.5f);
3781 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
3782 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
3784 // Build the animation
3785 float durationSeconds(1.0f);
3786 Animation animation = Animation::New(durationSeconds);
3787 float targetZ(1.0f);
3791 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Z), targetZ );
3793 catch (Dali::DaliException& e)
3795 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3796 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3801 int UtcDaliAnimationAnimateToActorAnchorPoint(void)
3803 TestApplication application;
3805 Actor actor = Actor::New();
3806 Stage::GetCurrent().Add(actor);
3807 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
3809 // Build the animation
3810 float durationSeconds(1.0f);
3811 Animation animation = Animation::New(durationSeconds);
3812 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
3816 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT), targetAnchorPoint);
3818 catch (Dali::DaliException& e)
3820 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3821 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3826 int UtcDaliAnimationAnimateToActorAnchorPointX(void)
3828 TestApplication application;
3830 Actor actor = Actor::New();
3831 Stage::GetCurrent().Add(actor);
3832 float startValue(0.5f);
3833 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
3834 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_X), startValue, TEST_LOCATION );
3836 // Build the animation
3837 float durationSeconds(1.0f);
3838 Animation animation = Animation::New(durationSeconds);
3839 float targetX(1.0f);
3843 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_X), targetX );
3845 catch (Dali::DaliException& e)
3847 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3848 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3853 int UtcDaliAnimationAnimateToActorAnchorPointY(void)
3855 TestApplication application;
3857 Actor actor = Actor::New();
3858 Stage::GetCurrent().Add(actor);
3859 float startValue(0.5f);
3860 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
3861 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
3863 // Build the animation
3864 float durationSeconds(1.0f);
3865 Animation animation = Animation::New(durationSeconds);
3866 float targetY(0.0f);
3870 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Y), targetY );
3872 catch (Dali::DaliException& e)
3874 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3875 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3880 int UtcDaliAnimationAnimateToActorAnchorPointZ(void)
3882 TestApplication application;
3884 Actor actor = Actor::New();
3885 Stage::GetCurrent().Add(actor);
3886 float startValue(0.5f);
3887 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
3888 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
3890 // Build the animation
3891 float durationSeconds(1.0f);
3892 Animation animation = Animation::New(durationSeconds);
3893 float targetZ(100.0f);
3897 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Z), targetZ );
3899 catch (Dali::DaliException& e)
3901 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3902 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3907 int UtcDaliAnimationAnimateToActorSize(void)
3909 TestApplication application;
3911 Actor actor = Actor::New();
3912 Stage::GetCurrent().Add(actor);
3913 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
3915 // Build the animation
3916 float durationSeconds(1.0f);
3917 Animation animation = Animation::New(durationSeconds);
3918 Vector3 targetSize(100.0f, 100.0f, 100.0f);
3919 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize );
3921 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
3923 // Start the animation
3926 bool signalReceived(false);
3927 AnimationFinishCheck finishCheck(signalReceived);
3928 animation.FinishedSignal().Connect(&application, finishCheck);
3930 application.SendNotification();
3931 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
3933 // We didn't expect the animation to finish yet
3934 application.SendNotification();
3935 finishCheck.CheckSignalNotReceived();
3936 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
3938 application.SendNotification();
3939 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
3941 // We did expect the animation to finish
3942 application.SendNotification();
3943 finishCheck.CheckSignalReceived();
3944 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
3947 finishCheck.Reset();
3948 actor.SetSize(Vector3::ZERO);
3949 application.SendNotification();
3950 application.Render(0);
3951 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
3953 // Repeat with a different (ease-in) alpha function
3954 animation = Animation::New(durationSeconds);
3955 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize, AlphaFunctions::EaseIn);
3956 animation.FinishedSignal().Connect(&application, finishCheck);
3959 application.SendNotification();
3960 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
3962 // We didn't expect the animation to finish yet
3963 application.SendNotification();
3964 finishCheck.CheckSignalNotReceived();
3966 // The size should have travelled less, than with a linear alpha function
3967 Vector3 current(actor.GetCurrentSize());
3968 DALI_TEST_CHECK( current.x > 0.0f );
3969 DALI_TEST_CHECK( current.y > 0.0f );
3970 DALI_TEST_CHECK( current.z > 0.0f );
3971 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
3972 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
3973 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
3975 application.SendNotification();
3976 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
3978 // We did expect the animation to finish
3979 application.SendNotification();
3980 finishCheck.CheckSignalReceived();
3981 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
3984 finishCheck.Reset();
3985 actor.SetSize(Vector3::ZERO);
3986 application.SendNotification();
3987 application.Render(0);
3988 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
3990 // Repeat with a delay
3992 animation = Animation::New(durationSeconds);
3993 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
3994 animation.FinishedSignal().Connect(&application, finishCheck);
3997 application.SendNotification();
3998 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4000 // We didn't expect the animation to finish yet
4001 application.SendNotification();
4002 finishCheck.CheckSignalNotReceived();
4003 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
4005 application.SendNotification();
4006 application.Render(static_cast<unsigned int>(durationSeconds*500.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 );
4015 int UtcDaliAnimationAnimateToActorSizeWidth(void)
4017 TestApplication application;
4019 Actor actor = Actor::New();
4020 Stage::GetCurrent().Add(actor);
4021 float startValue(0.0f);
4022 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
4023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), startValue, TEST_LOCATION );
4025 // Build the animation
4026 float durationSeconds(1.0f);
4027 Animation animation = Animation::New(durationSeconds);
4028 float targetWidth(10.0f);
4029 animation.AnimateTo( Property(actor, Actor::SIZE_WIDTH), targetWidth );
4031 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
4033 // Start the animation
4036 bool signalReceived(false);
4037 AnimationFinishCheck finishCheck(signalReceived);
4038 animation.FinishedSignal().Connect(&application, finishCheck);
4040 application.SendNotification();
4041 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4043 // We didn't expect the animation to finish yet
4044 application.SendNotification();
4045 finishCheck.CheckSignalNotReceived();
4046 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
4047 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), fiftyPercentProgress, TEST_LOCATION );
4049 application.SendNotification();
4050 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4052 // We did expect the animation to finish
4053 application.SendNotification();
4054 finishCheck.CheckSignalReceived();
4055 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
4056 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), targetWidth, TEST_LOCATION );
4060 int UtcDaliAnimationAnimateToActorSizeHeight(void)
4062 TestApplication application;
4064 Actor actor = Actor::New();
4065 Stage::GetCurrent().Add(actor);
4066 float startValue(0.0f);
4067 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
4068 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), startValue, TEST_LOCATION );
4070 // Build the animation
4071 float durationSeconds(1.0f);
4072 Animation animation = Animation::New(durationSeconds);
4073 float targetHeight(-10.0f);
4074 animation.AnimateTo( Property(actor, Actor::SIZE_HEIGHT), targetHeight );
4076 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
4078 // Start the animation
4081 bool signalReceived(false);
4082 AnimationFinishCheck finishCheck(signalReceived);
4083 animation.FinishedSignal().Connect(&application, finishCheck);
4085 application.SendNotification();
4086 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4088 // We didn't expect the animation to finish yet
4089 application.SendNotification();
4090 finishCheck.CheckSignalNotReceived();
4091 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
4092 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), fiftyPercentProgress, TEST_LOCATION );
4094 application.SendNotification();
4095 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4097 // We did expect the animation to finish
4098 application.SendNotification();
4099 finishCheck.CheckSignalReceived();
4100 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
4101 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
4105 int UtcDaliAnimationAnimateToActorSizeDepth(void)
4107 TestApplication application;
4109 Actor actor = Actor::New();
4110 Stage::GetCurrent().Add(actor);
4111 float startValue(0.0f);
4112 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
4113 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), startValue, TEST_LOCATION );
4115 // Build the animation
4116 float durationSeconds(1.0f);
4117 Animation animation = Animation::New(durationSeconds);
4118 float targetDepth(-10.0f);
4119 animation.AnimateTo( Property(actor, Actor::SIZE_DEPTH), targetDepth );
4121 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
4123 // Start the animation
4126 bool signalReceived(false);
4127 AnimationFinishCheck finishCheck(signalReceived);
4128 animation.FinishedSignal().Connect(&application, finishCheck);
4130 application.SendNotification();
4131 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4133 // We didn't expect the animation to finish yet
4134 application.SendNotification();
4135 finishCheck.CheckSignalNotReceived();
4136 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
4137 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), fiftyPercentProgress, TEST_LOCATION );
4139 application.SendNotification();
4140 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4142 // We did expect the animation to finish
4143 application.SendNotification();
4144 finishCheck.CheckSignalReceived();
4145 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
4146 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), targetDepth, TEST_LOCATION );
4150 int UtcDaliAnimationAnimateToActorPosition(void)
4152 TestApplication application;
4154 Actor actor = Actor::New();
4155 Stage::GetCurrent().Add(actor);
4156 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4158 // Build the animation
4159 float durationSeconds(1.0f);
4160 Animation animation = Animation::New(durationSeconds);
4161 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4162 animation.AnimateTo(Property(actor, Actor::POSITION), targetPosition);
4164 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4166 // Start the animation
4169 bool signalReceived(false);
4170 AnimationFinishCheck finishCheck(signalReceived);
4171 animation.FinishedSignal().Connect(&application, finishCheck);
4173 application.SendNotification();
4174 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
4176 // We didn't expect the animation to finish yet
4177 application.SendNotification();
4178 finishCheck.CheckSignalNotReceived();
4179 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
4181 application.SendNotification();
4182 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4184 // We did expect the animation to finish
4185 application.SendNotification();
4186 finishCheck.CheckSignalReceived();
4187 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4191 int UtcDaliAnimationAnimateToActorPositionX(void)
4193 TestApplication application;
4195 Actor actor = Actor::New();
4196 Stage::GetCurrent().Add(actor);
4197 float startValue(0.0f);
4198 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
4199 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4200 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4201 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4203 // Build the animation
4204 float durationSeconds(1.0f);
4205 Animation animation = Animation::New(durationSeconds);
4206 float targetX(1.0f);
4207 animation.AnimateTo( Property(actor, Actor::POSITION_X), targetX );
4209 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
4211 // Start the animation
4214 bool signalReceived(false);
4215 AnimationFinishCheck finishCheck(signalReceived);
4216 animation.FinishedSignal().Connect(&application, finishCheck);
4218 application.SendNotification();
4219 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4221 // We didn't expect the animation to finish yet
4222 application.SendNotification();
4223 finishCheck.CheckSignalNotReceived();
4224 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
4225 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), fiftyPercentProgress, TEST_LOCATION );
4226 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4227 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4229 application.SendNotification();
4230 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4232 // We did expect the animation to finish
4233 application.SendNotification();
4234 finishCheck.CheckSignalReceived();
4235 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
4236 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), targetX, TEST_LOCATION );
4237 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4238 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4242 int UtcDaliAnimationAnimateToActorPositionY(void)
4244 TestApplication application;
4246 Actor actor = Actor::New();
4247 Stage::GetCurrent().Add(actor);
4248 float startValue(0.0f);
4249 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
4250 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4251 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4252 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4254 // Build the animation
4255 float durationSeconds(1.0f);
4256 Animation animation = Animation::New(durationSeconds);
4257 float targetY(10.0f);
4258 animation.AnimateTo( Property(actor, Actor::POSITION_Y), targetY );
4260 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
4262 // Start the animation
4265 bool signalReceived(false);
4266 AnimationFinishCheck finishCheck(signalReceived);
4267 animation.FinishedSignal().Connect(&application, finishCheck);
4269 application.SendNotification();
4270 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4272 // We didn't expect the animation to finish yet
4273 application.SendNotification();
4274 finishCheck.CheckSignalNotReceived();
4275 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
4276 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4277 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), fiftyPercentProgress, TEST_LOCATION );
4278 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4280 application.SendNotification();
4281 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4283 // We did expect the animation to finish
4284 application.SendNotification();
4285 finishCheck.CheckSignalReceived();
4286 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
4287 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4288 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), targetY, TEST_LOCATION );
4289 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4293 int UtcDaliAnimationAnimateToActorPositionZ(void)
4295 TestApplication application;
4297 Actor actor = Actor::New();
4298 Stage::GetCurrent().Add(actor);
4299 float startValue(0.0f);
4300 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
4301 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4305 // Build the animation
4306 float durationSeconds(1.0f);
4307 Animation animation = Animation::New(durationSeconds);
4308 float targetZ(-5.0f);
4309 animation.AnimateTo( Property(actor, Actor::POSITION_Z), targetZ );
4311 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
4313 // Start the animation
4316 bool signalReceived(false);
4317 AnimationFinishCheck finishCheck(signalReceived);
4318 animation.FinishedSignal().Connect(&application, finishCheck);
4320 application.SendNotification();
4321 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4323 // We didn't expect the animation to finish yet
4324 application.SendNotification();
4325 finishCheck.CheckSignalNotReceived();
4326 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
4327 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4328 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4329 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), fiftyPercentProgress, TEST_LOCATION );
4331 application.SendNotification();
4332 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4334 // We did expect the animation to finish
4335 application.SendNotification();
4336 finishCheck.CheckSignalReceived();
4337 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
4338 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4339 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4340 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), targetZ, TEST_LOCATION );
4344 int UtcDaliAnimationAnimateToActorPositionAlphaFunction(void)
4346 TestApplication application;
4348 Actor actor = Actor::New();
4349 Stage::GetCurrent().Add(actor);
4350 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4352 // Build the animation
4353 float durationSeconds(1.0f);
4354 Animation animation = Animation::New(durationSeconds);
4355 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4356 animation.AnimateTo(Property(actor, Actor::POSITION), targetPosition, AlphaFunctions::EaseIn);
4358 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4360 // Start the animation
4363 bool signalReceived(false);
4364 AnimationFinishCheck finishCheck(signalReceived);
4365 animation.FinishedSignal().Connect(&application, finishCheck);
4367 application.SendNotification();
4368 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
4370 // We didn't expect the animation to finish yet
4371 application.SendNotification();
4372 finishCheck.CheckSignalNotReceived();
4374 // The position should have moved less, than with a linear alpha function
4375 Vector3 current(actor.GetCurrentPosition());
4376 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
4377 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
4378 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
4379 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
4380 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
4381 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
4383 application.SendNotification();
4384 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4386 // We did expect the animation to finish
4387 application.SendNotification();
4388 finishCheck.CheckSignalReceived();
4389 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4393 int UtcDaliAnimationAnimateToActorPositionTimePeriod(void)
4395 TestApplication application;
4397 Actor actor = Actor::New();
4398 Stage::GetCurrent().Add(actor);
4399 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4401 // Build the animation
4402 float durationSeconds(1.0f);
4403 Animation animation = Animation::New(durationSeconds);
4404 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4406 animation.AnimateTo( Property(actor, Actor::POSITION),
4408 TimePeriod( delay, durationSeconds - delay ) );
4410 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4412 // Start the animation
4415 bool signalReceived(false);
4416 AnimationFinishCheck finishCheck(signalReceived);
4417 animation.FinishedSignal().Connect(&application, finishCheck);
4419 application.SendNotification();
4420 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4422 // We didn't expect the animation to finish yet
4423 application.SendNotification();
4424 finishCheck.CheckSignalNotReceived();
4425 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4427 application.SendNotification();
4428 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
4430 // We didn't expect the animation to finish yet
4431 application.SendNotification();
4432 finishCheck.CheckSignalNotReceived();
4433 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
4435 application.SendNotification();
4436 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
4438 // We did expect the animation to finish
4439 application.SendNotification();
4440 finishCheck.CheckSignalReceived();
4441 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4445 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriod(void)
4447 TestApplication application;
4449 Actor actor = Actor::New();
4450 Stage::GetCurrent().Add(actor);
4451 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4453 // Build the animation
4454 float durationSeconds(1.0f);
4455 Animation animation = Animation::New(durationSeconds);
4456 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4458 animation.AnimateTo( Property(actor, Actor::POSITION),
4460 AlphaFunctions::Linear,
4461 TimePeriod( delay, durationSeconds - delay ) );
4463 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4465 // Start the animation
4468 bool signalReceived(false);
4469 AnimationFinishCheck finishCheck(signalReceived);
4470 animation.FinishedSignal().Connect(&application, finishCheck);
4472 application.SendNotification();
4473 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4475 // We didn't expect the animation to finish yet
4476 application.SendNotification();
4477 finishCheck.CheckSignalNotReceived();
4478 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4480 application.SendNotification();
4481 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
4483 // We didn't expect the animation to finish yet
4484 application.SendNotification();
4485 finishCheck.CheckSignalNotReceived();
4486 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
4488 application.SendNotification();
4489 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
4491 // We did expect the animation to finish
4492 application.SendNotification();
4493 finishCheck.CheckSignalReceived();
4494 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4498 int UtcDaliAnimationAnimateToActorRotationAngleAxis(void)
4500 TestApplication application;
4502 Actor actor = Actor::New();
4503 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4504 Stage::GetCurrent().Add(actor);
4505 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4507 // Build the animation
4508 float durationSeconds(1.0f);
4509 Animation animation = Animation::New(durationSeconds);
4510 Degree targetRotationDegrees(90.0f);
4511 Radian targetRotationRadians(targetRotationDegrees);
4512 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
4514 // Start the animation
4517 bool signalReceived(false);
4518 AnimationFinishCheck finishCheck(signalReceived);
4519 animation.FinishedSignal().Connect(&application, finishCheck);
4521 application.SendNotification();
4522 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4524 // We didn't expect the animation to finish yet
4525 application.SendNotification();
4526 finishCheck.CheckSignalNotReceived();
4527 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4529 application.SendNotification();
4530 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4532 // We didn't expect the animation to finish yet
4533 application.SendNotification();
4534 finishCheck.CheckSignalNotReceived();
4535 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4537 application.SendNotification();
4538 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4540 // We didn't expect the animation to finish yet
4541 application.SendNotification();
4542 finishCheck.CheckSignalNotReceived();
4543 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4545 application.SendNotification();
4546 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4548 // We did expect the animation to finish
4549 application.SendNotification();
4550 finishCheck.CheckSignalReceived();
4551 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4555 int UtcDaliAnimationAnimateToActorRotationQuaternion(void)
4557 TestApplication application;
4559 Actor actor = Actor::New();
4560 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4561 Stage::GetCurrent().Add(actor);
4562 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4564 // Build the animation
4565 float durationSeconds(1.0f);
4566 Animation animation = Animation::New(durationSeconds);
4567 Degree targetRotationDegrees(90.0f);
4568 Radian targetRotationRadians(targetRotationDegrees);
4569 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
4570 animation.AnimateTo( Property(actor, Actor::ROTATION), targetRotation );
4572 // Start the animation
4575 bool signalReceived(false);
4576 AnimationFinishCheck finishCheck(signalReceived);
4577 animation.FinishedSignal().Connect(&application, finishCheck);
4579 application.SendNotification();
4580 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4582 // We didn't expect the animation to finish yet
4583 application.SendNotification();
4584 finishCheck.CheckSignalNotReceived();
4585 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4587 application.SendNotification();
4588 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4590 // We didn't expect the animation to finish yet
4591 application.SendNotification();
4592 finishCheck.CheckSignalNotReceived();
4593 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4595 application.SendNotification();
4596 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4598 // We didn't expect the animation to finish yet
4599 application.SendNotification();
4600 finishCheck.CheckSignalNotReceived();
4601 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4603 application.SendNotification();
4604 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4606 // We did expect the animation to finish
4607 application.SendNotification();
4608 finishCheck.CheckSignalReceived();
4609 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4613 int UtcDaliAnimationAnimateToActorRotationAlphaFunction(void)
4615 TestApplication application;
4617 Actor actor = Actor::New();
4618 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4619 Stage::GetCurrent().Add(actor);
4620 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4622 // Build the animation
4623 float durationSeconds(1.0f);
4624 Animation animation = Animation::New(durationSeconds);
4625 Degree targetRotationDegrees(90.0f);
4626 Radian targetRotationRadians(targetRotationDegrees);
4627 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn);
4629 // Start the animation
4632 bool signalReceived(false);
4633 AnimationFinishCheck finishCheck(signalReceived);
4634 animation.FinishedSignal().Connect(&application, finishCheck);
4636 application.SendNotification();
4637 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4639 // We didn't expect the animation to finish yet
4640 application.SendNotification();
4641 finishCheck.CheckSignalNotReceived();
4642 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4644 application.SendNotification();
4645 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4647 // We didn't expect the animation to finish yet
4648 application.SendNotification();
4649 finishCheck.CheckSignalNotReceived();
4650 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4652 application.SendNotification();
4653 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4655 // We didn't expect the animation to finish yet
4656 application.SendNotification();
4657 finishCheck.CheckSignalNotReceived();
4658 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4660 application.SendNotification();
4661 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4663 // We did expect the animation to finish
4664 application.SendNotification();
4665 finishCheck.CheckSignalReceived();
4666 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4670 int UtcDaliAnimationAnimateToActorRotationTimePeriod(void)
4672 TestApplication application;
4674 Actor actor = Actor::New();
4675 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4676 Stage::GetCurrent().Add(actor);
4677 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4679 // Build the animation
4680 float durationSeconds(1.0f);
4681 Animation animation = Animation::New(durationSeconds);
4682 Degree targetRotationDegrees(90.0f);
4683 Radian targetRotationRadians(targetRotationDegrees);
4685 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
4687 // Start the animation
4690 bool signalReceived(false);
4691 AnimationFinishCheck finishCheck(signalReceived);
4692 animation.FinishedSignal().Connect(&application, finishCheck);
4694 application.SendNotification();
4695 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4697 // We didn't expect the animation to finish yet
4698 application.SendNotification();
4699 finishCheck.CheckSignalNotReceived();
4700 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4701 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4703 application.SendNotification();
4704 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4706 // We didn't expect the animation to finish yet
4707 application.SendNotification();
4708 finishCheck.CheckSignalNotReceived();
4709 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4710 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4712 application.SendNotification();
4713 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4715 // We didn't expect the animation to finish yet
4716 application.SendNotification();
4717 finishCheck.CheckSignalNotReceived();
4718 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4719 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4721 application.SendNotification();
4722 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4724 // We did expect the animation to finish
4725 application.SendNotification();
4726 finishCheck.CheckSignalReceived();
4727 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4731 int UtcDaliAnimationAnimateToActorRotationAlphaFunctionTimePeriod(void)
4733 TestApplication application;
4735 Actor actor = Actor::New();
4736 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4737 Stage::GetCurrent().Add(actor);
4738 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4740 // Build the animation
4741 float durationSeconds(1.0f);
4742 Animation animation = Animation::New(durationSeconds);
4743 Degree targetRotationDegrees(90.0f);
4744 Radian targetRotationRadians(targetRotationDegrees);
4746 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn, TimePeriod(delay, durationSeconds - delay));
4748 // Start the animation
4751 bool signalReceived(false);
4752 AnimationFinishCheck finishCheck(signalReceived);
4753 animation.FinishedSignal().Connect(&application, finishCheck);
4755 application.SendNotification();
4756 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4758 // We didn't expect the animation to finish yet
4759 application.SendNotification();
4760 finishCheck.CheckSignalNotReceived();
4761 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4762 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4764 application.SendNotification();
4765 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4767 // We didn't expect the animation to finish yet
4768 application.SendNotification();
4769 finishCheck.CheckSignalNotReceived();
4770 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4771 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4773 application.SendNotification();
4774 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4776 // We didn't expect the animation to finish yet
4777 application.SendNotification();
4778 finishCheck.CheckSignalNotReceived();
4779 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4780 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4782 application.SendNotification();
4783 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4785 // We did expect the animation to finish
4786 application.SendNotification();
4787 finishCheck.CheckSignalReceived();
4788 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4792 int UtcDaliAnimationAnimateToActorScale(void)
4794 TestApplication application;
4796 Actor actor = Actor::New();
4797 Stage::GetCurrent().Add(actor);
4798 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4800 // Build the animation
4801 float durationSeconds(1.0f);
4802 Animation animation = Animation::New(durationSeconds);
4803 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4804 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale );
4806 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
4808 // Start the animation
4811 bool signalReceived(false);
4812 AnimationFinishCheck finishCheck(signalReceived);
4813 animation.FinishedSignal().Connect(&application, finishCheck);
4815 application.SendNotification();
4816 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4818 // We didn't expect the animation to finish yet
4819 application.SendNotification();
4820 finishCheck.CheckSignalNotReceived();
4821 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4823 application.SendNotification();
4824 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4826 // We did expect the animation to finish
4827 application.SendNotification();
4828 finishCheck.CheckSignalReceived();
4829 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4832 finishCheck.Reset();
4833 actor.SetScale(Vector3::ONE);
4834 application.SendNotification();
4835 application.Render(0);
4836 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4838 // Repeat with a different (ease-in) alpha function
4839 animation = Animation::New(durationSeconds);
4840 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale, AlphaFunctions::EaseIn);
4841 animation.FinishedSignal().Connect(&application, finishCheck);
4844 application.SendNotification();
4845 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4847 // We didn't expect the animation to finish yet
4848 application.SendNotification();
4849 finishCheck.CheckSignalNotReceived();
4851 // The scale should have grown less, than with a linear alpha function
4852 Vector3 current(actor.GetCurrentScale());
4853 DALI_TEST_CHECK( current.x > 1.0f );
4854 DALI_TEST_CHECK( current.y > 1.0f );
4855 DALI_TEST_CHECK( current.z > 1.0f );
4856 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4857 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4858 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4860 application.SendNotification();
4861 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4863 // We did expect the animation to finish
4864 application.SendNotification();
4865 finishCheck.CheckSignalReceived();
4866 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4869 finishCheck.Reset();
4870 actor.SetScale(Vector3::ONE);
4871 application.SendNotification();
4872 application.Render(0);
4873 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4875 // Repeat with a delay
4877 animation = Animation::New(durationSeconds);
4878 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
4879 animation.FinishedSignal().Connect(&application, finishCheck);
4882 application.SendNotification();
4883 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4885 // We didn't expect the animation to finish yet
4886 application.SendNotification();
4887 finishCheck.CheckSignalNotReceived();
4888 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4890 application.SendNotification();
4891 application.Render(static_cast<unsigned int>(durationSeconds*500.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 );
4900 int UtcDaliAnimationAnimateToActorScaleX(void)
4902 TestApplication application;
4904 Actor actor = Actor::New();
4905 Stage::GetCurrent().Add(actor);
4906 float startValue(1.0f);
4907 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
4908 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
4909 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4910 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4912 // Build the animation
4913 float durationSeconds(1.0f);
4914 Animation animation = Animation::New(durationSeconds);
4915 float targetX(10.0f);
4916 animation.AnimateTo( Property(actor, Actor::SCALE_X), targetX );
4918 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
4920 // Start the animation
4923 bool signalReceived(false);
4924 AnimationFinishCheck finishCheck(signalReceived);
4925 animation.FinishedSignal().Connect(&application, finishCheck);
4927 application.SendNotification();
4928 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4930 // We didn't expect the animation to finish yet
4931 application.SendNotification();
4932 finishCheck.CheckSignalNotReceived();
4933 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
4934 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
4935 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4936 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4938 application.SendNotification();
4939 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4941 // We did expect the animation to finish
4942 application.SendNotification();
4943 finishCheck.CheckSignalReceived();
4944 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
4945 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), targetX, TEST_LOCATION );
4946 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4947 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4951 int UtcDaliAnimationAnimateToActorScaleY(void)
4953 TestApplication application;
4955 Actor actor = Actor::New();
4956 Stage::GetCurrent().Add(actor);
4957 float startValue(1.0f);
4958 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
4959 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
4960 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4961 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4963 // Build the animation
4964 float durationSeconds(1.0f);
4965 Animation animation = Animation::New(durationSeconds);
4966 float targetY(1000.0f);
4967 animation.AnimateTo( Property(actor, Actor::SCALE_Y), targetY );
4969 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
4971 // Start the animation
4974 bool signalReceived(false);
4975 AnimationFinishCheck finishCheck(signalReceived);
4976 animation.FinishedSignal().Connect(&application, finishCheck);
4978 application.SendNotification();
4979 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4981 // We didn't expect the animation to finish yet
4982 application.SendNotification();
4983 finishCheck.CheckSignalNotReceived();
4984 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
4985 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
4986 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
4987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4989 application.SendNotification();
4990 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4992 // We did expect the animation to finish
4993 application.SendNotification();
4994 finishCheck.CheckSignalReceived();
4995 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
4996 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
4997 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), targetY, TEST_LOCATION );
4998 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5002 int UtcDaliAnimationAnimateToActorScaleZ(void)
5004 TestApplication application;
5006 Actor actor = Actor::New();
5007 Stage::GetCurrent().Add(actor);
5008 float startValue(1.0f);
5009 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
5010 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5011 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5012 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5014 // Build the animation
5015 float durationSeconds(1.0f);
5016 Animation animation = Animation::New(durationSeconds);
5017 float targetZ(-1000.0f);
5018 animation.AnimateTo( Property(actor, Actor::SCALE_Z), targetZ );
5020 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
5022 // Start the animation
5025 bool signalReceived(false);
5026 AnimationFinishCheck finishCheck(signalReceived);
5027 animation.FinishedSignal().Connect(&application, finishCheck);
5029 application.SendNotification();
5030 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5032 // We didn't expect the animation to finish yet
5033 application.SendNotification();
5034 finishCheck.CheckSignalNotReceived();
5035 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
5036 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5037 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5038 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
5040 application.SendNotification();
5041 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5043 // We did expect the animation to finish
5044 application.SendNotification();
5045 finishCheck.CheckSignalReceived();
5046 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
5047 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5048 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5049 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), targetZ, TEST_LOCATION );
5053 int UtcDaliAnimationAnimateToActorColor(void)
5055 TestApplication application;
5057 Actor actor = Actor::New();
5058 Stage::GetCurrent().Add(actor);
5059 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5061 // Build the animation
5062 float durationSeconds(1.0f);
5063 Animation animation = Animation::New(durationSeconds);
5064 Vector4 targetColor(Color::RED);
5065 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor );
5067 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
5068 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
5070 // Start the animation
5073 bool signalReceived(false);
5074 AnimationFinishCheck finishCheck(signalReceived);
5075 animation.FinishedSignal().Connect(&application, finishCheck);
5077 application.SendNotification();
5078 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
5080 // We didn't expect the animation to finish yet
5081 application.SendNotification();
5082 finishCheck.CheckSignalNotReceived();
5083 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
5085 application.SendNotification();
5086 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
5088 // We did expect the animation to finish
5089 application.SendNotification();
5090 finishCheck.CheckSignalReceived();
5091 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5094 finishCheck.Reset();
5095 actor.SetColor(Color::WHITE);
5096 application.SendNotification();
5097 application.Render(0);
5098 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5100 // Repeat with a different (ease-in) alpha function
5101 animation = Animation::New(durationSeconds);
5102 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::EaseIn);
5103 animation.FinishedSignal().Connect(&application, finishCheck);
5106 application.SendNotification();
5107 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
5109 // We didn't expect the animation to finish yet
5110 application.SendNotification();
5111 finishCheck.CheckSignalNotReceived();
5113 // The color should have changed less, than with a linear alpha function
5114 Vector4 current(actor.GetCurrentColor());
5115 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
5116 DALI_TEST_CHECK( current.y < 1.0f );
5117 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
5118 DALI_TEST_CHECK( current.z < 1.0f );
5119 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
5120 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
5122 application.SendNotification();
5123 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
5125 // We did expect the animation to finish
5126 application.SendNotification();
5127 finishCheck.CheckSignalReceived();
5128 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5131 finishCheck.Reset();
5132 actor.SetColor(Color::WHITE);
5133 application.SendNotification();
5134 application.Render(0);
5135 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5137 // Repeat with a shorter animator duration
5138 float animatorDuration = 0.5f;
5139 animation = Animation::New(durationSeconds);
5140 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::Linear, TimePeriod(animatorDuration));
5141 animation.FinishedSignal().Connect(&application, finishCheck);
5144 application.SendNotification();
5145 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
5147 // We didn't expect the animation to finish yet
5148 application.SendNotification();
5149 finishCheck.CheckSignalNotReceived();
5150 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
5152 application.SendNotification();
5153 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
5155 // We didn't expect the animation to finish yet
5156 application.SendNotification();
5157 finishCheck.CheckSignalNotReceived();
5158 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5160 application.SendNotification();
5161 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5163 // We did expect the animation to finish
5164 application.SendNotification();
5165 finishCheck.CheckSignalReceived();
5166 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5170 int UtcDaliAnimationAnimateToActorColorRed(void)
5172 TestApplication application;
5174 Actor actor = Actor::New();
5175 Stage::GetCurrent().Add(actor);
5176 float startValue(1.0f);
5177 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
5178 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5179 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5180 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5181 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5183 // Build the animation
5184 float durationSeconds(1.0f);
5185 Animation animation = Animation::New(durationSeconds);
5186 float targetRed(0.5f);
5187 animation.AnimateTo( Property(actor, Actor::COLOR_RED), targetRed );
5189 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
5191 // Start the animation
5194 bool signalReceived(false);
5195 AnimationFinishCheck finishCheck(signalReceived);
5196 animation.FinishedSignal().Connect(&application, finishCheck);
5198 application.SendNotification();
5199 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5201 // We didn't expect the animation to finish yet
5202 application.SendNotification();
5203 finishCheck.CheckSignalNotReceived();
5204 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
5205 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
5206 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5207 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5208 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5210 application.SendNotification();
5211 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5213 // We did expect the animation to finish
5214 application.SendNotification();
5215 finishCheck.CheckSignalReceived();
5216 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
5217 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), targetRed, TEST_LOCATION );
5218 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5219 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5220 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5224 int UtcDaliAnimationAnimateToActorColorGreen(void)
5226 TestApplication application;
5228 Actor actor = Actor::New();
5229 Stage::GetCurrent().Add(actor);
5230 float startValue(1.0f);
5231 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
5232 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5233 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5234 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5235 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5237 // Build the animation
5238 float durationSeconds(1.0f);
5239 Animation animation = Animation::New(durationSeconds);
5240 float targetGreen(0.5f);
5241 animation.AnimateTo( Property(actor, Actor::COLOR_GREEN), targetGreen );
5243 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
5245 // Start the animation
5248 bool signalReceived(false);
5249 AnimationFinishCheck finishCheck(signalReceived);
5250 animation.FinishedSignal().Connect(&application, finishCheck);
5252 application.SendNotification();
5253 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5255 // We didn't expect the animation to finish yet
5256 application.SendNotification();
5257 finishCheck.CheckSignalNotReceived();
5258 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
5259 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5260 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
5261 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5262 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5264 application.SendNotification();
5265 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5267 // We did expect the animation to finish
5268 application.SendNotification();
5269 finishCheck.CheckSignalReceived();
5270 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
5271 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5272 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), targetGreen, TEST_LOCATION );
5273 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5274 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5278 int UtcDaliAnimationAnimateToActorColorBlue(void)
5280 TestApplication application;
5282 Actor actor = Actor::New();
5283 Stage::GetCurrent().Add(actor);
5284 float startValue(1.0f);
5285 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
5286 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5287 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5288 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5289 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5291 // Build the animation
5292 float durationSeconds(1.0f);
5293 Animation animation = Animation::New(durationSeconds);
5294 float targetBlue(0.5f);
5295 animation.AnimateTo( Property(actor, Actor::COLOR_BLUE), targetBlue );
5297 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
5299 // Start the animation
5302 bool signalReceived(false);
5303 AnimationFinishCheck finishCheck(signalReceived);
5304 animation.FinishedSignal().Connect(&application, finishCheck);
5306 application.SendNotification();
5307 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5309 // We didn't expect the animation to finish yet
5310 application.SendNotification();
5311 finishCheck.CheckSignalNotReceived();
5312 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
5313 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5314 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5315 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
5316 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5318 application.SendNotification();
5319 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5321 // We did expect the animation to finish
5322 application.SendNotification();
5323 finishCheck.CheckSignalReceived();
5324 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
5325 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5326 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5327 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), targetBlue, TEST_LOCATION );
5328 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5332 int UtcDaliAnimationAnimateToActorColorAlpha(void)
5334 TestApplication application;
5336 Actor actor = Actor::New();
5337 Stage::GetCurrent().Add(actor);
5338 float startValue(1.0f);
5339 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
5340 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5341 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5342 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5343 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5345 // Build the animation
5346 float durationSeconds(1.0f);
5347 Animation animation = Animation::New(durationSeconds);
5348 float targetAlpha(0.5f);
5349 animation.AnimateTo( Property(actor, Actor::COLOR_ALPHA), targetAlpha );
5351 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
5353 // Start the animation
5356 bool signalReceived(false);
5357 AnimationFinishCheck finishCheck(signalReceived);
5358 animation.FinishedSignal().Connect(&application, finishCheck);
5360 application.SendNotification();
5361 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5363 // We didn't expect the animation to finish yet
5364 application.SendNotification();
5365 finishCheck.CheckSignalNotReceived();
5366 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
5367 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5368 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5369 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5370 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
5372 application.SendNotification();
5373 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5375 // We did expect the animation to finish
5376 application.SendNotification();
5377 finishCheck.CheckSignalReceived();
5378 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
5379 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5380 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5381 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5382 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
5388 int UtcDaliAnimationKeyFrames01(void)
5390 TestApplication application;
5392 KeyFrames keyFrames = KeyFrames::New();
5393 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5395 keyFrames.Add(0.0f, 0.1f);
5396 keyFrames.Add(0.2f, 0.5f);
5397 keyFrames.Add(0.4f, 0.0f);
5398 keyFrames.Add(0.6f, 1.0f);
5399 keyFrames.Add(0.8f, 0.7f);
5400 keyFrames.Add(1.0f, 0.9f);
5402 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
5406 keyFrames.Add(1.9f, false);
5408 catch (Dali::DaliException& e)
5410 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5411 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5416 int UtcDaliAnimationKeyFrames02(void)
5418 TestApplication application;
5420 KeyFrames keyFrames = KeyFrames::New();
5421 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5423 keyFrames.Add(0.0f, true);
5424 keyFrames.Add(0.2f, false);
5425 keyFrames.Add(0.4f, false);
5426 keyFrames.Add(0.6f, true);
5427 keyFrames.Add(0.8f, true);
5428 keyFrames.Add(1.0f, false);
5430 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
5434 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
5436 catch (Dali::DaliException& e)
5438 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5439 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5445 int UtcDaliAnimationKeyFrames03(void)
5447 TestApplication application;
5449 KeyFrames keyFrames = KeyFrames::New();
5450 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5452 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
5453 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
5454 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
5455 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
5456 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
5457 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
5459 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
5463 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
5465 catch (Dali::DaliException& e)
5467 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5468 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5474 int UtcDaliAnimationKeyFrames04(void)
5476 TestApplication application;
5478 KeyFrames keyFrames = KeyFrames::New();
5479 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5481 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
5482 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
5483 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
5484 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
5485 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
5486 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
5488 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
5492 keyFrames.Add(0.7f, 1.0f);
5494 catch (Dali::DaliException& e)
5496 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5497 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5502 int UtcDaliAnimationKeyFrames05(void)
5504 TestApplication application;
5506 KeyFrames keyFrames = KeyFrames::New();
5507 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5509 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
5510 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
5511 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
5512 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
5513 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
5514 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
5516 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
5520 keyFrames.Add(0.7f, Quaternion(1.717f, Vector3::XAXIS));
5522 catch (Dali::DaliException& e)
5524 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5525 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5531 int UtcDaliAnimationKeyFrames06(void)
5533 TestApplication application;
5535 KeyFrames keyFrames = KeyFrames::New();
5536 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5538 keyFrames.Add(0.0f, Quaternion(1.717f, Vector3::XAXIS));
5539 keyFrames.Add(0.2f, Quaternion(2.0f, Vector3::XAXIS));
5540 keyFrames.Add(0.4f, Quaternion(3.0f, Vector3::ZAXIS));
5541 keyFrames.Add(0.6f, Quaternion(4.0f, Vector3(1.0f, 1.0f, 1.0f)));
5542 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
5543 keyFrames.Add(1.0f, Quaternion(3.0f, Vector3::YAXIS));
5545 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
5549 keyFrames.Add(0.7f, 1.1f);
5551 catch (Dali::DaliException& e)
5553 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5554 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5563 int UtcDaliAnimationAnimateBetweenActorColorAlpha(void)
5565 TestApplication application;
5567 float startValue(1.0f);
5568 Actor actor = Actor::New();
5569 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
5570 Stage::GetCurrent().Add(actor);
5572 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
5573 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5574 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5575 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5576 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5578 // Build the animation
5579 float durationSeconds(1.0f);
5580 Animation animation = Animation::New(durationSeconds);
5582 KeyFrames keyFrames = KeyFrames::New();
5583 keyFrames.Add(0.0f, 0.1f);
5584 keyFrames.Add(0.2f, 0.5f);
5585 keyFrames.Add(0.4f, 0.0f);
5586 keyFrames.Add(0.6f, 1.0f);
5587 keyFrames.Add(0.8f, 0.7f);
5588 keyFrames.Add(1.0f, 0.9f);
5590 animation.AnimateBetween( Property(actor, Actor::COLOR_ALPHA), keyFrames );
5592 // Start the animation
5595 bool signalReceived(false);
5596 AnimationFinishCheck finishCheck(signalReceived);
5597 animation.FinishedSignal().Connect(&application, finishCheck);
5598 application.SendNotification();
5599 application.Render(0);
5600 application.SendNotification();
5601 finishCheck.CheckSignalNotReceived();
5602 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
5604 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
5605 application.SendNotification();
5606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5607 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5608 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5609 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
5610 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
5612 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
5613 application.SendNotification();
5614 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5615 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5616 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5617 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
5618 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
5620 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
5621 application.SendNotification();
5622 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5623 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5624 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5625 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
5626 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
5628 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
5629 application.SendNotification();
5630 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5631 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5632 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5633 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
5634 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
5636 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
5637 application.SendNotification();
5638 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5639 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5640 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5641 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
5642 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
5644 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
5645 application.SendNotification();
5646 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5647 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5648 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5649 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
5650 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
5652 // We did expect the animation to finish
5654 finishCheck.CheckSignalReceived();
5659 int UtcDaliAnimationAnimateBetweenActorColor(void)
5661 TestApplication application;
5663 float startValue(1.0f);
5664 Actor actor = Actor::New();
5665 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
5666 Stage::GetCurrent().Add(actor);
5668 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
5669 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5670 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5671 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5672 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5674 // Build the animation
5675 float durationSeconds(1.0f);
5676 Animation animation = Animation::New(durationSeconds);
5678 KeyFrames keyFrames = KeyFrames::New();
5679 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
5680 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
5681 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
5683 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames );
5685 // Start the animation
5688 bool signalReceived(false);
5689 AnimationFinishCheck finishCheck(signalReceived);
5690 animation.FinishedSignal().Connect(&application, finishCheck);
5691 application.SendNotification();
5692 application.Render(0);
5693 application.SendNotification();
5694 finishCheck.CheckSignalNotReceived();
5695 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
5696 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
5697 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
5698 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
5700 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5701 application.SendNotification();
5702 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
5703 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
5704 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
5705 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
5707 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5708 application.SendNotification();
5709 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
5710 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
5711 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
5712 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
5714 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5715 application.SendNotification();
5716 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
5717 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
5718 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
5719 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
5721 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
5722 application.SendNotification();
5723 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
5724 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
5725 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
5726 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
5728 // We did expect the animation to finish
5730 finishCheck.CheckSignalReceived();
5734 int UtcDaliAnimationAnimateBetweenActorVisible01(void)
5736 TestApplication application;
5738 Actor actor = Actor::New();
5739 AngleAxis aa(Degree(90), Vector3::XAXIS);
5740 actor.SetRotation(aa.angle, aa.axis);
5741 Stage::GetCurrent().Add(actor);
5743 application.SendNotification();
5744 application.Render(0);
5746 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5748 // Build the animation
5749 float durationSeconds(1.0f);
5750 Animation animation = Animation::New(durationSeconds);
5752 KeyFrames keyFrames = KeyFrames::New();
5753 keyFrames.Add(0.0f, false);
5754 keyFrames.Add(0.2f, true);
5755 keyFrames.Add(0.4f, true);
5756 keyFrames.Add(0.8f, false);
5757 keyFrames.Add(1.0f, true);
5759 animation.AnimateBetween( Property(actor, Actor::VISIBLE), keyFrames );
5761 // Start the animation
5764 bool signalReceived(false);
5765 AnimationFinishCheck finishCheck(signalReceived);
5766 animation.FinishedSignal().Connect(&application, finishCheck);
5767 application.SendNotification();
5768 application.SendNotification();
5769 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
5770 application.SendNotification();
5771 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
5772 application.SendNotification();
5774 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
5775 finishCheck.CheckSignalReceived();
5780 // Valid test case, but no fix in dali-core yet.
5781 //int UtcDaliAnimationAnimateBetweenActorRotation01(void)
5783 TestApplication application;
5785 Actor actor = Actor::New();
5786 AngleAxis aa(Degree(90), Vector3::XAXIS);
5787 actor.SetRotation(aa.angle, aa.axis);
5788 Stage::GetCurrent().Add(actor);
5790 application.SendNotification();
5791 application.Render(0);
5792 Quaternion start(Radian(aa.angle), aa.axis);
5793 DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, TEST_LOCATION );
5795 // Build the animation
5796 float durationSeconds(1.0f);
5797 Animation animation = Animation::New(durationSeconds);
5799 KeyFrames keyFrames = KeyFrames::New();
5800 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
5802 animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames );
5804 // Start the animation
5807 bool signalReceived(false);
5808 AnimationFinishCheck finishCheck(signalReceived);
5809 animation.FinishedSignal().Connect(&application, finishCheck);
5810 application.SendNotification();
5811 application.SendNotification();
5812 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
5813 application.SendNotification();
5814 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
5815 application.SendNotification();
5817 Quaternion check = Quaternion::FromAxisAngle(Vector4::ZAXIS, Radian(Degree(60)));
5818 // THIS CHECK IS CURRENTLY FAILING!!!!
5819 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5820 finishCheck.CheckSignalReceived();
5825 int UtcDaliAnimationAnimateBetweenActorRotation02(void)
5827 TestApplication application;
5829 Actor actor = Actor::New();
5830 AngleAxis aa(Degree(90), Vector3::XAXIS);
5831 actor.SetRotation(aa.angle, aa.axis);
5832 application.SendNotification();
5833 application.Render(0);
5834 Stage::GetCurrent().Add(actor);
5836 Quaternion start(Radian(aa.angle), aa.axis);
5837 DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, TEST_LOCATION );
5839 // Build the animation
5840 float durationSeconds(1.0f);
5841 Animation animation = Animation::New(durationSeconds);
5843 KeyFrames keyFrames = KeyFrames::New();
5844 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
5845 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
5846 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
5848 animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames );
5850 // Start the animation
5853 bool signalReceived(false);
5854 AnimationFinishCheck finishCheck(signalReceived);
5855 animation.FinishedSignal().Connect(&application, finishCheck);
5856 application.SendNotification();
5857 application.Render(0);
5858 application.SendNotification();
5859 finishCheck.CheckSignalNotReceived();
5861 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
5862 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5864 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5865 application.SendNotification();
5866 check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(90)));
5867 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5869 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5870 application.SendNotification();
5871 check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(120)));
5872 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5874 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5875 application.SendNotification();
5876 check = Quaternion::FromAxisAngle(Vector4(0.5f, 0.5f, 0.0f, 0.0f), Radian(Degree(101.5)));
5877 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5879 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
5880 application.SendNotification();
5881 check = Quaternion::FromAxisAngle(Vector4::YAXIS, Radian(Degree(120)));
5882 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5884 // We did expect the animation to finish
5886 finishCheck.CheckSignalReceived();
5890 int UtcDaliAnimationMoveByFloat3(void)
5892 TestApplication application;
5894 Actor actor = Actor::New();
5895 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5896 actor.SetPosition(startPosition);
5897 Stage::GetCurrent().Add(actor);
5898 application.SendNotification();
5899 application.Render(0);
5900 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
5902 // Build the animation
5903 float durationSeconds(1.0f);
5904 Animation animation = Animation::New(durationSeconds);
5905 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5906 Vector3 relativePosition(targetPosition - startPosition);
5907 animation.MoveBy(actor, relativePosition.x, relativePosition.y, relativePosition.z);
5909 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
5911 // Start the animation
5914 bool signalReceived(false);
5915 AnimationFinishCheck finishCheck(signalReceived);
5916 animation.FinishedSignal().Connect(&application, finishCheck);
5918 application.SendNotification();
5919 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5921 // We didn't expect the animation to finish yet
5922 application.SendNotification();
5923 finishCheck.CheckSignalNotReceived();
5924 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
5926 application.SendNotification();
5927 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5929 // We did expect the animation to finish
5930 application.SendNotification();
5931 finishCheck.CheckSignalReceived();
5932 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5936 int UtcDaliAnimationMoveByVector3Alpha(void)
5938 TestApplication application;
5940 Actor actor = Actor::New();
5941 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5942 actor.SetPosition(startPosition);
5943 Stage::GetCurrent().Add(actor);
5944 application.SendNotification();
5945 application.Render(0);
5946 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
5948 // Build the animation
5949 float durationSeconds(1.0f);
5950 Animation animation = Animation::New(durationSeconds);
5951 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5952 Vector3 relativePosition(targetPosition - startPosition);
5953 animation.MoveBy(actor, relativePosition, AlphaFunctions::EaseOut);
5955 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
5957 // Start the animation
5960 bool signalReceived(false);
5961 AnimationFinishCheck finishCheck(signalReceived);
5962 animation.FinishedSignal().Connect(&application, finishCheck);
5964 application.SendNotification();
5965 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5967 // We didn't expect the animation to finish yet
5968 application.SendNotification();
5969 finishCheck.CheckSignalNotReceived();
5971 // The position should have moved more, than with a linear alpha function
5972 Vector3 current(actor.GetCurrentPosition());
5973 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5974 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5975 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5977 application.SendNotification();
5978 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5980 // We did expect the animation to finish
5981 application.SendNotification();
5982 finishCheck.CheckSignalReceived();
5983 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5987 int UtcDaliAnimationMoveByVector3AlphaFloat2(void)
5989 TestApplication application;
5991 Actor actor = Actor::New();
5992 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5993 actor.SetPosition(startPosition);
5994 Stage::GetCurrent().Add(actor);
5995 application.SendNotification();
5996 application.Render(0);
5997 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
5999 // Build the animation
6000 float durationSeconds(1.0f);
6001 Animation animation = Animation::New(durationSeconds);
6002 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
6003 Vector3 relativePosition(targetPosition - startPosition);
6005 animation.MoveBy(actor, relativePosition, AlphaFunctions::Linear, delay, durationSeconds - delay);
6007 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
6009 // Start the animation
6012 bool signalReceived(false);
6013 AnimationFinishCheck finishCheck(signalReceived);
6014 animation.FinishedSignal().Connect(&application, finishCheck);
6016 application.SendNotification();
6017 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6019 // We didn't expect the animation to finish yet
6020 application.SendNotification();
6021 finishCheck.CheckSignalNotReceived();
6022 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
6024 application.SendNotification();
6025 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6027 // We did expect the animation to finish
6028 application.SendNotification();
6029 finishCheck.CheckSignalReceived();
6030 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6034 int UtcDaliAnimationMoveToFloat3(void)
6036 TestApplication application;
6038 Actor actor = Actor::New();
6039 Stage::GetCurrent().Add(actor);
6040 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6042 // Build the animation
6043 float durationSeconds(1.0f);
6044 Animation animation = Animation::New(durationSeconds);
6045 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6046 animation.MoveTo(actor, targetPosition.x, targetPosition.y, targetPosition.z);
6048 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6050 // Start the animation
6053 bool signalReceived(false);
6054 AnimationFinishCheck finishCheck(signalReceived);
6055 animation.FinishedSignal().Connect(&application, finishCheck);
6057 application.SendNotification();
6058 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6060 // We didn't expect the animation to finish yet
6061 application.SendNotification();
6062 finishCheck.CheckSignalNotReceived();
6063 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6065 application.SendNotification();
6066 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6068 // We did expect the animation to finish
6069 application.SendNotification();
6070 finishCheck.CheckSignalReceived();
6071 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6075 int UtcDaliAnimationMoveToVector3Alpha(void)
6077 TestApplication application;
6079 Actor actor = Actor::New();
6080 Stage::GetCurrent().Add(actor);
6081 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6083 // Build the animation
6084 float durationSeconds(1.0f);
6085 Animation animation = Animation::New(durationSeconds);
6086 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6087 animation.MoveTo(actor, targetPosition, AlphaFunctions::EaseIn);
6089 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6091 // Start the animation
6094 bool signalReceived(false);
6095 AnimationFinishCheck finishCheck(signalReceived);
6096 animation.FinishedSignal().Connect(&application, finishCheck);
6098 application.SendNotification();
6099 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6101 // We didn't expect the animation to finish yet
6102 application.SendNotification();
6103 finishCheck.CheckSignalNotReceived();
6105 // The position should have moved less, than with a linear alpha function
6106 Vector3 current(actor.GetCurrentPosition());
6107 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
6108 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
6109 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
6110 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
6111 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
6112 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
6114 application.SendNotification();
6115 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6117 // We did expect the animation to finish
6118 application.SendNotification();
6119 finishCheck.CheckSignalReceived();
6120 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6124 int UtcDaliAnimationMoveToVector3AlphaFloat2(void)
6126 TestApplication application;
6128 Actor actor = Actor::New();
6129 Stage::GetCurrent().Add(actor);
6130 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6132 // Build the animation
6133 float durationSeconds(1.0f);
6134 Animation animation = Animation::New(durationSeconds);
6135 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6137 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear, delay, durationSeconds - delay);
6139 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6141 // Start the animation
6144 bool signalReceived(false);
6145 AnimationFinishCheck finishCheck(signalReceived);
6146 animation.FinishedSignal().Connect(&application, finishCheck);
6148 application.SendNotification();
6149 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6151 // We didn't expect the animation to finish yet
6152 application.SendNotification();
6153 finishCheck.CheckSignalNotReceived();
6154 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6156 application.SendNotification();
6157 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6159 // We didn't expect the animation to finish yet
6160 application.SendNotification();
6161 finishCheck.CheckSignalNotReceived();
6162 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6164 application.SendNotification();
6165 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6167 // We did expect the animation to finish
6168 application.SendNotification();
6169 finishCheck.CheckSignalReceived();
6170 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6174 int UtcDaliAnimationMove(void)
6176 TestApplication application;
6178 Actor actor = Actor::New();
6179 Vector3 initialPosition(Vector3::ZERO);
6180 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
6181 Stage::GetCurrent().Add(actor);
6183 // Build the animation
6184 float durationSeconds(10.0f);
6185 Animation animation = Animation::New(durationSeconds);
6186 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6187 BounceFunc func(0.0f, 0.0f, -100.0f);
6188 animation.Move(actor, func, AlphaFunctions::Linear, 0.0f, durationSeconds);
6190 // Start the animation
6193 bool signalReceived(false);
6194 AnimationFinishCheck finishCheck(signalReceived);
6195 animation.FinishedSignal().Connect(&application, finishCheck);
6197 application.SendNotification();
6198 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6200 // We didn't expect the animation to finish yet
6201 application.SendNotification();
6202 finishCheck.CheckSignalNotReceived();
6203 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.25f, initialPosition), TEST_LOCATION );
6205 application.SendNotification();
6206 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6208 // We didn't expect the animation to finish yet
6209 application.SendNotification();
6210 finishCheck.CheckSignalNotReceived();
6211 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.5f, initialPosition), TEST_LOCATION );
6213 application.SendNotification();
6214 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6216 // We didn't expect the animation to finish yet
6217 application.SendNotification();
6218 finishCheck.CheckSignalNotReceived();
6219 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.75f, initialPosition), TEST_LOCATION );
6221 application.SendNotification();
6222 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6224 // We did expect the animation to finish
6225 application.SendNotification();
6226 finishCheck.CheckSignalReceived();
6227 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
6231 int UtcDaliAnimationRotateByDegreeVector3(void)
6233 TestApplication application;
6235 Actor actor = Actor::New();
6236 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6237 Stage::GetCurrent().Add(actor);
6238 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6240 // Build the animation
6241 float durationSeconds(1.0f);
6242 Animation animation = Animation::New(durationSeconds);
6243 Degree relativeRotationDegrees(360.0f);
6244 Radian relativeRotationRadians(relativeRotationDegrees);
6245 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS);
6247 // Start the animation
6250 bool signalReceived(false);
6251 AnimationFinishCheck finishCheck(signalReceived);
6252 animation.FinishedSignal().Connect(&application, finishCheck);
6254 application.SendNotification();
6255 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6257 // We didn't expect the animation to finish yet
6258 application.SendNotification();
6259 finishCheck.CheckSignalNotReceived();
6260 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6262 application.SendNotification();
6263 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6265 // We didn't expect the animation to finish yet
6266 application.SendNotification();
6267 finishCheck.CheckSignalNotReceived();
6268 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6270 application.SendNotification();
6271 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6273 // We didn't expect the animation to finish yet
6274 application.SendNotification();
6275 finishCheck.CheckSignalNotReceived();
6276 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6278 application.SendNotification();
6279 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6281 // We did expect the animation to finish
6282 application.SendNotification();
6283 finishCheck.CheckSignalReceived();
6284 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6288 int UtcDaliAnimationRotateByRadianVector3(void)
6290 TestApplication application;
6292 Actor actor = Actor::New();
6293 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6294 Stage::GetCurrent().Add(actor);
6295 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6297 // Build the animation
6298 float durationSeconds(1.0f);
6299 Animation animation = Animation::New(durationSeconds);
6300 Degree relativeRotationDegrees(360.0f);
6301 Radian relativeRotationRadians(relativeRotationDegrees);
6302 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS);
6304 // Start the animation
6307 bool signalReceived(false);
6308 AnimationFinishCheck finishCheck(signalReceived);
6309 animation.FinishedSignal().Connect(&application, finishCheck);
6311 application.SendNotification();
6312 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6314 // We didn't expect the animation to finish yet
6315 application.SendNotification();
6316 finishCheck.CheckSignalNotReceived();
6317 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6319 application.SendNotification();
6320 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6322 // We didn't expect the animation to finish yet
6323 application.SendNotification();
6324 finishCheck.CheckSignalNotReceived();
6325 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6327 application.SendNotification();
6328 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6330 // We didn't expect the animation to finish yet
6331 application.SendNotification();
6332 finishCheck.CheckSignalNotReceived();
6333 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6335 application.SendNotification();
6336 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6338 // We did expect the animation to finish
6339 application.SendNotification();
6340 finishCheck.CheckSignalReceived();
6341 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6345 int UtcDaliAnimationRotateByDegreeVector3Alpha(void)
6347 TestApplication application;
6349 Actor actor = Actor::New();
6350 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6351 Stage::GetCurrent().Add(actor);
6352 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6354 // Build the animation
6355 float durationSeconds(1.0f);
6356 Animation animation = Animation::New(durationSeconds);
6357 Degree relativeRotationDegrees(360.0f);
6358 Radian relativeRotationRadians(relativeRotationDegrees);
6359 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6361 // Start the animation
6364 bool signalReceived(false);
6365 AnimationFinishCheck finishCheck(signalReceived);
6366 animation.FinishedSignal().Connect(&application, finishCheck);
6368 application.SendNotification();
6369 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6371 // We didn't expect the animation to finish yet
6372 application.SendNotification();
6373 finishCheck.CheckSignalNotReceived();
6374 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6376 application.SendNotification();
6377 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6379 // We didn't expect the animation to finish yet
6380 application.SendNotification();
6381 finishCheck.CheckSignalNotReceived();
6382 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6384 application.SendNotification();
6385 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6387 // We didn't expect the animation to finish yet
6388 application.SendNotification();
6389 finishCheck.CheckSignalNotReceived();
6390 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6392 application.SendNotification();
6393 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6395 // We did expect the animation to finish
6396 application.SendNotification();
6397 finishCheck.CheckSignalReceived();
6398 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6402 int UtcDaliAnimationRotateByRadianVector3Alpha(void)
6404 TestApplication application;
6406 Actor actor = Actor::New();
6407 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6408 Stage::GetCurrent().Add(actor);
6409 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6411 // Build the animation
6412 float durationSeconds(1.0f);
6413 Animation animation = Animation::New(durationSeconds);
6414 Degree relativeRotationDegrees(360.0f);
6415 Radian relativeRotationRadians(relativeRotationDegrees);
6416 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6418 // Start the animation
6421 bool signalReceived(false);
6422 AnimationFinishCheck finishCheck(signalReceived);
6423 animation.FinishedSignal().Connect(&application, finishCheck);
6425 application.SendNotification();
6426 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6428 // We didn't expect the animation to finish yet
6429 application.SendNotification();
6430 finishCheck.CheckSignalNotReceived();
6431 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6433 application.SendNotification();
6434 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6436 // We didn't expect the animation to finish yet
6437 application.SendNotification();
6438 finishCheck.CheckSignalNotReceived();
6439 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6441 application.SendNotification();
6442 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6444 // We didn't expect the animation to finish yet
6445 application.SendNotification();
6446 finishCheck.CheckSignalNotReceived();
6447 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6449 application.SendNotification();
6450 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6452 // We did expect the animation to finish
6453 application.SendNotification();
6454 finishCheck.CheckSignalReceived();
6455 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6459 int UtcDaliAnimationRotateByDegreeVector3AlphaFloat2(void)
6461 TestApplication application;
6463 Actor actor = Actor::New();
6464 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6465 Stage::GetCurrent().Add(actor);
6466 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6468 // Build the animation
6469 float durationSeconds(1.0f);
6470 Animation animation = Animation::New(durationSeconds);
6471 Degree relativeRotationDegrees(360.0f);
6472 Radian relativeRotationRadians(relativeRotationDegrees);
6474 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
6476 // Start the animation
6479 bool signalReceived(false);
6480 AnimationFinishCheck finishCheck(signalReceived);
6481 animation.FinishedSignal().Connect(&application, finishCheck);
6483 application.SendNotification();
6484 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6486 // We didn't expect the animation to finish yet
6487 application.SendNotification();
6488 finishCheck.CheckSignalNotReceived();
6489 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6490 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6492 application.SendNotification();
6493 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6495 // We didn't expect the animation to finish yet
6496 application.SendNotification();
6497 finishCheck.CheckSignalNotReceived();
6498 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6499 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6501 application.SendNotification();
6502 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6504 // We didn't expect the animation to finish yet
6505 application.SendNotification();
6506 finishCheck.CheckSignalNotReceived();
6507 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6508 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6510 application.SendNotification();
6511 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6513 // We did expect the animation to finish
6514 application.SendNotification();
6515 finishCheck.CheckSignalReceived();
6516 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6521 int UtcDaliAnimationRotateByRadianVector3AlphaFloat2(void)
6523 TestApplication application;
6525 Actor actor = Actor::New();
6526 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6527 Stage::GetCurrent().Add(actor);
6528 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6530 // Build the animation
6531 float durationSeconds(1.0f);
6532 Animation animation = Animation::New(durationSeconds);
6533 Degree relativeRotationDegrees(360.0f);
6534 Radian relativeRotationRadians(relativeRotationDegrees);
6536 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
6538 // Start the animation
6541 bool signalReceived(false);
6542 AnimationFinishCheck finishCheck(signalReceived);
6543 animation.FinishedSignal().Connect(&application, finishCheck);
6545 application.SendNotification();
6546 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6548 // We didn't expect the animation to finish yet
6549 application.SendNotification();
6550 finishCheck.CheckSignalNotReceived();
6551 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6552 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6554 application.SendNotification();
6555 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6557 // We didn't expect the animation to finish yet
6558 application.SendNotification();
6559 finishCheck.CheckSignalNotReceived();
6560 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6561 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6563 application.SendNotification();
6564 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6566 // We didn't expect the animation to finish yet
6567 application.SendNotification();
6568 finishCheck.CheckSignalNotReceived();
6569 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6570 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6572 application.SendNotification();
6573 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6575 // We did expect the animation to finish
6576 application.SendNotification();
6577 finishCheck.CheckSignalReceived();
6578 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6582 int UtcDaliAnimationRotateToDegreeVector3(void)
6584 TestApplication application;
6586 Actor actor = Actor::New();
6587 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6588 Stage::GetCurrent().Add(actor);
6589 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6591 // Build the animation
6592 float durationSeconds(1.0f);
6593 Animation animation = Animation::New(durationSeconds);
6594 Degree targetRotationDegrees(90.0f);
6595 Radian targetRotationRadians(targetRotationDegrees);
6596 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS);
6598 // Start the animation
6601 bool signalReceived(false);
6602 AnimationFinishCheck finishCheck(signalReceived);
6603 animation.FinishedSignal().Connect(&application, finishCheck);
6605 application.SendNotification();
6606 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6608 // We didn't expect the animation to finish yet
6609 application.SendNotification();
6610 finishCheck.CheckSignalNotReceived();
6611 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6613 application.SendNotification();
6614 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6616 // We didn't expect the animation to finish yet
6617 application.SendNotification();
6618 finishCheck.CheckSignalNotReceived();
6619 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6621 application.SendNotification();
6622 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6624 // We didn't expect the animation to finish yet
6625 application.SendNotification();
6626 finishCheck.CheckSignalNotReceived();
6627 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6629 application.SendNotification();
6630 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6632 // We did expect the animation to finish
6633 application.SendNotification();
6634 finishCheck.CheckSignalReceived();
6635 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6639 int UtcDaliAnimationRotateToRadianVector3(void)
6641 TestApplication application;
6643 Actor actor = Actor::New();
6644 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6645 Stage::GetCurrent().Add(actor);
6646 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6648 // Build the animation
6649 float durationSeconds(1.0f);
6650 Animation animation = Animation::New(durationSeconds);
6651 Degree targetRotationDegrees(90.0f);
6652 Radian targetRotationRadians(targetRotationDegrees);
6653 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS);
6655 // Start the animation
6658 bool signalReceived(false);
6659 AnimationFinishCheck finishCheck(signalReceived);
6660 animation.FinishedSignal().Connect(&application, finishCheck);
6662 application.SendNotification();
6663 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6665 // We didn't expect the animation to finish yet
6666 application.SendNotification();
6667 finishCheck.CheckSignalNotReceived();
6668 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6670 application.SendNotification();
6671 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6673 // We didn't expect the animation to finish yet
6674 application.SendNotification();
6675 finishCheck.CheckSignalNotReceived();
6676 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6678 application.SendNotification();
6679 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6681 // We didn't expect the animation to finish yet
6682 application.SendNotification();
6683 finishCheck.CheckSignalNotReceived();
6684 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6686 application.SendNotification();
6687 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6689 // We did expect the animation to finish
6690 application.SendNotification();
6691 finishCheck.CheckSignalReceived();
6692 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6696 int UtcDaliAnimationRotateToQuaternion(void)
6698 TestApplication application;
6700 Actor actor = Actor::New();
6701 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6702 Stage::GetCurrent().Add(actor);
6703 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6705 // Build the animation
6706 float durationSeconds(1.0f);
6707 Animation animation = Animation::New(durationSeconds);
6708 Degree targetRotationDegrees(90.0f);
6709 Radian targetRotationRadians(targetRotationDegrees);
6710 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6711 animation.RotateTo(actor, targetRotation/*Quaternion version*/);
6713 // Start the animation
6716 bool signalReceived(false);
6717 AnimationFinishCheck finishCheck(signalReceived);
6718 animation.FinishedSignal().Connect(&application, finishCheck);
6720 application.SendNotification();
6721 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6723 // We didn't expect the animation to finish yet
6724 application.SendNotification();
6725 finishCheck.CheckSignalNotReceived();
6726 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6728 application.SendNotification();
6729 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6731 // We didn't expect the animation to finish yet
6732 application.SendNotification();
6733 finishCheck.CheckSignalNotReceived();
6734 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6736 application.SendNotification();
6737 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6739 // We didn't expect the animation to finish yet
6740 application.SendNotification();
6741 finishCheck.CheckSignalNotReceived();
6742 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6744 application.SendNotification();
6745 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6747 // We did expect the animation to finish
6748 application.SendNotification();
6749 finishCheck.CheckSignalReceived();
6750 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6754 int UtcDaliAnimationRotateToDegreeVector3Alpha(void)
6756 TestApplication application;
6758 Actor actor = Actor::New();
6759 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6760 Stage::GetCurrent().Add(actor);
6761 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6763 // Build the animation
6764 float durationSeconds(1.0f);
6765 Animation animation = Animation::New(durationSeconds);
6766 Degree targetRotationDegrees(90.0f);
6767 Radian targetRotationRadians(targetRotationDegrees);
6768 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6770 // Start the animation
6773 bool signalReceived(false);
6774 AnimationFinishCheck finishCheck(signalReceived);
6775 animation.FinishedSignal().Connect(&application, finishCheck);
6777 application.SendNotification();
6778 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6780 // We didn't expect the animation to finish yet
6781 application.SendNotification();
6782 finishCheck.CheckSignalNotReceived();
6783 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6785 application.SendNotification();
6786 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6788 // We didn't expect the animation to finish yet
6789 application.SendNotification();
6790 finishCheck.CheckSignalNotReceived();
6791 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6793 application.SendNotification();
6794 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6796 // We didn't expect the animation to finish yet
6797 application.SendNotification();
6798 finishCheck.CheckSignalNotReceived();
6799 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6801 application.SendNotification();
6802 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6804 // We did expect the animation to finish
6805 application.SendNotification();
6806 finishCheck.CheckSignalReceived();
6807 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6811 int UtcDaliAnimationRotateToRadianVector3Alpha(void)
6813 TestApplication application;
6815 Actor actor = Actor::New();
6816 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6817 Stage::GetCurrent().Add(actor);
6818 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6820 // Build the animation
6821 float durationSeconds(1.0f);
6822 Animation animation = Animation::New(durationSeconds);
6823 Degree targetRotationDegrees(90.0f);
6824 Radian targetRotationRadians(targetRotationDegrees);
6825 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6827 // Start the animation
6830 bool signalReceived(false);
6831 AnimationFinishCheck finishCheck(signalReceived);
6832 animation.FinishedSignal().Connect(&application, finishCheck);
6834 application.SendNotification();
6835 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6837 // We didn't expect the animation to finish yet
6838 application.SendNotification();
6839 finishCheck.CheckSignalNotReceived();
6840 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6842 application.SendNotification();
6843 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6845 // We didn't expect the animation to finish yet
6846 application.SendNotification();
6847 finishCheck.CheckSignalNotReceived();
6848 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6850 application.SendNotification();
6851 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6853 // We didn't expect the animation to finish yet
6854 application.SendNotification();
6855 finishCheck.CheckSignalNotReceived();
6856 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6858 application.SendNotification();
6859 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6861 // We did expect the animation to finish
6862 application.SendNotification();
6863 finishCheck.CheckSignalReceived();
6864 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6868 int UtcDaliAnimationRotateToQuaternionAlpha(void)
6870 TestApplication application;
6872 Actor actor = Actor::New();
6873 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6874 Stage::GetCurrent().Add(actor);
6875 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6877 // Build the animation
6878 float durationSeconds(1.0f);
6879 Animation animation = Animation::New(durationSeconds);
6880 Degree targetRotationDegrees(90.0f);
6881 Radian targetRotationRadians(targetRotationDegrees);
6882 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6883 animation.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn);
6885 // Start the animation
6888 bool signalReceived(false);
6889 AnimationFinishCheck finishCheck(signalReceived);
6890 animation.FinishedSignal().Connect(&application, finishCheck);
6892 application.SendNotification();
6893 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6895 // We didn't expect the animation to finish yet
6896 application.SendNotification();
6897 finishCheck.CheckSignalNotReceived();
6898 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6900 application.SendNotification();
6901 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6903 // We didn't expect the animation to finish yet
6904 application.SendNotification();
6905 finishCheck.CheckSignalNotReceived();
6906 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6908 application.SendNotification();
6909 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6911 // We didn't expect the animation to finish yet
6912 application.SendNotification();
6913 finishCheck.CheckSignalNotReceived();
6914 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6916 application.SendNotification();
6917 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6919 // We did expect the animation to finish
6920 application.SendNotification();
6921 finishCheck.CheckSignalReceived();
6922 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6926 int UtcDaliAnimationRotateToDegreeVector3AlphaFloat2(void)
6928 TestApplication application;
6930 Actor actor = Actor::New();
6931 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6932 Stage::GetCurrent().Add(actor);
6933 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6935 // Build the animation
6936 float durationSeconds(1.0f);
6937 Animation animation = Animation::New(durationSeconds);
6938 Degree targetRotationDegrees(90.0f);
6939 Radian targetRotationRadians(targetRotationDegrees);
6941 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
6943 // Start the animation
6946 bool signalReceived(false);
6947 AnimationFinishCheck finishCheck(signalReceived);
6948 animation.FinishedSignal().Connect(&application, finishCheck);
6950 application.SendNotification();
6951 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6953 // We didn't expect the animation to finish yet
6954 application.SendNotification();
6955 finishCheck.CheckSignalNotReceived();
6956 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6957 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6959 application.SendNotification();
6960 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6962 // We didn't expect the animation to finish yet
6963 application.SendNotification();
6964 finishCheck.CheckSignalNotReceived();
6965 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6966 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6968 application.SendNotification();
6969 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6971 // We didn't expect the animation to finish yet
6972 application.SendNotification();
6973 finishCheck.CheckSignalNotReceived();
6974 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6975 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6977 application.SendNotification();
6978 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6980 // We did expect the animation to finish
6981 application.SendNotification();
6982 finishCheck.CheckSignalReceived();
6983 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6987 int UtcDaliAnimationRotateToRadianVector3AlphaFloat2(void)
6989 TestApplication application;
6991 Actor actor = Actor::New();
6992 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6993 Stage::GetCurrent().Add(actor);
6994 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6996 // Build the animation
6997 float durationSeconds(1.0f);
6998 Animation animation = Animation::New(durationSeconds);
6999 Degree targetRotationDegrees(90.0f);
7000 Radian targetRotationRadians(targetRotationDegrees);
7002 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7004 // Start the animation
7007 bool signalReceived(false);
7008 AnimationFinishCheck finishCheck(signalReceived);
7009 animation.FinishedSignal().Connect(&application, finishCheck);
7011 application.SendNotification();
7012 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7014 // We didn't expect the animation to finish yet
7015 application.SendNotification();
7016 finishCheck.CheckSignalNotReceived();
7017 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7018 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7020 application.SendNotification();
7021 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7023 // We didn't expect the animation to finish yet
7024 application.SendNotification();
7025 finishCheck.CheckSignalNotReceived();
7026 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7027 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7029 application.SendNotification();
7030 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7032 // We didn't expect the animation to finish yet
7033 application.SendNotification();
7034 finishCheck.CheckSignalNotReceived();
7035 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7036 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7038 application.SendNotification();
7039 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7041 // We did expect the animation to finish
7042 application.SendNotification();
7043 finishCheck.CheckSignalReceived();
7044 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7048 int UtcDaliAnimationRotateToQuaternionAlphaFloat2(void)
7050 TestApplication application;
7052 Actor actor = Actor::New();
7053 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7054 Stage::GetCurrent().Add(actor);
7055 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7057 // Build the animation
7058 float durationSeconds(1.0f);
7059 Animation animation = Animation::New(durationSeconds);
7060 Degree targetRotationDegrees(90.0f);
7061 Radian targetRotationRadians(targetRotationDegrees);
7063 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7064 animation.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7066 // Start the animation
7069 bool signalReceived(false);
7070 AnimationFinishCheck finishCheck(signalReceived);
7071 animation.FinishedSignal().Connect(&application, finishCheck);
7073 application.SendNotification();
7074 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7076 // We didn't expect the animation to finish yet
7077 application.SendNotification();
7078 finishCheck.CheckSignalNotReceived();
7079 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7080 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7082 application.SendNotification();
7083 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7085 // We didn't expect the animation to finish yet
7086 application.SendNotification();
7087 finishCheck.CheckSignalNotReceived();
7088 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7089 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7091 application.SendNotification();
7092 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7094 // We didn't expect the animation to finish yet
7095 application.SendNotification();
7096 finishCheck.CheckSignalNotReceived();
7097 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7098 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7100 application.SendNotification();
7101 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7103 // We did expect the animation to finish
7104 application.SendNotification();
7105 finishCheck.CheckSignalReceived();
7106 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7110 int UtcDaliAnimationRotate(void)
7112 TestApplication application;
7114 Actor actor = Actor::New();
7115 Quaternion initialRotation(0.0f, Vector3::YAXIS);
7116 actor.SetRotation(initialRotation);
7117 Stage::GetCurrent().Add(actor);
7118 DALI_TEST_EQUALS( actor.GetCurrentRotation(), initialRotation, ROTATION_EPSILON, TEST_LOCATION );
7120 // Build the animation
7121 float durationSeconds(1.0f);
7122 Animation animation = Animation::New(durationSeconds);
7123 TumbleFunc func(Vector3::YAXIS);
7124 animation.Rotate(actor, func, AlphaFunctions::Linear, 0.0f, durationSeconds);
7126 // Start the animation
7129 bool signalReceived(false);
7130 AnimationFinishCheck finishCheck(signalReceived);
7131 animation.FinishedSignal().Connect(&application, finishCheck);
7133 application.SendNotification();
7134 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7136 // We didn't expect the animation to finish yet
7137 application.SendNotification();
7138 finishCheck.CheckSignalNotReceived();
7139 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.25f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7141 application.SendNotification();
7142 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7144 // We didn't expect the animation to finish yet
7145 application.SendNotification();
7146 finishCheck.CheckSignalNotReceived();
7147 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.5f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7149 application.SendNotification();
7150 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7152 // We didn't expect the animation to finish yet
7153 application.SendNotification();
7154 finishCheck.CheckSignalNotReceived();
7155 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.75f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7157 application.SendNotification();
7158 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7160 // We did expect the animation to finish
7161 application.SendNotification();
7162 finishCheck.CheckSignalReceived();
7163 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(1.0f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7167 int UtcDaliAnimationScaleBy(void)
7169 TestApplication application;
7171 Actor actor = Actor::New();
7172 Stage::GetCurrent().Add(actor);
7173 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7175 // Build the animation
7176 float durationSeconds(1.0f);
7177 Animation animation = Animation::New(durationSeconds);
7178 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7179 Vector3 relativeScale(targetScale - Vector3::ONE);
7180 animation.ScaleBy(actor, relativeScale.x, relativeScale.y, relativeScale.z);
7182 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
7184 // Start the animation
7187 bool signalReceived(false);
7188 AnimationFinishCheck finishCheck(signalReceived);
7189 animation.FinishedSignal().Connect(&application, finishCheck);
7191 application.SendNotification();
7192 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7194 // We didn't expect the animation to finish yet
7195 application.SendNotification();
7196 finishCheck.CheckSignalNotReceived();
7197 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7199 application.SendNotification();
7200 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7202 // We did expect the animation to finish
7203 application.SendNotification();
7204 finishCheck.CheckSignalReceived();
7205 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7208 finishCheck.Reset();
7209 actor.SetScale(Vector3::ONE);
7210 application.SendNotification();
7211 application.Render(0);
7212 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7214 // Repeat with a different (ease-in) alpha function
7215 animation = Animation::New(durationSeconds);
7216 animation.ScaleBy(actor, relativeScale, AlphaFunctions::EaseIn);
7217 animation.FinishedSignal().Connect(&application, finishCheck);
7220 application.SendNotification();
7221 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7223 // We didn't expect the animation to finish yet
7224 application.SendNotification();
7225 finishCheck.CheckSignalNotReceived();
7227 // The scale should have grown less, than with a linear alpha function
7228 Vector3 current(actor.GetCurrentScale());
7229 DALI_TEST_CHECK( current.x > 1.0f );
7230 DALI_TEST_CHECK( current.y > 1.0f );
7231 DALI_TEST_CHECK( current.z > 1.0f );
7232 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7233 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7234 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7236 application.SendNotification();
7237 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7239 // We did expect the animation to finish
7240 application.SendNotification();
7241 finishCheck.CheckSignalReceived();
7242 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7245 finishCheck.Reset();
7246 actor.SetScale(Vector3::ONE);
7247 application.SendNotification();
7248 application.Render(0);
7249 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7251 // Repeat with a delay
7253 animation = Animation::New(durationSeconds);
7254 animation.ScaleBy(actor, relativeScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
7255 animation.FinishedSignal().Connect(&application, finishCheck);
7258 application.SendNotification();
7259 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7261 // We didn't expect the animation to finish yet
7262 application.SendNotification();
7263 finishCheck.CheckSignalNotReceived();
7264 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7266 application.SendNotification();
7267 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7269 // We did expect the animation to finish
7270 application.SendNotification();
7271 finishCheck.CheckSignalReceived();
7272 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7276 int UtcDaliAnimationScaleTo(void)
7278 TestApplication application;
7280 Actor actor = Actor::New();
7281 Stage::GetCurrent().Add(actor);
7282 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7284 // Build the animation
7285 float durationSeconds(1.0f);
7286 Animation animation = Animation::New(durationSeconds);
7287 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7288 animation.ScaleTo(actor, targetScale.x, targetScale.y, targetScale.z);
7290 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7292 // Start the animation
7295 bool signalReceived(false);
7296 AnimationFinishCheck finishCheck(signalReceived);
7297 animation.FinishedSignal().Connect(&application, finishCheck);
7299 application.SendNotification();
7300 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7302 // We didn't expect the animation to finish yet
7303 application.SendNotification();
7304 finishCheck.CheckSignalNotReceived();
7305 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7307 application.SendNotification();
7308 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7310 // We did expect the animation to finish
7311 application.SendNotification();
7312 finishCheck.CheckSignalReceived();
7313 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7316 finishCheck.Reset();
7317 actor.SetScale(Vector3::ONE);
7318 application.SendNotification();
7319 application.Render(0);
7320 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7322 // Repeat with a different (ease-in) alpha function
7323 animation = Animation::New(durationSeconds);
7324 animation.ScaleTo(actor, targetScale, AlphaFunctions::EaseIn);
7325 animation.FinishedSignal().Connect(&application, finishCheck);
7328 application.SendNotification();
7329 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7331 // We didn't expect the animation to finish yet
7332 application.SendNotification();
7333 finishCheck.CheckSignalNotReceived();
7335 // The scale should have grown less, than with a linear alpha function
7336 Vector3 current(actor.GetCurrentScale());
7337 DALI_TEST_CHECK( current.x > 1.0f );
7338 DALI_TEST_CHECK( current.y > 1.0f );
7339 DALI_TEST_CHECK( current.z > 1.0f );
7340 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7341 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7342 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7344 application.SendNotification();
7345 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7347 // We did expect the animation to finish
7348 application.SendNotification();
7349 finishCheck.CheckSignalReceived();
7350 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7353 finishCheck.Reset();
7354 actor.SetScale(Vector3::ONE);
7355 application.SendNotification();
7356 application.Render(0);
7357 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7359 // Repeat with a delay
7361 animation = Animation::New(durationSeconds);
7362 animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
7363 animation.FinishedSignal().Connect(&application, finishCheck);
7366 application.SendNotification();
7367 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7369 // We didn't expect the animation to finish yet
7370 application.SendNotification();
7371 finishCheck.CheckSignalNotReceived();
7372 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7374 application.SendNotification();
7375 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7377 // We did expect the animation to finish
7378 application.SendNotification();
7379 finishCheck.CheckSignalReceived();
7380 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7384 int UtcDaliAnimationShow(void)
7386 TestApplication application;
7388 Actor actor = Actor::New();
7389 actor.SetVisible(false);
7390 application.SendNotification();
7391 application.Render(0);
7392 DALI_TEST_CHECK( !actor.IsVisible() );
7393 Stage::GetCurrent().Add(actor);
7395 // Start the animation
7396 float durationSeconds(10.0f);
7397 Animation animation = Animation::New(durationSeconds);
7398 animation.Show(actor, durationSeconds*0.5f);
7401 bool signalReceived(false);
7402 AnimationFinishCheck finishCheck(signalReceived);
7403 animation.FinishedSignal().Connect(&application, finishCheck);
7405 application.SendNotification();
7406 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
7408 // We didn't expect the animation to finish yet
7409 application.SendNotification();
7410 finishCheck.CheckSignalNotReceived();
7411 DALI_TEST_CHECK( !actor.IsVisible() );
7413 application.SendNotification();
7414 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
7416 // We didn't expect the animation to finish yet
7417 application.SendNotification();
7418 finishCheck.CheckSignalNotReceived();
7419 DALI_TEST_CHECK( actor.IsVisible() );
7421 application.SendNotification();
7422 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7424 // We did expect the animation to finish
7425 application.SendNotification();
7426 finishCheck.CheckSignalReceived();
7427 DALI_TEST_CHECK( actor.IsVisible() );
7431 int UtcDaliAnimationHide(void)
7433 TestApplication application;
7435 Actor actor = Actor::New();
7436 DALI_TEST_CHECK( actor.IsVisible() );
7437 Stage::GetCurrent().Add(actor);
7439 // Start the animation
7440 float durationSeconds(10.0f);
7441 Animation animation = Animation::New(durationSeconds);
7442 animation.Hide(actor, durationSeconds*0.5f);
7445 bool signalReceived(false);
7446 AnimationFinishCheck finishCheck(signalReceived);
7447 animation.FinishedSignal().Connect(&application, finishCheck);
7449 application.SendNotification();
7450 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
7452 // We didn't expect the animation to finish yet
7453 application.SendNotification();
7454 finishCheck.CheckSignalNotReceived();
7455 DALI_TEST_CHECK( actor.IsVisible() );
7457 application.SendNotification();
7458 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
7460 // We didn't expect the animation to finish yet
7461 application.SendNotification();
7462 finishCheck.CheckSignalNotReceived();
7463 DALI_TEST_CHECK( !actor.IsVisible() );
7465 application.SendNotification();
7466 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7468 // We did expect the animation to finish
7469 application.SendNotification();
7470 finishCheck.CheckSignalReceived();
7471 DALI_TEST_CHECK( !actor.IsVisible() );
7475 int UtcDaliAnimationShowHideAtEnd(void)
7477 // Test that show/hide delay can be the same as animation duration
7478 // i.e. to show/hide at the end of the animation
7480 TestApplication application;
7482 Actor actor = Actor::New();
7483 DALI_TEST_CHECK( actor.IsVisible() );
7484 Stage::GetCurrent().Add(actor);
7486 // Start Hide animation
7487 float durationSeconds(10.0f);
7488 Animation animation = Animation::New(durationSeconds);
7489 animation.Hide(actor, durationSeconds/*Hide at end*/);
7492 bool signalReceived(false);
7493 AnimationFinishCheck finishCheck(signalReceived);
7494 animation.FinishedSignal().Connect(&application, finishCheck);
7496 application.SendNotification();
7497 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
7499 // We did expect the animation to finish
7500 application.SendNotification();
7501 finishCheck.CheckSignalReceived();
7502 DALI_TEST_CHECK( !actor.IsVisible() );
7504 // Start Show animation
7505 animation = Animation::New(durationSeconds);
7506 animation.Show(actor, durationSeconds/*Show at end*/);
7507 animation.FinishedSignal().Connect(&application, finishCheck);
7510 application.SendNotification();
7511 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
7513 // We did expect the animation to finish
7514 application.SendNotification();
7515 finishCheck.CheckSignalReceived();
7516 DALI_TEST_CHECK( actor.IsVisible() );
7520 int UtcDaliAnimationOpacityBy(void)
7522 TestApplication application;
7523 Actor actor = Actor::New();
7524 float startingOpacity(0.5f);
7525 actor.SetOpacity(startingOpacity);
7526 application.SendNotification();
7527 application.Render(0);
7528 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7529 Stage::GetCurrent().Add(actor);
7531 // Build the animation
7532 float durationSeconds(1.0f);
7533 Animation animation = Animation::New(durationSeconds);
7534 float relativeOpacity(-0.5f); // target of zero
7535 animation.OpacityBy(actor, relativeOpacity);
7537 float seventyFivePercentProgress((1.0f - 0.75f) * startingOpacity);
7539 // Start the animation
7542 bool signalReceived(false);
7543 AnimationFinishCheck finishCheck(signalReceived);
7544 animation.FinishedSignal().Connect(&application, finishCheck);
7546 application.SendNotification();
7547 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7549 // We didn't expect the animation to finish yet
7550 application.SendNotification();
7551 finishCheck.CheckSignalNotReceived();
7552 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), seventyFivePercentProgress, TEST_LOCATION );
7554 application.SendNotification();
7555 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7557 // We did expect the animation to finish
7558 application.SendNotification();
7559 finishCheck.CheckSignalReceived();
7560 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
7563 finishCheck.Reset();
7564 actor.SetOpacity(startingOpacity);
7565 application.SendNotification();
7566 application.Render(0);
7567 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7569 // Repeat with a different (ease-in) alpha function
7570 animation = Animation::New(durationSeconds);
7571 animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::EaseIn);
7572 animation.FinishedSignal().Connect(&application, finishCheck);
7575 application.SendNotification();
7576 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7578 // We didn't expect the animation to finish yet
7579 application.SendNotification();
7580 finishCheck.CheckSignalNotReceived();
7582 // The opacity should reduce less, than with a linear alpha function
7583 float current(actor.GetCurrentOpacity());
7584 DALI_TEST_CHECK( current < 1.0f );
7585 DALI_TEST_CHECK( current > seventyFivePercentProgress );
7587 application.SendNotification();
7588 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7590 // We did expect the animation to finish
7591 application.SendNotification();
7592 finishCheck.CheckSignalReceived();
7593 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
7596 finishCheck.Reset();
7597 actor.SetOpacity(startingOpacity);
7598 application.SendNotification();
7599 application.Render(0);
7600 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7602 // Repeat with a delay
7604 animation = Animation::New(durationSeconds);
7605 animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::Linear, delay, durationSeconds - delay);
7606 animation.FinishedSignal().Connect(&application, finishCheck);
7609 application.SendNotification();
7610 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7612 // We didn't expect the animation to finish yet
7613 application.SendNotification();
7614 finishCheck.CheckSignalNotReceived();
7615 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7617 application.SendNotification();
7618 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7620 // We didn't expect the animation to finish yet
7621 application.SendNotification();
7622 finishCheck.CheckSignalNotReceived();
7623 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), seventyFivePercentProgress, TEST_LOCATION );
7625 application.SendNotification();
7626 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7628 // We did expect the animation to finish
7629 application.SendNotification();
7630 finishCheck.CheckSignalReceived();
7631 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
7635 int UtcDaliAnimationOpacityTo(void)
7637 TestApplication application;
7639 Actor actor = Actor::New();
7640 Stage::GetCurrent().Add(actor);
7641 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7643 // Build the animation
7644 float durationSeconds(1.0f);
7645 Animation animation = Animation::New(durationSeconds);
7646 float targetOpacity(0.0f);
7647 animation.OpacityTo(actor, targetOpacity);
7649 float ninetyNinePercentProgress(0.01f);
7651 // Start the animation
7654 bool signalReceived(false);
7655 AnimationFinishCheck finishCheck(signalReceived);
7656 animation.FinishedSignal().Connect(&application, finishCheck);
7658 application.SendNotification();
7659 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7661 // We didn't expect the animation to finish yet
7662 application.SendNotification();
7663 finishCheck.CheckSignalNotReceived();
7664 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), ninetyNinePercentProgress, 0.001f, TEST_LOCATION );
7666 application.SendNotification();
7667 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7669 // We did expect the animation to finish
7670 application.SendNotification();
7671 finishCheck.CheckSignalReceived();
7672 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
7675 finishCheck.Reset();
7676 actor.SetOpacity(1.0f);
7677 application.SendNotification();
7678 application.Render(0);
7679 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7681 // Repeat with a different (ease-in) alpha function
7682 animation = Animation::New(durationSeconds);
7683 animation.OpacityTo(actor, targetOpacity, AlphaFunctions::EaseIn);
7684 animation.FinishedSignal().Connect(&application, finishCheck);
7687 application.SendNotification();
7688 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7690 // We didn't expect the animation to finish yet
7691 application.SendNotification();
7692 finishCheck.CheckSignalNotReceived();
7694 // The opacity should reduce less, than with a linear alpha function
7695 float current(actor.GetCurrentOpacity());
7696 DALI_TEST_CHECK( current < 1.0f );
7697 DALI_TEST_CHECK( current > ninetyNinePercentProgress );
7699 application.SendNotification();
7700 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7702 // We did expect the animation to finish
7703 application.SendNotification();
7704 finishCheck.CheckSignalReceived();
7705 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
7708 finishCheck.Reset();
7709 actor.SetOpacity(1.0f);
7710 application.SendNotification();
7711 application.Render(0);
7712 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7714 // Repeat with a delay
7716 animation = Animation::New(durationSeconds);
7717 animation.OpacityTo(actor, targetOpacity, AlphaFunctions::Linear, delay, durationSeconds - delay);
7718 animation.FinishedSignal().Connect(&application, finishCheck);
7721 application.SendNotification();
7722 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7724 // We didn't expect the animation to finish yet
7725 application.SendNotification();
7726 finishCheck.CheckSignalNotReceived();
7727 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7729 application.SendNotification();
7730 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7732 // We did expect the animation to finish
7733 application.SendNotification();
7734 finishCheck.CheckSignalReceived();
7735 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
7739 int UtcDaliAnimationColorBy(void)
7741 TestApplication application;
7743 Actor actor = Actor::New();
7744 actor.SetColor(Color::BLACK);
7745 application.SendNotification();
7746 application.Render(0);
7747 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::BLACK, TEST_LOCATION );
7748 Stage::GetCurrent().Add(actor);
7750 // Build the animation
7751 float durationSeconds(1.0f);
7752 Animation animation = Animation::New(durationSeconds);
7753 Vector4 targetColor(Color::GREEN);
7754 Vector4 relativeColor(Color::GREEN); // Note the alpha is automatically clamped <= 1.0f in world color
7755 animation.ColorBy(actor, relativeColor);
7757 Vector4 tenPercentProgress(Vector4(0.0f, 0.1f, 0.0f, 1.0f));
7758 Vector4 twentyPercentProgress(Vector4(0.0f, 0.2f, 0.0f, 1.0f));
7760 // Start the animation
7763 bool signalReceived(false);
7764 AnimationFinishCheck finishCheck(signalReceived);
7765 animation.FinishedSignal().Connect(&application, finishCheck);
7767 application.SendNotification();
7768 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7770 // We didn't expect the animation to finish yet
7771 application.SendNotification();
7772 finishCheck.CheckSignalNotReceived();
7773 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), tenPercentProgress, TEST_LOCATION );
7775 application.SendNotification();
7776 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7778 // We did expect the animation to finish
7779 application.SendNotification();
7780 finishCheck.CheckSignalReceived();
7781 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7784 finishCheck.Reset();
7785 actor.SetColor(Color::BLACK);
7786 application.SendNotification();
7787 application.Render(0);
7788 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION );
7790 // Repeat with a different (ease-in) alpha function
7791 animation = Animation::New(durationSeconds);
7792 animation.ColorBy(actor, relativeColor, AlphaFunctions::EaseIn);
7793 animation.FinishedSignal().Connect(&application, finishCheck);
7796 application.SendNotification();
7797 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7799 // We didn't expect the animation to finish yet
7800 application.SendNotification();
7801 finishCheck.CheckSignalNotReceived();
7803 // The color should have changed less, than with a linear alpha function
7804 Vector4 current(actor.GetCurrentWorldColor());
7805 DALI_TEST_CHECK( current.x == 0.0f ); // doesn't change
7806 DALI_TEST_CHECK( current.y > 0.0f );
7807 DALI_TEST_CHECK( current.y < tenPercentProgress.y );
7808 DALI_TEST_CHECK( current.z == 0.0f ); // doesn't change
7809 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7811 application.SendNotification();
7812 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7814 // We did expect the animation to finish
7815 application.SendNotification();
7816 finishCheck.CheckSignalReceived();
7817 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7820 finishCheck.Reset();
7821 actor.SetColor(Color::BLACK);
7822 application.SendNotification();
7823 application.Render(0);
7824 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION );
7826 // Repeat with a shorter animator duration
7827 float animatorDuration = 0.5f;
7828 animation = Animation::New(durationSeconds);
7829 animation.ColorBy(actor, relativeColor, AlphaFunctions::Linear, 0, animatorDuration);
7830 animation.FinishedSignal().Connect(&application, finishCheck);
7833 application.SendNotification();
7834 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7836 // We didn't expect the animation to finish yet
7837 application.SendNotification();
7838 finishCheck.CheckSignalNotReceived();
7839 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), twentyPercentProgress, TEST_LOCATION );
7841 application.SendNotification();
7842 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7844 // We didn't expect the animation to finish yet
7845 application.SendNotification();
7846 finishCheck.CheckSignalNotReceived();
7847 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7849 application.SendNotification();
7850 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7852 // We did expect the animation to finish
7853 application.SendNotification();
7854 finishCheck.CheckSignalReceived();
7855 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7859 int UtcDaliAnimationColorTo(void)
7861 TestApplication application;
7863 Actor actor = Actor::New();
7864 Stage::GetCurrent().Add(actor);
7865 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7867 // Build the animation
7868 float durationSeconds(1.0f);
7869 Animation animation = Animation::New(durationSeconds);
7870 Vector4 targetColor(Color::RED);
7871 animation.ColorTo(actor, targetColor);
7873 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7874 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7876 // Start the animation
7879 bool signalReceived(false);
7880 AnimationFinishCheck finishCheck(signalReceived);
7881 animation.FinishedSignal().Connect(&application, finishCheck);
7883 application.SendNotification();
7884 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7886 // We didn't expect the animation to finish yet
7887 application.SendNotification();
7888 finishCheck.CheckSignalNotReceived();
7889 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7891 application.SendNotification();
7892 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7894 // We did expect the animation to finish
7895 application.SendNotification();
7896 finishCheck.CheckSignalReceived();
7897 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7900 finishCheck.Reset();
7901 actor.SetColor(Color::WHITE);
7902 application.SendNotification();
7903 application.Render(0);
7904 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7906 // Repeat with a different (ease-in) alpha function
7907 animation = Animation::New(durationSeconds);
7908 animation.ColorTo(actor, targetColor, AlphaFunctions::EaseIn);
7909 animation.FinishedSignal().Connect(&application, finishCheck);
7912 application.SendNotification();
7913 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7915 // We didn't expect the animation to finish yet
7916 application.SendNotification();
7917 finishCheck.CheckSignalNotReceived();
7919 // The color should have changed less, than with a linear alpha function
7920 Vector4 current(actor.GetCurrentColor());
7921 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7922 DALI_TEST_CHECK( current.y < 1.0f );
7923 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7924 DALI_TEST_CHECK( current.z < 1.0f );
7925 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7926 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7928 application.SendNotification();
7929 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7931 // We did expect the animation to finish
7932 application.SendNotification();
7933 finishCheck.CheckSignalReceived();
7934 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7937 finishCheck.Reset();
7938 actor.SetColor(Color::WHITE);
7939 application.SendNotification();
7940 application.Render(0);
7941 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7943 // Repeat with a shorter animator duration
7944 float animatorDuration = 0.5f;
7945 animation = Animation::New(durationSeconds);
7946 animation.ColorTo(actor, targetColor, AlphaFunctions::Linear, 0, animatorDuration);
7947 animation.FinishedSignal().Connect(&application, finishCheck);
7950 application.SendNotification();
7951 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7953 // We didn't expect the animation to finish yet
7954 application.SendNotification();
7955 finishCheck.CheckSignalNotReceived();
7956 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7958 application.SendNotification();
7959 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7961 // We didn't expect the animation to finish yet
7962 application.SendNotification();
7963 finishCheck.CheckSignalNotReceived();
7964 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7966 application.SendNotification();
7967 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7969 // We did expect the animation to finish
7970 application.SendNotification();
7971 finishCheck.CheckSignalReceived();
7972 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7976 int UtcDaliAnimationResize(void)
7978 TestApplication application;
7980 Actor actor = Actor::New();
7981 Stage::GetCurrent().Add(actor);
7982 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7984 // Build the animation
7985 float durationSeconds(1.0f);
7986 Animation animation = Animation::New(durationSeconds);
7987 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7988 animation.Resize(actor, targetSize);
7990 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7992 // Start the animation
7995 bool signalReceived(false);
7996 AnimationFinishCheck finishCheck(signalReceived);
7997 animation.FinishedSignal().Connect(&application, finishCheck);
7999 application.SendNotification();
8000 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8002 // We didn't expect the animation to finish yet
8003 application.SendNotification();
8004 finishCheck.CheckSignalNotReceived();
8005 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
8007 application.SendNotification();
8008 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8010 // We did expect the animation to finish
8011 application.SendNotification();
8012 finishCheck.CheckSignalReceived();
8013 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8016 finishCheck.Reset();
8017 actor.SetSize(Vector3::ZERO);
8018 application.SendNotification();
8019 application.Render(0);
8020 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8022 // Repeat with a different (ease-in) alpha function
8023 animation = Animation::New(durationSeconds);
8024 animation.Resize(actor, targetSize, AlphaFunctions::EaseIn);
8025 animation.FinishedSignal().Connect(&application, finishCheck);
8028 application.SendNotification();
8029 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8031 // We didn't expect the animation to finish yet
8032 application.SendNotification();
8033 finishCheck.CheckSignalNotReceived();
8035 // The size should have travelled less, than with a linear alpha function
8036 Vector3 current(actor.GetCurrentSize());
8037 DALI_TEST_CHECK( current.x > 0.0f );
8038 DALI_TEST_CHECK( current.y > 0.0f );
8039 DALI_TEST_CHECK( current.z > 0.0f );
8040 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8041 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8042 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8044 application.SendNotification();
8045 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8047 // We did expect the animation to finish
8048 application.SendNotification();
8049 finishCheck.CheckSignalReceived();
8050 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8053 finishCheck.Reset();
8054 actor.SetSize(Vector3::ZERO);
8055 application.SendNotification();
8056 application.Render(0);
8057 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8059 // Repeat with a delay
8061 animation = Animation::New(durationSeconds);
8062 animation.Resize(actor, targetSize, AlphaFunctions::Linear, delay, durationSeconds - delay);
8063 animation.FinishedSignal().Connect(&application, finishCheck);
8066 application.SendNotification();
8067 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8069 // We didn't expect the animation to finish yet
8070 application.SendNotification();
8071 finishCheck.CheckSignalNotReceived();
8072 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8074 application.SendNotification();
8075 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8077 // We did expect the animation to finish
8078 application.SendNotification();
8079 finishCheck.CheckSignalReceived();
8080 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8084 int UtcDaliAnimationAnimateBool(void)
8086 TestApplication application;
8088 Actor actor = Actor::New();
8089 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8090 Stage::GetCurrent().Add(actor);
8092 // Build the animation
8093 float durationSeconds(10.0f);
8094 Animation animation = Animation::New(durationSeconds);
8095 animation.Animate<bool>( Property(actor, Actor::VISIBLE), ReturnFalseAfterProgressOne, TimePeriod(durationSeconds*0.25f/*delay*/, durationSeconds*0.1f) );
8097 // Start the animation
8100 bool signalReceived(false);
8101 AnimationFinishCheck finishCheck(signalReceived);
8102 animation.FinishedSignal().Connect(&application, finishCheck);
8104 application.SendNotification();
8105 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8107 // We didn't expect the animation to finish yet
8108 application.SendNotification();
8109 finishCheck.CheckSignalNotReceived();
8111 // Should still be visible
8112 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8114 application.SendNotification();
8115 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8117 // We didn't expect the animation to finish yet
8118 application.SendNotification();
8119 finishCheck.CheckSignalNotReceived();
8121 // Now animate functor should have hidden the actor
8122 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
8124 application.SendNotification();
8125 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8127 // We did expect the animation to finish
8128 application.SendNotification();
8129 finishCheck.CheckSignalReceived();
8130 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
8134 int UtcDaliAnimationAnimateFloat(void)
8136 TestApplication application;
8138 Actor actor = Actor::New();
8139 Stage::GetCurrent().Add(actor);
8141 // Register a float property
8142 float startValue(10.0f);
8143 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8144 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
8146 // Build the animation
8147 float durationSeconds(10.0f);
8148 Animation animation = Animation::New(durationSeconds);
8149 float targetPosition(0.0f);
8150 AnimateFloatTestFunctor func( 100, targetPosition );
8151 animation.Animate<float>( Property(actor, index), func );
8153 // Start the animation
8156 bool signalReceived(false);
8157 AnimationFinishCheck finishCheck(signalReceived);
8158 animation.FinishedSignal().Connect(&application, finishCheck);
8160 application.SendNotification();
8161 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8163 // We didn't expect the animation to finish yet
8164 application.SendNotification();
8165 finishCheck.CheckSignalNotReceived();
8166 DALI_TEST_EQUALS( actor.GetProperty<float>(index), 75.0f, TEST_LOCATION );
8168 application.SendNotification();
8169 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8171 // We didn't expect the animation to finish yet
8172 application.SendNotification();
8173 finishCheck.CheckSignalNotReceived();
8174 DALI_TEST_EQUALS( actor.GetProperty<float>(index), 50.0f, TEST_LOCATION );
8176 application.SendNotification();
8177 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8179 // We didn't expect the animation to finish yet
8180 application.SendNotification();
8181 finishCheck.CheckSignalNotReceived();
8182 DALI_TEST_EQUALS( actor.GetProperty<float>(index), 25.0f, TEST_LOCATION );
8184 application.SendNotification();
8185 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8187 // We did expect the animation to finish
8188 application.SendNotification();
8189 finishCheck.CheckSignalReceived();
8190 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetPosition, TEST_LOCATION );
8194 int UtcDaliAnimationAnimateVector2(void)
8196 TestApplication application;
8198 Actor actor = Actor::New();
8199 Stage::GetCurrent().Add(actor);
8201 // Register a Vector2 property
8202 Vector2 startValue(10.0f, 10.0f);
8203 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8204 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
8206 // Build the animation
8207 float durationSeconds(10.0f);
8208 Animation animation = Animation::New(durationSeconds);
8209 Vector2 targetPosition(0.0f, 0.0f);
8210 AnimateVector2TestFunctor func( Vector2(100,100), targetPosition );
8211 animation.Animate<Vector2>( Property(actor, index), func );
8213 // Start the animation
8216 bool signalReceived(false);
8217 AnimationFinishCheck finishCheck(signalReceived);
8218 animation.FinishedSignal().Connect(&application, finishCheck);
8220 application.SendNotification();
8221 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8223 // We didn't expect the animation to finish yet
8224 application.SendNotification();
8225 finishCheck.CheckSignalNotReceived();
8226 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), Vector2(75,75), TEST_LOCATION );
8228 application.SendNotification();
8229 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8231 // We didn't expect the animation to finish yet
8232 application.SendNotification();
8233 finishCheck.CheckSignalNotReceived();
8234 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), Vector2(50,50), TEST_LOCATION );
8236 application.SendNotification();
8237 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8239 // We didn't expect the animation to finish yet
8240 application.SendNotification();
8241 finishCheck.CheckSignalNotReceived();
8242 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), Vector2(25,25), TEST_LOCATION );
8244 application.SendNotification();
8245 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8247 // We did expect the animation to finish
8248 application.SendNotification();
8249 finishCheck.CheckSignalReceived();
8250 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetPosition, TEST_LOCATION );
8254 int UtcDaliAnimationAnimateVector3(void)
8256 TestApplication application;
8258 Actor actor = Actor::New();
8259 Vector3 initialPosition(Vector3::ZERO);
8260 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8261 Stage::GetCurrent().Add(actor);
8263 // Build the animation
8264 float durationSeconds(10.0f);
8265 Animation animation = Animation::New(durationSeconds);
8266 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8267 BounceFunc func(0.0f, 0.0f, -100.0f);
8268 animation.Animate<Vector3>( Property(actor, Actor::POSITION), func, AlphaFunctions::Linear, durationSeconds );
8270 // Start the animation
8273 bool signalReceived(false);
8274 AnimationFinishCheck finishCheck(signalReceived);
8275 animation.FinishedSignal().Connect(&application, finishCheck);
8277 application.SendNotification();
8278 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8280 // We didn't expect the animation to finish yet
8281 application.SendNotification();
8282 finishCheck.CheckSignalNotReceived();
8283 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.25f, initialPosition), TEST_LOCATION );
8285 application.SendNotification();
8286 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8288 // We didn't expect the animation to finish yet
8289 application.SendNotification();
8290 finishCheck.CheckSignalNotReceived();
8291 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.5f, initialPosition), TEST_LOCATION );
8293 application.SendNotification();
8294 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8296 // We didn't expect the animation to finish yet
8297 application.SendNotification();
8298 finishCheck.CheckSignalNotReceived();
8299 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.75f, initialPosition), TEST_LOCATION );
8301 application.SendNotification();
8302 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8304 // We did expect the animation to finish
8305 application.SendNotification();
8306 finishCheck.CheckSignalReceived();
8307 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8311 int UtcDaliAnimationAnimateVector4(void)
8313 TestApplication application;
8315 Actor actor = Actor::New();
8316 Stage::GetCurrent().Add(actor);
8318 // Register a Vector4 property
8319 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
8320 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8321 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
8323 // Build the animation
8324 float durationSeconds(10.0f);
8325 Animation animation = Animation::New(durationSeconds);
8326 Vector4 targetPosition(200,400,0,-1000);
8327 AnimateVector4TestFunctor func( Vector4(1000,1000,1000,1000), targetPosition );
8328 animation.Animate<Vector4>( Property(actor, index), func );
8330 // Start the animation
8333 bool signalReceived(false);
8334 AnimationFinishCheck finishCheck(signalReceived);
8335 animation.FinishedSignal().Connect(&application, finishCheck);
8337 application.SendNotification();
8338 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8340 // We didn't expect the animation to finish yet
8341 application.SendNotification();
8342 finishCheck.CheckSignalNotReceived();
8343 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), Vector4(800,850,750,500), TEST_LOCATION );
8345 application.SendNotification();
8346 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8348 // We didn't expect the animation to finish yet
8349 application.SendNotification();
8350 finishCheck.CheckSignalNotReceived();
8351 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), Vector4(600,700,500,0), TEST_LOCATION );
8353 application.SendNotification();
8354 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8356 // We didn't expect the animation to finish yet
8357 application.SendNotification();
8358 finishCheck.CheckSignalNotReceived();
8359 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), Vector4(400,550,250,-500), TEST_LOCATION );
8361 application.SendNotification();
8362 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8364 // We did expect the animation to finish
8365 application.SendNotification();
8366 finishCheck.CheckSignalReceived();
8367 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetPosition, TEST_LOCATION );
8371 int UtcDaliAnimationAnimateQuaternion(void)
8373 TestApplication application;
8375 Actor actor = Actor::New();
8376 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
8377 Stage::GetCurrent().Add(actor);
8378 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8380 // Build the animation
8381 float durationSeconds(1.0f);
8382 Animation animation = Animation::New(durationSeconds);
8384 Degree sourceRotationDegrees(90.0f);
8385 Radian sourceRotationRadians(sourceRotationDegrees);
8386 Quaternion sourceRotation(sourceRotationRadians, Vector3::YAXIS);
8388 Degree targetRotationDegrees(150.0f);
8389 Radian targetRotationRadians(targetRotationDegrees);
8390 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8392 AnimateQuaternionTestFunctor func( sourceRotation, targetRotation );
8393 animation.Animate<Quaternion>( Property(actor, Actor::ROTATION), func );
8395 // Start the animation
8398 bool signalReceived(false);
8399 AnimationFinishCheck finishCheck(signalReceived);
8400 animation.FinishedSignal().Connect(&application, finishCheck);
8402 application.SendNotification();
8403 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8405 // We didn't expect the animation to finish yet
8406 application.SendNotification();
8407 finishCheck.CheckSignalNotReceived();
8408 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(Radian(Degree(105)), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8410 application.SendNotification();
8411 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8413 // We didn't expect the animation to finish yet
8414 application.SendNotification();
8415 finishCheck.CheckSignalNotReceived();
8416 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(Radian(Degree(120)), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8418 application.SendNotification();
8419 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8421 // We didn't expect the animation to finish yet
8422 application.SendNotification();
8423 finishCheck.CheckSignalNotReceived();
8424 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(Radian(Degree(135)), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8426 application.SendNotification();
8427 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8429 // We did expect the animation to finish
8430 application.SendNotification();
8431 finishCheck.CheckSignalReceived();
8432 DALI_TEST_EQUALS( actor.GetCurrentRotation(), targetRotation, ROTATION_EPSILON, TEST_LOCATION );
8436 int UtcDaliKeyFramesCreateDestroy(void)
8438 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
8440 KeyFrames* keyFrames = new KeyFrames;
8442 DALI_TEST_CHECK( true );
8446 int UtcDaliKeyFramesDownCast(void)
8448 TestApplication application;
8449 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
8451 KeyFrames keyFrames = KeyFrames::New();
8452 BaseHandle object(keyFrames);
8454 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
8455 DALI_TEST_CHECK(keyFrames2);
8457 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
8458 DALI_TEST_CHECK(keyFrames3);
8460 BaseHandle unInitializedObject;
8461 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
8462 DALI_TEST_CHECK(!keyFrames4);
8464 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
8465 DALI_TEST_CHECK(!keyFrames5);
8469 int UtcDaliAnimationResizeByXY(void)
8471 TestApplication application;
8473 Actor actor = Actor::New();
8474 Stage::GetCurrent().Add(actor);
8475 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8477 // Build the animation
8478 float durationSeconds(1.0f);
8479 Animation animation = Animation::New(durationSeconds);
8480 Vector3 targetSize(100.0f, 100.0f, 100.0f);
8481 animation.Resize(actor, targetSize);
8483 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
8485 // Start the animation
8488 bool signalReceived(false);
8489 AnimationFinishCheck finishCheck(signalReceived);
8490 animation.FinishedSignal().Connect(&application, finishCheck);
8492 application.SendNotification();
8493 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8495 // We didn't expect the animation to finish yet
8496 application.SendNotification();
8497 finishCheck.CheckSignalNotReceived();
8498 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
8500 application.SendNotification();
8501 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8503 // We did expect the animation to finish
8504 application.SendNotification();
8505 finishCheck.CheckSignalReceived();
8506 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8509 finishCheck.Reset();
8510 actor.SetSize(Vector3::ZERO);
8511 application.SendNotification();
8512 application.Render(0);
8513 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8515 // Repeat with a different (ease-in) alpha function
8516 animation = Animation::New(durationSeconds);
8517 animation.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::EaseIn);
8518 animation.FinishedSignal().Connect(&application, finishCheck);
8521 application.SendNotification();
8522 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8524 // We didn't expect the animation to finish yet
8525 application.SendNotification();
8526 finishCheck.CheckSignalNotReceived();
8528 // The size should have travelled less, than with a linear alpha function
8529 Vector3 current(actor.GetCurrentSize());
8530 DALI_TEST_CHECK( current.x > 0.0f );
8531 DALI_TEST_CHECK( current.y > 0.0f );
8532 DALI_TEST_CHECK( current.z > 0.0f );
8533 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8534 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8535 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8537 application.SendNotification();
8538 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8540 // We did expect the animation to finish
8541 application.SendNotification();
8542 finishCheck.CheckSignalReceived();
8543 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8546 finishCheck.Reset();
8547 actor.SetSize(Vector3::ZERO);
8548 application.SendNotification();
8549 application.Render(0);
8550 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8552 // Repeat with a delay
8554 animation = Animation::New(durationSeconds);
8555 animation.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::Linear, delay, durationSeconds - delay);
8556 animation.FinishedSignal().Connect(&application, finishCheck);
8559 application.SendNotification();
8560 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8562 // We didn't expect the animation to finish yet
8563 application.SendNotification();
8564 finishCheck.CheckSignalNotReceived();
8565 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8567 application.SendNotification();
8568 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8570 // We did expect the animation to finish
8571 application.SendNotification();
8572 finishCheck.CheckSignalReceived();
8573 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8578 int UtcDaliAnimationAnimateBetweenActorColorTimePeriod(void)
8580 TestApplication application;
8582 float startValue(1.0f);
8583 Actor actor = Actor::New();
8584 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8585 Stage::GetCurrent().Add(actor);
8587 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8588 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
8589 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
8590 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
8591 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
8593 // Build the animation
8594 float durationSeconds(1.0f);
8595 Animation animation = Animation::New(durationSeconds);
8597 KeyFrames keyFrames = KeyFrames::New();
8598 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8599 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8600 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8602 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, TimePeriod( 1.0f) );
8604 // Start the animation
8607 bool signalReceived(false);
8608 AnimationFinishCheck finishCheck(signalReceived);
8609 animation.FinishedSignal().Connect(&application, finishCheck);
8610 application.SendNotification();
8611 application.Render(0);
8612 application.SendNotification();
8613 finishCheck.CheckSignalNotReceived();
8614 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8615 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8616 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8617 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8619 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8620 application.SendNotification();
8621 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8622 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8623 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8624 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8626 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8627 application.SendNotification();
8628 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8629 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8630 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8631 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8633 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8634 application.SendNotification();
8635 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8636 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8637 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8638 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8640 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8641 application.SendNotification();
8642 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8643 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8644 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8645 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8647 // We did expect the animation to finish
8649 finishCheck.CheckSignalReceived();
8653 int UtcDaliAnimationAnimateBetweenActorColorFunction(void)
8655 TestApplication application;
8657 float startValue(1.0f);
8658 Actor actor = Actor::New();
8659 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8660 Stage::GetCurrent().Add(actor);
8662 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8663 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
8664 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
8665 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
8666 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
8668 // Build the animation
8669 float durationSeconds(1.0f);
8670 Animation animation = Animation::New(durationSeconds);
8672 KeyFrames keyFrames = KeyFrames::New();
8673 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8674 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8675 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8677 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear );
8679 // Start the animation
8682 bool signalReceived(false);
8683 AnimationFinishCheck finishCheck(signalReceived);
8684 animation.FinishedSignal().Connect(&application, finishCheck);
8685 application.SendNotification();
8686 application.Render(0);
8687 application.SendNotification();
8688 finishCheck.CheckSignalNotReceived();
8689 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8690 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8691 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8692 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8694 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8695 application.SendNotification();
8696 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8697 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8698 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8699 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8701 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8702 application.SendNotification();
8703 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8704 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8705 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8706 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8708 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8709 application.SendNotification();
8710 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8711 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8712 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8713 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8715 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8716 application.SendNotification();
8717 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8718 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8719 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8720 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8722 // We did expect the animation to finish
8724 finishCheck.CheckSignalReceived();
8728 int UtcDaliAnimationAnimateBetweenActorColorFunctionTimePeriod(void)
8730 TestApplication application;
8732 float startValue(1.0f);
8733 Actor actor = Actor::New();
8734 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8735 Stage::GetCurrent().Add(actor);
8737 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8738 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
8739 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
8740 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
8741 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
8743 // Build the animation
8744 float durationSeconds(1.0f);
8745 Animation animation = Animation::New(durationSeconds);
8747 KeyFrames keyFrames = KeyFrames::New();
8748 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8749 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8750 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8752 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear, TimePeriod( 1.0f) );
8754 // Start the animation
8757 bool signalReceived(false);
8758 AnimationFinishCheck finishCheck(signalReceived);
8759 animation.FinishedSignal().Connect(&application, finishCheck);
8760 application.SendNotification();
8761 application.Render(0);
8762 application.SendNotification();
8763 finishCheck.CheckSignalNotReceived();
8764 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8765 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8766 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8767 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8769 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8770 application.SendNotification();
8771 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8772 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8773 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8774 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8776 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8777 application.SendNotification();
8778 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8779 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8780 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8781 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8783 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8784 application.SendNotification();
8785 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8786 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8787 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8788 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8790 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8791 application.SendNotification();
8792 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8793 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8794 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8795 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8797 // We did expect the animation to finish
8799 finishCheck.CheckSignalReceived();
8803 int UtcDaliAnimationAnimateVector3Func(void)
8805 TestApplication application;
8807 Actor actor = Actor::New();
8808 Vector3 initialPosition(Vector3::ZERO);
8809 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8810 Stage::GetCurrent().Add(actor);
8812 // Build the animation
8813 float durationSeconds(10.0f);
8814 Animation animation = Animation::New(durationSeconds);
8815 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8816 BounceFunc func(0.0f, 0.0f, -100.0f);
8817 animation.Animate<Vector3>( Property(actor, Actor::POSITION), func, AlphaFunctions::Linear );
8819 // Start the animation
8822 bool signalReceived(false);
8823 AnimationFinishCheck finishCheck(signalReceived);
8824 animation.FinishedSignal().Connect(&application, finishCheck);
8826 application.SendNotification();
8827 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8829 // We didn't expect the animation to finish yet
8830 application.SendNotification();
8831 finishCheck.CheckSignalNotReceived();
8832 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.25f, initialPosition), TEST_LOCATION );
8834 application.SendNotification();
8835 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8837 // We didn't expect the animation to finish yet
8838 application.SendNotification();
8839 finishCheck.CheckSignalNotReceived();
8840 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.5f, initialPosition), TEST_LOCATION );
8842 application.SendNotification();
8843 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8845 // We didn't expect the animation to finish yet
8846 application.SendNotification();
8847 finishCheck.CheckSignalNotReceived();
8848 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.75f, initialPosition), TEST_LOCATION );
8850 application.SendNotification();
8851 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8853 // We did expect the animation to finish
8854 application.SendNotification();
8855 finishCheck.CheckSignalReceived();
8856 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8860 int UtcDaliAnimationCreateDestroy(void)
8862 TestApplication application;
8863 Animation* animation = new Animation;
8864 DALI_TEST_CHECK( animation );