2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/dali.h>
23 #include <dali-test-suite-utils.h>
28 void utc_dali_animation_startup(void)
30 test_return_value = TET_UNDEF;
33 void utc_dali_animation_cleanup(void)
35 test_return_value = TET_PASS;
41 static const float ROTATION_EPSILON = 0.0001f;
42 static const float VECTOR4_EPSILON = 0.0001f;
44 // Functor to test whether a Finish signal is emitted
45 struct AnimationFinishCheck
47 AnimationFinishCheck(bool& signalReceived)
48 : mSignalReceived(signalReceived)
52 void operator()(Animation& animation)
54 mSignalReceived = true;
59 mSignalReceived = false;
62 void CheckSignalReceived()
66 tet_printf("Expected Finish signal was not received\n");
75 void CheckSignalNotReceived()
79 tet_printf("Unexpected Finish signal was received\n");
88 bool& mSignalReceived; // owned by individual tests
91 static bool ReturnFalseAfterProgressOne( float alpha, const bool& current )
96 struct AnimateFloatTestFunctor
98 AnimateFloatTestFunctor( float start, float end )
104 float operator()( float alpha, const float& current )
106 return mStart + ((mEnd - mStart) * alpha );
113 struct AnimateVector2TestFunctor
115 AnimateVector2TestFunctor( Vector2 start, Vector2 end )
121 Vector2 operator()( float alpha, const Vector2& current )
123 return mStart + ((mEnd - mStart) * alpha );
130 struct AnimateVector4TestFunctor
132 AnimateVector4TestFunctor( Vector4 start, Vector4 end )
138 Vector4 operator()( float alpha, const Vector4& current )
140 return mStart + ((mEnd - mStart) * alpha );
147 struct AnimateQuaternionTestFunctor
149 AnimateQuaternionTestFunctor( Quaternion start, Quaternion end )
155 Quaternion operator()( float alpha, const Quaternion& current )
157 return Quaternion::Slerp(mStart, mEnd, alpha);
166 BounceFunc(float x, float y, float z)
167 : mDistance(Vector3(x, y, z))
170 Vector3 operator()(float alpha, const Vector3& current)
172 if (alpha>0.001f && alpha<1.0f)
174 const float flip = 0.5f - cosf(alpha * Math::PI * 2.0f) * 0.5f;
175 Vector3 newTranslation(current);
176 newTranslation += mDistance * flip;
177 return newTranslation;
187 TumbleFunc(Vector3 axis) : tumbleAxis(axis){}
188 Quaternion operator()(float alpha, const Quaternion& current)
190 if (alpha>0.001f && alpha<1.0f)
192 Quaternion tumbleRotation(alpha * Math::PI * 2.0f, tumbleAxis);
193 return tumbleRotation * current;
202 int UtcDaliAnimationNew01(void)
204 TestApplication application;
207 DALI_TEST_CHECK(!animation);
209 animation = Animation::New(1.0f);
211 DALI_TEST_CHECK(animation);
215 int UtcDaliAnimationNew02(void)
217 TestApplication application;
220 DALI_TEST_CHECK(!animation);
223 animation = Animation::New(0.0f);
225 catch (Dali::DaliException& e)
227 // TODO: Determine why catch doesn't.
230 // Tests that a negative test of an assertion succeeds
231 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
232 DALI_TEST_EQUALS(e.mCondition, "durationSeconds > 0.0f", TEST_LOCATION);
237 int UtcDaliAnimationDownCast(void)
239 TestApplication application;
240 tet_infoline("Testing Dali::Animation::DownCast()");
242 float durationSeconds(1.0f);
243 Animation animation = Animation::New(durationSeconds);
245 BaseHandle object(animation);
247 Animation animation2 = Animation::DownCast(object);
248 DALI_TEST_CHECK(animation2);
250 Animation animation3 = DownCast< Animation >(object);
251 DALI_TEST_CHECK(animation3);
253 BaseHandle unInitializedObject;
254 Animation animation4 = Animation::DownCast(unInitializedObject);
255 DALI_TEST_CHECK(!animation4);
257 Animation animation5 = DownCast< Animation >(unInitializedObject);
258 DALI_TEST_CHECK(!animation5);
262 int UtcDaliAnimationSetDuration(void)
264 TestApplication application;
266 Actor actor = Actor::New();
267 Stage::GetCurrent().Add(actor);
269 // Build the animation
270 float durationSeconds(1.0f);
271 Animation animation = Animation::New(durationSeconds);
272 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
274 // Start the animation
275 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
276 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
279 bool signalReceived(false);
280 AnimationFinishCheck finishCheck(signalReceived);
281 animation.FinishedSignal().Connect(&application, finishCheck);
283 application.SendNotification();
284 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
286 // We didn't expect the animation to finish yet
287 application.SendNotification();
288 finishCheck.CheckSignalNotReceived();
290 application.Render(2u/*just beyond the animation duration*/);
292 // We did expect the animation to finish
293 application.SendNotification();
294 finishCheck.CheckSignalReceived();
295 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
297 // Restart the animation, with a different duration
299 actor.SetPosition(Vector3::ZERO);
300 durationSeconds = 3.5f;
301 animation.SetDuration(durationSeconds);
302 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
305 application.SendNotification();
306 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
308 // We didn't expect the animation to finish yet
309 application.SendNotification();
310 finishCheck.CheckSignalNotReceived();
312 application.Render(2u/*just beyond the animation duration*/);
314 // We did expect the animation to finish
315 application.SendNotification();
316 finishCheck.CheckSignalReceived();
317 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
319 // Check that nothing has changed after a couple of buffer swaps
320 application.Render(0);
321 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
322 application.Render(0);
323 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
327 int UtcDaliAnimationGetDuration(void)
329 TestApplication application;
331 Animation animation = Animation::New(1.0f);
332 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
334 animation.SetDuration(2.0f);
335 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
339 int UtcDaliAnimationSetLooping(void)
341 TestApplication application;
343 Actor actor = Actor::New();
344 Stage::GetCurrent().Add(actor);
346 // Build the animation
347 float durationSeconds(1.0f);
348 Animation animation = Animation::New(durationSeconds);
349 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
350 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
352 // Start the animation
353 animation.SetLooping(true);
354 DALI_TEST_CHECK(animation.IsLooping());
357 bool signalReceived(false);
358 AnimationFinishCheck finishCheck(signalReceived);
359 animation.FinishedSignal().Connect(&application, finishCheck);
361 application.SendNotification();
364 float intervalSeconds = 0.25f;
365 float progress = 0.0f;
366 for (int iterations = 0; iterations < 5;)
368 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
370 progress += intervalSeconds;
371 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
373 if (progress >= 1.0f)
375 progress = progress - 1.0f;
380 // We didn't expect the animation to finish yet
381 application.SendNotification();
382 finishCheck.CheckSignalNotReceived();
384 animation.SetLooping(false);
385 DALI_TEST_CHECK(!animation.IsLooping());
387 application.SendNotification();
388 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
390 // We did expect the animation to finish
391 application.SendNotification();
392 finishCheck.CheckSignalReceived();
393 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
395 // Check that nothing has changed after a couple of buffer swaps
396 application.Render(0);
397 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
398 application.Render(0);
399 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
403 int UtcDaliAnimationIsLooping(void)
405 TestApplication application;
407 Animation animation = Animation::New(1.0f);
408 DALI_TEST_CHECK(!animation.IsLooping());
410 animation.SetLooping(true);
411 DALI_TEST_CHECK(animation.IsLooping());
415 int UtcDaliAnimationSetEndAction(void)
417 TestApplication application;
419 Actor actor = Actor::New();
420 Stage::GetCurrent().Add(actor);
422 // Build the animation
423 float durationSeconds(1.0f);
424 Animation animation = Animation::New(durationSeconds);
425 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
427 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
428 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
430 // Start the animation
433 bool signalReceived(false);
434 AnimationFinishCheck finishCheck(signalReceived);
435 animation.FinishedSignal().Connect(&application, finishCheck);
437 application.SendNotification();
438 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
440 // We did expect the animation to finish
441 application.SendNotification();
442 finishCheck.CheckSignalReceived();
443 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
445 // Go back to the start
446 actor.SetPosition(Vector3::ZERO);
447 application.SendNotification();
448 application.Render(0);
449 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
451 // Test BakeFinal, animate again, for half the duration
453 animation.SetEndAction(Animation::BakeFinal);
454 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
457 application.SendNotification();
458 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
460 // Stop the animation early
463 // We did NOT expect the animation to finish
464 application.SendNotification();
465 finishCheck.CheckSignalNotReceived();
466 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
468 // Go back to the start
469 actor.SetPosition(Vector3::ZERO);
470 application.SendNotification();
471 application.Render(0);
472 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
474 // Test EndAction::Discard, animate again, but don't bake this time
476 animation.SetEndAction(Animation::Discard);
477 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
480 application.SendNotification();
481 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
483 // We did expect the animation to finish
484 application.SendNotification();
485 finishCheck.CheckSignalReceived();
486 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
488 // The position should be discarded in the next frame
489 application.Render(0);
490 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
492 // Check that nothing has changed after a couple of buffer swaps
493 application.Render(0);
494 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
495 application.Render(0);
496 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
500 int UtcDaliAnimationGetEndAction(void)
502 TestApplication application;
504 Animation animation = Animation::New(1.0f);
505 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
507 animation.SetEndAction(Animation::Discard);
508 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
510 animation.SetEndAction(Animation::BakeFinal);
511 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
516 int UtcDaliAnimationGetDestroyAction(void)
518 TestApplication application;
519 Animation animation = Animation::New(1.0f);
520 DALI_TEST_CHECK(animation.GetDestroyAction() == Animation::Bake); // default!
522 animation.SetDestroyAction(Animation::Discard);
523 DALI_TEST_CHECK(animation.GetDestroyAction() == Animation::Discard);
525 animation.SetDestroyAction(Animation::BakeFinal);
526 DALI_TEST_CHECK(animation.GetDestroyAction() == Animation::BakeFinal);
531 int UtcDaliAnimationSetDefaultAlphaFunction(void)
533 TestApplication application;
535 Animation animation = Animation::New(1.0f);
536 AlphaFunction func = animation.GetDefaultAlphaFunction();
537 DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
539 animation.SetDefaultAlphaFunction(AlphaFunctions::EaseIn);
540 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
541 DALI_TEST_CHECK(func2(0.1f) < AlphaFunctions::Linear(0.1f)); // less progress when easing-in
545 int UtcDaliAnimationGetDefaultAlphaFunction(void)
547 TestApplication application;
549 Animation animation = Animation::New(1.0f);
550 AlphaFunction func = animation.GetDefaultAlphaFunction();
552 // Test that the default is linear
553 DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
557 int UtcDaliAnimationPlay(void)
559 TestApplication application;
561 Actor actor = Actor::New();
562 Stage::GetCurrent().Add(actor);
564 // Build the animation
565 float durationSeconds(1.0f);
566 Animation animation = Animation::New(durationSeconds);
567 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
568 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
570 // Start the animation
573 bool signalReceived(false);
574 AnimationFinishCheck finishCheck(signalReceived);
575 animation.FinishedSignal().Connect(&application, finishCheck);
577 application.SendNotification();
578 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
580 // We didn't expect the animation to finish yet
581 application.SendNotification();
582 finishCheck.CheckSignalNotReceived();
583 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
585 animation.Play(); // Test that calling play has no effect, when animation is already playing
586 application.SendNotification();
587 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
589 // We didn't expect the animation to finish yet
590 application.SendNotification();
591 finishCheck.CheckSignalNotReceived();
592 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
594 animation.Play(); // Test that calling play has no effect, when animation is already playing
595 application.SendNotification();
596 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
598 // We didn't expect the animation to finish yet
599 application.SendNotification();
600 finishCheck.CheckSignalNotReceived();
601 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
603 animation.Play(); // Test that calling play has no effect, when animation is already playing
604 application.SendNotification();
605 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
607 // We didn't expect the animation to finish yet
608 application.SendNotification();
609 finishCheck.CheckSignalNotReceived();
610 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
612 animation.Play(); // Test that calling play has no effect, when animation is already playing
613 application.SendNotification();
614 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
616 // We did expect the animation to finish
617 application.SendNotification();
618 finishCheck.CheckSignalReceived();
619 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
621 // Check that nothing has changed after a couple of buffer swaps
622 application.Render(0);
623 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
624 application.Render(0);
625 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
629 int UtcDaliAnimationPlayOffStage(void)
631 // Test that an animation can be played, when the actor is off-stage.
632 // When the actor is added to the stage, it should appear at the current position
633 // i.e. where it would have been anyway, if on-stage from the beginning.
635 TestApplication application;
637 Actor actor = Actor::New();
638 Vector3 basePosition(Vector3::ZERO);
639 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
640 // Not added to the stage!
642 // Build the animation
643 float durationSeconds(1.0f);
644 Animation animation = Animation::New(durationSeconds);
645 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
646 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
648 // Start the animation
651 bool signalReceived(false);
652 AnimationFinishCheck finishCheck(signalReceived);
653 animation.FinishedSignal().Connect(&application, finishCheck);
655 application.SendNotification();
656 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
658 // We didn't expect the animation to finish yet
659 application.SendNotification();
660 finishCheck.CheckSignalNotReceived();
661 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
664 Stage::GetCurrent().Add(actor);
666 application.SendNotification();
667 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
669 // We didn't expect the animation to finish yet
670 application.SendNotification();
671 finishCheck.CheckSignalNotReceived();
672 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
673 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
675 // Remove from the stage
676 Stage::GetCurrent().Remove(actor);
678 application.SendNotification();
679 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
681 // We didn't expect the animation to finish yet
682 application.SendNotification();
683 finishCheck.CheckSignalNotReceived();
684 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
687 Stage::GetCurrent().Add(actor);
689 application.SendNotification();
690 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
692 // We didn't expect the animation to finish yet
693 application.SendNotification();
694 finishCheck.CheckSignalNotReceived();
695 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
696 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
698 application.SendNotification();
699 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
701 // We did expect the animation to finish
702 application.SendNotification();
703 finishCheck.CheckSignalReceived();
704 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
706 // Check that nothing has changed after a couple of buffer swaps
707 application.Render(0);
708 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
709 application.Render(0);
710 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
714 int UtcDaliAnimationPlayDiscardHandle(void)
716 TestApplication application;
718 Actor actor = Actor::New();
719 Stage::GetCurrent().Add(actor);
721 // Build the animation
722 float durationSeconds(1.0f);
723 Animation animation = Animation::New(durationSeconds);
724 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
725 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
727 bool signalReceived(false);
728 AnimationFinishCheck finishCheck(signalReceived);
729 animation.FinishedSignal().Connect(&application, finishCheck);
731 // Start the animation
734 // This is a test of the "Fire and Forget" behaviour
735 // Discard the animation handle!
737 DALI_TEST_CHECK( !animation );
739 application.SendNotification();
740 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
742 // We didn't expect the animation to finish yet
743 application.SendNotification();
744 finishCheck.CheckSignalNotReceived();
745 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
747 application.SendNotification();
748 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
750 // We didn't expect the animation to finish yet
751 application.SendNotification();
752 finishCheck.CheckSignalNotReceived();
753 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
755 application.SendNotification();
756 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
758 // We didn't expect the animation to finish yet
759 application.SendNotification();
760 finishCheck.CheckSignalNotReceived();
761 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
763 application.SendNotification();
764 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
766 // We didn't expect the animation to finish yet
767 application.SendNotification();
768 finishCheck.CheckSignalNotReceived();
769 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
771 application.SendNotification();
772 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
774 // We did expect the animation to finish
775 application.SendNotification();
776 finishCheck.CheckSignalReceived();
777 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
779 // Check that nothing has changed after a couple of buffer swaps
780 application.Render(0);
781 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
782 application.Render(0);
783 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
787 int UtcDaliAnimationPlayStopDiscardHandle(void)
789 TestApplication application;
791 Actor actor = Actor::New();
792 Stage::GetCurrent().Add(actor);
794 // Build the animation
795 float durationSeconds(1.0f);
796 Animation animation = Animation::New(durationSeconds);
797 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
798 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
800 // Start the animation
803 bool signalReceived(false);
804 AnimationFinishCheck finishCheck(signalReceived);
805 animation.FinishedSignal().Connect(&application, finishCheck);
807 application.SendNotification();
808 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
810 // We didn't expect the animation to finish yet
811 application.SendNotification();
812 finishCheck.CheckSignalNotReceived();
813 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
815 // This is a test of the "Fire and Forget" behaviour
816 // Stop the animation, and Discard the animation handle!
819 DALI_TEST_CHECK( !animation );
821 application.SendNotification();
822 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
824 // We expect the animation to finish at 20% progress
825 application.SendNotification();
826 finishCheck.CheckSignalReceived();
828 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
830 application.SendNotification();
831 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
833 // Check that nothing has changed
834 application.SendNotification();
835 finishCheck.CheckSignalNotReceived();
836 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
838 application.SendNotification();
839 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
841 // Check that nothing has changed
842 application.SendNotification();
843 finishCheck.CheckSignalNotReceived();
844 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
846 application.SendNotification();
847 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
849 // Check that nothing has changed
850 application.SendNotification();
851 finishCheck.CheckSignalNotReceived();
852 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
856 int UtcDaliAnimationPause(void)
858 TestApplication application;
860 Actor actor = Actor::New();
861 Stage::GetCurrent().Add(actor);
863 // Build the animation
864 float durationSeconds(1.0f);
865 Animation animation = Animation::New(durationSeconds);
866 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
867 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
869 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
871 // Start the animation
874 bool signalReceived(false);
875 AnimationFinishCheck finishCheck(signalReceived);
876 animation.FinishedSignal().Connect(&application, finishCheck);
878 application.SendNotification();
879 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
881 // We didn't expect the animation to finish yet
882 application.SendNotification();
883 finishCheck.CheckSignalNotReceived();
884 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
886 // Pause the animation
888 application.SendNotification();
891 for (int i=0; i<5; ++i)
893 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
895 // We didn't expect the animation to finish yet
896 application.SendNotification();
897 finishCheck.CheckSignalNotReceived();
898 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
903 application.SendNotification();
904 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
906 // We didn't expect the animation to finish yet
907 application.SendNotification();
908 finishCheck.CheckSignalNotReceived();
910 application.SendNotification();
911 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
913 // We did expect the animation to finish
914 application.SendNotification();
915 finishCheck.CheckSignalReceived();
916 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
918 // Check that nothing has changed after a couple of buffer swaps
919 application.Render(0);
920 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
921 application.Render(0);
922 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
926 int UtcDaliAnimationStop(void)
928 TestApplication application;
930 Actor actor = Actor::New();
931 Stage::GetCurrent().Add(actor);
933 // Build the animation
934 float durationSeconds(1.0f);
935 Animation animation = Animation::New(durationSeconds);
936 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
937 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
939 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
941 // Start the animation
944 bool signalReceived(false);
945 AnimationFinishCheck finishCheck(signalReceived);
946 animation.FinishedSignal().Connect(&application, finishCheck);
948 application.SendNotification();
949 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
951 // We didn't expect the animation to finish yet
952 application.SendNotification();
953 finishCheck.CheckSignalNotReceived();
954 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
956 // Stop the animation
958 application.SendNotification();
961 for (int i=0; i<5; ++i)
963 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
965 // We did expect the animation to finish
966 application.SendNotification();
967 finishCheck.CheckSignalReceived();
968 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
973 int UtcDaliAnimationStopSetPosition(void)
975 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
976 // i.e. to check that the animation does not interfere with the position set.
978 TestApplication application;
980 Actor actor = Actor::New();
981 Stage::GetCurrent().Add(actor);
983 // Build the animation
984 float durationSeconds(1.0f);
985 Animation animation = Animation::New(durationSeconds);
986 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
987 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
989 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
991 // Start the animation
994 bool signalReceived(false);
995 AnimationFinishCheck finishCheck(signalReceived);
996 animation.FinishedSignal().Connect(&application, finishCheck);
998 application.SendNotification();
999 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1001 // We didn't expect the animation to finish yet
1002 application.SendNotification();
1003 finishCheck.CheckSignalNotReceived();
1004 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1006 // Stop the animation
1008 Vector3 positionSet(2.0f, 3.0f, 4.0f);
1009 actor.SetPosition(positionSet);
1010 application.SendNotification();
1013 for (int i=0; i<5; ++i)
1015 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
1017 // We did expect the animation to finish
1018 application.SendNotification();
1019 finishCheck.CheckSignalReceived();
1020 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
1025 int UtcDaliAnimationClear(void)
1027 TestApplication application;
1029 Actor actor = Actor::New();
1030 Stage::GetCurrent().Add(actor);
1032 // Build the animation
1033 float durationSeconds(1.0f);
1034 Animation animation = Animation::New(durationSeconds);
1035 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1036 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear);
1038 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
1040 // Start the animation
1043 bool signalReceived(false);
1044 AnimationFinishCheck finishCheck(signalReceived);
1045 animation.FinishedSignal().Connect(&application, finishCheck);
1047 application.SendNotification();
1048 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1050 // We didn't expect the animation to finish yet
1051 application.SendNotification();
1052 finishCheck.CheckSignalNotReceived();
1053 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
1055 // Clear the animation
1057 application.SendNotification();
1059 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1061 // We don't expect the animation to finish now
1062 application.SendNotification();
1063 finishCheck.CheckSignalNotReceived();
1064 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
1066 // Restart as a scale animation; this should not move the actor's position
1067 finishCheck.Reset();
1068 actor.SetPosition(Vector3::ZERO);
1069 Vector3 targetScale(3.0f, 3.0f, 3.0f);
1070 animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear);
1073 application.SendNotification();
1074 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
1076 // We didn't expect the animation to finish yet
1077 application.SendNotification();
1078 finishCheck.CheckSignalNotReceived();
1079 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1080 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
1082 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
1084 // We did expect the animation to finish
1085 application.SendNotification();
1086 finishCheck.CheckSignalReceived();
1087 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
1088 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
1092 int UtcDaliAnimationSignalFinish(void)
1094 TestApplication application;
1096 // Start the empty animation
1097 float durationSeconds(1.0f);
1098 Animation animation = Animation::New(durationSeconds);
1101 bool signalReceived(false);
1102 AnimationFinishCheck finishCheck(signalReceived);
1103 animation.FinishedSignal().Connect(&application, finishCheck);
1105 application.SendNotification();
1106 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
1108 // We did expect the animation to finish
1109 application.SendNotification();
1110 finishCheck.CheckSignalReceived();
1114 int UtcDaliAnimationAnimateByBoolean(void)
1116 TestApplication application;
1118 Actor actor = Actor::New();
1120 // Register a boolean property
1121 bool startValue(false);
1122 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1123 Stage::GetCurrent().Add(actor);
1124 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1126 // Build the animation
1127 float durationSeconds(2.0f);
1128 Animation animation = Animation::New(durationSeconds);
1129 const bool relativeValue(true);
1130 const bool finalValue( false || relativeValue );
1131 animation.AnimateBy(Property(actor, index), relativeValue);
1133 // Start the animation
1136 bool signalReceived(false);
1137 AnimationFinishCheck finishCheck(signalReceived);
1138 animation.FinishedSignal().Connect(&application, finishCheck);
1140 application.SendNotification();
1141 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1143 // We didn't expect the animation to finish yet
1144 application.SendNotification();
1145 finishCheck.CheckSignalNotReceived();
1146 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1148 application.SendNotification();
1149 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1151 // We did expect the animation to finish
1152 application.SendNotification();
1153 finishCheck.CheckSignalReceived();
1154 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1156 // Check that nothing has changed after a couple of buffer swaps
1157 application.Render(0);
1158 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1159 application.Render(0);
1160 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1162 // Repeat with relative value "false" - this should be an NOOP
1163 animation = Animation::New(durationSeconds);
1164 bool noOpValue(false);
1165 animation.AnimateBy(Property(actor, index), noOpValue);
1167 // Start the animation
1170 finishCheck.Reset();
1171 animation.FinishedSignal().Connect(&application, finishCheck);
1173 application.SendNotification();
1174 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1176 // We didn't expect the animation to finish yet
1177 application.SendNotification();
1178 finishCheck.CheckSignalNotReceived();
1179 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1181 application.SendNotification();
1182 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1184 // We did expect the animation to finish
1185 application.SendNotification();
1186 finishCheck.CheckSignalReceived();
1187 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1189 // Check that nothing has changed after a couple of buffer swaps
1190 application.Render(0);
1191 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1192 application.Render(0);
1193 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1197 int UtcDaliAnimationAnimateByBooleanAlphaFunction(void)
1199 TestApplication application;
1201 Actor actor = Actor::New();
1203 // Register a boolean property
1204 bool startValue(false);
1205 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1206 Stage::GetCurrent().Add(actor);
1207 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1209 // Build the animation
1210 float durationSeconds(2.0f);
1211 Animation animation = Animation::New(durationSeconds);
1212 bool relativeValue(true);
1213 bool finalValue( false || relativeValue );
1214 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseIn);
1216 // Start the animation
1219 bool signalReceived(false);
1220 AnimationFinishCheck finishCheck(signalReceived);
1221 animation.FinishedSignal().Connect(&application, finishCheck);
1223 application.SendNotification();
1224 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1226 // We didn't expect the animation to finish yet
1227 application.SendNotification();
1228 finishCheck.CheckSignalNotReceived();
1229 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1231 application.SendNotification();
1232 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1234 // We did expect the animation to finish
1235 application.SendNotification();
1236 finishCheck.CheckSignalReceived();
1237 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1239 // Check that nothing has changed after a couple of buffer swaps
1240 application.Render(0);
1241 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1242 application.Render(0);
1243 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1245 // Repeat with relative value "false" - this should be an NOOP
1246 animation = Animation::New(durationSeconds);
1247 bool noOpValue(false);
1248 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunctions::EaseIn);
1250 // Start the animation
1253 finishCheck.Reset();
1254 animation.FinishedSignal().Connect(&application, finishCheck);
1256 application.SendNotification();
1257 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1259 // We didn't expect the animation to finish yet
1260 application.SendNotification();
1261 finishCheck.CheckSignalNotReceived();
1262 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1264 application.SendNotification();
1265 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1267 // We did expect the animation to finish
1268 application.SendNotification();
1269 finishCheck.CheckSignalReceived();
1270 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1274 int UtcDaliAnimationAnimateByBooleanTimePeriod(void)
1276 TestApplication application;
1278 Actor actor = Actor::New();
1280 // Register a boolean property
1281 bool startValue(false);
1282 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1283 Stage::GetCurrent().Add(actor);
1284 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1286 // Build the animation
1287 float durationSeconds(2.0f);
1288 Animation animation = Animation::New(durationSeconds);
1289 bool relativeValue(true);
1290 bool finalValue( false || relativeValue );
1291 float animatorDurationSeconds(durationSeconds * 0.5f);
1292 animation.AnimateBy( Property(actor, index),
1294 TimePeriod( animatorDurationSeconds ) );
1296 // Start the animation
1299 bool signalReceived(false);
1300 AnimationFinishCheck finishCheck(signalReceived);
1301 animation.FinishedSignal().Connect(&application, finishCheck);
1303 application.SendNotification();
1304 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
1306 // We didn't expect the animation to finish yet
1307 application.SendNotification();
1308 finishCheck.CheckSignalNotReceived();
1309 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1311 application.SendNotification();
1312 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
1314 // We didn't expect the animation to finish yet...
1315 application.SendNotification();
1316 finishCheck.CheckSignalNotReceived();
1318 // ...however we should have reached the final value
1319 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1321 application.SendNotification();
1322 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
1324 // We did expect the animation to finish
1325 application.SendNotification();
1326 finishCheck.CheckSignalReceived();
1327 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1329 // Check that nothing has changed after a couple of buffer swaps
1330 application.Render(0);
1331 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1332 application.Render(0);
1333 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1337 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriod(void)
1339 TestApplication application;
1341 Actor actor = Actor::New();
1343 // Register a boolean property
1344 bool startValue(false);
1345 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1346 Stage::GetCurrent().Add(actor);
1347 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1349 // Build the animation
1350 float durationSeconds(2.0f);
1351 Animation animation = Animation::New(durationSeconds);
1352 bool relativeValue(true);
1353 bool finalValue( false || relativeValue );
1354 float animatorDurationSeconds(durationSeconds * 0.5f);
1355 animation.AnimateBy( Property(actor, index),
1357 AlphaFunctions::EaseInOut,
1358 TimePeriod( animatorDurationSeconds ) );
1360 // Start the animation
1363 bool signalReceived(false);
1364 AnimationFinishCheck finishCheck(signalReceived);
1365 animation.FinishedSignal().Connect(&application, finishCheck);
1367 application.SendNotification();
1368 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
1370 // We didn't expect the animation to finish yet
1371 application.SendNotification();
1372 finishCheck.CheckSignalNotReceived();
1373 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
1375 application.SendNotification();
1376 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
1378 // We didn't expect the animation to finish yet...
1379 application.SendNotification();
1380 finishCheck.CheckSignalNotReceived();
1382 // ...however we should have reached the final value
1383 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1385 application.SendNotification();
1386 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
1388 // We did expect the animation to finish
1389 application.SendNotification();
1390 finishCheck.CheckSignalReceived();
1391 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1393 // Check that nothing has changed after a couple of buffer swaps
1394 application.Render(0);
1395 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1396 application.Render(0);
1397 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
1401 int UtcDaliAnimationAnimateByFloat(void)
1403 TestApplication application;
1405 Actor actor = Actor::New();
1407 // Register a float property
1408 float startValue(10.0f);
1409 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1410 Stage::GetCurrent().Add(actor);
1411 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1413 // Build the animation
1414 float durationSeconds(2.0f);
1415 Animation animation = Animation::New(durationSeconds);
1416 float targetValue(50.0f);
1417 float relativeValue(targetValue - startValue);
1418 animation.AnimateBy(Property(actor, index), relativeValue);
1420 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1422 // Start the animation
1425 bool signalReceived(false);
1426 AnimationFinishCheck finishCheck(signalReceived);
1427 animation.FinishedSignal().Connect(&application, finishCheck);
1429 application.SendNotification();
1430 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1432 // We didn't expect the animation to finish yet
1433 application.SendNotification();
1434 finishCheck.CheckSignalNotReceived();
1435 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
1437 application.SendNotification();
1438 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1440 // We did expect the animation to finish
1441 application.SendNotification();
1442 finishCheck.CheckSignalReceived();
1443 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1445 // Check that nothing has changed after a couple of buffer swaps
1446 application.Render(0);
1447 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1448 application.Render(0);
1449 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1453 int UtcDaliAnimationAnimateByFloatAlphaFunction(void)
1455 TestApplication application;
1457 Actor actor = Actor::New();
1459 // Register a float property
1460 float startValue(10.0f);
1461 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1462 Stage::GetCurrent().Add(actor);
1463 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1465 // Build the animation
1466 float durationSeconds(1.0f);
1467 Animation animation = Animation::New(durationSeconds);
1468 float targetValue(90.0f);
1469 float relativeValue(targetValue - startValue);
1470 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1472 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1474 // Start the animation
1477 bool signalReceived(false);
1478 AnimationFinishCheck finishCheck(signalReceived);
1479 animation.FinishedSignal().Connect(&application, finishCheck);
1481 application.SendNotification();
1482 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1484 // We didn't expect the animation to finish yet
1485 application.SendNotification();
1486 finishCheck.CheckSignalNotReceived();
1488 // The position should have moved more, than with a linear alpha function
1489 float current(actor.GetProperty<float>(index));
1490 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
1492 application.SendNotification();
1493 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1495 // We did expect the animation to finish
1496 application.SendNotification();
1497 finishCheck.CheckSignalReceived();
1498 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1500 // Check that nothing has changed after a couple of buffer swaps
1501 application.Render(0);
1502 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1503 application.Render(0);
1504 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1508 int UtcDaliAnimationAnimateByFloatTimePeriod(void)
1510 TestApplication application;
1512 Actor actor = Actor::New();
1514 // Register a float property
1515 float startValue(10.0f);
1516 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1517 Stage::GetCurrent().Add(actor);
1518 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1520 // Build the animation
1521 float durationSeconds(1.0f);
1522 Animation animation = Animation::New(durationSeconds);
1523 float targetValue(30.0f);
1524 float relativeValue(targetValue - startValue);
1526 animation.AnimateBy(Property(actor, index),
1528 TimePeriod(delay, durationSeconds - delay));
1530 // Start the animation
1533 bool signalReceived(false);
1534 AnimationFinishCheck finishCheck(signalReceived);
1535 animation.FinishedSignal().Connect(&application, finishCheck);
1537 application.SendNotification();
1538 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1540 // We didn't expect the animation to finish yet
1541 application.SendNotification();
1542 finishCheck.CheckSignalNotReceived();
1543 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1545 application.SendNotification();
1546 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1548 // We didn't expect the animation to finish yet
1549 application.SendNotification();
1550 finishCheck.CheckSignalNotReceived();
1551 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1553 application.SendNotification();
1554 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1556 // We did expect the animation to finish
1557 application.SendNotification();
1558 finishCheck.CheckSignalReceived();
1559 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1561 // Check that nothing has changed after a couple of buffer swaps
1562 application.Render(0);
1563 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1564 application.Render(0);
1565 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1569 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriod(void)
1571 TestApplication application;
1573 Actor actor = Actor::New();
1575 // Register a float property
1576 float startValue(10.0f);
1577 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1578 Stage::GetCurrent().Add(actor);
1579 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1581 // Build the animation
1582 float durationSeconds(1.0f);
1583 Animation animation = Animation::New(durationSeconds);
1584 float targetValue(30.0f);
1585 float relativeValue(targetValue - startValue);
1587 animation.AnimateBy(Property(actor, index),
1589 AlphaFunctions::Linear,
1590 TimePeriod(delay, durationSeconds - delay));
1592 // Start the animation
1595 bool signalReceived(false);
1596 AnimationFinishCheck finishCheck(signalReceived);
1597 animation.FinishedSignal().Connect(&application, finishCheck);
1599 application.SendNotification();
1600 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1602 // We didn't expect the animation to finish yet
1603 application.SendNotification();
1604 finishCheck.CheckSignalNotReceived();
1605 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
1607 application.SendNotification();
1608 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1610 // We didn't expect the animation to finish yet
1611 application.SendNotification();
1612 finishCheck.CheckSignalNotReceived();
1613 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1615 application.SendNotification();
1616 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1618 // We did expect the animation to finish
1619 application.SendNotification();
1620 finishCheck.CheckSignalReceived();
1621 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1623 // Check that nothing has changed after a couple of buffer swaps
1624 application.Render(0);
1625 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1626 application.Render(0);
1627 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
1631 int UtcDaliAnimationAnimateByVector2(void)
1633 TestApplication application;
1635 Actor actor = Actor::New();
1637 // Register a Vector2 property
1638 Vector2 startValue(10.0f, 10.0f);
1639 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1640 Stage::GetCurrent().Add(actor);
1641 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1643 // Build the animation
1644 float durationSeconds(2.0f);
1645 Animation animation = Animation::New(durationSeconds);
1646 Vector2 targetValue(60.0f, 60.0f);
1647 Vector2 relativeValue(targetValue - startValue);
1648 animation.AnimateBy(Property(actor, index), relativeValue);
1650 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1652 // Start the animation
1655 bool signalReceived(false);
1656 AnimationFinishCheck finishCheck(signalReceived);
1657 animation.FinishedSignal().Connect(&application, finishCheck);
1659 application.SendNotification();
1660 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1662 // We didn't expect the animation to finish yet
1663 application.SendNotification();
1664 finishCheck.CheckSignalNotReceived();
1665 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
1667 application.SendNotification();
1668 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1670 // We did expect the animation to finish
1671 application.SendNotification();
1672 finishCheck.CheckSignalReceived();
1673 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1675 // Check that nothing has changed after a couple of buffer swaps
1676 application.Render(0);
1677 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1678 application.Render(0);
1679 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1683 int UtcDaliAnimationAnimateByVector2AlphaFunction(void)
1685 TestApplication application;
1687 Actor actor = Actor::New();
1689 // Register a Vector2 property
1690 Vector2 startValue(100.0f, 100.0f);
1691 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1692 Stage::GetCurrent().Add(actor);
1693 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1695 // Build the animation
1696 float durationSeconds(1.0f);
1697 Animation animation = Animation::New(durationSeconds);
1698 Vector2 targetValue(20.0f, 20.0f);
1699 Vector2 relativeValue(targetValue - startValue);
1700 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1702 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1704 // Start the animation
1707 bool signalReceived(false);
1708 AnimationFinishCheck finishCheck(signalReceived);
1709 animation.FinishedSignal().Connect(&application, finishCheck);
1711 application.SendNotification();
1712 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1714 // We didn't expect the animation to finish yet
1715 application.SendNotification();
1716 finishCheck.CheckSignalNotReceived();
1718 // The position should have moved more, than with a linear alpha function
1719 Vector2 current(actor.GetProperty<Vector2>(index));
1720 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
1721 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
1723 application.SendNotification();
1724 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1726 // We did expect the animation to finish
1727 application.SendNotification();
1728 finishCheck.CheckSignalReceived();
1729 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1731 // Check that nothing has changed after a couple of buffer swaps
1732 application.Render(0);
1733 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1734 application.Render(0);
1735 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1739 int UtcDaliAnimationAnimateByVector2TimePeriod(void)
1741 TestApplication application;
1743 Actor actor = Actor::New();
1745 // Register a Vector2 property
1746 Vector2 startValue(10.0f, 10.0f);
1747 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1748 Stage::GetCurrent().Add(actor);
1749 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1751 // Build the animation
1752 float durationSeconds(1.0f);
1753 Animation animation = Animation::New(durationSeconds);
1754 Vector2 targetValue(30.0f, 30.0f);
1755 Vector2 relativeValue(targetValue - startValue);
1757 animation.AnimateBy(Property(actor, index),
1759 TimePeriod(delay, durationSeconds - delay));
1761 // Start the animation
1764 bool signalReceived(false);
1765 AnimationFinishCheck finishCheck(signalReceived);
1766 animation.FinishedSignal().Connect(&application, finishCheck);
1768 application.SendNotification();
1769 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1771 // We didn't expect the animation to finish yet
1772 application.SendNotification();
1773 finishCheck.CheckSignalNotReceived();
1774 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1776 application.SendNotification();
1777 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1779 // We didn't expect the animation to finish yet
1780 application.SendNotification();
1781 finishCheck.CheckSignalNotReceived();
1782 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1784 application.SendNotification();
1785 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1787 // We did expect the animation to finish
1788 application.SendNotification();
1789 finishCheck.CheckSignalReceived();
1790 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1792 // Check that nothing has changed after a couple of buffer swaps
1793 application.Render(0);
1794 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1795 application.Render(0);
1796 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1800 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriod(void)
1802 TestApplication application;
1804 Actor actor = Actor::New();
1806 // Register a Vector2 property
1807 Vector2 startValue(5.0f, 5.0f);
1808 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1809 Stage::GetCurrent().Add(actor);
1810 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1812 // Build the animation
1813 float durationSeconds(1.0f);
1814 Animation animation = Animation::New(durationSeconds);
1815 Vector2 targetValue(10.0f, 10.0f);
1816 Vector2 relativeValue(targetValue - startValue);
1818 animation.AnimateBy(Property(actor, index),
1820 AlphaFunctions::Linear,
1821 TimePeriod(delay, durationSeconds - delay));
1823 // Start the animation
1826 bool signalReceived(false);
1827 AnimationFinishCheck finishCheck(signalReceived);
1828 animation.FinishedSignal().Connect(&application, finishCheck);
1830 application.SendNotification();
1831 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
1833 // We didn't expect the animation to finish yet
1834 application.SendNotification();
1835 finishCheck.CheckSignalNotReceived();
1836 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
1838 application.SendNotification();
1839 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
1841 // We didn't expect the animation to finish yet
1842 application.SendNotification();
1843 finishCheck.CheckSignalNotReceived();
1844 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
1846 application.SendNotification();
1847 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
1849 // We did expect the animation to finish
1850 application.SendNotification();
1851 finishCheck.CheckSignalReceived();
1852 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1854 // Check that nothing has changed after a couple of buffer swaps
1855 application.Render(0);
1856 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1857 application.Render(0);
1858 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
1862 int UtcDaliAnimationAnimateByVector3(void)
1864 TestApplication application;
1866 Actor actor = Actor::New();
1868 // Register a Vector3 property
1869 Vector3 startValue(10.0f, 10.0f, 10.0f);
1870 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1871 Stage::GetCurrent().Add(actor);
1872 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1874 // Build the animation
1875 float durationSeconds(2.0f);
1876 Animation animation = Animation::New(durationSeconds);
1877 Vector3 targetValue(60.0f, 60.0f, 60.0f);
1878 Vector3 relativeValue(targetValue - startValue);
1879 animation.AnimateBy(Property(actor, index), relativeValue);
1881 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1883 // Start the animation
1886 bool signalReceived(false);
1887 AnimationFinishCheck finishCheck(signalReceived);
1888 animation.FinishedSignal().Connect(&application, finishCheck);
1890 application.SendNotification();
1891 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1893 // We didn't expect the animation to finish yet
1894 application.SendNotification();
1895 finishCheck.CheckSignalNotReceived();
1896 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
1898 application.SendNotification();
1899 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1901 // We did expect the animation to finish
1902 application.SendNotification();
1903 finishCheck.CheckSignalReceived();
1904 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1906 // Check that nothing has changed after a couple of buffer swaps
1907 application.Render(0);
1908 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1909 application.Render(0);
1910 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1914 int UtcDaliAnimationAnimateByVector3AlphaFunction(void)
1916 TestApplication application;
1918 Actor actor = Actor::New();
1920 // Register a Vector3 property
1921 Vector3 startValue(100.0f, 100.0f, 100.0f);
1922 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1923 Stage::GetCurrent().Add(actor);
1924 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1926 // Build the animation
1927 float durationSeconds(1.0f);
1928 Animation animation = Animation::New(durationSeconds);
1929 Vector3 targetValue(20.0f, 20.0f, 20.0f);
1930 Vector3 relativeValue(targetValue - startValue);
1931 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
1933 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
1935 // Start the animation
1938 bool signalReceived(false);
1939 AnimationFinishCheck finishCheck(signalReceived);
1940 animation.FinishedSignal().Connect(&application, finishCheck);
1942 application.SendNotification();
1943 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
1945 // We didn't expect the animation to finish yet
1946 application.SendNotification();
1947 finishCheck.CheckSignalNotReceived();
1949 // The position should have moved more, than with a linear alpha function
1950 Vector3 current(actor.GetProperty<Vector3>(index));
1951 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
1952 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
1953 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
1955 application.SendNotification();
1956 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
1958 // We did expect the animation to finish
1959 application.SendNotification();
1960 finishCheck.CheckSignalReceived();
1961 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1963 // Check that nothing has changed after a couple of buffer swaps
1964 application.Render(0);
1965 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1966 application.Render(0);
1967 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
1971 int UtcDaliAnimationAnimateByVector3TimePeriod(void)
1973 TestApplication application;
1975 Actor actor = Actor::New();
1977 // Register a Vector3 property
1978 Vector3 startValue(10.0f, 10.0f, 10.0f);
1979 Property::Index index = actor.RegisterProperty( "test-property", startValue );
1980 Stage::GetCurrent().Add(actor);
1981 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
1983 // Build the animation
1984 float durationSeconds(1.0f);
1985 Animation animation = Animation::New(durationSeconds);
1986 Vector3 targetValue(30.0f, 30.0f, 30.0f);
1987 Vector3 relativeValue(targetValue - startValue);
1989 animation.AnimateBy(Property(actor, index),
1991 TimePeriod(delay, durationSeconds - delay));
1993 // Start the animation
1996 bool signalReceived(false);
1997 AnimationFinishCheck finishCheck(signalReceived);
1998 animation.FinishedSignal().Connect(&application, finishCheck);
2000 application.SendNotification();
2001 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2003 // We didn't expect the animation to finish yet
2004 application.SendNotification();
2005 finishCheck.CheckSignalNotReceived();
2006 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2008 application.SendNotification();
2009 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2011 // We didn't expect the animation to finish yet
2012 application.SendNotification();
2013 finishCheck.CheckSignalNotReceived();
2014 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2016 application.SendNotification();
2017 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2019 // We did expect the animation to finish
2020 application.SendNotification();
2021 finishCheck.CheckSignalReceived();
2022 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2024 // Check that nothing has changed after a couple of buffer swaps
2025 application.Render(0);
2026 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2027 application.Render(0);
2028 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2032 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriod(void)
2034 TestApplication application;
2036 Actor actor = Actor::New();
2038 // Register a Vector3 property
2039 Vector3 startValue(5.0f, 5.0f, 5.0f);
2040 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2041 Stage::GetCurrent().Add(actor);
2042 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2044 // Build the animation
2045 float durationSeconds(1.0f);
2046 Animation animation = Animation::New(durationSeconds);
2047 Vector3 targetValue(10.0f, 10.0f, 10.0f);
2048 Vector3 relativeValue(targetValue - startValue);
2050 animation.AnimateBy(Property(actor, index),
2052 AlphaFunctions::Linear,
2053 TimePeriod(delay, durationSeconds - delay));
2055 // Start the animation
2058 bool signalReceived(false);
2059 AnimationFinishCheck finishCheck(signalReceived);
2060 animation.FinishedSignal().Connect(&application, finishCheck);
2062 application.SendNotification();
2063 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2065 // We didn't expect the animation to finish yet
2066 application.SendNotification();
2067 finishCheck.CheckSignalNotReceived();
2068 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
2070 application.SendNotification();
2071 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2073 // We didn't expect the animation to finish yet
2074 application.SendNotification();
2075 finishCheck.CheckSignalNotReceived();
2076 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2078 application.SendNotification();
2079 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2081 // We did expect the animation to finish
2082 application.SendNotification();
2083 finishCheck.CheckSignalReceived();
2084 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2086 // Check that nothing has changed after a couple of buffer swaps
2087 application.Render(0);
2088 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2089 application.Render(0);
2090 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
2094 int UtcDaliAnimationAnimateByVector4(void)
2096 TestApplication application;
2098 Actor actor = Actor::New();
2100 // Register a Vector4 property
2101 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
2102 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2103 Stage::GetCurrent().Add(actor);
2104 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2106 // Build the animation
2107 float durationSeconds(2.0f);
2108 Animation animation = Animation::New(durationSeconds);
2109 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
2110 Vector4 relativeValue(targetValue - startValue);
2111 animation.AnimateBy(Property(actor, index), relativeValue);
2113 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2115 // Start the animation
2118 bool signalReceived(false);
2119 AnimationFinishCheck finishCheck(signalReceived);
2120 animation.FinishedSignal().Connect(&application, finishCheck);
2122 application.SendNotification();
2123 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2125 // We didn't expect the animation to finish yet
2126 application.SendNotification();
2127 finishCheck.CheckSignalNotReceived();
2128 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
2130 application.SendNotification();
2131 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2133 // We did expect the animation to finish
2134 application.SendNotification();
2135 finishCheck.CheckSignalReceived();
2136 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2138 // Check that nothing has changed after a couple of buffer swaps
2139 application.Render(0);
2140 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2141 application.Render(0);
2142 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2146 int UtcDaliAnimationAnimateByVector4AlphaFunction(void)
2148 TestApplication application;
2150 Actor actor = Actor::New();
2152 // Register a Vector4 property
2153 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
2154 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2155 Stage::GetCurrent().Add(actor);
2156 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2158 // Build the animation
2159 float durationSeconds(1.0f);
2160 Animation animation = Animation::New(durationSeconds);
2161 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
2162 Vector4 relativeValue(targetValue - startValue);
2163 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
2165 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2167 // Start the animation
2170 bool signalReceived(false);
2171 AnimationFinishCheck finishCheck(signalReceived);
2172 animation.FinishedSignal().Connect(&application, finishCheck);
2174 application.SendNotification();
2175 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2177 // We didn't expect the animation to finish yet
2178 application.SendNotification();
2179 finishCheck.CheckSignalNotReceived();
2181 // The position should have moved more, than with a linear alpha function
2182 Vector4 current(actor.GetProperty<Vector4>(index));
2183 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
2184 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
2185 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
2186 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
2188 application.SendNotification();
2189 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2191 // We did expect the animation to finish
2192 application.SendNotification();
2193 finishCheck.CheckSignalReceived();
2194 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2196 // Check that nothing has changed after a couple of buffer swaps
2197 application.Render(0);
2198 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2199 application.Render(0);
2200 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2204 int UtcDaliAnimationAnimateByVector4TimePeriod(void)
2206 TestApplication application;
2208 Actor actor = Actor::New();
2210 // Register a Vector4 property
2211 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
2212 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2213 Stage::GetCurrent().Add(actor);
2214 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2216 // Build the animation
2217 float durationSeconds(1.0f);
2218 Animation animation = Animation::New(durationSeconds);
2219 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
2220 Vector4 relativeValue(targetValue - startValue);
2222 animation.AnimateBy(Property(actor, index),
2224 TimePeriod(delay, durationSeconds - delay));
2226 // Start the animation
2229 bool signalReceived(false);
2230 AnimationFinishCheck finishCheck(signalReceived);
2231 animation.FinishedSignal().Connect(&application, finishCheck);
2233 application.SendNotification();
2234 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2236 // We didn't expect the animation to finish yet
2237 application.SendNotification();
2238 finishCheck.CheckSignalNotReceived();
2239 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2241 application.SendNotification();
2242 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2244 // We didn't expect the animation to finish yet
2245 application.SendNotification();
2246 finishCheck.CheckSignalNotReceived();
2247 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2249 application.SendNotification();
2250 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2252 // We did expect the animation to finish
2253 application.SendNotification();
2254 finishCheck.CheckSignalReceived();
2255 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2257 // Check that nothing has changed after a couple of buffer swaps
2258 application.Render(0);
2259 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2260 application.Render(0);
2261 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2265 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriod(void)
2267 TestApplication application;
2269 Actor actor = Actor::New();
2271 // Register a Vector4 property
2272 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
2273 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2274 Stage::GetCurrent().Add(actor);
2275 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2277 // Build the animation
2278 float durationSeconds(1.0f);
2279 Animation animation = Animation::New(durationSeconds);
2280 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
2281 Vector4 relativeValue(targetValue - startValue);
2283 animation.AnimateBy(Property(actor, index),
2285 AlphaFunctions::Linear,
2286 TimePeriod(delay, durationSeconds - delay));
2288 // Start the animation
2291 bool signalReceived(false);
2292 AnimationFinishCheck finishCheck(signalReceived);
2293 animation.FinishedSignal().Connect(&application, finishCheck);
2295 application.SendNotification();
2296 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2298 // We didn't expect the animation to finish yet
2299 application.SendNotification();
2300 finishCheck.CheckSignalNotReceived();
2301 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
2303 application.SendNotification();
2304 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2306 // We didn't expect the animation to finish yet
2307 application.SendNotification();
2308 finishCheck.CheckSignalNotReceived();
2309 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2311 application.SendNotification();
2312 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2314 // We did expect the animation to finish
2315 application.SendNotification();
2316 finishCheck.CheckSignalReceived();
2317 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2319 // Check that nothing has changed after a couple of buffer swaps
2320 application.Render(0);
2321 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2322 application.Render(0);
2323 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
2327 int UtcDaliAnimationAnimateByActorPosition(void)
2329 TestApplication application;
2331 Actor actor = Actor::New();
2332 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2333 actor.SetPosition(startPosition);
2334 Stage::GetCurrent().Add(actor);
2335 application.SendNotification();
2336 application.Render(0);
2337 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2339 // Build the animation
2340 float durationSeconds(1.0f);
2341 Animation animation = Animation::New(durationSeconds);
2342 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2343 Vector3 relativePosition(targetPosition - startPosition);
2344 animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition);
2346 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2348 // Start the animation
2351 bool signalReceived(false);
2352 AnimationFinishCheck finishCheck(signalReceived);
2353 animation.FinishedSignal().Connect(&application, finishCheck);
2355 application.SendNotification();
2356 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2358 // We didn't expect the animation to finish yet
2359 application.SendNotification();
2360 finishCheck.CheckSignalNotReceived();
2361 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
2363 application.SendNotification();
2364 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2366 // We did expect the animation to finish
2367 application.SendNotification();
2368 finishCheck.CheckSignalReceived();
2369 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2371 // Check that nothing has changed after a couple of buffer swaps
2372 application.Render(0);
2373 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2374 application.Render(0);
2375 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2379 int UtcDaliAnimationAnimateByActorPositionAlphaFunction(void)
2381 TestApplication application;
2383 Actor actor = Actor::New();
2384 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2385 actor.SetPosition(startPosition);
2386 Stage::GetCurrent().Add(actor);
2387 application.SendNotification();
2388 application.Render(0);
2389 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2391 // Build the animation
2392 float durationSeconds(1.0f);
2393 Animation animation = Animation::New(durationSeconds);
2394 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2395 Vector3 relativePosition(targetPosition - startPosition);
2396 animation.AnimateBy(Property(actor, Actor::POSITION), relativePosition, AlphaFunctions::EaseOut);
2398 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2400 // Start the animation
2403 bool signalReceived(false);
2404 AnimationFinishCheck finishCheck(signalReceived);
2405 animation.FinishedSignal().Connect(&application, finishCheck);
2407 application.SendNotification();
2408 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2410 // We didn't expect the animation to finish yet
2411 application.SendNotification();
2412 finishCheck.CheckSignalNotReceived();
2414 // The position should have moved more, than with a linear alpha function
2415 Vector3 current(actor.GetCurrentPosition());
2416 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
2417 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
2418 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
2420 application.SendNotification();
2421 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2423 // We did expect the animation to finish
2424 application.SendNotification();
2425 finishCheck.CheckSignalReceived();
2426 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2428 // Check that nothing has changed after a couple of buffer swaps
2429 application.Render(0);
2430 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2431 application.Render(0);
2432 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2436 int UtcDaliAnimationAnimateByActorPositionTimePeriod(void)
2438 TestApplication application;
2440 Actor actor = Actor::New();
2441 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2442 actor.SetPosition(startPosition);
2443 Stage::GetCurrent().Add(actor);
2444 application.SendNotification();
2445 application.Render(0);
2446 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2448 // Build the animation
2449 float durationSeconds(1.0f);
2450 Animation animation = Animation::New(durationSeconds);
2451 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2452 Vector3 relativePosition(targetPosition - startPosition);
2454 animation.AnimateBy(Property(actor, Actor::POSITION),
2456 TimePeriod(delay, durationSeconds - delay));
2458 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2460 // Start the animation
2463 bool signalReceived(false);
2464 AnimationFinishCheck finishCheck(signalReceived);
2465 animation.FinishedSignal().Connect(&application, finishCheck);
2467 application.SendNotification();
2468 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2470 // We didn't expect the animation to finish yet
2471 application.SendNotification();
2472 finishCheck.CheckSignalNotReceived();
2473 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2475 application.SendNotification();
2476 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2478 // We did expect the animation to finish
2479 application.SendNotification();
2480 finishCheck.CheckSignalReceived();
2481 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2483 // Check that nothing has changed after a couple of buffer swaps
2484 application.Render(0);
2485 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2486 application.Render(0);
2487 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2491 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriod(void)
2493 TestApplication application;
2495 Actor actor = Actor::New();
2496 Vector3 startPosition(10.0f, 10.0f, 10.0f);
2497 actor.SetPosition(startPosition);
2498 Stage::GetCurrent().Add(actor);
2499 application.SendNotification();
2500 application.Render(0);
2501 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2503 // Build the animation
2504 float durationSeconds(1.0f);
2505 Animation animation = Animation::New(durationSeconds);
2506 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
2507 Vector3 relativePosition(targetPosition - startPosition);
2509 animation.AnimateBy(Property(actor, Actor::POSITION),
2511 AlphaFunctions::Linear,
2512 TimePeriod(delay, durationSeconds - delay));
2514 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
2516 // Start the animation
2519 bool signalReceived(false);
2520 AnimationFinishCheck finishCheck(signalReceived);
2521 animation.FinishedSignal().Connect(&application, finishCheck);
2523 application.SendNotification();
2524 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2526 // We didn't expect the animation to finish yet
2527 application.SendNotification();
2528 finishCheck.CheckSignalNotReceived();
2529 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
2531 application.SendNotification();
2532 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2534 // We did expect the animation to finish
2535 application.SendNotification();
2536 finishCheck.CheckSignalReceived();
2537 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2539 // Check that nothing has changed after a couple of buffer swaps
2540 application.Render(0);
2541 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2542 application.Render(0);
2543 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2547 int UtcDaliAnimationAnimateToBoolean(void)
2549 TestApplication application;
2551 Actor actor = Actor::New();
2553 // Register a boolean property
2554 const bool startValue(false);
2555 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2556 Stage::GetCurrent().Add(actor);
2557 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2559 // Build the animation
2560 float durationSeconds(2.0f);
2561 Animation animation = Animation::New(durationSeconds);
2562 const bool targetValue( !startValue );
2563 animation.AnimateTo(Property(actor, index), targetValue);
2565 // Start the animation
2568 bool signalReceived(false);
2569 AnimationFinishCheck finishCheck(signalReceived);
2570 animation.FinishedSignal().Connect(&application, finishCheck);
2572 application.SendNotification();
2573 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2575 // We didn't expect the animation to finish yet
2576 application.SendNotification();
2577 finishCheck.CheckSignalNotReceived();
2578 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2580 application.SendNotification();
2581 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2583 // We did expect the animation to finish
2584 application.SendNotification();
2585 finishCheck.CheckSignalReceived();
2586 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2588 // Check that nothing has changed after a couple of buffer swaps
2589 application.Render(0);
2590 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2591 application.Render(0);
2592 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2594 // Repeat with target value "false"
2595 animation = Animation::New(durationSeconds);
2596 const bool finalValue( !targetValue );
2597 animation.AnimateTo(Property(actor, index), finalValue);
2599 // Start the animation
2602 finishCheck.Reset();
2603 animation.FinishedSignal().Connect(&application, finishCheck);
2605 application.SendNotification();
2606 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2608 // We didn't expect the animation to finish yet
2609 application.SendNotification();
2610 finishCheck.CheckSignalNotReceived();
2611 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2613 application.SendNotification();
2614 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2616 // We did expect the animation to finish
2617 application.SendNotification();
2618 finishCheck.CheckSignalReceived();
2619 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2621 // Check that nothing has changed after a couple of buffer swaps
2622 application.Render(0);
2623 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2624 application.Render(0);
2625 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2629 int UtcDaliAnimationAnimateToBooleanAlphaFunction(void)
2631 TestApplication application;
2633 Actor actor = Actor::New();
2635 // Register a boolean property
2636 const bool startValue(false);
2637 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2638 Stage::GetCurrent().Add(actor);
2639 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2641 // Build the animation
2642 float durationSeconds(2.0f);
2643 Animation animation = Animation::New(durationSeconds);
2644 const bool targetValue( !startValue );
2645 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
2647 // Start the animation
2650 bool signalReceived(false);
2651 AnimationFinishCheck finishCheck(signalReceived);
2652 animation.FinishedSignal().Connect(&application, finishCheck);
2654 application.SendNotification();
2655 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2657 // We didn't expect the animation to finish yet
2658 application.SendNotification();
2659 finishCheck.CheckSignalNotReceived();
2660 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2662 application.SendNotification();
2663 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2665 // We did expect the animation to finish
2666 application.SendNotification();
2667 finishCheck.CheckSignalReceived();
2668 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2670 // Check that nothing has changed after a couple of buffer swaps
2671 application.Render(0);
2672 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2673 application.Render(0);
2674 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2676 // Repeat with target value "false"
2677 animation = Animation::New(durationSeconds);
2678 const bool finalValue( !targetValue );
2679 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunctions::EaseOut);
2681 // Start the animation
2684 finishCheck.Reset();
2685 animation.FinishedSignal().Connect(&application, finishCheck);
2687 application.SendNotification();
2688 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2690 // We didn't expect the animation to finish yet
2691 application.SendNotification();
2692 finishCheck.CheckSignalNotReceived();
2693 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
2695 application.SendNotification();
2696 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2698 // We did expect the animation to finish
2699 application.SendNotification();
2700 finishCheck.CheckSignalReceived();
2701 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2703 // Check that nothing has changed after a couple of buffer swaps
2704 application.Render(0);
2705 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2706 application.Render(0);
2707 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2711 int UtcDaliAnimationAnimateToBooleanTimePeriod(void)
2713 TestApplication application;
2715 Actor actor = Actor::New();
2717 // Register a boolean property
2718 bool startValue(false);
2719 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2720 Stage::GetCurrent().Add(actor);
2721 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2723 // Build the animation
2724 float durationSeconds(2.0f);
2725 Animation animation = Animation::New(durationSeconds);
2726 bool finalValue( !startValue );
2727 float animatorDurationSeconds(durationSeconds * 0.5f);
2728 animation.AnimateTo( Property(actor, index),
2730 TimePeriod( animatorDurationSeconds ) );
2732 // Start the animation
2735 bool signalReceived(false);
2736 AnimationFinishCheck finishCheck(signalReceived);
2737 animation.FinishedSignal().Connect(&application, finishCheck);
2739 application.SendNotification();
2740 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2742 // We didn't expect the animation to finish yet
2743 application.SendNotification();
2744 finishCheck.CheckSignalNotReceived();
2745 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2747 application.SendNotification();
2748 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2750 // We didn't expect the animation to finish yet...
2751 application.SendNotification();
2752 finishCheck.CheckSignalNotReceived();
2754 // ...however we should have reached the final value
2755 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2757 application.SendNotification();
2758 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2760 // We did expect the animation to finish
2761 application.SendNotification();
2762 finishCheck.CheckSignalReceived();
2763 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2765 // Check that nothing has changed after a couple of buffer swaps
2766 application.Render(0);
2767 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2768 application.Render(0);
2769 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2773 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriod(void)
2775 TestApplication application;
2777 Actor actor = Actor::New();
2779 // Register a boolean property
2780 bool startValue(false);
2781 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2782 Stage::GetCurrent().Add(actor);
2783 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2785 // Build the animation
2786 float durationSeconds(2.0f);
2787 Animation animation = Animation::New(durationSeconds);
2788 bool finalValue( !startValue );
2789 float animatorDurationSeconds(durationSeconds * 0.5f);
2790 animation.AnimateTo( Property(actor, index),
2792 AlphaFunctions::Linear,
2793 TimePeriod( animatorDurationSeconds ) );
2795 // Start the animation
2798 bool signalReceived(false);
2799 AnimationFinishCheck finishCheck(signalReceived);
2800 animation.FinishedSignal().Connect(&application, finishCheck);
2802 application.SendNotification();
2803 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2805 // We didn't expect the animation to finish yet
2806 application.SendNotification();
2807 finishCheck.CheckSignalNotReceived();
2808 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2810 application.SendNotification();
2811 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2813 // We didn't expect the animation to finish yet...
2814 application.SendNotification();
2815 finishCheck.CheckSignalNotReceived();
2817 // ...however we should have reached the final value
2818 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2820 application.SendNotification();
2821 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2823 // We did expect the animation to finish
2824 application.SendNotification();
2825 finishCheck.CheckSignalReceived();
2826 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2828 // Check that nothing has changed after a couple of buffer swaps
2829 application.Render(0);
2830 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2831 application.Render(0);
2832 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2836 int UtcDaliAnimationAnimateToFloat(void)
2838 TestApplication application;
2840 Actor actor = Actor::New();
2842 // Register a float property
2843 float startValue(10.0f);
2844 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2845 Stage::GetCurrent().Add(actor);
2846 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2848 // Build the animation
2849 float durationSeconds(2.0f);
2850 Animation animation = Animation::New(durationSeconds);
2851 float targetValue(50.0f);
2852 float relativeValue(targetValue - startValue);
2853 animation.AnimateTo(Property(actor, "test-property"), targetValue);
2855 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2857 // Start the animation
2860 bool signalReceived(false);
2861 AnimationFinishCheck finishCheck(signalReceived);
2862 animation.FinishedSignal().Connect(&application, finishCheck);
2864 application.SendNotification();
2865 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2867 // We didn't expect the animation to finish yet
2868 application.SendNotification();
2869 finishCheck.CheckSignalNotReceived();
2870 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
2872 application.SendNotification();
2873 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2875 // We did expect the animation to finish
2876 application.SendNotification();
2877 finishCheck.CheckSignalReceived();
2878 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2882 int UtcDaliAnimationAnimateToFloatAlphaFunction(void)
2884 TestApplication application;
2886 Actor actor = Actor::New();
2888 // Register a float property
2889 float startValue(10.0f);
2890 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2891 Stage::GetCurrent().Add(actor);
2892 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2894 // Build the animation
2895 float durationSeconds(1.0f);
2896 Animation animation = Animation::New(durationSeconds);
2897 float targetValue(90.0f);
2898 float relativeValue(targetValue - startValue);
2899 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
2901 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
2903 // Start the animation
2906 bool signalReceived(false);
2907 AnimationFinishCheck finishCheck(signalReceived);
2908 animation.FinishedSignal().Connect(&application, finishCheck);
2910 application.SendNotification();
2911 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2913 // We didn't expect the animation to finish yet
2914 application.SendNotification();
2915 finishCheck.CheckSignalNotReceived();
2917 // The position should have moved more, than with a linear alpha function
2918 float current(actor.GetProperty<float>(index));
2919 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
2921 application.SendNotification();
2922 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2924 // We did expect the animation to finish
2925 application.SendNotification();
2926 finishCheck.CheckSignalReceived();
2927 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2931 int UtcDaliAnimationAnimateToFloatTimePeriod(void)
2933 TestApplication application;
2935 Actor actor = Actor::New();
2937 // Register a float property
2938 float startValue(10.0f);
2939 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2940 Stage::GetCurrent().Add(actor);
2941 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2943 // Build the animation
2944 float durationSeconds(1.0f);
2945 Animation animation = Animation::New(durationSeconds);
2946 float targetValue(30.0f);
2947 float relativeValue(targetValue - startValue);
2949 animation.AnimateTo(Property(actor, index),
2951 TimePeriod(delay, durationSeconds - delay));
2953 // Start the animation
2956 bool signalReceived(false);
2957 AnimationFinishCheck finishCheck(signalReceived);
2958 animation.FinishedSignal().Connect(&application, finishCheck);
2960 application.SendNotification();
2961 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
2963 // We didn't expect the animation to finish yet
2964 application.SendNotification();
2965 finishCheck.CheckSignalNotReceived();
2966 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2968 application.SendNotification();
2969 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
2971 // We didn't expect the animation to finish yet
2972 application.SendNotification();
2973 finishCheck.CheckSignalNotReceived();
2974 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
2976 application.SendNotification();
2977 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
2979 // We did expect the animation to finish
2980 application.SendNotification();
2981 finishCheck.CheckSignalReceived();
2982 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
2986 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriod(void)
2988 TestApplication application;
2990 Actor actor = Actor::New();
2992 // Register a float property
2993 float startValue(10.0f);
2994 Property::Index index = actor.RegisterProperty( "test-property", startValue );
2995 Stage::GetCurrent().Add(actor);
2996 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
2998 // Build the animation
2999 float durationSeconds(1.0f);
3000 Animation animation = Animation::New(durationSeconds);
3001 float targetValue(30.0f);
3002 float relativeValue(targetValue - startValue);
3004 animation.AnimateTo(Property(actor, index),
3006 AlphaFunctions::Linear,
3007 TimePeriod(delay, durationSeconds - delay));
3009 // Start the animation
3012 bool signalReceived(false);
3013 AnimationFinishCheck finishCheck(signalReceived);
3014 animation.FinishedSignal().Connect(&application, finishCheck);
3016 application.SendNotification();
3017 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3019 // We didn't expect the animation to finish yet
3020 application.SendNotification();
3021 finishCheck.CheckSignalNotReceived();
3022 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3024 application.SendNotification();
3025 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3027 // We didn't expect the animation to finish yet
3028 application.SendNotification();
3029 finishCheck.CheckSignalNotReceived();
3030 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3032 application.SendNotification();
3033 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3035 // We did expect the animation to finish
3036 application.SendNotification();
3037 finishCheck.CheckSignalReceived();
3038 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3042 int UtcDaliAnimationAnimateToVector2(void)
3044 TestApplication application;
3046 Actor actor = Actor::New();
3048 // Register a Vector2 property
3049 Vector2 startValue(-50.0f, -50.0f);
3050 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3051 Stage::GetCurrent().Add(actor);
3052 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3054 // Build the animation
3055 float durationSeconds(2.0f);
3056 Animation animation = Animation::New(durationSeconds);
3057 Vector2 targetValue(50.0f, 50.0f);
3058 Vector2 relativeValue(targetValue - startValue);
3059 animation.AnimateTo(Property(actor, index), targetValue);
3061 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3063 // Start the animation
3066 bool signalReceived(false);
3067 AnimationFinishCheck finishCheck(signalReceived);
3068 animation.FinishedSignal().Connect(&application, finishCheck);
3070 application.SendNotification();
3071 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3073 // We didn't expect the animation to finish yet
3074 application.SendNotification();
3075 finishCheck.CheckSignalNotReceived();
3076 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
3078 application.SendNotification();
3079 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3081 // We did expect the animation to finish
3082 application.SendNotification();
3083 finishCheck.CheckSignalReceived();
3084 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3088 int UtcDaliAnimationAnimateToVector2AlphaFunction(void)
3090 TestApplication application;
3092 Actor actor = Actor::New();
3094 // Register a Vector2 property
3095 Vector2 startValue(1000.0f, 1000.0f);
3096 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3097 Stage::GetCurrent().Add(actor);
3098 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3100 // Build the animation
3101 float durationSeconds(1.0f);
3102 Animation animation = Animation::New(durationSeconds);
3103 Vector2 targetValue(9000.0f, 9000.0f);
3104 Vector2 relativeValue(targetValue - startValue);
3105 animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
3107 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3109 // Start the animation
3112 bool signalReceived(false);
3113 AnimationFinishCheck finishCheck(signalReceived);
3114 animation.FinishedSignal().Connect(&application, finishCheck);
3116 application.SendNotification();
3117 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3119 // We didn't expect the animation to finish yet
3120 application.SendNotification();
3121 finishCheck.CheckSignalNotReceived();
3123 // The position should have moved more, than with a linear alpha function
3124 Vector2 current(actor.GetProperty<Vector2>(index));
3125 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3126 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3128 application.SendNotification();
3129 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3131 // We did expect the animation to finish
3132 application.SendNotification();
3133 finishCheck.CheckSignalReceived();
3134 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3138 int UtcDaliAnimationAnimateToVector2TimePeriod(void)
3140 TestApplication application;
3142 Actor actor = Actor::New();
3144 // Register a Vector2 property
3145 Vector2 startValue(10.0f, 10.0f);
3146 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3147 Stage::GetCurrent().Add(actor);
3148 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3150 // Build the animation
3151 float durationSeconds(1.0f);
3152 Animation animation = Animation::New(durationSeconds);
3153 Vector2 targetValue(-10.0f, 20.0f);
3154 Vector2 relativeValue(targetValue - startValue);
3156 animation.AnimateTo(Property(actor, index),
3158 TimePeriod(delay, durationSeconds - delay));
3160 // Start the animation
3163 bool signalReceived(false);
3164 AnimationFinishCheck finishCheck(signalReceived);
3165 animation.FinishedSignal().Connect(&application, finishCheck);
3167 application.SendNotification();
3168 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3170 // We didn't expect the animation to finish yet
3171 application.SendNotification();
3172 finishCheck.CheckSignalNotReceived();
3173 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3175 application.SendNotification();
3176 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3178 // We didn't expect the animation to finish yet
3179 application.SendNotification();
3180 finishCheck.CheckSignalNotReceived();
3181 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3183 application.SendNotification();
3184 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3186 // We did expect the animation to finish
3187 application.SendNotification();
3188 finishCheck.CheckSignalReceived();
3189 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3193 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriod(void)
3195 TestApplication application;
3197 Actor actor = Actor::New();
3199 // Register a Vector2 property
3200 Vector2 startValue(10.0f, 10.0f);
3201 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3202 Stage::GetCurrent().Add(actor);
3203 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3205 // Build the animation
3206 float durationSeconds(1.0f);
3207 Animation animation = Animation::New(durationSeconds);
3208 Vector2 targetValue(30.0f, 30.0f);
3209 Vector2 relativeValue(targetValue - startValue);
3211 animation.AnimateTo(Property(actor, index),
3213 AlphaFunctions::Linear,
3214 TimePeriod(delay, durationSeconds - delay));
3216 // Start the animation
3219 bool signalReceived(false);
3220 AnimationFinishCheck finishCheck(signalReceived);
3221 animation.FinishedSignal().Connect(&application, finishCheck);
3223 application.SendNotification();
3224 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3226 // We didn't expect the animation to finish yet
3227 application.SendNotification();
3228 finishCheck.CheckSignalNotReceived();
3229 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3231 application.SendNotification();
3232 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3234 // We didn't expect the animation to finish yet
3235 application.SendNotification();
3236 finishCheck.CheckSignalNotReceived();
3237 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3239 application.SendNotification();
3240 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3242 // We did expect the animation to finish
3243 application.SendNotification();
3244 finishCheck.CheckSignalReceived();
3245 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3249 int UtcDaliAnimationAnimateToVector3(void)
3251 TestApplication application;
3253 Actor actor = Actor::New();
3255 // Register a Vector3 property
3256 Vector3 startValue(-50.0f, -50.0f, -50.0f);
3257 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3258 Stage::GetCurrent().Add(actor);
3259 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3261 // Build the animation
3262 float durationSeconds(2.0f);
3263 Animation animation = Animation::New(durationSeconds);
3264 Vector3 targetValue(50.0f, 50.0f, 50.0f);
3265 Vector3 relativeValue(targetValue - startValue);
3266 animation.AnimateTo(Property(actor, index), targetValue);
3268 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3270 // Start the animation
3273 bool signalReceived(false);
3274 AnimationFinishCheck finishCheck(signalReceived);
3275 animation.FinishedSignal().Connect(&application, finishCheck);
3277 application.SendNotification();
3278 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3280 // We didn't expect the animation to finish yet
3281 application.SendNotification();
3282 finishCheck.CheckSignalNotReceived();
3283 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
3285 application.SendNotification();
3286 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3288 // We did expect the animation to finish
3289 application.SendNotification();
3290 finishCheck.CheckSignalReceived();
3291 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3295 int UtcDaliAnimationAnimateToVector3AlphaFunction(void)
3297 TestApplication application;
3299 Actor actor = Actor::New();
3301 // Register a Vector3 property
3302 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
3303 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3304 Stage::GetCurrent().Add(actor);
3305 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3307 // Build the animation
3308 float durationSeconds(1.0f);
3309 Animation animation = Animation::New(durationSeconds);
3310 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
3311 Vector3 relativeValue(targetValue - startValue);
3312 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
3314 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3316 // Start the animation
3319 bool signalReceived(false);
3320 AnimationFinishCheck finishCheck(signalReceived);
3321 animation.FinishedSignal().Connect(&application, finishCheck);
3323 application.SendNotification();
3324 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3326 // We didn't expect the animation to finish yet
3327 application.SendNotification();
3328 finishCheck.CheckSignalNotReceived();
3330 // The position should have moved more, than with a linear alpha function
3331 Vector3 current(actor.GetProperty<Vector3>(index));
3332 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3333 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3334 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3336 application.SendNotification();
3337 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3339 // We did expect the animation to finish
3340 application.SendNotification();
3341 finishCheck.CheckSignalReceived();
3342 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3346 int UtcDaliAnimationAnimateToVector3TimePeriod(void)
3348 TestApplication application;
3350 Actor actor = Actor::New();
3352 // Register a Vector3 property
3353 Vector3 startValue(10.0f, 10.0f, 10.0f);
3354 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3355 Stage::GetCurrent().Add(actor);
3356 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3358 // Build the animation
3359 float durationSeconds(1.0f);
3360 Animation animation = Animation::New(durationSeconds);
3361 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
3362 Vector3 relativeValue(targetValue - startValue);
3364 animation.AnimateTo(Property(actor, index),
3366 TimePeriod(delay, durationSeconds - delay));
3368 // Start the animation
3371 bool signalReceived(false);
3372 AnimationFinishCheck finishCheck(signalReceived);
3373 animation.FinishedSignal().Connect(&application, finishCheck);
3375 application.SendNotification();
3376 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3378 // We didn't expect the animation to finish yet
3379 application.SendNotification();
3380 finishCheck.CheckSignalNotReceived();
3381 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3383 application.SendNotification();
3384 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3386 // We didn't expect the animation to finish yet
3387 application.SendNotification();
3388 finishCheck.CheckSignalNotReceived();
3389 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3391 application.SendNotification();
3392 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3394 // We did expect the animation to finish
3395 application.SendNotification();
3396 finishCheck.CheckSignalReceived();
3397 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3401 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriod(void)
3403 TestApplication application;
3405 Actor actor = Actor::New();
3407 // Register a Vector3 property
3408 Vector3 startValue(10.0f, 10.0f, 10.0f);
3409 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3410 Stage::GetCurrent().Add(actor);
3411 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3413 // Build the animation
3414 float durationSeconds(1.0f);
3415 Animation animation = Animation::New(durationSeconds);
3416 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3417 Vector3 relativeValue(targetValue - startValue);
3419 animation.AnimateTo(Property(actor, "test-property"),
3421 AlphaFunctions::Linear,
3422 TimePeriod(delay, durationSeconds - delay));
3424 // Start the animation
3427 bool signalReceived(false);
3428 AnimationFinishCheck finishCheck(signalReceived);
3429 animation.FinishedSignal().Connect(&application, finishCheck);
3431 application.SendNotification();
3432 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3434 // We didn't expect the animation to finish yet
3435 application.SendNotification();
3436 finishCheck.CheckSignalNotReceived();
3437 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3439 application.SendNotification();
3440 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3442 // We didn't expect the animation to finish yet
3443 application.SendNotification();
3444 finishCheck.CheckSignalNotReceived();
3445 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3447 application.SendNotification();
3448 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3450 // We did expect the animation to finish
3451 application.SendNotification();
3452 finishCheck.CheckSignalReceived();
3453 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3457 int UtcDaliAnimationAnimateToVector3Component(void)
3459 TestApplication application;
3461 Actor actor = Actor::New();
3463 // Register a Vector3 property
3464 Vector3 startValue(10.0f, 10.0f, 10.0f);
3465 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3466 Stage::GetCurrent().Add(actor);
3467 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3469 // Build the animation
3470 float durationSeconds(1.0f);
3471 Animation animation = Animation::New(durationSeconds);
3472 Vector3 targetValue(30.0f, 30.0f, 10.0f);
3473 Vector3 relativeValue(targetValue - startValue);
3475 animation.AnimateTo(Property(actor, "test-property", 0),
3477 AlphaFunctions::Linear,
3478 TimePeriod(delay, durationSeconds - delay));
3479 animation.AnimateTo(Property(actor, index, 1),
3481 AlphaFunctions::Linear,
3482 TimePeriod(delay, durationSeconds - delay));
3484 // Start the animation
3487 bool signalReceived(false);
3488 AnimationFinishCheck finishCheck(signalReceived);
3489 animation.FinishedSignal().Connect(&application, finishCheck);
3491 application.SendNotification();
3492 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3494 // We didn't expect the animation to finish yet
3495 application.SendNotification();
3496 finishCheck.CheckSignalNotReceived();
3497 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3499 application.SendNotification();
3500 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3502 // We didn't expect the animation to finish yet
3503 application.SendNotification();
3504 finishCheck.CheckSignalNotReceived();
3505 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3507 application.SendNotification();
3508 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3510 // We did expect the animation to finish
3511 application.SendNotification();
3512 finishCheck.CheckSignalReceived();
3513 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3517 int UtcDaliAnimationAnimateToVector4(void)
3519 TestApplication application;
3521 Actor actor = Actor::New();
3523 // Register a Vector4 property
3524 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
3525 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3526 Stage::GetCurrent().Add(actor);
3527 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3529 // Build the animation
3530 float durationSeconds(2.0f);
3531 Animation animation = Animation::New(durationSeconds);
3532 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
3533 Vector4 relativeValue(targetValue - startValue);
3534 animation.AnimateTo(Property(actor, index), targetValue);
3536 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3538 // Start the animation
3541 bool signalReceived(false);
3542 AnimationFinishCheck finishCheck(signalReceived);
3543 animation.FinishedSignal().Connect(&application, finishCheck);
3545 application.SendNotification();
3546 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3548 // We didn't expect the animation to finish yet
3549 application.SendNotification();
3550 finishCheck.CheckSignalNotReceived();
3551 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
3553 application.SendNotification();
3554 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3556 // We did expect the animation to finish
3557 application.SendNotification();
3558 finishCheck.CheckSignalReceived();
3559 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3563 int UtcDaliAnimationAnimateToVector4AlphaFunction(void)
3565 TestApplication application;
3567 Actor actor = Actor::New();
3569 // Register a Vector4 property
3570 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
3571 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3572 Stage::GetCurrent().Add(actor);
3573 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3575 // Build the animation
3576 float durationSeconds(1.0f);
3577 Animation animation = Animation::New(durationSeconds);
3578 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
3579 Vector4 relativeValue(targetValue - startValue);
3580 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
3582 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3584 // Start the animation
3587 bool signalReceived(false);
3588 AnimationFinishCheck finishCheck(signalReceived);
3589 animation.FinishedSignal().Connect(&application, finishCheck);
3591 application.SendNotification();
3592 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3594 // We didn't expect the animation to finish yet
3595 application.SendNotification();
3596 finishCheck.CheckSignalNotReceived();
3598 // The position should have moved more, than with a linear alpha function
3599 Vector4 current(actor.GetProperty<Vector4>(index));
3600 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
3601 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
3602 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
3603 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
3605 application.SendNotification();
3606 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3608 // We did expect the animation to finish
3609 application.SendNotification();
3610 finishCheck.CheckSignalReceived();
3611 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3615 int UtcDaliAnimationAnimateToVector4TimePeriod(void)
3617 TestApplication application;
3619 Actor actor = Actor::New();
3621 // Register a Vector4 property
3622 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3623 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3624 Stage::GetCurrent().Add(actor);
3625 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
3627 // Build the animation
3628 float durationSeconds(1.0f);
3629 Animation animation = Animation::New(durationSeconds);
3630 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
3631 Vector4 relativeValue(targetValue - startValue);
3633 animation.AnimateTo(Property(actor, index),
3635 TimePeriod(delay, durationSeconds - delay));
3637 // Start the animation
3640 bool signalReceived(false);
3641 AnimationFinishCheck finishCheck(signalReceived);
3642 animation.FinishedSignal().Connect(&application, finishCheck);
3644 application.SendNotification();
3645 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3647 // We didn't expect the animation to finish yet
3648 application.SendNotification();
3649 finishCheck.CheckSignalNotReceived();
3650 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
3652 application.SendNotification();
3653 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3655 // We didn't expect the animation to finish yet
3656 application.SendNotification();
3657 finishCheck.CheckSignalNotReceived();
3658 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
3660 application.SendNotification();
3661 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3663 // We did expect the animation to finish
3664 application.SendNotification();
3665 finishCheck.CheckSignalReceived();
3666 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
3670 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriod(void)
3672 TestApplication application;
3674 Actor actor = Actor::New();
3676 // Register a Vector4 property
3677 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
3678 Property::Index index = actor.RegisterProperty( "test-property", startValue );
3679 Stage::GetCurrent().Add(actor);
3680 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3682 // Build the animation
3683 float durationSeconds(1.0f);
3684 Animation animation = Animation::New(durationSeconds);
3685 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
3686 Vector4 relativeValue(targetValue - startValue);
3688 animation.AnimateTo(Property(actor, index),
3690 AlphaFunctions::Linear,
3691 TimePeriod(delay, durationSeconds - delay));
3693 // Start the animation
3696 bool signalReceived(false);
3697 AnimationFinishCheck finishCheck(signalReceived);
3698 animation.FinishedSignal().Connect(&application, finishCheck);
3700 application.SendNotification();
3701 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3703 // We didn't expect the animation to finish yet
3704 application.SendNotification();
3705 finishCheck.CheckSignalNotReceived();
3706 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
3708 application.SendNotification();
3709 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3711 // We didn't expect the animation to finish yet
3712 application.SendNotification();
3713 finishCheck.CheckSignalNotReceived();
3714 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3716 application.SendNotification();
3717 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3719 // We did expect the animation to finish
3720 application.SendNotification();
3721 finishCheck.CheckSignalReceived();
3722 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
3726 int UtcDaliAnimationAnimateToActorParentOrigin(void)
3728 TestApplication application;
3730 Actor actor = Actor::New();
3731 Stage::GetCurrent().Add(actor);
3732 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
3734 // Build the animation
3735 float durationSeconds(1.0f);
3736 Animation animation = Animation::New(durationSeconds);
3737 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
3741 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN), targetParentOrigin );
3743 catch (Dali::DaliException& e)
3745 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3746 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3751 int UtcDaliAnimationAnimateToActorParentOriginX(void)
3753 TestApplication application;
3755 Actor actor = Actor::New();
3756 Stage::GetCurrent().Add(actor);
3757 float startValue(0.0f);
3758 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
3759 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
3761 // Build the animation
3762 float durationSeconds(1.0f);
3763 Animation animation = Animation::New(durationSeconds);
3764 float targetX(1.0f);
3768 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_X), targetX );
3770 catch (Dali::DaliException& e)
3772 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3773 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3778 int UtcDaliAnimationAnimateToActorParentOriginY(void)
3780 TestApplication application;
3782 Actor actor = Actor::New();
3783 Stage::GetCurrent().Add(actor);
3784 float startValue(0.0f);
3785 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
3786 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
3788 // Build the animation
3789 float durationSeconds(1.0f);
3790 Animation animation = Animation::New(durationSeconds);
3791 float targetY(1.0f);
3795 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Y), targetY );
3797 catch (Dali::DaliException& e)
3799 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3800 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3805 int UtcDaliAnimationAnimateToActorParentOriginZ(void)
3807 TestApplication application;
3809 Actor actor = Actor::New();
3810 Stage::GetCurrent().Add(actor);
3811 float startValue(0.5f);
3812 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
3813 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
3815 // Build the animation
3816 float durationSeconds(1.0f);
3817 Animation animation = Animation::New(durationSeconds);
3818 float targetZ(1.0f);
3822 animation.AnimateTo( Property(actor, Actor::PARENT_ORIGIN_Z), targetZ );
3824 catch (Dali::DaliException& e)
3826 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3827 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3832 int UtcDaliAnimationAnimateToActorAnchorPoint(void)
3834 TestApplication application;
3836 Actor actor = Actor::New();
3837 Stage::GetCurrent().Add(actor);
3838 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
3840 // Build the animation
3841 float durationSeconds(1.0f);
3842 Animation animation = Animation::New(durationSeconds);
3843 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
3847 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT), targetAnchorPoint);
3849 catch (Dali::DaliException& e)
3851 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3852 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3857 int UtcDaliAnimationAnimateToActorAnchorPointX(void)
3859 TestApplication application;
3861 Actor actor = Actor::New();
3862 Stage::GetCurrent().Add(actor);
3863 float startValue(0.5f);
3864 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
3865 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_X), startValue, TEST_LOCATION );
3867 // Build the animation
3868 float durationSeconds(1.0f);
3869 Animation animation = Animation::New(durationSeconds);
3870 float targetX(1.0f);
3874 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_X), targetX );
3876 catch (Dali::DaliException& e)
3878 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3879 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3884 int UtcDaliAnimationAnimateToActorAnchorPointY(void)
3886 TestApplication application;
3888 Actor actor = Actor::New();
3889 Stage::GetCurrent().Add(actor);
3890 float startValue(0.5f);
3891 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
3892 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
3894 // Build the animation
3895 float durationSeconds(1.0f);
3896 Animation animation = Animation::New(durationSeconds);
3897 float targetY(0.0f);
3901 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Y), targetY );
3903 catch (Dali::DaliException& e)
3905 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3906 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3911 int UtcDaliAnimationAnimateToActorAnchorPointZ(void)
3913 TestApplication application;
3915 Actor actor = Actor::New();
3916 Stage::GetCurrent().Add(actor);
3917 float startValue(0.5f);
3918 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
3919 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
3921 // Build the animation
3922 float durationSeconds(1.0f);
3923 Animation animation = Animation::New(durationSeconds);
3924 float targetZ(100.0f);
3928 animation.AnimateTo( Property(actor, Actor::ANCHOR_POINT_Z), targetZ );
3930 catch (Dali::DaliException& e)
3932 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
3933 DALI_TEST_ASSERT(e, "IsPropertyAnimatable(index)", TEST_LOCATION);
3938 int UtcDaliAnimationAnimateToActorSize(void)
3940 TestApplication application;
3942 Actor actor = Actor::New();
3943 Stage::GetCurrent().Add(actor);
3944 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
3946 // Build the animation
3947 float durationSeconds(1.0f);
3948 Animation animation = Animation::New(durationSeconds);
3949 Vector3 targetSize(100.0f, 100.0f, 100.0f);
3950 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize );
3952 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
3954 // Start the animation
3957 bool signalReceived(false);
3958 AnimationFinishCheck finishCheck(signalReceived);
3959 animation.FinishedSignal().Connect(&application, finishCheck);
3961 application.SendNotification();
3962 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
3964 // We didn't expect the animation to finish yet
3965 application.SendNotification();
3966 finishCheck.CheckSignalNotReceived();
3967 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
3969 application.SendNotification();
3970 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
3972 // We did expect the animation to finish
3973 application.SendNotification();
3974 finishCheck.CheckSignalReceived();
3975 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
3978 finishCheck.Reset();
3979 actor.SetSize(Vector3::ZERO);
3980 application.SendNotification();
3981 application.Render(0);
3982 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
3984 // Repeat with a different (ease-in) alpha function
3985 animation = Animation::New(durationSeconds);
3986 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize, AlphaFunctions::EaseIn);
3987 animation.FinishedSignal().Connect(&application, finishCheck);
3990 application.SendNotification();
3991 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
3993 // We didn't expect the animation to finish yet
3994 application.SendNotification();
3995 finishCheck.CheckSignalNotReceived();
3997 // The size should have travelled less, than with a linear alpha function
3998 Vector3 current(actor.GetCurrentSize());
3999 DALI_TEST_CHECK( current.x > 0.0f );
4000 DALI_TEST_CHECK( current.y > 0.0f );
4001 DALI_TEST_CHECK( current.z > 0.0f );
4002 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4003 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4004 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4006 application.SendNotification();
4007 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4009 // We did expect the animation to finish
4010 application.SendNotification();
4011 finishCheck.CheckSignalReceived();
4012 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
4015 finishCheck.Reset();
4016 actor.SetSize(Vector3::ZERO);
4017 application.SendNotification();
4018 application.Render(0);
4019 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
4021 // Repeat with a delay
4023 animation = Animation::New(durationSeconds);
4024 animation.AnimateTo( Property(actor, Actor::SIZE), targetSize, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
4025 animation.FinishedSignal().Connect(&application, finishCheck);
4028 application.SendNotification();
4029 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4031 // We didn't expect the animation to finish yet
4032 application.SendNotification();
4033 finishCheck.CheckSignalNotReceived();
4034 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
4036 application.SendNotification();
4037 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4039 // We did expect the animation to finish
4040 application.SendNotification();
4041 finishCheck.CheckSignalReceived();
4042 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
4046 int UtcDaliAnimationAnimateToActorSizeWidth(void)
4048 TestApplication application;
4050 Actor actor = Actor::New();
4051 Stage::GetCurrent().Add(actor);
4052 float startValue(0.0f);
4053 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
4054 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), startValue, TEST_LOCATION );
4056 // Build the animation
4057 float durationSeconds(1.0f);
4058 Animation animation = Animation::New(durationSeconds);
4059 float targetWidth(10.0f);
4060 animation.AnimateTo( Property(actor, Actor::SIZE_WIDTH), targetWidth );
4062 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
4064 // Start the animation
4067 bool signalReceived(false);
4068 AnimationFinishCheck finishCheck(signalReceived);
4069 animation.FinishedSignal().Connect(&application, finishCheck);
4071 application.SendNotification();
4072 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4074 // We didn't expect the animation to finish yet
4075 application.SendNotification();
4076 finishCheck.CheckSignalNotReceived();
4077 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
4078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), fiftyPercentProgress, TEST_LOCATION );
4080 application.SendNotification();
4081 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4083 // We did expect the animation to finish
4084 application.SendNotification();
4085 finishCheck.CheckSignalReceived();
4086 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
4087 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_WIDTH), targetWidth, TEST_LOCATION );
4091 int UtcDaliAnimationAnimateToActorSizeHeight(void)
4093 TestApplication application;
4095 Actor actor = Actor::New();
4096 Stage::GetCurrent().Add(actor);
4097 float startValue(0.0f);
4098 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
4099 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), startValue, TEST_LOCATION );
4101 // Build the animation
4102 float durationSeconds(1.0f);
4103 Animation animation = Animation::New(durationSeconds);
4104 float targetHeight(-10.0f);
4105 animation.AnimateTo( Property(actor, Actor::SIZE_HEIGHT), targetHeight );
4107 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
4109 // Start the animation
4112 bool signalReceived(false);
4113 AnimationFinishCheck finishCheck(signalReceived);
4114 animation.FinishedSignal().Connect(&application, finishCheck);
4116 application.SendNotification();
4117 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4119 // We didn't expect the animation to finish yet
4120 application.SendNotification();
4121 finishCheck.CheckSignalNotReceived();
4122 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
4123 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), fiftyPercentProgress, TEST_LOCATION );
4125 application.SendNotification();
4126 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4128 // We did expect the animation to finish
4129 application.SendNotification();
4130 finishCheck.CheckSignalReceived();
4131 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
4132 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
4136 int UtcDaliAnimationAnimateToActorSizeDepth(void)
4138 TestApplication application;
4140 Actor actor = Actor::New();
4141 Stage::GetCurrent().Add(actor);
4142 float startValue(0.0f);
4143 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
4144 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), startValue, TEST_LOCATION );
4146 // Build the animation
4147 float durationSeconds(1.0f);
4148 Animation animation = Animation::New(durationSeconds);
4149 float targetDepth(-10.0f);
4150 animation.AnimateTo( Property(actor, Actor::SIZE_DEPTH), targetDepth );
4152 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
4154 // Start the animation
4157 bool signalReceived(false);
4158 AnimationFinishCheck finishCheck(signalReceived);
4159 animation.FinishedSignal().Connect(&application, finishCheck);
4161 application.SendNotification();
4162 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4164 // We didn't expect the animation to finish yet
4165 application.SendNotification();
4166 finishCheck.CheckSignalNotReceived();
4167 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
4168 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), fiftyPercentProgress, TEST_LOCATION );
4170 application.SendNotification();
4171 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4173 // We did expect the animation to finish
4174 application.SendNotification();
4175 finishCheck.CheckSignalReceived();
4176 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
4177 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SIZE_DEPTH), targetDepth, TEST_LOCATION );
4181 int UtcDaliAnimationAnimateToActorPosition(void)
4183 TestApplication application;
4185 Actor actor = Actor::New();
4186 Stage::GetCurrent().Add(actor);
4187 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4189 // Build the animation
4190 float durationSeconds(1.0f);
4191 Animation animation = Animation::New(durationSeconds);
4192 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4193 animation.AnimateTo(Property(actor, Actor::POSITION), targetPosition);
4195 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4197 // Start the animation
4200 bool signalReceived(false);
4201 AnimationFinishCheck finishCheck(signalReceived);
4202 animation.FinishedSignal().Connect(&application, finishCheck);
4204 application.SendNotification();
4205 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
4207 // We didn't expect the animation to finish yet
4208 application.SendNotification();
4209 finishCheck.CheckSignalNotReceived();
4210 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
4212 application.SendNotification();
4213 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4215 // We did expect the animation to finish
4216 application.SendNotification();
4217 finishCheck.CheckSignalReceived();
4218 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4222 int UtcDaliAnimationAnimateToActorPositionX(void)
4224 TestApplication application;
4226 Actor actor = Actor::New();
4227 Stage::GetCurrent().Add(actor);
4228 float startValue(0.0f);
4229 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
4230 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4231 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4232 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4234 // Build the animation
4235 float durationSeconds(1.0f);
4236 Animation animation = Animation::New(durationSeconds);
4237 float targetX(1.0f);
4238 animation.AnimateTo( Property(actor, Actor::POSITION_X), targetX );
4240 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
4242 // Start the animation
4245 bool signalReceived(false);
4246 AnimationFinishCheck finishCheck(signalReceived);
4247 animation.FinishedSignal().Connect(&application, finishCheck);
4249 application.SendNotification();
4250 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4252 // We didn't expect the animation to finish yet
4253 application.SendNotification();
4254 finishCheck.CheckSignalNotReceived();
4255 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
4256 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), fiftyPercentProgress, TEST_LOCATION );
4257 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4258 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4260 application.SendNotification();
4261 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4263 // We did expect the animation to finish
4264 application.SendNotification();
4265 finishCheck.CheckSignalReceived();
4266 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
4267 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), targetX, TEST_LOCATION );
4268 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4269 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4273 int UtcDaliAnimationAnimateToActorPositionY(void)
4275 TestApplication application;
4277 Actor actor = Actor::New();
4278 Stage::GetCurrent().Add(actor);
4279 float startValue(0.0f);
4280 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
4281 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4282 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4283 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4285 // Build the animation
4286 float durationSeconds(1.0f);
4287 Animation animation = Animation::New(durationSeconds);
4288 float targetY(10.0f);
4289 animation.AnimateTo( Property(actor, Actor::POSITION_Y), targetY );
4291 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
4293 // Start the animation
4296 bool signalReceived(false);
4297 AnimationFinishCheck finishCheck(signalReceived);
4298 animation.FinishedSignal().Connect(&application, finishCheck);
4300 application.SendNotification();
4301 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4303 // We didn't expect the animation to finish yet
4304 application.SendNotification();
4305 finishCheck.CheckSignalNotReceived();
4306 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
4307 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4308 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), fiftyPercentProgress, TEST_LOCATION );
4309 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4311 application.SendNotification();
4312 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4314 // We did expect the animation to finish
4315 application.SendNotification();
4316 finishCheck.CheckSignalReceived();
4317 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
4318 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), targetY, TEST_LOCATION );
4320 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4324 int UtcDaliAnimationAnimateToActorPositionZ(void)
4326 TestApplication application;
4328 Actor actor = Actor::New();
4329 Stage::GetCurrent().Add(actor);
4330 float startValue(0.0f);
4331 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
4332 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4333 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4334 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), startValue, TEST_LOCATION );
4336 // Build the animation
4337 float durationSeconds(1.0f);
4338 Animation animation = Animation::New(durationSeconds);
4339 float targetZ(-5.0f);
4340 animation.AnimateTo( Property(actor, Actor::POSITION_Z), targetZ );
4342 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
4344 // Start the animation
4347 bool signalReceived(false);
4348 AnimationFinishCheck finishCheck(signalReceived);
4349 animation.FinishedSignal().Connect(&application, finishCheck);
4351 application.SendNotification();
4352 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4354 // We didn't expect the animation to finish yet
4355 application.SendNotification();
4356 finishCheck.CheckSignalNotReceived();
4357 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
4358 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4359 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4360 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), fiftyPercentProgress, TEST_LOCATION );
4362 application.SendNotification();
4363 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4365 // We did expect the animation to finish
4366 application.SendNotification();
4367 finishCheck.CheckSignalReceived();
4368 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
4369 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_X), startValue, TEST_LOCATION );
4370 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Y), startValue, TEST_LOCATION );
4371 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::POSITION_Z), targetZ, TEST_LOCATION );
4375 int UtcDaliAnimationAnimateToActorPositionAlphaFunction(void)
4377 TestApplication application;
4379 Actor actor = Actor::New();
4380 Stage::GetCurrent().Add(actor);
4381 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4383 // Build the animation
4384 float durationSeconds(1.0f);
4385 Animation animation = Animation::New(durationSeconds);
4386 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4387 animation.AnimateTo(Property(actor, Actor::POSITION), targetPosition, AlphaFunctions::EaseIn);
4389 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4391 // Start the animation
4394 bool signalReceived(false);
4395 AnimationFinishCheck finishCheck(signalReceived);
4396 animation.FinishedSignal().Connect(&application, finishCheck);
4398 application.SendNotification();
4399 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
4401 // We didn't expect the animation to finish yet
4402 application.SendNotification();
4403 finishCheck.CheckSignalNotReceived();
4405 // The position should have moved less, than with a linear alpha function
4406 Vector3 current(actor.GetCurrentPosition());
4407 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
4408 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
4409 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
4410 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
4411 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
4412 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
4414 application.SendNotification();
4415 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4417 // We did expect the animation to finish
4418 application.SendNotification();
4419 finishCheck.CheckSignalReceived();
4420 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4424 int UtcDaliAnimationAnimateToActorPositionTimePeriod(void)
4426 TestApplication application;
4428 Actor actor = Actor::New();
4429 Stage::GetCurrent().Add(actor);
4430 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4432 // Build the animation
4433 float durationSeconds(1.0f);
4434 Animation animation = Animation::New(durationSeconds);
4435 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4437 animation.AnimateTo( Property(actor, Actor::POSITION),
4439 TimePeriod( delay, durationSeconds - delay ) );
4441 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4443 // Start the animation
4446 bool signalReceived(false);
4447 AnimationFinishCheck finishCheck(signalReceived);
4448 animation.FinishedSignal().Connect(&application, finishCheck);
4450 application.SendNotification();
4451 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4453 // We didn't expect the animation to finish yet
4454 application.SendNotification();
4455 finishCheck.CheckSignalNotReceived();
4456 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4458 application.SendNotification();
4459 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
4461 // We didn't expect the animation to finish yet
4462 application.SendNotification();
4463 finishCheck.CheckSignalNotReceived();
4464 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
4466 application.SendNotification();
4467 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
4469 // We did expect the animation to finish
4470 application.SendNotification();
4471 finishCheck.CheckSignalReceived();
4472 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4476 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriod(void)
4478 TestApplication application;
4480 Actor actor = Actor::New();
4481 Stage::GetCurrent().Add(actor);
4482 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4484 // Build the animation
4485 float durationSeconds(1.0f);
4486 Animation animation = Animation::New(durationSeconds);
4487 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
4489 animation.AnimateTo( Property(actor, Actor::POSITION),
4491 AlphaFunctions::Linear,
4492 TimePeriod( delay, durationSeconds - delay ) );
4494 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
4496 // Start the animation
4499 bool signalReceived(false);
4500 AnimationFinishCheck finishCheck(signalReceived);
4501 animation.FinishedSignal().Connect(&application, finishCheck);
4503 application.SendNotification();
4504 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4506 // We didn't expect the animation to finish yet
4507 application.SendNotification();
4508 finishCheck.CheckSignalNotReceived();
4509 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4511 application.SendNotification();
4512 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
4514 // We didn't expect the animation to finish yet
4515 application.SendNotification();
4516 finishCheck.CheckSignalNotReceived();
4517 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
4519 application.SendNotification();
4520 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
4522 // We did expect the animation to finish
4523 application.SendNotification();
4524 finishCheck.CheckSignalReceived();
4525 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4529 int UtcDaliAnimationAnimateToActorRotationAngleAxis(void)
4531 TestApplication application;
4533 Actor actor = Actor::New();
4534 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4535 Stage::GetCurrent().Add(actor);
4536 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4538 // Build the animation
4539 float durationSeconds(1.0f);
4540 Animation animation = Animation::New(durationSeconds);
4541 Degree targetRotationDegrees(90.0f);
4542 Radian targetRotationRadians(targetRotationDegrees);
4543 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
4545 // Start the animation
4548 bool signalReceived(false);
4549 AnimationFinishCheck finishCheck(signalReceived);
4550 animation.FinishedSignal().Connect(&application, finishCheck);
4552 application.SendNotification();
4553 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4555 // We didn't expect the animation to finish yet
4556 application.SendNotification();
4557 finishCheck.CheckSignalNotReceived();
4558 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4560 application.SendNotification();
4561 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4563 // We didn't expect the animation to finish yet
4564 application.SendNotification();
4565 finishCheck.CheckSignalNotReceived();
4566 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4568 application.SendNotification();
4569 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4571 // We didn't expect the animation to finish yet
4572 application.SendNotification();
4573 finishCheck.CheckSignalNotReceived();
4574 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4576 application.SendNotification();
4577 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4579 // We did expect the animation to finish
4580 application.SendNotification();
4581 finishCheck.CheckSignalReceived();
4582 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4586 int UtcDaliAnimationAnimateToActorRotationQuaternion(void)
4588 TestApplication application;
4590 Actor actor = Actor::New();
4591 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4592 Stage::GetCurrent().Add(actor);
4593 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4595 // Build the animation
4596 float durationSeconds(1.0f);
4597 Animation animation = Animation::New(durationSeconds);
4598 Degree targetRotationDegrees(90.0f);
4599 Radian targetRotationRadians(targetRotationDegrees);
4600 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
4601 animation.AnimateTo( Property(actor, Actor::ROTATION), targetRotation );
4603 // Start the animation
4606 bool signalReceived(false);
4607 AnimationFinishCheck finishCheck(signalReceived);
4608 animation.FinishedSignal().Connect(&application, finishCheck);
4610 application.SendNotification();
4611 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4613 // We didn't expect the animation to finish yet
4614 application.SendNotification();
4615 finishCheck.CheckSignalNotReceived();
4616 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4618 application.SendNotification();
4619 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4621 // We didn't expect the animation to finish yet
4622 application.SendNotification();
4623 finishCheck.CheckSignalNotReceived();
4624 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4626 application.SendNotification();
4627 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4629 // We didn't expect the animation to finish yet
4630 application.SendNotification();
4631 finishCheck.CheckSignalNotReceived();
4632 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4634 application.SendNotification();
4635 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4637 // We did expect the animation to finish
4638 application.SendNotification();
4639 finishCheck.CheckSignalReceived();
4640 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4644 int UtcDaliAnimationAnimateToActorRotationAlphaFunction(void)
4646 TestApplication application;
4648 Actor actor = Actor::New();
4649 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4650 Stage::GetCurrent().Add(actor);
4651 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4653 // Build the animation
4654 float durationSeconds(1.0f);
4655 Animation animation = Animation::New(durationSeconds);
4656 Degree targetRotationDegrees(90.0f);
4657 Radian targetRotationRadians(targetRotationDegrees);
4658 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn);
4660 // Start the animation
4663 bool signalReceived(false);
4664 AnimationFinishCheck finishCheck(signalReceived);
4665 animation.FinishedSignal().Connect(&application, finishCheck);
4667 application.SendNotification();
4668 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4670 // We didn't expect the animation to finish yet
4671 application.SendNotification();
4672 finishCheck.CheckSignalNotReceived();
4673 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4675 application.SendNotification();
4676 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4678 // We didn't expect the animation to finish yet
4679 application.SendNotification();
4680 finishCheck.CheckSignalNotReceived();
4681 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4683 application.SendNotification();
4684 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4686 // We didn't expect the animation to finish yet
4687 application.SendNotification();
4688 finishCheck.CheckSignalNotReceived();
4689 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4691 application.SendNotification();
4692 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4694 // We did expect the animation to finish
4695 application.SendNotification();
4696 finishCheck.CheckSignalReceived();
4697 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4701 int UtcDaliAnimationAnimateToActorRotationTimePeriod(void)
4703 TestApplication application;
4705 Actor actor = Actor::New();
4706 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4707 Stage::GetCurrent().Add(actor);
4708 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4710 // Build the animation
4711 float durationSeconds(1.0f);
4712 Animation animation = Animation::New(durationSeconds);
4713 Degree targetRotationDegrees(90.0f);
4714 Radian targetRotationRadians(targetRotationDegrees);
4716 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
4718 // Start the animation
4721 bool signalReceived(false);
4722 AnimationFinishCheck finishCheck(signalReceived);
4723 animation.FinishedSignal().Connect(&application, finishCheck);
4725 application.SendNotification();
4726 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4728 // We didn't expect the animation to finish yet
4729 application.SendNotification();
4730 finishCheck.CheckSignalNotReceived();
4731 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4732 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4734 application.SendNotification();
4735 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4737 // We didn't expect the animation to finish yet
4738 application.SendNotification();
4739 finishCheck.CheckSignalNotReceived();
4740 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4741 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4743 application.SendNotification();
4744 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4746 // We didn't expect the animation to finish yet
4747 application.SendNotification();
4748 finishCheck.CheckSignalNotReceived();
4749 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4750 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4752 application.SendNotification();
4753 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4755 // We did expect the animation to finish
4756 application.SendNotification();
4757 finishCheck.CheckSignalReceived();
4758 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4762 int UtcDaliAnimationAnimateToActorRotationAlphaFunctionTimePeriod(void)
4764 TestApplication application;
4766 Actor actor = Actor::New();
4767 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
4768 Stage::GetCurrent().Add(actor);
4769 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4771 // Build the animation
4772 float durationSeconds(1.0f);
4773 Animation animation = Animation::New(durationSeconds);
4774 Degree targetRotationDegrees(90.0f);
4775 Radian targetRotationRadians(targetRotationDegrees);
4777 animation.AnimateTo( Property(actor, Actor::ROTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn, TimePeriod(delay, durationSeconds - delay));
4779 // Start the animation
4782 bool signalReceived(false);
4783 AnimationFinishCheck finishCheck(signalReceived);
4784 animation.FinishedSignal().Connect(&application, finishCheck);
4786 application.SendNotification();
4787 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4789 // We didn't expect the animation to finish yet
4790 application.SendNotification();
4791 finishCheck.CheckSignalNotReceived();
4792 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4793 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4795 application.SendNotification();
4796 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4798 // We didn't expect the animation to finish yet
4799 application.SendNotification();
4800 finishCheck.CheckSignalNotReceived();
4801 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4802 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4804 application.SendNotification();
4805 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4807 // We didn't expect the animation to finish yet
4808 application.SendNotification();
4809 finishCheck.CheckSignalNotReceived();
4810 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4811 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4813 application.SendNotification();
4814 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4816 // We did expect the animation to finish
4817 application.SendNotification();
4818 finishCheck.CheckSignalReceived();
4819 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4823 int UtcDaliAnimationAnimateToActorScale(void)
4825 TestApplication application;
4827 Actor actor = Actor::New();
4828 Stage::GetCurrent().Add(actor);
4829 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4831 // Build the animation
4832 float durationSeconds(1.0f);
4833 Animation animation = Animation::New(durationSeconds);
4834 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4835 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale );
4837 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
4839 // Start the animation
4842 bool signalReceived(false);
4843 AnimationFinishCheck finishCheck(signalReceived);
4844 animation.FinishedSignal().Connect(&application, finishCheck);
4846 application.SendNotification();
4847 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4849 // We didn't expect the animation to finish yet
4850 application.SendNotification();
4851 finishCheck.CheckSignalNotReceived();
4852 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4854 application.SendNotification();
4855 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4857 // We did expect the animation to finish
4858 application.SendNotification();
4859 finishCheck.CheckSignalReceived();
4860 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4863 finishCheck.Reset();
4864 actor.SetScale(Vector3::ONE);
4865 application.SendNotification();
4866 application.Render(0);
4867 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4869 // Repeat with a different (ease-in) alpha function
4870 animation = Animation::New(durationSeconds);
4871 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale, AlphaFunctions::EaseIn);
4872 animation.FinishedSignal().Connect(&application, finishCheck);
4875 application.SendNotification();
4876 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4878 // We didn't expect the animation to finish yet
4879 application.SendNotification();
4880 finishCheck.CheckSignalNotReceived();
4882 // The scale should have grown less, than with a linear alpha function
4883 Vector3 current(actor.GetCurrentScale());
4884 DALI_TEST_CHECK( current.x > 1.0f );
4885 DALI_TEST_CHECK( current.y > 1.0f );
4886 DALI_TEST_CHECK( current.z > 1.0f );
4887 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4888 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4889 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4891 application.SendNotification();
4892 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4894 // We did expect the animation to finish
4895 application.SendNotification();
4896 finishCheck.CheckSignalReceived();
4897 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4900 finishCheck.Reset();
4901 actor.SetScale(Vector3::ONE);
4902 application.SendNotification();
4903 application.Render(0);
4904 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4906 // Repeat with a delay
4908 animation = Animation::New(durationSeconds);
4909 animation.AnimateTo( Property(actor, Actor::SCALE), targetScale, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
4910 animation.FinishedSignal().Connect(&application, finishCheck);
4913 application.SendNotification();
4914 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4916 // We didn't expect the animation to finish yet
4917 application.SendNotification();
4918 finishCheck.CheckSignalNotReceived();
4919 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4921 application.SendNotification();
4922 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4924 // We did expect the animation to finish
4925 application.SendNotification();
4926 finishCheck.CheckSignalReceived();
4927 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4931 int UtcDaliAnimationAnimateToActorScaleX(void)
4933 TestApplication application;
4935 Actor actor = Actor::New();
4936 Stage::GetCurrent().Add(actor);
4937 float startValue(1.0f);
4938 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
4939 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
4940 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4941 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4943 // Build the animation
4944 float durationSeconds(1.0f);
4945 Animation animation = Animation::New(durationSeconds);
4946 float targetX(10.0f);
4947 animation.AnimateTo( Property(actor, Actor::SCALE_X), targetX );
4949 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
4951 // Start the animation
4954 bool signalReceived(false);
4955 AnimationFinishCheck finishCheck(signalReceived);
4956 animation.FinishedSignal().Connect(&application, finishCheck);
4958 application.SendNotification();
4959 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
4961 // We didn't expect the animation to finish yet
4962 application.SendNotification();
4963 finishCheck.CheckSignalNotReceived();
4964 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
4965 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
4966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4967 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4969 application.SendNotification();
4970 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4972 // We did expect the animation to finish
4973 application.SendNotification();
4974 finishCheck.CheckSignalReceived();
4975 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
4976 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), targetX, TEST_LOCATION );
4977 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4978 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4982 int UtcDaliAnimationAnimateToActorScaleY(void)
4984 TestApplication application;
4986 Actor actor = Actor::New();
4987 Stage::GetCurrent().Add(actor);
4988 float startValue(1.0f);
4989 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
4990 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
4991 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
4992 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
4994 // Build the animation
4995 float durationSeconds(1.0f);
4996 Animation animation = Animation::New(durationSeconds);
4997 float targetY(1000.0f);
4998 animation.AnimateTo( Property(actor, Actor::SCALE_Y), targetY );
5000 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
5002 // Start the animation
5005 bool signalReceived(false);
5006 AnimationFinishCheck finishCheck(signalReceived);
5007 animation.FinishedSignal().Connect(&application, finishCheck);
5009 application.SendNotification();
5010 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5012 // We didn't expect the animation to finish yet
5013 application.SendNotification();
5014 finishCheck.CheckSignalNotReceived();
5015 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
5016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5017 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
5018 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5020 application.SendNotification();
5021 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5023 // We did expect the animation to finish
5024 application.SendNotification();
5025 finishCheck.CheckSignalReceived();
5026 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
5027 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5028 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), targetY, TEST_LOCATION );
5029 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5033 int UtcDaliAnimationAnimateToActorScaleZ(void)
5035 TestApplication application;
5037 Actor actor = Actor::New();
5038 Stage::GetCurrent().Add(actor);
5039 float startValue(1.0f);
5040 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
5041 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5042 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5043 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), startValue, TEST_LOCATION );
5045 // Build the animation
5046 float durationSeconds(1.0f);
5047 Animation animation = Animation::New(durationSeconds);
5048 float targetZ(-1000.0f);
5049 animation.AnimateTo( Property(actor, Actor::SCALE_Z), targetZ );
5051 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
5053 // Start the animation
5056 bool signalReceived(false);
5057 AnimationFinishCheck finishCheck(signalReceived);
5058 animation.FinishedSignal().Connect(&application, finishCheck);
5060 application.SendNotification();
5061 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5063 // We didn't expect the animation to finish yet
5064 application.SendNotification();
5065 finishCheck.CheckSignalNotReceived();
5066 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
5067 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5068 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5069 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
5071 application.SendNotification();
5072 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5074 // We did expect the animation to finish
5075 application.SendNotification();
5076 finishCheck.CheckSignalReceived();
5077 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
5078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_X), startValue, TEST_LOCATION );
5079 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Y), startValue, TEST_LOCATION );
5080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::SCALE_Z), targetZ, TEST_LOCATION );
5084 int UtcDaliAnimationAnimateToActorColor(void)
5086 TestApplication application;
5088 Actor actor = Actor::New();
5089 Stage::GetCurrent().Add(actor);
5090 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5092 // Build the animation
5093 float durationSeconds(1.0f);
5094 Animation animation = Animation::New(durationSeconds);
5095 Vector4 targetColor(Color::RED);
5096 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor );
5098 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
5099 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
5101 // Start the animation
5104 bool signalReceived(false);
5105 AnimationFinishCheck finishCheck(signalReceived);
5106 animation.FinishedSignal().Connect(&application, finishCheck);
5108 application.SendNotification();
5109 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
5111 // We didn't expect the animation to finish yet
5112 application.SendNotification();
5113 finishCheck.CheckSignalNotReceived();
5114 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
5116 application.SendNotification();
5117 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
5119 // We did expect the animation to finish
5120 application.SendNotification();
5121 finishCheck.CheckSignalReceived();
5122 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5125 finishCheck.Reset();
5126 actor.SetColor(Color::WHITE);
5127 application.SendNotification();
5128 application.Render(0);
5129 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5131 // Repeat with a different (ease-in) alpha function
5132 animation = Animation::New(durationSeconds);
5133 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::EaseIn);
5134 animation.FinishedSignal().Connect(&application, finishCheck);
5137 application.SendNotification();
5138 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
5140 // We didn't expect the animation to finish yet
5141 application.SendNotification();
5142 finishCheck.CheckSignalNotReceived();
5144 // The color should have changed less, than with a linear alpha function
5145 Vector4 current(actor.GetCurrentColor());
5146 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
5147 DALI_TEST_CHECK( current.y < 1.0f );
5148 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
5149 DALI_TEST_CHECK( current.z < 1.0f );
5150 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
5151 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
5153 application.SendNotification();
5154 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
5156 // We did expect the animation to finish
5157 application.SendNotification();
5158 finishCheck.CheckSignalReceived();
5159 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5162 finishCheck.Reset();
5163 actor.SetColor(Color::WHITE);
5164 application.SendNotification();
5165 application.Render(0);
5166 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5168 // Repeat with a shorter animator duration
5169 float animatorDuration = 0.5f;
5170 animation = Animation::New(durationSeconds);
5171 animation.AnimateTo( Property(actor, Actor::COLOR), targetColor, AlphaFunctions::Linear, TimePeriod(animatorDuration));
5172 animation.FinishedSignal().Connect(&application, finishCheck);
5175 application.SendNotification();
5176 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
5178 // We didn't expect the animation to finish yet
5179 application.SendNotification();
5180 finishCheck.CheckSignalNotReceived();
5181 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
5183 application.SendNotification();
5184 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
5186 // We didn't expect the animation to finish yet
5187 application.SendNotification();
5188 finishCheck.CheckSignalNotReceived();
5189 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5191 application.SendNotification();
5192 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5194 // We did expect the animation to finish
5195 application.SendNotification();
5196 finishCheck.CheckSignalReceived();
5197 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5201 int UtcDaliAnimationAnimateToActorColorRed(void)
5203 TestApplication application;
5205 Actor actor = Actor::New();
5206 Stage::GetCurrent().Add(actor);
5207 float startValue(1.0f);
5208 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
5209 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5210 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5211 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5212 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5214 // Build the animation
5215 float durationSeconds(1.0f);
5216 Animation animation = Animation::New(durationSeconds);
5217 float targetRed(0.5f);
5218 animation.AnimateTo( Property(actor, Actor::COLOR_RED), targetRed );
5220 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
5222 // Start the animation
5225 bool signalReceived(false);
5226 AnimationFinishCheck finishCheck(signalReceived);
5227 animation.FinishedSignal().Connect(&application, finishCheck);
5229 application.SendNotification();
5230 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5232 // We didn't expect the animation to finish yet
5233 application.SendNotification();
5234 finishCheck.CheckSignalNotReceived();
5235 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
5236 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
5237 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5238 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5239 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5241 application.SendNotification();
5242 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5244 // We did expect the animation to finish
5245 application.SendNotification();
5246 finishCheck.CheckSignalReceived();
5247 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
5248 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), targetRed, TEST_LOCATION );
5249 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5250 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5251 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5255 int UtcDaliAnimationAnimateToActorColorGreen(void)
5257 TestApplication application;
5259 Actor actor = Actor::New();
5260 Stage::GetCurrent().Add(actor);
5261 float startValue(1.0f);
5262 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
5263 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5264 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5265 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5266 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5268 // Build the animation
5269 float durationSeconds(1.0f);
5270 Animation animation = Animation::New(durationSeconds);
5271 float targetGreen(0.5f);
5272 animation.AnimateTo( Property(actor, Actor::COLOR_GREEN), targetGreen );
5274 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
5276 // Start the animation
5279 bool signalReceived(false);
5280 AnimationFinishCheck finishCheck(signalReceived);
5281 animation.FinishedSignal().Connect(&application, finishCheck);
5283 application.SendNotification();
5284 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5286 // We didn't expect the animation to finish yet
5287 application.SendNotification();
5288 finishCheck.CheckSignalNotReceived();
5289 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
5290 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5291 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
5292 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5293 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5295 application.SendNotification();
5296 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5298 // We did expect the animation to finish
5299 application.SendNotification();
5300 finishCheck.CheckSignalReceived();
5301 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
5302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), targetGreen, TEST_LOCATION );
5304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5305 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5309 int UtcDaliAnimationAnimateToActorColorBlue(void)
5311 TestApplication application;
5313 Actor actor = Actor::New();
5314 Stage::GetCurrent().Add(actor);
5315 float startValue(1.0f);
5316 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
5317 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5318 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5320 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5322 // Build the animation
5323 float durationSeconds(1.0f);
5324 Animation animation = Animation::New(durationSeconds);
5325 float targetBlue(0.5f);
5326 animation.AnimateTo( Property(actor, Actor::COLOR_BLUE), targetBlue );
5328 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
5330 // Start the animation
5333 bool signalReceived(false);
5334 AnimationFinishCheck finishCheck(signalReceived);
5335 animation.FinishedSignal().Connect(&application, finishCheck);
5337 application.SendNotification();
5338 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5340 // We didn't expect the animation to finish yet
5341 application.SendNotification();
5342 finishCheck.CheckSignalNotReceived();
5343 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
5344 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5345 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5346 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
5347 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5349 application.SendNotification();
5350 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5352 // We did expect the animation to finish
5353 application.SendNotification();
5354 finishCheck.CheckSignalReceived();
5355 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
5356 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5357 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5358 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), targetBlue, TEST_LOCATION );
5359 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5363 int UtcDaliAnimationAnimateToActorColorAlpha(void)
5365 TestApplication application;
5367 Actor actor = Actor::New();
5368 Stage::GetCurrent().Add(actor);
5369 float startValue(1.0f);
5370 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
5371 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5372 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5373 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5374 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5376 // Build the animation
5377 float durationSeconds(1.0f);
5378 Animation animation = Animation::New(durationSeconds);
5379 float targetAlpha(0.5f);
5380 animation.AnimateTo( Property(actor, Actor::COLOR_ALPHA), targetAlpha );
5382 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
5384 // Start the animation
5387 bool signalReceived(false);
5388 AnimationFinishCheck finishCheck(signalReceived);
5389 animation.FinishedSignal().Connect(&application, finishCheck);
5391 application.SendNotification();
5392 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
5394 // We didn't expect the animation to finish yet
5395 application.SendNotification();
5396 finishCheck.CheckSignalNotReceived();
5397 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
5398 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5399 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5400 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5401 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
5403 application.SendNotification();
5404 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5406 // We did expect the animation to finish
5407 application.SendNotification();
5408 finishCheck.CheckSignalReceived();
5409 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
5410 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5411 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5412 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5413 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
5419 int UtcDaliAnimationKeyFrames01(void)
5421 TestApplication application;
5423 KeyFrames keyFrames = KeyFrames::New();
5424 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5426 keyFrames.Add(0.0f, 0.1f);
5427 keyFrames.Add(0.2f, 0.5f);
5428 keyFrames.Add(0.4f, 0.0f);
5429 keyFrames.Add(0.6f, 1.0f);
5430 keyFrames.Add(0.8f, 0.7f);
5431 keyFrames.Add(1.0f, 0.9f);
5433 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
5437 keyFrames.Add(1.9f, false);
5439 catch (Dali::DaliException& e)
5441 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5442 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5447 int UtcDaliAnimationKeyFrames02(void)
5449 TestApplication application;
5451 KeyFrames keyFrames = KeyFrames::New();
5452 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5454 keyFrames.Add(0.0f, true);
5455 keyFrames.Add(0.2f, false);
5456 keyFrames.Add(0.4f, false);
5457 keyFrames.Add(0.6f, true);
5458 keyFrames.Add(0.8f, true);
5459 keyFrames.Add(1.0f, false);
5461 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
5465 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
5467 catch (Dali::DaliException& e)
5469 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5470 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5476 int UtcDaliAnimationKeyFrames03(void)
5478 TestApplication application;
5480 KeyFrames keyFrames = KeyFrames::New();
5481 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5483 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
5484 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
5485 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
5486 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
5487 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
5488 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
5490 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
5494 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
5496 catch (Dali::DaliException& e)
5498 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5499 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5505 int UtcDaliAnimationKeyFrames04(void)
5507 TestApplication application;
5509 KeyFrames keyFrames = KeyFrames::New();
5510 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5512 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
5513 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
5514 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
5515 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
5516 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
5517 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
5519 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
5523 keyFrames.Add(0.7f, 1.0f);
5525 catch (Dali::DaliException& e)
5527 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5528 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5533 int UtcDaliAnimationKeyFrames05(void)
5535 TestApplication application;
5537 KeyFrames keyFrames = KeyFrames::New();
5538 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5540 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
5541 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
5542 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
5543 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
5544 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
5545 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
5547 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
5551 keyFrames.Add(0.7f, Quaternion(1.717f, Vector3::XAXIS));
5553 catch (Dali::DaliException& e)
5555 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5556 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5562 int UtcDaliAnimationKeyFrames06(void)
5564 TestApplication application;
5566 KeyFrames keyFrames = KeyFrames::New();
5567 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
5569 keyFrames.Add(0.0f, Quaternion(1.717f, Vector3::XAXIS));
5570 keyFrames.Add(0.2f, Quaternion(2.0f, Vector3::XAXIS));
5571 keyFrames.Add(0.4f, Quaternion(3.0f, Vector3::ZAXIS));
5572 keyFrames.Add(0.6f, Quaternion(4.0f, Vector3(1.0f, 1.0f, 1.0f)));
5573 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
5574 keyFrames.Add(1.0f, Quaternion(3.0f, Vector3::YAXIS));
5576 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
5580 keyFrames.Add(0.7f, 1.1f);
5582 catch (Dali::DaliException& e)
5584 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
5585 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
5594 int UtcDaliAnimationAnimateBetweenActorColorAlpha(void)
5596 TestApplication application;
5598 float startValue(1.0f);
5599 Actor actor = Actor::New();
5600 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
5601 Stage::GetCurrent().Add(actor);
5603 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
5604 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5607 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5609 // Build the animation
5610 float durationSeconds(1.0f);
5611 Animation animation = Animation::New(durationSeconds);
5613 KeyFrames keyFrames = KeyFrames::New();
5614 keyFrames.Add(0.0f, 0.1f);
5615 keyFrames.Add(0.2f, 0.5f);
5616 keyFrames.Add(0.4f, 0.0f);
5617 keyFrames.Add(0.6f, 1.0f);
5618 keyFrames.Add(0.8f, 0.7f);
5619 keyFrames.Add(1.0f, 0.9f);
5621 animation.AnimateBetween( Property(actor, Actor::COLOR_ALPHA), keyFrames );
5623 // Start the animation
5626 bool signalReceived(false);
5627 AnimationFinishCheck finishCheck(signalReceived);
5628 animation.FinishedSignal().Connect(&application, finishCheck);
5629 application.SendNotification();
5630 application.Render(0);
5631 application.SendNotification();
5632 finishCheck.CheckSignalNotReceived();
5633 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
5635 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
5636 application.SendNotification();
5637 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5638 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5639 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5640 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
5641 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
5643 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
5644 application.SendNotification();
5645 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5646 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5647 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5648 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
5649 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
5651 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
5652 application.SendNotification();
5653 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5654 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5655 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5656 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
5657 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
5659 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
5660 application.SendNotification();
5661 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5663 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5664 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
5665 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
5667 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
5668 application.SendNotification();
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), 0.8f, 0.01f, TEST_LOCATION );
5673 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
5675 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
5676 application.SendNotification();
5677 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5678 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5679 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5680 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
5681 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
5683 // We did expect the animation to finish
5685 finishCheck.CheckSignalReceived();
5690 int UtcDaliAnimationAnimateBetweenActorColor(void)
5692 TestApplication application;
5694 float startValue(1.0f);
5695 Actor actor = Actor::New();
5696 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
5697 Stage::GetCurrent().Add(actor);
5699 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
5700 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
5701 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
5702 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
5703 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
5705 // Build the animation
5706 float durationSeconds(1.0f);
5707 Animation animation = Animation::New(durationSeconds);
5709 KeyFrames keyFrames = KeyFrames::New();
5710 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
5711 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
5712 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
5714 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames );
5716 // Start the animation
5719 bool signalReceived(false);
5720 AnimationFinishCheck finishCheck(signalReceived);
5721 animation.FinishedSignal().Connect(&application, finishCheck);
5722 application.SendNotification();
5723 application.Render(0);
5724 application.SendNotification();
5725 finishCheck.CheckSignalNotReceived();
5726 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
5727 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
5728 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
5729 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
5731 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5732 application.SendNotification();
5733 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
5734 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
5735 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
5736 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
5738 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5739 application.SendNotification();
5740 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
5741 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
5742 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
5743 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
5745 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5746 application.SendNotification();
5747 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
5748 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
5749 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
5750 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
5752 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
5753 application.SendNotification();
5754 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
5755 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
5756 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
5757 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
5759 // We did expect the animation to finish
5761 finishCheck.CheckSignalReceived();
5765 int UtcDaliAnimationAnimateBetweenActorVisible01(void)
5767 TestApplication application;
5769 Actor actor = Actor::New();
5770 AngleAxis aa(Degree(90), Vector3::XAXIS);
5771 actor.SetRotation(aa.angle, aa.axis);
5772 Stage::GetCurrent().Add(actor);
5774 application.SendNotification();
5775 application.Render(0);
5777 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5779 // Build the animation
5780 float durationSeconds(1.0f);
5781 Animation animation = Animation::New(durationSeconds);
5783 KeyFrames keyFrames = KeyFrames::New();
5784 keyFrames.Add(0.0f, false);
5785 keyFrames.Add(0.2f, true);
5786 keyFrames.Add(0.4f, true);
5787 keyFrames.Add(0.8f, false);
5788 keyFrames.Add(1.0f, true);
5790 animation.AnimateBetween( Property(actor, Actor::VISIBLE), keyFrames );
5792 // Start the animation
5795 bool signalReceived(false);
5796 AnimationFinishCheck finishCheck(signalReceived);
5797 animation.FinishedSignal().Connect(&application, finishCheck);
5798 application.SendNotification();
5799 application.SendNotification();
5800 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
5801 application.SendNotification();
5802 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
5803 application.SendNotification();
5805 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
5806 finishCheck.CheckSignalReceived();
5810 int UtcDaliAnimationAnimateBetweenActorRotation01(void)
5812 TestApplication application;
5814 Actor actor = Actor::New();
5815 AngleAxis aa(Degree(90), Vector3::XAXIS);
5816 actor.SetRotation(aa.angle, aa.axis);
5817 Stage::GetCurrent().Add(actor);
5819 application.SendNotification();
5820 application.Render(0);
5821 Quaternion start(Radian(aa.angle), aa.axis);
5822 DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, TEST_LOCATION );
5824 // Build the animation
5825 float durationSeconds(1.0f);
5826 Animation animation = Animation::New(durationSeconds);
5828 KeyFrames keyFrames = KeyFrames::New();
5829 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
5831 animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames );
5833 // Start the animation
5836 bool signalReceived(false);
5837 AnimationFinishCheck finishCheck(signalReceived);
5838 animation.FinishedSignal().Connect(&application, finishCheck);
5839 application.SendNotification();
5840 application.SendNotification();
5841 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
5842 application.SendNotification();
5843 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
5844 application.SendNotification();
5846 Quaternion check = Quaternion::FromAxisAngle(Vector4::ZAXIS, Radian(Degree(60)));
5848 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5849 finishCheck.CheckSignalReceived();
5853 int UtcDaliAnimationAnimateBetweenActorRotation02(void)
5855 TestApplication application;
5857 Actor actor = Actor::New();
5858 AngleAxis aa(Degree(90), Vector3::XAXIS);
5859 actor.SetRotation(aa.angle, aa.axis);
5860 application.SendNotification();
5861 application.Render(0);
5862 Stage::GetCurrent().Add(actor);
5864 Quaternion start(Radian(aa.angle), aa.axis);
5865 DALI_TEST_EQUALS( actor.GetCurrentRotation(), start, 0.001f, TEST_LOCATION );
5867 // Build the animation
5868 float durationSeconds(1.0f);
5869 Animation animation = Animation::New(durationSeconds);
5871 KeyFrames keyFrames = KeyFrames::New();
5872 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
5873 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
5874 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
5876 animation.AnimateBetween( Property(actor, Actor::ROTATION), keyFrames );
5878 // Start the animation
5881 bool signalReceived(false);
5882 AnimationFinishCheck finishCheck(signalReceived);
5883 animation.FinishedSignal().Connect(&application, finishCheck);
5884 application.SendNotification();
5885 application.Render(0);
5886 application.SendNotification();
5887 finishCheck.CheckSignalNotReceived();
5889 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
5890 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5892 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5893 application.SendNotification();
5894 check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(90)));
5895 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5897 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5898 application.SendNotification();
5899 check = Quaternion::FromAxisAngle(Vector4::XAXIS, Radian(Degree(120)));
5900 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5902 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5903 application.SendNotification();
5904 check = Quaternion::FromAxisAngle(Vector4(0.5f, 0.5f, 0.0f, 0.0f), Radian(Degree(101.5)));
5905 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5907 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
5908 application.SendNotification();
5909 check = Quaternion::FromAxisAngle(Vector4::YAXIS, Radian(Degree(120)));
5910 DALI_TEST_EQUALS( actor.GetCurrentRotation(), check, 0.001f, TEST_LOCATION );
5912 // We did expect the animation to finish
5914 finishCheck.CheckSignalReceived();
5918 int UtcDaliAnimationMoveByFloat3(void)
5920 TestApplication application;
5922 Actor actor = Actor::New();
5923 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5924 actor.SetPosition(startPosition);
5925 Stage::GetCurrent().Add(actor);
5926 application.SendNotification();
5927 application.Render(0);
5928 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
5930 // Build the animation
5931 float durationSeconds(1.0f);
5932 Animation animation = Animation::New(durationSeconds);
5933 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5934 Vector3 relativePosition(targetPosition - startPosition);
5935 animation.MoveBy(actor, relativePosition.x, relativePosition.y, relativePosition.z);
5937 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
5939 // Start the animation
5942 bool signalReceived(false);
5943 AnimationFinishCheck finishCheck(signalReceived);
5944 animation.FinishedSignal().Connect(&application, finishCheck);
5946 application.SendNotification();
5947 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5949 // We didn't expect the animation to finish yet
5950 application.SendNotification();
5951 finishCheck.CheckSignalNotReceived();
5952 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
5954 application.SendNotification();
5955 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5957 // We did expect the animation to finish
5958 application.SendNotification();
5959 finishCheck.CheckSignalReceived();
5960 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
5964 int UtcDaliAnimationMoveByVector3Alpha(void)
5966 TestApplication application;
5968 Actor actor = Actor::New();
5969 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5970 actor.SetPosition(startPosition);
5971 Stage::GetCurrent().Add(actor);
5972 application.SendNotification();
5973 application.Render(0);
5974 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
5976 // Build the animation
5977 float durationSeconds(1.0f);
5978 Animation animation = Animation::New(durationSeconds);
5979 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5980 Vector3 relativePosition(targetPosition - startPosition);
5981 animation.MoveBy(actor, relativePosition, AlphaFunctions::EaseOut);
5983 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
5985 // Start the animation
5988 bool signalReceived(false);
5989 AnimationFinishCheck finishCheck(signalReceived);
5990 animation.FinishedSignal().Connect(&application, finishCheck);
5992 application.SendNotification();
5993 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5995 // We didn't expect the animation to finish yet
5996 application.SendNotification();
5997 finishCheck.CheckSignalNotReceived();
5999 // The position should have moved more, than with a linear alpha function
6000 Vector3 current(actor.GetCurrentPosition());
6001 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6002 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6003 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6005 application.SendNotification();
6006 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6008 // We did expect the animation to finish
6009 application.SendNotification();
6010 finishCheck.CheckSignalReceived();
6011 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6015 int UtcDaliAnimationMoveByVector3AlphaFloat2(void)
6017 TestApplication application;
6019 Actor actor = Actor::New();
6020 Vector3 startPosition(10.0f, 10.0f, 10.0f);
6021 actor.SetPosition(startPosition);
6022 Stage::GetCurrent().Add(actor);
6023 application.SendNotification();
6024 application.Render(0);
6025 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
6027 // Build the animation
6028 float durationSeconds(1.0f);
6029 Animation animation = Animation::New(durationSeconds);
6030 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
6031 Vector3 relativePosition(targetPosition - startPosition);
6033 animation.MoveBy(actor, relativePosition, AlphaFunctions::Linear, delay, durationSeconds - delay);
6035 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
6037 // Start the animation
6040 bool signalReceived(false);
6041 AnimationFinishCheck finishCheck(signalReceived);
6042 animation.FinishedSignal().Connect(&application, finishCheck);
6044 application.SendNotification();
6045 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6047 // We didn't expect the animation to finish yet
6048 application.SendNotification();
6049 finishCheck.CheckSignalNotReceived();
6050 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
6052 application.SendNotification();
6053 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6055 // We did expect the animation to finish
6056 application.SendNotification();
6057 finishCheck.CheckSignalReceived();
6058 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6062 int UtcDaliAnimationMoveToFloat3(void)
6064 TestApplication application;
6066 Actor actor = Actor::New();
6067 Stage::GetCurrent().Add(actor);
6068 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6070 // Build the animation
6071 float durationSeconds(1.0f);
6072 Animation animation = Animation::New(durationSeconds);
6073 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6074 animation.MoveTo(actor, targetPosition.x, targetPosition.y, targetPosition.z);
6076 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6078 // Start the animation
6081 bool signalReceived(false);
6082 AnimationFinishCheck finishCheck(signalReceived);
6083 animation.FinishedSignal().Connect(&application, finishCheck);
6085 application.SendNotification();
6086 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6088 // We didn't expect the animation to finish yet
6089 application.SendNotification();
6090 finishCheck.CheckSignalNotReceived();
6091 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6093 application.SendNotification();
6094 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6096 // We did expect the animation to finish
6097 application.SendNotification();
6098 finishCheck.CheckSignalReceived();
6099 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6103 int UtcDaliAnimationMoveToVector3Alpha(void)
6105 TestApplication application;
6107 Actor actor = Actor::New();
6108 Stage::GetCurrent().Add(actor);
6109 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6111 // Build the animation
6112 float durationSeconds(1.0f);
6113 Animation animation = Animation::New(durationSeconds);
6114 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6115 animation.MoveTo(actor, targetPosition, AlphaFunctions::EaseIn);
6117 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6119 // Start the animation
6122 bool signalReceived(false);
6123 AnimationFinishCheck finishCheck(signalReceived);
6124 animation.FinishedSignal().Connect(&application, finishCheck);
6126 application.SendNotification();
6127 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6129 // We didn't expect the animation to finish yet
6130 application.SendNotification();
6131 finishCheck.CheckSignalNotReceived();
6133 // The position should have moved less, than with a linear alpha function
6134 Vector3 current(actor.GetCurrentPosition());
6135 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
6136 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
6137 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
6138 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
6139 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
6140 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
6142 application.SendNotification();
6143 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6145 // We did expect the animation to finish
6146 application.SendNotification();
6147 finishCheck.CheckSignalReceived();
6148 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6152 int UtcDaliAnimationMoveToVector3AlphaFloat2(void)
6154 TestApplication application;
6156 Actor actor = Actor::New();
6157 Stage::GetCurrent().Add(actor);
6158 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6160 // Build the animation
6161 float durationSeconds(1.0f);
6162 Animation animation = Animation::New(durationSeconds);
6163 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6165 animation.MoveTo(actor, targetPosition, AlphaFunctions::Linear, delay, durationSeconds - delay);
6167 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6169 // Start the animation
6172 bool signalReceived(false);
6173 AnimationFinishCheck finishCheck(signalReceived);
6174 animation.FinishedSignal().Connect(&application, finishCheck);
6176 application.SendNotification();
6177 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6179 // We didn't expect the animation to finish yet
6180 application.SendNotification();
6181 finishCheck.CheckSignalNotReceived();
6182 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6184 application.SendNotification();
6185 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6187 // We didn't expect the animation to finish yet
6188 application.SendNotification();
6189 finishCheck.CheckSignalNotReceived();
6190 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6192 application.SendNotification();
6193 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6195 // We did expect the animation to finish
6196 application.SendNotification();
6197 finishCheck.CheckSignalReceived();
6198 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6202 int UtcDaliAnimationMove(void)
6204 TestApplication application;
6206 Actor actor = Actor::New();
6207 Vector3 initialPosition(Vector3::ZERO);
6208 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
6209 Stage::GetCurrent().Add(actor);
6211 // Build the animation
6212 float durationSeconds(10.0f);
6213 Animation animation = Animation::New(durationSeconds);
6214 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6215 BounceFunc func(0.0f, 0.0f, -100.0f);
6216 animation.Move(actor, func, AlphaFunctions::Linear, 0.0f, durationSeconds);
6218 // Start the animation
6221 bool signalReceived(false);
6222 AnimationFinishCheck finishCheck(signalReceived);
6223 animation.FinishedSignal().Connect(&application, finishCheck);
6225 application.SendNotification();
6226 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6228 // We didn't expect the animation to finish yet
6229 application.SendNotification();
6230 finishCheck.CheckSignalNotReceived();
6231 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.25f, initialPosition), TEST_LOCATION );
6233 application.SendNotification();
6234 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6236 // We didn't expect the animation to finish yet
6237 application.SendNotification();
6238 finishCheck.CheckSignalNotReceived();
6239 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.5f, initialPosition), TEST_LOCATION );
6241 application.SendNotification();
6242 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6244 // We didn't expect the animation to finish yet
6245 application.SendNotification();
6246 finishCheck.CheckSignalNotReceived();
6247 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.75f, initialPosition), TEST_LOCATION );
6249 application.SendNotification();
6250 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6252 // We did expect the animation to finish
6253 application.SendNotification();
6254 finishCheck.CheckSignalReceived();
6255 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
6259 int UtcDaliAnimationRotateByDegreeVector3(void)
6261 TestApplication application;
6263 Actor actor = Actor::New();
6264 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6265 Stage::GetCurrent().Add(actor);
6266 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6268 // Build the animation
6269 float durationSeconds(1.0f);
6270 Animation animation = Animation::New(durationSeconds);
6271 Degree relativeRotationDegrees(360.0f);
6272 Radian relativeRotationRadians(relativeRotationDegrees);
6273 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS);
6275 // Start the animation
6278 bool signalReceived(false);
6279 AnimationFinishCheck finishCheck(signalReceived);
6280 animation.FinishedSignal().Connect(&application, finishCheck);
6282 application.SendNotification();
6283 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6285 // We didn't expect the animation to finish yet
6286 application.SendNotification();
6287 finishCheck.CheckSignalNotReceived();
6288 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6290 application.SendNotification();
6291 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6293 // We didn't expect the animation to finish yet
6294 application.SendNotification();
6295 finishCheck.CheckSignalNotReceived();
6296 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6298 application.SendNotification();
6299 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6301 // We didn't expect the animation to finish yet
6302 application.SendNotification();
6303 finishCheck.CheckSignalNotReceived();
6304 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6306 application.SendNotification();
6307 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6309 // We did expect the animation to finish
6310 application.SendNotification();
6311 finishCheck.CheckSignalReceived();
6312 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6316 int UtcDaliAnimationRotateByRadianVector3(void)
6318 TestApplication application;
6320 Actor actor = Actor::New();
6321 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6322 Stage::GetCurrent().Add(actor);
6323 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6325 // Build the animation
6326 float durationSeconds(1.0f);
6327 Animation animation = Animation::New(durationSeconds);
6328 Degree relativeRotationDegrees(360.0f);
6329 Radian relativeRotationRadians(relativeRotationDegrees);
6330 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS);
6332 // Start the animation
6335 bool signalReceived(false);
6336 AnimationFinishCheck finishCheck(signalReceived);
6337 animation.FinishedSignal().Connect(&application, finishCheck);
6339 application.SendNotification();
6340 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6342 // We didn't expect the animation to finish yet
6343 application.SendNotification();
6344 finishCheck.CheckSignalNotReceived();
6345 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6347 application.SendNotification();
6348 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6350 // We didn't expect the animation to finish yet
6351 application.SendNotification();
6352 finishCheck.CheckSignalNotReceived();
6353 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6355 application.SendNotification();
6356 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6358 // We didn't expect the animation to finish yet
6359 application.SendNotification();
6360 finishCheck.CheckSignalNotReceived();
6361 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6363 application.SendNotification();
6364 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6366 // We did expect the animation to finish
6367 application.SendNotification();
6368 finishCheck.CheckSignalReceived();
6369 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6373 int UtcDaliAnimationRotateByDegreeVector3Alpha(void)
6375 TestApplication application;
6377 Actor actor = Actor::New();
6378 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6379 Stage::GetCurrent().Add(actor);
6380 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6382 // Build the animation
6383 float durationSeconds(1.0f);
6384 Animation animation = Animation::New(durationSeconds);
6385 Degree relativeRotationDegrees(360.0f);
6386 Radian relativeRotationRadians(relativeRotationDegrees);
6387 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6389 // Start the animation
6392 bool signalReceived(false);
6393 AnimationFinishCheck finishCheck(signalReceived);
6394 animation.FinishedSignal().Connect(&application, finishCheck);
6396 application.SendNotification();
6397 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6399 // We didn't expect the animation to finish yet
6400 application.SendNotification();
6401 finishCheck.CheckSignalNotReceived();
6402 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6404 application.SendNotification();
6405 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6407 // We didn't expect the animation to finish yet
6408 application.SendNotification();
6409 finishCheck.CheckSignalNotReceived();
6410 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6412 application.SendNotification();
6413 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6415 // We didn't expect the animation to finish yet
6416 application.SendNotification();
6417 finishCheck.CheckSignalNotReceived();
6418 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6420 application.SendNotification();
6421 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6423 // We did expect the animation to finish
6424 application.SendNotification();
6425 finishCheck.CheckSignalReceived();
6426 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6430 int UtcDaliAnimationRotateByRadianVector3Alpha(void)
6432 TestApplication application;
6434 Actor actor = Actor::New();
6435 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6436 Stage::GetCurrent().Add(actor);
6437 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6439 // Build the animation
6440 float durationSeconds(1.0f);
6441 Animation animation = Animation::New(durationSeconds);
6442 Degree relativeRotationDegrees(360.0f);
6443 Radian relativeRotationRadians(relativeRotationDegrees);
6444 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6446 // Start the animation
6449 bool signalReceived(false);
6450 AnimationFinishCheck finishCheck(signalReceived);
6451 animation.FinishedSignal().Connect(&application, finishCheck);
6453 application.SendNotification();
6454 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6456 // We didn't expect the animation to finish yet
6457 application.SendNotification();
6458 finishCheck.CheckSignalNotReceived();
6459 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6461 application.SendNotification();
6462 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6464 // We didn't expect the animation to finish yet
6465 application.SendNotification();
6466 finishCheck.CheckSignalNotReceived();
6467 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6469 application.SendNotification();
6470 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6472 // We didn't expect the animation to finish yet
6473 application.SendNotification();
6474 finishCheck.CheckSignalNotReceived();
6475 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6477 application.SendNotification();
6478 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6480 // We did expect the animation to finish
6481 application.SendNotification();
6482 finishCheck.CheckSignalReceived();
6483 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6487 int UtcDaliAnimationRotateByDegreeVector3AlphaFloat2(void)
6489 TestApplication application;
6491 Actor actor = Actor::New();
6492 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6493 Stage::GetCurrent().Add(actor);
6494 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6496 // Build the animation
6497 float durationSeconds(1.0f);
6498 Animation animation = Animation::New(durationSeconds);
6499 Degree relativeRotationDegrees(360.0f);
6500 Radian relativeRotationRadians(relativeRotationDegrees);
6502 animation.RotateBy(actor, relativeRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
6504 // Start the animation
6507 bool signalReceived(false);
6508 AnimationFinishCheck finishCheck(signalReceived);
6509 animation.FinishedSignal().Connect(&application, finishCheck);
6511 application.SendNotification();
6512 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6514 // We didn't expect the animation to finish yet
6515 application.SendNotification();
6516 finishCheck.CheckSignalNotReceived();
6517 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6518 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6520 application.SendNotification();
6521 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6523 // We didn't expect the animation to finish yet
6524 application.SendNotification();
6525 finishCheck.CheckSignalNotReceived();
6526 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6527 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6529 application.SendNotification();
6530 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6532 // We didn't expect the animation to finish yet
6533 application.SendNotification();
6534 finishCheck.CheckSignalNotReceived();
6535 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6536 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6538 application.SendNotification();
6539 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6541 // We did expect the animation to finish
6542 application.SendNotification();
6543 finishCheck.CheckSignalReceived();
6544 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6549 int UtcDaliAnimationRotateByRadianVector3AlphaFloat2(void)
6551 TestApplication application;
6553 Actor actor = Actor::New();
6554 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6555 Stage::GetCurrent().Add(actor);
6556 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6558 // Build the animation
6559 float durationSeconds(1.0f);
6560 Animation animation = Animation::New(durationSeconds);
6561 Degree relativeRotationDegrees(360.0f);
6562 Radian relativeRotationRadians(relativeRotationDegrees);
6564 animation.RotateBy(actor, relativeRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
6566 // Start the animation
6569 bool signalReceived(false);
6570 AnimationFinishCheck finishCheck(signalReceived);
6571 animation.FinishedSignal().Connect(&application, finishCheck);
6573 application.SendNotification();
6574 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6576 // We didn't expect the animation to finish yet
6577 application.SendNotification();
6578 finishCheck.CheckSignalNotReceived();
6579 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6580 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6582 application.SendNotification();
6583 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6585 // We didn't expect the animation to finish yet
6586 application.SendNotification();
6587 finishCheck.CheckSignalNotReceived();
6588 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6589 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6591 application.SendNotification();
6592 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6594 // We didn't expect the animation to finish yet
6595 application.SendNotification();
6596 finishCheck.CheckSignalNotReceived();
6597 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
6598 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6600 application.SendNotification();
6601 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6603 // We did expect the animation to finish
6604 application.SendNotification();
6605 finishCheck.CheckSignalReceived();
6606 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6610 int UtcDaliAnimationRotateToDegreeVector3(void)
6612 TestApplication application;
6614 Actor actor = Actor::New();
6615 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6616 Stage::GetCurrent().Add(actor);
6617 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6619 // Build the animation
6620 float durationSeconds(1.0f);
6621 Animation animation = Animation::New(durationSeconds);
6622 Degree targetRotationDegrees(90.0f);
6623 Radian targetRotationRadians(targetRotationDegrees);
6624 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS);
6626 // Start the animation
6629 bool signalReceived(false);
6630 AnimationFinishCheck finishCheck(signalReceived);
6631 animation.FinishedSignal().Connect(&application, finishCheck);
6633 application.SendNotification();
6634 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6636 // We didn't expect the animation to finish yet
6637 application.SendNotification();
6638 finishCheck.CheckSignalNotReceived();
6639 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6641 application.SendNotification();
6642 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6644 // We didn't expect the animation to finish yet
6645 application.SendNotification();
6646 finishCheck.CheckSignalNotReceived();
6647 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6649 application.SendNotification();
6650 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6652 // We didn't expect the animation to finish yet
6653 application.SendNotification();
6654 finishCheck.CheckSignalNotReceived();
6655 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6657 application.SendNotification();
6658 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6660 // We did expect the animation to finish
6661 application.SendNotification();
6662 finishCheck.CheckSignalReceived();
6663 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6667 int UtcDaliAnimationRotateToRadianVector3(void)
6669 TestApplication application;
6671 Actor actor = Actor::New();
6672 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6673 Stage::GetCurrent().Add(actor);
6674 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6676 // Build the animation
6677 float durationSeconds(1.0f);
6678 Animation animation = Animation::New(durationSeconds);
6679 Degree targetRotationDegrees(90.0f);
6680 Radian targetRotationRadians(targetRotationDegrees);
6681 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS);
6683 // Start the animation
6686 bool signalReceived(false);
6687 AnimationFinishCheck finishCheck(signalReceived);
6688 animation.FinishedSignal().Connect(&application, finishCheck);
6690 application.SendNotification();
6691 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6693 // We didn't expect the animation to finish yet
6694 application.SendNotification();
6695 finishCheck.CheckSignalNotReceived();
6696 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6698 application.SendNotification();
6699 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6701 // We didn't expect the animation to finish yet
6702 application.SendNotification();
6703 finishCheck.CheckSignalNotReceived();
6704 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6706 application.SendNotification();
6707 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6709 // We didn't expect the animation to finish yet
6710 application.SendNotification();
6711 finishCheck.CheckSignalNotReceived();
6712 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6714 application.SendNotification();
6715 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6717 // We did expect the animation to finish
6718 application.SendNotification();
6719 finishCheck.CheckSignalReceived();
6720 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6724 int UtcDaliAnimationRotateToQuaternion(void)
6726 TestApplication application;
6728 Actor actor = Actor::New();
6729 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6730 Stage::GetCurrent().Add(actor);
6731 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6733 // Build the animation
6734 float durationSeconds(1.0f);
6735 Animation animation = Animation::New(durationSeconds);
6736 Degree targetRotationDegrees(90.0f);
6737 Radian targetRotationRadians(targetRotationDegrees);
6738 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6739 animation.RotateTo(actor, targetRotation/*Quaternion version*/);
6741 // Start the animation
6744 bool signalReceived(false);
6745 AnimationFinishCheck finishCheck(signalReceived);
6746 animation.FinishedSignal().Connect(&application, finishCheck);
6748 application.SendNotification();
6749 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6751 // We didn't expect the animation to finish yet
6752 application.SendNotification();
6753 finishCheck.CheckSignalNotReceived();
6754 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6756 application.SendNotification();
6757 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6759 // We didn't expect the animation to finish yet
6760 application.SendNotification();
6761 finishCheck.CheckSignalNotReceived();
6762 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6764 application.SendNotification();
6765 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6767 // We didn't expect the animation to finish yet
6768 application.SendNotification();
6769 finishCheck.CheckSignalNotReceived();
6770 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6772 application.SendNotification();
6773 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6775 // We did expect the animation to finish
6776 application.SendNotification();
6777 finishCheck.CheckSignalReceived();
6778 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6782 int UtcDaliAnimationRotateToDegreeVector3Alpha(void)
6784 TestApplication application;
6786 Actor actor = Actor::New();
6787 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6788 Stage::GetCurrent().Add(actor);
6789 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6791 // Build the animation
6792 float durationSeconds(1.0f);
6793 Animation animation = Animation::New(durationSeconds);
6794 Degree targetRotationDegrees(90.0f);
6795 Radian targetRotationRadians(targetRotationDegrees);
6796 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6798 // Start the animation
6801 bool signalReceived(false);
6802 AnimationFinishCheck finishCheck(signalReceived);
6803 animation.FinishedSignal().Connect(&application, finishCheck);
6805 application.SendNotification();
6806 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6808 // We didn't expect the animation to finish yet
6809 application.SendNotification();
6810 finishCheck.CheckSignalNotReceived();
6811 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6813 application.SendNotification();
6814 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6816 // We didn't expect the animation to finish yet
6817 application.SendNotification();
6818 finishCheck.CheckSignalNotReceived();
6819 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6821 application.SendNotification();
6822 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6824 // We didn't expect the animation to finish yet
6825 application.SendNotification();
6826 finishCheck.CheckSignalNotReceived();
6827 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6829 application.SendNotification();
6830 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6832 // We did expect the animation to finish
6833 application.SendNotification();
6834 finishCheck.CheckSignalReceived();
6835 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6839 int UtcDaliAnimationRotateToRadianVector3Alpha(void)
6841 TestApplication application;
6843 Actor actor = Actor::New();
6844 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6845 Stage::GetCurrent().Add(actor);
6846 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6848 // Build the animation
6849 float durationSeconds(1.0f);
6850 Animation animation = Animation::New(durationSeconds);
6851 Degree targetRotationDegrees(90.0f);
6852 Radian targetRotationRadians(targetRotationDegrees);
6853 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn);
6855 // Start the animation
6858 bool signalReceived(false);
6859 AnimationFinishCheck finishCheck(signalReceived);
6860 animation.FinishedSignal().Connect(&application, finishCheck);
6862 application.SendNotification();
6863 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6865 // We didn't expect the animation to finish yet
6866 application.SendNotification();
6867 finishCheck.CheckSignalNotReceived();
6868 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6870 application.SendNotification();
6871 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6873 // We didn't expect the animation to finish yet
6874 application.SendNotification();
6875 finishCheck.CheckSignalNotReceived();
6876 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6878 application.SendNotification();
6879 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6881 // We didn't expect the animation to finish yet
6882 application.SendNotification();
6883 finishCheck.CheckSignalNotReceived();
6884 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6886 application.SendNotification();
6887 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6889 // We did expect the animation to finish
6890 application.SendNotification();
6891 finishCheck.CheckSignalReceived();
6892 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6896 int UtcDaliAnimationRotateToQuaternionAlpha(void)
6898 TestApplication application;
6900 Actor actor = Actor::New();
6901 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6902 Stage::GetCurrent().Add(actor);
6903 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6905 // Build the animation
6906 float durationSeconds(1.0f);
6907 Animation animation = Animation::New(durationSeconds);
6908 Degree targetRotationDegrees(90.0f);
6909 Radian targetRotationRadians(targetRotationDegrees);
6910 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
6911 animation.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn);
6913 // Start the animation
6916 bool signalReceived(false);
6917 AnimationFinishCheck finishCheck(signalReceived);
6918 animation.FinishedSignal().Connect(&application, finishCheck);
6920 application.SendNotification();
6921 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6923 // We didn't expect the animation to finish yet
6924 application.SendNotification();
6925 finishCheck.CheckSignalNotReceived();
6926 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6928 application.SendNotification();
6929 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6931 // We didn't expect the animation to finish yet
6932 application.SendNotification();
6933 finishCheck.CheckSignalNotReceived();
6934 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6936 application.SendNotification();
6937 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6939 // We didn't expect the animation to finish yet
6940 application.SendNotification();
6941 finishCheck.CheckSignalNotReceived();
6942 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6944 application.SendNotification();
6945 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6947 // We did expect the animation to finish
6948 application.SendNotification();
6949 finishCheck.CheckSignalReceived();
6950 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6954 int UtcDaliAnimationRotateToDegreeVector3AlphaFloat2(void)
6956 TestApplication application;
6958 Actor actor = Actor::New();
6959 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
6960 Stage::GetCurrent().Add(actor);
6961 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6963 // Build the animation
6964 float durationSeconds(1.0f);
6965 Animation animation = Animation::New(durationSeconds);
6966 Degree targetRotationDegrees(90.0f);
6967 Radian targetRotationRadians(targetRotationDegrees);
6969 animation.RotateTo(actor, targetRotationDegrees/*Degree version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
6971 // Start the animation
6974 bool signalReceived(false);
6975 AnimationFinishCheck finishCheck(signalReceived);
6976 animation.FinishedSignal().Connect(&application, finishCheck);
6978 application.SendNotification();
6979 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
6981 // We didn't expect the animation to finish yet
6982 application.SendNotification();
6983 finishCheck.CheckSignalNotReceived();
6984 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
6985 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6987 application.SendNotification();
6988 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
6990 // We didn't expect the animation to finish yet
6991 application.SendNotification();
6992 finishCheck.CheckSignalNotReceived();
6993 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
6994 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
6996 application.SendNotification();
6997 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
6999 // We didn't expect the animation to finish yet
7000 application.SendNotification();
7001 finishCheck.CheckSignalNotReceived();
7002 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7003 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7005 application.SendNotification();
7006 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7008 // We did expect the animation to finish
7009 application.SendNotification();
7010 finishCheck.CheckSignalReceived();
7011 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7015 int UtcDaliAnimationRotateToRadianVector3AlphaFloat2(void)
7017 TestApplication application;
7019 Actor actor = Actor::New();
7020 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7021 Stage::GetCurrent().Add(actor);
7022 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7024 // Build the animation
7025 float durationSeconds(1.0f);
7026 Animation animation = Animation::New(durationSeconds);
7027 Degree targetRotationDegrees(90.0f);
7028 Radian targetRotationRadians(targetRotationDegrees);
7030 animation.RotateTo(actor, targetRotationRadians/*Radian version*/, Vector3::YAXIS, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7032 // Start the animation
7035 bool signalReceived(false);
7036 AnimationFinishCheck finishCheck(signalReceived);
7037 animation.FinishedSignal().Connect(&application, finishCheck);
7039 application.SendNotification();
7040 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7042 // We didn't expect the animation to finish yet
7043 application.SendNotification();
7044 finishCheck.CheckSignalNotReceived();
7045 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7046 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7048 application.SendNotification();
7049 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7051 // We didn't expect the animation to finish yet
7052 application.SendNotification();
7053 finishCheck.CheckSignalNotReceived();
7054 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7055 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7057 application.SendNotification();
7058 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7060 // We didn't expect the animation to finish yet
7061 application.SendNotification();
7062 finishCheck.CheckSignalNotReceived();
7063 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7064 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7066 application.SendNotification();
7067 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7069 // We did expect the animation to finish
7070 application.SendNotification();
7071 finishCheck.CheckSignalReceived();
7072 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7076 int UtcDaliAnimationRotateToQuaternionAlphaFloat2(void)
7078 TestApplication application;
7080 Actor actor = Actor::New();
7081 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
7082 Stage::GetCurrent().Add(actor);
7083 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7085 // Build the animation
7086 float durationSeconds(1.0f);
7087 Animation animation = Animation::New(durationSeconds);
7088 Degree targetRotationDegrees(90.0f);
7089 Radian targetRotationRadians(targetRotationDegrees);
7091 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7092 animation.RotateTo(actor, targetRotation/*Quaternion version*/, AlphaFunctions::EaseIn, delay, durationSeconds - delay);
7094 // Start the animation
7097 bool signalReceived(false);
7098 AnimationFinishCheck finishCheck(signalReceived);
7099 animation.FinishedSignal().Connect(&application, finishCheck);
7101 application.SendNotification();
7102 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7104 // We didn't expect the animation to finish yet
7105 application.SendNotification();
7106 finishCheck.CheckSignalNotReceived();
7107 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7108 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7110 application.SendNotification();
7111 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7113 // We didn't expect the animation to finish yet
7114 application.SendNotification();
7115 finishCheck.CheckSignalNotReceived();
7116 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7117 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7119 application.SendNotification();
7120 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7122 // We didn't expect the animation to finish yet
7123 application.SendNotification();
7124 finishCheck.CheckSignalNotReceived();
7125 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7126 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7128 application.SendNotification();
7129 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7131 // We did expect the animation to finish
7132 application.SendNotification();
7133 finishCheck.CheckSignalReceived();
7134 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7138 int UtcDaliAnimationRotate(void)
7140 TestApplication application;
7142 Actor actor = Actor::New();
7143 Quaternion initialRotation(0.0f, Vector3::YAXIS);
7144 actor.SetRotation(initialRotation);
7145 Stage::GetCurrent().Add(actor);
7146 DALI_TEST_EQUALS( actor.GetCurrentRotation(), initialRotation, ROTATION_EPSILON, TEST_LOCATION );
7148 // Build the animation
7149 float durationSeconds(1.0f);
7150 Animation animation = Animation::New(durationSeconds);
7151 TumbleFunc func(Vector3::YAXIS);
7152 animation.Rotate(actor, func, AlphaFunctions::Linear, 0.0f, durationSeconds);
7154 // Start the animation
7157 bool signalReceived(false);
7158 AnimationFinishCheck finishCheck(signalReceived);
7159 animation.FinishedSignal().Connect(&application, finishCheck);
7161 application.SendNotification();
7162 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7164 // We didn't expect the animation to finish yet
7165 application.SendNotification();
7166 finishCheck.CheckSignalNotReceived();
7167 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.25f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7169 application.SendNotification();
7170 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7172 // We didn't expect the animation to finish yet
7173 application.SendNotification();
7174 finishCheck.CheckSignalNotReceived();
7175 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.5f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7177 application.SendNotification();
7178 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7180 // We didn't expect the animation to finish yet
7181 application.SendNotification();
7182 finishCheck.CheckSignalNotReceived();
7183 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(0.75f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7185 application.SendNotification();
7186 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7188 // We did expect the animation to finish
7189 application.SendNotification();
7190 finishCheck.CheckSignalReceived();
7191 DALI_TEST_EQUALS( actor.GetCurrentRotation(), func(1.0f, initialRotation), ROTATION_EPSILON, TEST_LOCATION );
7195 int UtcDaliAnimationScaleBy(void)
7197 TestApplication application;
7199 Actor actor = Actor::New();
7200 Stage::GetCurrent().Add(actor);
7201 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7203 // Build the animation
7204 float durationSeconds(1.0f);
7205 Animation animation = Animation::New(durationSeconds);
7206 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7207 Vector3 relativeScale(targetScale - Vector3::ONE);
7208 animation.ScaleBy(actor, relativeScale.x, relativeScale.y, relativeScale.z);
7210 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
7212 // Start the animation
7215 bool signalReceived(false);
7216 AnimationFinishCheck finishCheck(signalReceived);
7217 animation.FinishedSignal().Connect(&application, finishCheck);
7219 application.SendNotification();
7220 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7222 // We didn't expect the animation to finish yet
7223 application.SendNotification();
7224 finishCheck.CheckSignalNotReceived();
7225 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7227 application.SendNotification();
7228 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7230 // We did expect the animation to finish
7231 application.SendNotification();
7232 finishCheck.CheckSignalReceived();
7233 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7236 finishCheck.Reset();
7237 actor.SetScale(Vector3::ONE);
7238 application.SendNotification();
7239 application.Render(0);
7240 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7242 // Repeat with a different (ease-in) alpha function
7243 animation = Animation::New(durationSeconds);
7244 animation.ScaleBy(actor, relativeScale, AlphaFunctions::EaseIn);
7245 animation.FinishedSignal().Connect(&application, finishCheck);
7248 application.SendNotification();
7249 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7251 // We didn't expect the animation to finish yet
7252 application.SendNotification();
7253 finishCheck.CheckSignalNotReceived();
7255 // The scale should have grown less, than with a linear alpha function
7256 Vector3 current(actor.GetCurrentScale());
7257 DALI_TEST_CHECK( current.x > 1.0f );
7258 DALI_TEST_CHECK( current.y > 1.0f );
7259 DALI_TEST_CHECK( current.z > 1.0f );
7260 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7261 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7262 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7264 application.SendNotification();
7265 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7267 // We did expect the animation to finish
7268 application.SendNotification();
7269 finishCheck.CheckSignalReceived();
7270 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7273 finishCheck.Reset();
7274 actor.SetScale(Vector3::ONE);
7275 application.SendNotification();
7276 application.Render(0);
7277 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7279 // Repeat with a delay
7281 animation = Animation::New(durationSeconds);
7282 animation.ScaleBy(actor, relativeScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
7283 animation.FinishedSignal().Connect(&application, finishCheck);
7286 application.SendNotification();
7287 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7289 // We didn't expect the animation to finish yet
7290 application.SendNotification();
7291 finishCheck.CheckSignalNotReceived();
7292 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7294 application.SendNotification();
7295 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7297 // We did expect the animation to finish
7298 application.SendNotification();
7299 finishCheck.CheckSignalReceived();
7300 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7304 int UtcDaliAnimationScaleTo(void)
7306 TestApplication application;
7308 Actor actor = Actor::New();
7309 Stage::GetCurrent().Add(actor);
7310 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7312 // Build the animation
7313 float durationSeconds(1.0f);
7314 Animation animation = Animation::New(durationSeconds);
7315 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7316 animation.ScaleTo(actor, targetScale.x, targetScale.y, targetScale.z);
7318 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7320 // Start the animation
7323 bool signalReceived(false);
7324 AnimationFinishCheck finishCheck(signalReceived);
7325 animation.FinishedSignal().Connect(&application, finishCheck);
7327 application.SendNotification();
7328 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7330 // We didn't expect the animation to finish yet
7331 application.SendNotification();
7332 finishCheck.CheckSignalNotReceived();
7333 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7335 application.SendNotification();
7336 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7338 // We did expect the animation to finish
7339 application.SendNotification();
7340 finishCheck.CheckSignalReceived();
7341 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7344 finishCheck.Reset();
7345 actor.SetScale(Vector3::ONE);
7346 application.SendNotification();
7347 application.Render(0);
7348 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7350 // Repeat with a different (ease-in) alpha function
7351 animation = Animation::New(durationSeconds);
7352 animation.ScaleTo(actor, targetScale, AlphaFunctions::EaseIn);
7353 animation.FinishedSignal().Connect(&application, finishCheck);
7356 application.SendNotification();
7357 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7359 // We didn't expect the animation to finish yet
7360 application.SendNotification();
7361 finishCheck.CheckSignalNotReceived();
7363 // The scale should have grown less, than with a linear alpha function
7364 Vector3 current(actor.GetCurrentScale());
7365 DALI_TEST_CHECK( current.x > 1.0f );
7366 DALI_TEST_CHECK( current.y > 1.0f );
7367 DALI_TEST_CHECK( current.z > 1.0f );
7368 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7369 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7370 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7372 application.SendNotification();
7373 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7375 // We did expect the animation to finish
7376 application.SendNotification();
7377 finishCheck.CheckSignalReceived();
7378 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7381 finishCheck.Reset();
7382 actor.SetScale(Vector3::ONE);
7383 application.SendNotification();
7384 application.Render(0);
7385 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7387 // Repeat with a delay
7389 animation = Animation::New(durationSeconds);
7390 animation.ScaleTo(actor, targetScale, AlphaFunctions::Linear, delay, durationSeconds - delay);
7391 animation.FinishedSignal().Connect(&application, finishCheck);
7394 application.SendNotification();
7395 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7397 // We didn't expect the animation to finish yet
7398 application.SendNotification();
7399 finishCheck.CheckSignalNotReceived();
7400 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7402 application.SendNotification();
7403 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7405 // We did expect the animation to finish
7406 application.SendNotification();
7407 finishCheck.CheckSignalReceived();
7408 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7412 int UtcDaliAnimationShow(void)
7414 TestApplication application;
7416 Actor actor = Actor::New();
7417 actor.SetVisible(false);
7418 application.SendNotification();
7419 application.Render(0);
7420 DALI_TEST_CHECK( !actor.IsVisible() );
7421 Stage::GetCurrent().Add(actor);
7423 // Start the animation
7424 float durationSeconds(10.0f);
7425 Animation animation = Animation::New(durationSeconds);
7426 animation.Show(actor, durationSeconds*0.5f);
7429 bool signalReceived(false);
7430 AnimationFinishCheck finishCheck(signalReceived);
7431 animation.FinishedSignal().Connect(&application, finishCheck);
7433 application.SendNotification();
7434 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
7436 // We didn't expect the animation to finish yet
7437 application.SendNotification();
7438 finishCheck.CheckSignalNotReceived();
7439 DALI_TEST_CHECK( !actor.IsVisible() );
7441 application.SendNotification();
7442 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
7444 // We didn't expect the animation to finish yet
7445 application.SendNotification();
7446 finishCheck.CheckSignalNotReceived();
7447 DALI_TEST_CHECK( actor.IsVisible() );
7449 application.SendNotification();
7450 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7452 // We did expect the animation to finish
7453 application.SendNotification();
7454 finishCheck.CheckSignalReceived();
7455 DALI_TEST_CHECK( actor.IsVisible() );
7459 int UtcDaliAnimationHide(void)
7461 TestApplication application;
7463 Actor actor = Actor::New();
7464 DALI_TEST_CHECK( actor.IsVisible() );
7465 Stage::GetCurrent().Add(actor);
7467 // Start the animation
7468 float durationSeconds(10.0f);
7469 Animation animation = Animation::New(durationSeconds);
7470 animation.Hide(actor, durationSeconds*0.5f);
7473 bool signalReceived(false);
7474 AnimationFinishCheck finishCheck(signalReceived);
7475 animation.FinishedSignal().Connect(&application, finishCheck);
7477 application.SendNotification();
7478 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
7480 // We didn't expect the animation to finish yet
7481 application.SendNotification();
7482 finishCheck.CheckSignalNotReceived();
7483 DALI_TEST_CHECK( actor.IsVisible() );
7485 application.SendNotification();
7486 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
7488 // We didn't expect the animation to finish yet
7489 application.SendNotification();
7490 finishCheck.CheckSignalNotReceived();
7491 DALI_TEST_CHECK( !actor.IsVisible() );
7493 application.SendNotification();
7494 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7496 // We did expect the animation to finish
7497 application.SendNotification();
7498 finishCheck.CheckSignalReceived();
7499 DALI_TEST_CHECK( !actor.IsVisible() );
7503 int UtcDaliAnimationShowHideAtEnd(void)
7505 // Test that show/hide delay can be the same as animation duration
7506 // i.e. to show/hide at the end of the animation
7508 TestApplication application;
7510 Actor actor = Actor::New();
7511 DALI_TEST_CHECK( actor.IsVisible() );
7512 Stage::GetCurrent().Add(actor);
7514 // Start Hide animation
7515 float durationSeconds(10.0f);
7516 Animation animation = Animation::New(durationSeconds);
7517 animation.Hide(actor, durationSeconds/*Hide at end*/);
7520 bool signalReceived(false);
7521 AnimationFinishCheck finishCheck(signalReceived);
7522 animation.FinishedSignal().Connect(&application, finishCheck);
7524 application.SendNotification();
7525 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
7527 // We did expect the animation to finish
7528 application.SendNotification();
7529 finishCheck.CheckSignalReceived();
7530 DALI_TEST_CHECK( !actor.IsVisible() );
7532 // Start Show animation
7533 animation = Animation::New(durationSeconds);
7534 animation.Show(actor, durationSeconds/*Show at end*/);
7535 animation.FinishedSignal().Connect(&application, finishCheck);
7538 application.SendNotification();
7539 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
7541 // We did expect the animation to finish
7542 application.SendNotification();
7543 finishCheck.CheckSignalReceived();
7544 DALI_TEST_CHECK( actor.IsVisible() );
7548 int UtcDaliAnimationOpacityBy(void)
7550 TestApplication application;
7551 Actor actor = Actor::New();
7552 float startingOpacity(0.5f);
7553 actor.SetOpacity(startingOpacity);
7554 application.SendNotification();
7555 application.Render(0);
7556 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7557 Stage::GetCurrent().Add(actor);
7559 // Build the animation
7560 float durationSeconds(1.0f);
7561 Animation animation = Animation::New(durationSeconds);
7562 float relativeOpacity(-0.5f); // target of zero
7563 animation.OpacityBy(actor, relativeOpacity);
7565 float seventyFivePercentProgress((1.0f - 0.75f) * startingOpacity);
7567 // Start the animation
7570 bool signalReceived(false);
7571 AnimationFinishCheck finishCheck(signalReceived);
7572 animation.FinishedSignal().Connect(&application, finishCheck);
7574 application.SendNotification();
7575 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7577 // We didn't expect the animation to finish yet
7578 application.SendNotification();
7579 finishCheck.CheckSignalNotReceived();
7580 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), seventyFivePercentProgress, TEST_LOCATION );
7582 application.SendNotification();
7583 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7585 // We did expect the animation to finish
7586 application.SendNotification();
7587 finishCheck.CheckSignalReceived();
7588 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
7591 finishCheck.Reset();
7592 actor.SetOpacity(startingOpacity);
7593 application.SendNotification();
7594 application.Render(0);
7595 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7597 // Repeat with a different (ease-in) alpha function
7598 animation = Animation::New(durationSeconds);
7599 animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::EaseIn);
7600 animation.FinishedSignal().Connect(&application, finishCheck);
7603 application.SendNotification();
7604 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7606 // We didn't expect the animation to finish yet
7607 application.SendNotification();
7608 finishCheck.CheckSignalNotReceived();
7610 // The opacity should reduce less, than with a linear alpha function
7611 float current(actor.GetCurrentOpacity());
7612 DALI_TEST_CHECK( current < 1.0f );
7613 DALI_TEST_CHECK( current > seventyFivePercentProgress );
7615 application.SendNotification();
7616 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7618 // We did expect the animation to finish
7619 application.SendNotification();
7620 finishCheck.CheckSignalReceived();
7621 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
7624 finishCheck.Reset();
7625 actor.SetOpacity(startingOpacity);
7626 application.SendNotification();
7627 application.Render(0);
7628 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7630 // Repeat with a delay
7632 animation = Animation::New(durationSeconds);
7633 animation.OpacityBy(actor, relativeOpacity, AlphaFunctions::Linear, delay, durationSeconds - delay);
7634 animation.FinishedSignal().Connect(&application, finishCheck);
7637 application.SendNotification();
7638 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7640 // We didn't expect the animation to finish yet
7641 application.SendNotification();
7642 finishCheck.CheckSignalNotReceived();
7643 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity, TEST_LOCATION );
7645 application.SendNotification();
7646 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7648 // We didn't expect the animation to finish yet
7649 application.SendNotification();
7650 finishCheck.CheckSignalNotReceived();
7651 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), seventyFivePercentProgress, TEST_LOCATION );
7653 application.SendNotification();
7654 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7656 // We did expect the animation to finish
7657 application.SendNotification();
7658 finishCheck.CheckSignalReceived();
7659 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), startingOpacity+relativeOpacity, TEST_LOCATION );
7663 int UtcDaliAnimationOpacityTo(void)
7665 TestApplication application;
7667 Actor actor = Actor::New();
7668 Stage::GetCurrent().Add(actor);
7669 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7671 // Build the animation
7672 float durationSeconds(1.0f);
7673 Animation animation = Animation::New(durationSeconds);
7674 float targetOpacity(0.0f);
7675 animation.OpacityTo(actor, targetOpacity);
7677 float ninetyNinePercentProgress(0.01f);
7679 // Start the animation
7682 bool signalReceived(false);
7683 AnimationFinishCheck finishCheck(signalReceived);
7684 animation.FinishedSignal().Connect(&application, finishCheck);
7686 application.SendNotification();
7687 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7689 // We didn't expect the animation to finish yet
7690 application.SendNotification();
7691 finishCheck.CheckSignalNotReceived();
7692 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), ninetyNinePercentProgress, 0.001f, TEST_LOCATION );
7694 application.SendNotification();
7695 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7697 // We did expect the animation to finish
7698 application.SendNotification();
7699 finishCheck.CheckSignalReceived();
7700 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
7703 finishCheck.Reset();
7704 actor.SetOpacity(1.0f);
7705 application.SendNotification();
7706 application.Render(0);
7707 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7709 // Repeat with a different (ease-in) alpha function
7710 animation = Animation::New(durationSeconds);
7711 animation.OpacityTo(actor, targetOpacity, AlphaFunctions::EaseIn);
7712 animation.FinishedSignal().Connect(&application, finishCheck);
7715 application.SendNotification();
7716 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7718 // We didn't expect the animation to finish yet
7719 application.SendNotification();
7720 finishCheck.CheckSignalNotReceived();
7722 // The opacity should reduce less, than with a linear alpha function
7723 float current(actor.GetCurrentOpacity());
7724 DALI_TEST_CHECK( current < 1.0f );
7725 DALI_TEST_CHECK( current > ninetyNinePercentProgress );
7727 application.SendNotification();
7728 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7730 // We did expect the animation to finish
7731 application.SendNotification();
7732 finishCheck.CheckSignalReceived();
7733 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
7736 finishCheck.Reset();
7737 actor.SetOpacity(1.0f);
7738 application.SendNotification();
7739 application.Render(0);
7740 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7742 // Repeat with a delay
7744 animation = Animation::New(durationSeconds);
7745 animation.OpacityTo(actor, targetOpacity, AlphaFunctions::Linear, delay, durationSeconds - delay);
7746 animation.FinishedSignal().Connect(&application, finishCheck);
7749 application.SendNotification();
7750 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7752 // We didn't expect the animation to finish yet
7753 application.SendNotification();
7754 finishCheck.CheckSignalNotReceived();
7755 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), 1.0f, TEST_LOCATION );
7757 application.SendNotification();
7758 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7760 // We did expect the animation to finish
7761 application.SendNotification();
7762 finishCheck.CheckSignalReceived();
7763 DALI_TEST_EQUALS( actor.GetCurrentOpacity(), targetOpacity, TEST_LOCATION );
7767 int UtcDaliAnimationColorBy(void)
7769 TestApplication application;
7771 Actor actor = Actor::New();
7772 actor.SetColor(Color::BLACK);
7773 application.SendNotification();
7774 application.Render(0);
7775 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::BLACK, TEST_LOCATION );
7776 Stage::GetCurrent().Add(actor);
7778 // Build the animation
7779 float durationSeconds(1.0f);
7780 Animation animation = Animation::New(durationSeconds);
7781 Vector4 targetColor(Color::GREEN);
7782 Vector4 relativeColor(Color::GREEN); // Note the alpha is automatically clamped <= 1.0f in world color
7783 animation.ColorBy(actor, relativeColor);
7785 Vector4 tenPercentProgress(Vector4(0.0f, 0.1f, 0.0f, 1.0f));
7786 Vector4 twentyPercentProgress(Vector4(0.0f, 0.2f, 0.0f, 1.0f));
7788 // Start the animation
7791 bool signalReceived(false);
7792 AnimationFinishCheck finishCheck(signalReceived);
7793 animation.FinishedSignal().Connect(&application, finishCheck);
7795 application.SendNotification();
7796 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7798 // We didn't expect the animation to finish yet
7799 application.SendNotification();
7800 finishCheck.CheckSignalNotReceived();
7801 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), tenPercentProgress, TEST_LOCATION );
7803 application.SendNotification();
7804 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7806 // We did expect the animation to finish
7807 application.SendNotification();
7808 finishCheck.CheckSignalReceived();
7809 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7812 finishCheck.Reset();
7813 actor.SetColor(Color::BLACK);
7814 application.SendNotification();
7815 application.Render(0);
7816 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION );
7818 // Repeat with a different (ease-in) alpha function
7819 animation = Animation::New(durationSeconds);
7820 animation.ColorBy(actor, relativeColor, AlphaFunctions::EaseIn);
7821 animation.FinishedSignal().Connect(&application, finishCheck);
7824 application.SendNotification();
7825 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7827 // We didn't expect the animation to finish yet
7828 application.SendNotification();
7829 finishCheck.CheckSignalNotReceived();
7831 // The color should have changed less, than with a linear alpha function
7832 Vector4 current(actor.GetCurrentWorldColor());
7833 DALI_TEST_CHECK( current.x == 0.0f ); // doesn't change
7834 DALI_TEST_CHECK( current.y > 0.0f );
7835 DALI_TEST_CHECK( current.y < tenPercentProgress.y );
7836 DALI_TEST_CHECK( current.z == 0.0f ); // doesn't change
7837 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7839 application.SendNotification();
7840 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7842 // We did expect the animation to finish
7843 application.SendNotification();
7844 finishCheck.CheckSignalReceived();
7845 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7848 finishCheck.Reset();
7849 actor.SetColor(Color::BLACK);
7850 application.SendNotification();
7851 application.Render(0);
7852 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), Color::BLACK, TEST_LOCATION );
7854 // Repeat with a shorter animator duration
7855 float animatorDuration = 0.5f;
7856 animation = Animation::New(durationSeconds);
7857 animation.ColorBy(actor, relativeColor, AlphaFunctions::Linear, 0, animatorDuration);
7858 animation.FinishedSignal().Connect(&application, finishCheck);
7861 application.SendNotification();
7862 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7864 // We didn't expect the animation to finish yet
7865 application.SendNotification();
7866 finishCheck.CheckSignalNotReceived();
7867 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), twentyPercentProgress, TEST_LOCATION );
7869 application.SendNotification();
7870 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7872 // We didn't expect the animation to finish yet
7873 application.SendNotification();
7874 finishCheck.CheckSignalNotReceived();
7875 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7877 application.SendNotification();
7878 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7880 // We did expect the animation to finish
7881 application.SendNotification();
7882 finishCheck.CheckSignalReceived();
7883 DALI_TEST_EQUALS( actor.GetCurrentWorldColor(), targetColor, TEST_LOCATION );
7887 int UtcDaliAnimationColorTo(void)
7889 TestApplication application;
7891 Actor actor = Actor::New();
7892 Stage::GetCurrent().Add(actor);
7893 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7895 // Build the animation
7896 float durationSeconds(1.0f);
7897 Animation animation = Animation::New(durationSeconds);
7898 Vector4 targetColor(Color::RED);
7899 animation.ColorTo(actor, targetColor);
7901 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7902 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7904 // Start the animation
7907 bool signalReceived(false);
7908 AnimationFinishCheck finishCheck(signalReceived);
7909 animation.FinishedSignal().Connect(&application, finishCheck);
7911 application.SendNotification();
7912 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7914 // We didn't expect the animation to finish yet
7915 application.SendNotification();
7916 finishCheck.CheckSignalNotReceived();
7917 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7919 application.SendNotification();
7920 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7922 // We did expect the animation to finish
7923 application.SendNotification();
7924 finishCheck.CheckSignalReceived();
7925 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7928 finishCheck.Reset();
7929 actor.SetColor(Color::WHITE);
7930 application.SendNotification();
7931 application.Render(0);
7932 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7934 // Repeat with a different (ease-in) alpha function
7935 animation = Animation::New(durationSeconds);
7936 animation.ColorTo(actor, targetColor, AlphaFunctions::EaseIn);
7937 animation.FinishedSignal().Connect(&application, finishCheck);
7940 application.SendNotification();
7941 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7943 // We didn't expect the animation to finish yet
7944 application.SendNotification();
7945 finishCheck.CheckSignalNotReceived();
7947 // The color should have changed less, than with a linear alpha function
7948 Vector4 current(actor.GetCurrentColor());
7949 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7950 DALI_TEST_CHECK( current.y < 1.0f );
7951 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7952 DALI_TEST_CHECK( current.z < 1.0f );
7953 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7954 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7956 application.SendNotification();
7957 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7959 // We did expect the animation to finish
7960 application.SendNotification();
7961 finishCheck.CheckSignalReceived();
7962 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7965 finishCheck.Reset();
7966 actor.SetColor(Color::WHITE);
7967 application.SendNotification();
7968 application.Render(0);
7969 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7971 // Repeat with a shorter animator duration
7972 float animatorDuration = 0.5f;
7973 animation = Animation::New(durationSeconds);
7974 animation.ColorTo(actor, targetColor, AlphaFunctions::Linear, 0, animatorDuration);
7975 animation.FinishedSignal().Connect(&application, finishCheck);
7978 application.SendNotification();
7979 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7981 // We didn't expect the animation to finish yet
7982 application.SendNotification();
7983 finishCheck.CheckSignalNotReceived();
7984 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7986 application.SendNotification();
7987 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7989 // We didn't expect the animation to finish yet
7990 application.SendNotification();
7991 finishCheck.CheckSignalNotReceived();
7992 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7994 application.SendNotification();
7995 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7997 // We did expect the animation to finish
7998 application.SendNotification();
7999 finishCheck.CheckSignalReceived();
8000 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8004 int UtcDaliAnimationResize(void)
8006 TestApplication application;
8008 Actor actor = Actor::New();
8009 Stage::GetCurrent().Add(actor);
8010 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8012 // Build the animation
8013 float durationSeconds(1.0f);
8014 Animation animation = Animation::New(durationSeconds);
8015 Vector3 targetSize(100.0f, 100.0f, 100.0f);
8016 animation.Resize(actor, targetSize);
8018 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
8020 // Start the animation
8023 bool signalReceived(false);
8024 AnimationFinishCheck finishCheck(signalReceived);
8025 animation.FinishedSignal().Connect(&application, finishCheck);
8027 application.SendNotification();
8028 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8030 // We didn't expect the animation to finish yet
8031 application.SendNotification();
8032 finishCheck.CheckSignalNotReceived();
8033 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
8035 application.SendNotification();
8036 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8038 // We did expect the animation to finish
8039 application.SendNotification();
8040 finishCheck.CheckSignalReceived();
8041 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8044 finishCheck.Reset();
8045 actor.SetSize(Vector3::ZERO);
8046 application.SendNotification();
8047 application.Render(0);
8048 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8050 // Repeat with a different (ease-in) alpha function
8051 animation = Animation::New(durationSeconds);
8052 animation.Resize(actor, targetSize, AlphaFunctions::EaseIn);
8053 animation.FinishedSignal().Connect(&application, finishCheck);
8056 application.SendNotification();
8057 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8059 // We didn't expect the animation to finish yet
8060 application.SendNotification();
8061 finishCheck.CheckSignalNotReceived();
8063 // The size should have travelled less, than with a linear alpha function
8064 Vector3 current(actor.GetCurrentSize());
8065 DALI_TEST_CHECK( current.x > 0.0f );
8066 DALI_TEST_CHECK( current.y > 0.0f );
8067 DALI_TEST_CHECK( current.z > 0.0f );
8068 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8069 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8070 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8072 application.SendNotification();
8073 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8075 // We did expect the animation to finish
8076 application.SendNotification();
8077 finishCheck.CheckSignalReceived();
8078 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8081 finishCheck.Reset();
8082 actor.SetSize(Vector3::ZERO);
8083 application.SendNotification();
8084 application.Render(0);
8085 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8087 // Repeat with a delay
8089 animation = Animation::New(durationSeconds);
8090 animation.Resize(actor, targetSize, AlphaFunctions::Linear, delay, durationSeconds - delay);
8091 animation.FinishedSignal().Connect(&application, finishCheck);
8094 application.SendNotification();
8095 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8097 // We didn't expect the animation to finish yet
8098 application.SendNotification();
8099 finishCheck.CheckSignalNotReceived();
8100 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8102 application.SendNotification();
8103 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8105 // We did expect the animation to finish
8106 application.SendNotification();
8107 finishCheck.CheckSignalReceived();
8108 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8112 int UtcDaliAnimationAnimateBool(void)
8114 TestApplication application;
8116 Actor actor = Actor::New();
8117 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8118 Stage::GetCurrent().Add(actor);
8120 // Build the animation
8121 float durationSeconds(10.0f);
8122 Animation animation = Animation::New(durationSeconds);
8123 animation.Animate<bool>( Property(actor, Actor::VISIBLE), ReturnFalseAfterProgressOne, TimePeriod(durationSeconds*0.25f/*delay*/, durationSeconds*0.1f) );
8125 // Start the animation
8128 bool signalReceived(false);
8129 AnimationFinishCheck finishCheck(signalReceived);
8130 animation.FinishedSignal().Connect(&application, finishCheck);
8132 application.SendNotification();
8133 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8135 // We didn't expect the animation to finish yet
8136 application.SendNotification();
8137 finishCheck.CheckSignalNotReceived();
8139 // Should still be visible
8140 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8142 application.SendNotification();
8143 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8145 // We didn't expect the animation to finish yet
8146 application.SendNotification();
8147 finishCheck.CheckSignalNotReceived();
8149 // Now animate functor should have hidden the actor
8150 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
8152 application.SendNotification();
8153 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8155 // We did expect the animation to finish
8156 application.SendNotification();
8157 finishCheck.CheckSignalReceived();
8158 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
8162 int UtcDaliAnimationAnimateFloat(void)
8164 TestApplication application;
8166 Actor actor = Actor::New();
8167 Stage::GetCurrent().Add(actor);
8169 // Register a float property
8170 float startValue(10.0f);
8171 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8172 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
8174 // Build the animation
8175 float durationSeconds(10.0f);
8176 Animation animation = Animation::New(durationSeconds);
8177 float targetPosition(0.0f);
8178 AnimateFloatTestFunctor func( 100, targetPosition );
8179 animation.Animate<float>( Property(actor, index), func );
8181 // Start the animation
8184 bool signalReceived(false);
8185 AnimationFinishCheck finishCheck(signalReceived);
8186 animation.FinishedSignal().Connect(&application, finishCheck);
8188 application.SendNotification();
8189 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8191 // We didn't expect the animation to finish yet
8192 application.SendNotification();
8193 finishCheck.CheckSignalNotReceived();
8194 DALI_TEST_EQUALS( actor.GetProperty<float>(index), 75.0f, TEST_LOCATION );
8196 application.SendNotification();
8197 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8199 // We didn't expect the animation to finish yet
8200 application.SendNotification();
8201 finishCheck.CheckSignalNotReceived();
8202 DALI_TEST_EQUALS( actor.GetProperty<float>(index), 50.0f, TEST_LOCATION );
8204 application.SendNotification();
8205 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8207 // We didn't expect the animation to finish yet
8208 application.SendNotification();
8209 finishCheck.CheckSignalNotReceived();
8210 DALI_TEST_EQUALS( actor.GetProperty<float>(index), 25.0f, TEST_LOCATION );
8212 application.SendNotification();
8213 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8215 // We did expect the animation to finish
8216 application.SendNotification();
8217 finishCheck.CheckSignalReceived();
8218 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetPosition, TEST_LOCATION );
8222 int UtcDaliAnimationAnimateVector2(void)
8224 TestApplication application;
8226 Actor actor = Actor::New();
8227 Stage::GetCurrent().Add(actor);
8229 // Register a Vector2 property
8230 Vector2 startValue(10.0f, 10.0f);
8231 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8232 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
8234 // Build the animation
8235 float durationSeconds(10.0f);
8236 Animation animation = Animation::New(durationSeconds);
8237 Vector2 targetPosition(0.0f, 0.0f);
8238 AnimateVector2TestFunctor func( Vector2(100,100), targetPosition );
8239 animation.Animate<Vector2>( Property(actor, index), func );
8241 // Start the animation
8244 bool signalReceived(false);
8245 AnimationFinishCheck finishCheck(signalReceived);
8246 animation.FinishedSignal().Connect(&application, finishCheck);
8248 application.SendNotification();
8249 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8251 // We didn't expect the animation to finish yet
8252 application.SendNotification();
8253 finishCheck.CheckSignalNotReceived();
8254 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), Vector2(75,75), TEST_LOCATION );
8256 application.SendNotification();
8257 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8259 // We didn't expect the animation to finish yet
8260 application.SendNotification();
8261 finishCheck.CheckSignalNotReceived();
8262 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), Vector2(50,50), TEST_LOCATION );
8264 application.SendNotification();
8265 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8267 // We didn't expect the animation to finish yet
8268 application.SendNotification();
8269 finishCheck.CheckSignalNotReceived();
8270 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), Vector2(25,25), TEST_LOCATION );
8272 application.SendNotification();
8273 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8275 // We did expect the animation to finish
8276 application.SendNotification();
8277 finishCheck.CheckSignalReceived();
8278 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetPosition, TEST_LOCATION );
8282 int UtcDaliAnimationAnimateVector3(void)
8284 TestApplication application;
8286 Actor actor = Actor::New();
8287 Vector3 initialPosition(Vector3::ZERO);
8288 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8289 Stage::GetCurrent().Add(actor);
8291 // Build the animation
8292 float durationSeconds(10.0f);
8293 Animation animation = Animation::New(durationSeconds);
8294 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8295 BounceFunc func(0.0f, 0.0f, -100.0f);
8296 animation.Animate<Vector3>( Property(actor, Actor::POSITION), func, AlphaFunctions::Linear, durationSeconds );
8298 // Start the animation
8301 bool signalReceived(false);
8302 AnimationFinishCheck finishCheck(signalReceived);
8303 animation.FinishedSignal().Connect(&application, finishCheck);
8305 application.SendNotification();
8306 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8308 // We didn't expect the animation to finish yet
8309 application.SendNotification();
8310 finishCheck.CheckSignalNotReceived();
8311 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.25f, initialPosition), TEST_LOCATION );
8313 application.SendNotification();
8314 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8316 // We didn't expect the animation to finish yet
8317 application.SendNotification();
8318 finishCheck.CheckSignalNotReceived();
8319 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.5f, initialPosition), TEST_LOCATION );
8321 application.SendNotification();
8322 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8324 // We didn't expect the animation to finish yet
8325 application.SendNotification();
8326 finishCheck.CheckSignalNotReceived();
8327 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.75f, initialPosition), TEST_LOCATION );
8329 application.SendNotification();
8330 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8332 // We did expect the animation to finish
8333 application.SendNotification();
8334 finishCheck.CheckSignalReceived();
8335 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8339 int UtcDaliAnimationAnimateVector4(void)
8341 TestApplication application;
8343 Actor actor = Actor::New();
8344 Stage::GetCurrent().Add(actor);
8346 // Register a Vector4 property
8347 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
8348 Property::Index index = actor.RegisterProperty( "test-property", startValue );
8349 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
8351 // Build the animation
8352 float durationSeconds(10.0f);
8353 Animation animation = Animation::New(durationSeconds);
8354 Vector4 targetPosition(200,400,0,-1000);
8355 AnimateVector4TestFunctor func( Vector4(1000,1000,1000,1000), targetPosition );
8356 animation.Animate<Vector4>( Property(actor, index), func );
8358 // Start the animation
8361 bool signalReceived(false);
8362 AnimationFinishCheck finishCheck(signalReceived);
8363 animation.FinishedSignal().Connect(&application, finishCheck);
8365 application.SendNotification();
8366 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8368 // We didn't expect the animation to finish yet
8369 application.SendNotification();
8370 finishCheck.CheckSignalNotReceived();
8371 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), Vector4(800,850,750,500), TEST_LOCATION );
8373 application.SendNotification();
8374 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8376 // We didn't expect the animation to finish yet
8377 application.SendNotification();
8378 finishCheck.CheckSignalNotReceived();
8379 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), Vector4(600,700,500,0), TEST_LOCATION );
8381 application.SendNotification();
8382 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8384 // We didn't expect the animation to finish yet
8385 application.SendNotification();
8386 finishCheck.CheckSignalNotReceived();
8387 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), Vector4(400,550,250,-500), TEST_LOCATION );
8389 application.SendNotification();
8390 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8392 // We did expect the animation to finish
8393 application.SendNotification();
8394 finishCheck.CheckSignalReceived();
8395 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetPosition, TEST_LOCATION );
8399 int UtcDaliAnimationAnimateQuaternion(void)
8401 TestApplication application;
8403 Actor actor = Actor::New();
8404 actor.SetRotation(Quaternion(0.0f, Vector3::YAXIS));
8405 Stage::GetCurrent().Add(actor);
8406 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(0.0f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8408 // Build the animation
8409 float durationSeconds(1.0f);
8410 Animation animation = Animation::New(durationSeconds);
8412 Degree sourceRotationDegrees(90.0f);
8413 Radian sourceRotationRadians(sourceRotationDegrees);
8414 Quaternion sourceRotation(sourceRotationRadians, Vector3::YAXIS);
8416 Degree targetRotationDegrees(150.0f);
8417 Radian targetRotationRadians(targetRotationDegrees);
8418 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8420 AnimateQuaternionTestFunctor func( sourceRotation, targetRotation );
8421 animation.Animate<Quaternion>( Property(actor, Actor::ROTATION), func );
8423 // Start the animation
8426 bool signalReceived(false);
8427 AnimationFinishCheck finishCheck(signalReceived);
8428 animation.FinishedSignal().Connect(&application, finishCheck);
8430 application.SendNotification();
8431 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8433 // We didn't expect the animation to finish yet
8434 application.SendNotification();
8435 finishCheck.CheckSignalNotReceived();
8436 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(Radian(Degree(105)), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8438 application.SendNotification();
8439 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8441 // We didn't expect the animation to finish yet
8442 application.SendNotification();
8443 finishCheck.CheckSignalNotReceived();
8444 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(Radian(Degree(120)), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8446 application.SendNotification();
8447 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8449 // We didn't expect the animation to finish yet
8450 application.SendNotification();
8451 finishCheck.CheckSignalNotReceived();
8452 DALI_TEST_EQUALS( actor.GetCurrentRotation(), Quaternion(Radian(Degree(135)), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8454 application.SendNotification();
8455 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8457 // We did expect the animation to finish
8458 application.SendNotification();
8459 finishCheck.CheckSignalReceived();
8460 DALI_TEST_EQUALS( actor.GetCurrentRotation(), targetRotation, ROTATION_EPSILON, TEST_LOCATION );
8464 int UtcDaliKeyFramesCreateDestroy(void)
8466 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
8468 KeyFrames* keyFrames = new KeyFrames;
8470 DALI_TEST_CHECK( true );
8474 int UtcDaliKeyFramesDownCast(void)
8476 TestApplication application;
8477 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
8479 KeyFrames keyFrames = KeyFrames::New();
8480 BaseHandle object(keyFrames);
8482 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
8483 DALI_TEST_CHECK(keyFrames2);
8485 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
8486 DALI_TEST_CHECK(keyFrames3);
8488 BaseHandle unInitializedObject;
8489 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
8490 DALI_TEST_CHECK(!keyFrames4);
8492 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
8493 DALI_TEST_CHECK(!keyFrames5);
8497 int UtcDaliAnimationResizeByXY(void)
8499 TestApplication application;
8501 Actor actor = Actor::New();
8502 Stage::GetCurrent().Add(actor);
8503 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8505 // Build the animation
8506 float durationSeconds(1.0f);
8507 Animation animation = Animation::New(durationSeconds);
8508 Vector3 targetSize(100.0f, 100.0f, 100.0f);
8509 animation.Resize(actor, targetSize);
8511 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
8513 // Start the animation
8516 bool signalReceived(false);
8517 AnimationFinishCheck finishCheck(signalReceived);
8518 animation.FinishedSignal().Connect(&application, finishCheck);
8520 application.SendNotification();
8521 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8523 // We didn't expect the animation to finish yet
8524 application.SendNotification();
8525 finishCheck.CheckSignalNotReceived();
8526 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
8528 application.SendNotification();
8529 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8531 // We did expect the animation to finish
8532 application.SendNotification();
8533 finishCheck.CheckSignalReceived();
8534 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8537 finishCheck.Reset();
8538 actor.SetSize(Vector3::ZERO);
8539 application.SendNotification();
8540 application.Render(0);
8541 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8543 // Repeat with a different (ease-in) alpha function
8544 animation = Animation::New(durationSeconds);
8545 animation.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::EaseIn);
8546 animation.FinishedSignal().Connect(&application, finishCheck);
8549 application.SendNotification();
8550 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8552 // We didn't expect the animation to finish yet
8553 application.SendNotification();
8554 finishCheck.CheckSignalNotReceived();
8556 // The size should have travelled less, than with a linear alpha function
8557 Vector3 current(actor.GetCurrentSize());
8558 DALI_TEST_CHECK( current.x > 0.0f );
8559 DALI_TEST_CHECK( current.y > 0.0f );
8560 DALI_TEST_CHECK( current.z > 0.0f );
8561 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8562 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8563 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8565 application.SendNotification();
8566 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8568 // We did expect the animation to finish
8569 application.SendNotification();
8570 finishCheck.CheckSignalReceived();
8571 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8574 finishCheck.Reset();
8575 actor.SetSize(Vector3::ZERO);
8576 application.SendNotification();
8577 application.Render(0);
8578 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8580 // Repeat with a delay
8582 animation = Animation::New(durationSeconds);
8583 animation.Resize(actor, targetSize.x, targetSize.y, AlphaFunctions::Linear, delay, durationSeconds - delay);
8584 animation.FinishedSignal().Connect(&application, finishCheck);
8587 application.SendNotification();
8588 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8590 // We didn't expect the animation to finish yet
8591 application.SendNotification();
8592 finishCheck.CheckSignalNotReceived();
8593 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
8595 application.SendNotification();
8596 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8598 // We did expect the animation to finish
8599 application.SendNotification();
8600 finishCheck.CheckSignalReceived();
8601 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
8606 int UtcDaliAnimationAnimateBetweenActorColorTimePeriod(void)
8608 TestApplication application;
8610 float startValue(1.0f);
8611 Actor actor = Actor::New();
8612 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8613 Stage::GetCurrent().Add(actor);
8615 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8616 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
8617 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
8618 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
8619 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
8621 // Build the animation
8622 float durationSeconds(1.0f);
8623 Animation animation = Animation::New(durationSeconds);
8625 KeyFrames keyFrames = KeyFrames::New();
8626 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8627 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8628 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8630 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, TimePeriod( 1.0f) );
8632 // Start the animation
8635 bool signalReceived(false);
8636 AnimationFinishCheck finishCheck(signalReceived);
8637 animation.FinishedSignal().Connect(&application, finishCheck);
8638 application.SendNotification();
8639 application.Render(0);
8640 application.SendNotification();
8641 finishCheck.CheckSignalNotReceived();
8642 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8643 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8644 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8645 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8647 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8648 application.SendNotification();
8649 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8650 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8651 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8652 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8654 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8655 application.SendNotification();
8656 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8657 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8659 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8661 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8662 application.SendNotification();
8663 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8664 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8665 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8666 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8668 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8669 application.SendNotification();
8670 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8671 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8672 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8673 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8675 // We did expect the animation to finish
8677 finishCheck.CheckSignalReceived();
8681 int UtcDaliAnimationAnimateBetweenActorColorFunction(void)
8683 TestApplication application;
8685 float startValue(1.0f);
8686 Actor actor = Actor::New();
8687 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8688 Stage::GetCurrent().Add(actor);
8690 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8691 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
8692 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
8693 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
8694 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
8696 // Build the animation
8697 float durationSeconds(1.0f);
8698 Animation animation = Animation::New(durationSeconds);
8700 KeyFrames keyFrames = KeyFrames::New();
8701 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8702 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8703 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8705 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear );
8707 // Start the animation
8710 bool signalReceived(false);
8711 AnimationFinishCheck finishCheck(signalReceived);
8712 animation.FinishedSignal().Connect(&application, finishCheck);
8713 application.SendNotification();
8714 application.Render(0);
8715 application.SendNotification();
8716 finishCheck.CheckSignalNotReceived();
8717 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8718 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8719 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8720 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8722 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8723 application.SendNotification();
8724 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8725 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8726 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8727 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8729 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8730 application.SendNotification();
8731 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8732 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8733 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8734 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8736 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8737 application.SendNotification();
8738 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8739 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8740 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8741 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8743 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8744 application.SendNotification();
8745 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8746 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8747 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8748 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8750 // We did expect the animation to finish
8752 finishCheck.CheckSignalReceived();
8756 int UtcDaliAnimationAnimateBetweenActorColorFunctionTimePeriod(void)
8758 TestApplication application;
8760 float startValue(1.0f);
8761 Actor actor = Actor::New();
8762 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8763 Stage::GetCurrent().Add(actor);
8765 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8766 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), startValue, TEST_LOCATION );
8767 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), startValue, TEST_LOCATION );
8768 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), startValue, TEST_LOCATION );
8769 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), startValue, TEST_LOCATION );
8771 // Build the animation
8772 float durationSeconds(1.0f);
8773 Animation animation = Animation::New(durationSeconds);
8775 KeyFrames keyFrames = KeyFrames::New();
8776 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8777 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8778 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8780 animation.AnimateBetween( Property(actor, Actor::COLOR), keyFrames, AlphaFunctions::Linear, TimePeriod( 1.0f) );
8782 // Start the animation
8785 bool signalReceived(false);
8786 AnimationFinishCheck finishCheck(signalReceived);
8787 animation.FinishedSignal().Connect(&application, finishCheck);
8788 application.SendNotification();
8789 application.Render(0);
8790 application.SendNotification();
8791 finishCheck.CheckSignalNotReceived();
8792 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8793 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8794 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8795 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8797 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8798 application.SendNotification();
8799 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8800 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8801 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8802 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8804 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8805 application.SendNotification();
8806 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8807 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8808 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8809 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8811 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8812 application.SendNotification();
8813 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8814 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8815 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8816 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8818 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8819 application.SendNotification();
8820 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8821 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8822 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8823 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8825 // We did expect the animation to finish
8827 finishCheck.CheckSignalReceived();
8831 int UtcDaliAnimationAnimateVector3Func(void)
8833 TestApplication application;
8835 Actor actor = Actor::New();
8836 Vector3 initialPosition(Vector3::ZERO);
8837 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8838 Stage::GetCurrent().Add(actor);
8840 // Build the animation
8841 float durationSeconds(10.0f);
8842 Animation animation = Animation::New(durationSeconds);
8843 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8844 BounceFunc func(0.0f, 0.0f, -100.0f);
8845 animation.Animate<Vector3>( Property(actor, Actor::POSITION), func, AlphaFunctions::Linear );
8847 // Start the animation
8850 bool signalReceived(false);
8851 AnimationFinishCheck finishCheck(signalReceived);
8852 animation.FinishedSignal().Connect(&application, finishCheck);
8854 application.SendNotification();
8855 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8857 // We didn't expect the animation to finish yet
8858 application.SendNotification();
8859 finishCheck.CheckSignalNotReceived();
8860 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.25f, initialPosition), TEST_LOCATION );
8862 application.SendNotification();
8863 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8865 // We didn't expect the animation to finish yet
8866 application.SendNotification();
8867 finishCheck.CheckSignalNotReceived();
8868 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.5f, initialPosition), TEST_LOCATION );
8870 application.SendNotification();
8871 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8873 // We didn't expect the animation to finish yet
8874 application.SendNotification();
8875 finishCheck.CheckSignalNotReceived();
8876 DALI_TEST_EQUALS( actor.GetCurrentPosition(), func(0.75f, initialPosition), TEST_LOCATION );
8878 application.SendNotification();
8879 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8881 // We did expect the animation to finish
8882 application.SendNotification();
8883 finishCheck.CheckSignalReceived();
8884 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
8888 int UtcDaliAnimationCreateDestroy(void)
8890 TestApplication application;
8891 Animation* animation = new Animation;
8892 DALI_TEST_CHECK( animation );