2 * Copyright (c) 2020 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.
18 #include <dali-test-suite-utils.h>
19 #include <dali/devel-api/actors/actor-devel.h>
20 #include <dali/devel-api/animation/animation-devel.h>
21 #include <dali/public-api/dali-core.h>
30 void utc_dali_animation_startuP(void)
32 test_return_value = TET_UNDEF;
35 void utc_dali_animation_cleanuP(void)
37 test_return_value = TET_PASS;
42 static const float ROTATION_EPSILON = 0.0001f;
43 static const float VECTOR4_EPSILON = 0.0001f;
44 static const float VECTOR3_EPSILON = 0.0001f;
46 // Functor to test whether a Finish signal is emitted
47 struct AnimationFinishCheck
49 AnimationFinishCheck(bool& signalReceived)
50 : mSignalReceived(signalReceived)
54 void operator()(Animation& animation)
56 mSignalReceived = true;
61 mSignalReceived = false;
64 void CheckSignalReceived()
68 tet_printf("Expected Finish signal was not received\n");
77 void CheckSignalNotReceived()
81 tet_printf("Unexpected Finish signal was received\n");
90 bool& mSignalReceived; // owned by individual tests
93 // Functor to test whether a Progress signal is emitted
94 struct AnimationProgressCheck
96 AnimationProgressCheck(bool& signalReceived, std::string name = " ")
97 : mSignalReceived(signalReceived),
102 void operator()(Animation& animation)
104 mSignalReceived = true;
109 mSignalReceived = false;
112 void CheckSignalReceived()
116 tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str());
117 tet_result(TET_FAIL);
121 tet_result(TET_PASS);
125 void CheckSignalNotReceived()
129 tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
130 tet_result(TET_FAIL);
134 tet_result(TET_PASS);
138 bool& mSignalReceived; // owned by individual tests
144 int UtcDaliAnimationConstructorP(void)
146 TestApplication application;
150 DALI_TEST_CHECK(!animation);
154 int UtcDaliAnimationNewP(void)
156 TestApplication application;
158 Animation animation = Animation::New(1.0f);
160 DALI_TEST_CHECK(animation);
164 int UtcDaliAnimationNewN(void)
166 TestApplication application;
168 Animation animation = Animation::New(-1.0f);
170 DALI_TEST_CHECK(animation);
171 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
175 int UtcDaliAnimationDownCastP(void)
177 TestApplication application;
179 tet_infoline("Testing Dali::Animation::DownCast()");
181 float durationSeconds(1.0f);
182 Animation animation = Animation::New(durationSeconds);
184 BaseHandle object(animation);
186 Animation animation2 = Animation::DownCast(object);
187 DALI_TEST_CHECK(animation2);
189 Animation animation3 = DownCast<Animation>(object);
190 DALI_TEST_CHECK(animation3);
194 int UtcDaliAnimationDownCastN(void)
196 TestApplication application;
198 BaseHandle unInitializedObject;
200 Animation animation1 = Animation::DownCast(unInitializedObject);
201 DALI_TEST_CHECK(!animation1);
203 Animation animation2 = DownCast<Animation>(unInitializedObject);
204 DALI_TEST_CHECK(!animation2);
208 int UtcDaliAnimationCopyConstructorP(void)
210 TestApplication application;
212 // Initialize an object, ref count == 1
213 Animation animation = Animation::New(1.0f);
215 Animation copy(animation);
216 DALI_TEST_CHECK(copy);
218 DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
222 int UtcDaliAnimationAssignmentOperatorP(void)
224 TestApplication application;
226 Animation animation = Animation::New(1.0f);
228 Animation copy = animation;
229 DALI_TEST_CHECK(copy);
231 DALI_TEST_CHECK(animation == copy);
233 DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
237 int UtcDaliAnimationMoveConstructor(void)
239 TestApplication application;
243 Animation animation = Animation::New(1.0f);
244 DALI_TEST_CHECK(animation);
245 DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
246 DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
248 Animation movedAnimation = std::move(animation);
249 DALI_TEST_CHECK(movedAnimation);
250 DALI_TEST_EQUALS(1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
251 DALI_TEST_EQUALS(1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION);
252 DALI_TEST_CHECK(!animation);
256 KeyFrames keyframes = KeyFrames::New();
257 DALI_TEST_CHECK(keyframes);
258 DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
259 DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
261 keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
262 keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
263 DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
265 KeyFrames movedKeyFrames = std::move(keyframes);
266 DALI_TEST_CHECK(movedKeyFrames);
267 DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
268 DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
269 DALI_TEST_CHECK(!keyframes);
274 int UtcDaliAnimationMoveAssignment(void)
276 TestApplication application;
280 Animation animation = Animation::New(1.0f);
281 DALI_TEST_CHECK(animation);
282 DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
283 DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
286 move = std::move(animation);
287 DALI_TEST_CHECK(move);
288 DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
289 DALI_TEST_EQUALS(1.0f, move.GetDuration(), 0.001f, TEST_LOCATION);
290 DALI_TEST_CHECK(!animation);
294 KeyFrames keyframes = KeyFrames::New();
295 DALI_TEST_CHECK(keyframes);
296 DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
297 DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
299 keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
300 keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
301 DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
303 KeyFrames movedKeyFrames;
304 movedKeyFrames = std::move(keyframes);
305 DALI_TEST_CHECK(movedKeyFrames);
306 DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
307 DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
308 DALI_TEST_CHECK(!keyframes);
313 int UtcDaliAnimationSetDurationP(void)
315 TestApplication application;
317 Actor actor = Actor::New();
318 application.GetScene().Add(actor);
320 // Build the animation
321 float durationSeconds(1.0f);
322 Animation animation = Animation::New(durationSeconds);
323 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
325 // Start the animation
326 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
327 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
330 bool signalReceived(false);
331 AnimationFinishCheck finishCheck(signalReceived);
332 animation.FinishedSignal().Connect(&application, finishCheck);
334 application.SendNotification();
335 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
337 // We didn't expect the animation to finish yet
338 application.SendNotification();
339 finishCheck.CheckSignalNotReceived();
341 application.Render(2u /*just beyond the animation duration*/);
343 // We did expect the animation to finish
344 application.SendNotification();
345 finishCheck.CheckSignalReceived();
346 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
348 // Restart the animation, with a different duration
350 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
351 durationSeconds = 3.5f;
352 animation.SetDuration(durationSeconds);
353 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
356 application.SendNotification();
357 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
359 // We didn't expect the animation to finish yet
360 application.SendNotification();
361 finishCheck.CheckSignalNotReceived();
363 application.Render(2u /*just beyond the animation duration*/);
365 // We did expect the animation to finish
366 application.SendNotification();
367 finishCheck.CheckSignalReceived();
368 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
370 // Check that nothing has changed after a couple of buffer swaps
371 application.Render(0);
372 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
373 application.Render(0);
374 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
378 int UtcDaliAnimationSetDurationN(void)
380 TestApplication application;
382 Animation animation = Animation::New(1.0f);
383 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
385 animation.SetDuration(-1.0f);
386 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
390 int UtcDaliAnimationGetDurationP(void)
392 TestApplication application;
394 Animation animation = Animation::New(1.0f);
395 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
397 animation.SetDuration(2.0f);
398 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
402 int UtcDaliAnimationSetLoopingP(void)
404 TestApplication application;
406 Actor actor = Actor::New();
407 application.GetScene().Add(actor);
409 // Build the animation
410 float durationSeconds(1.0f);
411 Animation animation = Animation::New(durationSeconds);
412 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
413 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
415 // Start the animation
416 animation.SetLooping(true);
417 DALI_TEST_CHECK(animation.IsLooping());
420 bool signalReceived(false);
421 AnimationFinishCheck finishCheck(signalReceived);
422 animation.FinishedSignal().Connect(&application, finishCheck);
424 application.SendNotification();
427 float intervalSeconds = 0.25f;
428 float progress = 0.0f;
429 for(int iterations = 0; iterations < 5;)
431 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
433 progress += intervalSeconds;
434 DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
438 progress = progress - 1.0f;
443 // We didn't expect the animation to finish yet
444 application.SendNotification();
445 finishCheck.CheckSignalNotReceived();
447 animation.SetLooping(false);
448 DALI_TEST_CHECK(!animation.IsLooping());
450 application.SendNotification();
451 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
453 // We did expect the animation to finish
454 application.SendNotification();
455 finishCheck.CheckSignalReceived();
456 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
458 // Check that nothing has changed after a couple of buffer swaps
459 application.Render(0);
460 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
461 application.Render(0);
462 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
466 int UtcDaliAnimationSetLoopCountP(void)
468 TestApplication application;
470 Actor actor = Actor::New();
471 application.GetScene().Add(actor);
473 // Build the animation
474 float durationSeconds(1.0f);
475 Animation animation = Animation::New(durationSeconds);
476 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
477 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
479 // Start the animation
480 animation.SetLoopCount(3);
481 DALI_TEST_CHECK(animation.IsLooping());
484 bool signalReceived(false);
485 AnimationFinishCheck finishCheck(signalReceived);
486 animation.FinishedSignal().Connect(&application, finishCheck);
488 application.Render(0);
489 application.SendNotification();
490 application.Render(0);
491 application.SendNotification();
492 application.Render(0);
493 application.SendNotification();
494 application.Render(0);
495 application.SendNotification();
498 float intervalSeconds = 3.0f;
500 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
501 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
503 application.Render(0);
504 application.SendNotification();
505 application.Render(0);
506 application.SendNotification();
507 application.Render(0);
508 application.SendNotification();
509 application.Render(0);
510 application.SendNotification();
511 finishCheck.CheckSignalNotReceived();
513 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
515 application.SendNotification();
516 finishCheck.CheckSignalReceived();
517 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
521 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
522 application.SendNotification();
523 finishCheck.CheckSignalNotReceived();
525 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
526 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
527 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
528 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
529 application.SendNotification();
530 finishCheck.CheckSignalNotReceived();
535 int UtcDaliAnimationSetLoopCountP2(void)
537 TestApplication application;
540 // switching between forever and loop count
543 Actor actor = Actor::New();
544 application.GetScene().Add(actor);
546 // Build the animation
547 float durationSeconds(1.0f);
548 Animation animation = Animation::New(durationSeconds);
549 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
550 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
551 animation.SetEndAction(Animation::DISCARD);
553 // Start the animation
554 animation.SetLoopCount(3);
555 DALI_TEST_CHECK(animation.IsLooping());
558 bool signalReceived(false);
559 AnimationFinishCheck finishCheck(signalReceived);
560 animation.FinishedSignal().Connect(&application, finishCheck);
562 float intervalSeconds = 3.0f;
564 application.SendNotification();
565 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
566 application.SendNotification();
567 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
568 application.SendNotification();
569 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
570 application.SendNotification();
572 application.SendNotification();
573 finishCheck.CheckSignalReceived();
578 animation.SetLooping(true);
579 DALI_TEST_CHECK(animation.IsLooping());
581 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
582 application.SendNotification();
583 finishCheck.CheckSignalNotReceived();
585 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
586 application.SendNotification();
587 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
588 application.SendNotification();
589 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
590 application.SendNotification();
591 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
592 application.SendNotification();
593 application.SendNotification();
594 finishCheck.CheckSignalNotReceived();
599 animation.SetLoopCount(3);
600 DALI_TEST_CHECK(animation.IsLooping());
603 application.SendNotification();
604 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
605 application.SendNotification();
606 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
607 application.SendNotification();
608 finishCheck.CheckSignalNotReceived();
610 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
611 application.SendNotification();
612 finishCheck.CheckSignalReceived();
617 animation.SetLooping(true);
618 DALI_TEST_CHECK(animation.IsLooping());
620 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
621 application.SendNotification();
622 finishCheck.CheckSignalNotReceived();
624 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
625 application.SendNotification();
626 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
627 application.SendNotification();
628 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
629 application.SendNotification();
630 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
631 application.SendNotification();
632 finishCheck.CheckSignalNotReceived();
637 animation.SetLoopCount(3);
638 DALI_TEST_CHECK(animation.IsLooping());
640 application.SendNotification();
641 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
642 application.SendNotification();
643 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
644 application.SendNotification();
645 finishCheck.CheckSignalNotReceived();
647 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
648 application.SendNotification();
649 finishCheck.CheckSignalNotReceived(); // we never hit play
656 int UtcDaliAnimationSetLoopCountP3(void)
658 TestApplication application;
661 // switching between forever and loop count
663 Actor actor = Actor::New();
664 application.GetScene().Add(actor);
666 // Build the animation
667 float durationSeconds(1.0f);
668 Animation animation = Animation::New(durationSeconds);
669 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
670 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
671 animation.SetEndAction(Animation::DISCARD);
673 float intervalSeconds = 3.0f;
675 bool signalReceived(false);
676 AnimationFinishCheck finishCheck(signalReceived);
677 animation.FinishedSignal().Connect(&application, finishCheck);
680 animation.SetLooping(true);
681 DALI_TEST_CHECK(animation.IsLooping());
683 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
684 application.SendNotification();
685 finishCheck.CheckSignalNotReceived();
687 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
688 application.SendNotification();
689 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
690 application.SendNotification();
691 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
692 application.SendNotification();
693 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
694 application.SendNotification();
695 finishCheck.CheckSignalNotReceived();
700 animation.SetLoopCount(3);
701 DALI_TEST_CHECK(animation.IsLooping());
703 application.SendNotification();
704 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
705 application.SendNotification();
706 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
707 application.SendNotification();
708 finishCheck.CheckSignalNotReceived();
710 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
711 application.SendNotification();
712 finishCheck.CheckSignalNotReceived(); // we never hit play
719 int UtcDaliAnimationSetLoopCountP4(void)
721 TestApplication application;
726 Actor actor = Actor::New();
727 application.GetScene().Add(actor);
729 // Build the animation
730 float durationSeconds(1.0f);
731 Animation animation = Animation::New(durationSeconds);
732 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
733 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
734 animation.SetEndAction(Animation::BAKE);
736 float intervalSeconds = 3.0f;
738 bool signalReceived(false);
739 AnimationFinishCheck finishCheck(signalReceived);
740 animation.FinishedSignal().Connect(&application, finishCheck);
742 animation.SetLoopCount(1);
744 DALI_TEST_CHECK(!animation.IsLooping());
746 application.SendNotification();
747 finishCheck.CheckSignalNotReceived();
748 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
749 application.SendNotification();
750 finishCheck.CheckSignalReceived();
752 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
753 actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
757 animation.Play(); // again
758 DALI_TEST_CHECK(!animation.IsLooping());
760 application.SendNotification();
761 finishCheck.CheckSignalNotReceived();
762 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
763 application.SendNotification();
764 finishCheck.CheckSignalReceived();
766 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
771 int UtcDaliAnimationGetLoopCountP(void)
773 TestApplication application;
775 Actor actor = Actor::New();
776 application.GetScene().Add(actor);
778 // Build the animation
779 float durationSeconds(1.0f);
780 Animation animation = Animation::New(durationSeconds);
781 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
782 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
784 DALI_TEST_CHECK(1 == animation.GetLoopCount());
786 // Start the animation
787 animation.SetLoopCount(3);
788 DALI_TEST_CHECK(animation.IsLooping());
789 DALI_TEST_CHECK(3 == animation.GetLoopCount());
793 application.Render(0);
794 application.SendNotification();
797 float intervalSeconds = 3.0f;
799 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
800 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
802 application.Render(0);
803 application.SendNotification();
805 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
806 application.SendNotification();
808 animation.SetLoopCount(0);
809 DALI_TEST_CHECK(animation.IsLooping());
810 DALI_TEST_CHECK(0 == animation.GetLoopCount());
812 animation.SetLoopCount(1);
813 DALI_TEST_CHECK(!animation.IsLooping());
814 DALI_TEST_CHECK(1 == animation.GetLoopCount());
819 int UtcDaliAnimationGetCurrentLoopP(void)
821 TestApplication application;
823 Actor actor = Actor::New();
824 application.GetScene().Add(actor);
826 // Build the animation
827 float durationSeconds(1.0f);
828 Animation animation = Animation::New(durationSeconds);
829 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
830 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
832 // Start the animation
833 animation.SetLoopCount(3);
834 DALI_TEST_CHECK(animation.IsLooping());
835 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
838 bool signalReceived(false);
839 AnimationFinishCheck finishCheck(signalReceived);
840 animation.FinishedSignal().Connect(&application, finishCheck);
842 application.SendNotification();
845 float intervalSeconds = 3.0f;
847 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
848 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
850 application.SendNotification();
851 finishCheck.CheckSignalNotReceived();
852 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
854 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
856 application.SendNotification();
857 finishCheck.CheckSignalReceived();
858 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
859 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
863 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
864 application.SendNotification();
865 finishCheck.CheckSignalNotReceived();
866 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
868 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
869 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
870 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
871 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
872 application.SendNotification();
873 finishCheck.CheckSignalNotReceived();
874 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
879 int UtcDaliAnimationIsLoopingP(void)
881 TestApplication application;
883 Animation animation = Animation::New(1.0f);
884 DALI_TEST_CHECK(!animation.IsLooping());
886 animation.SetLooping(true);
887 DALI_TEST_CHECK(animation.IsLooping());
891 int UtcDaliAnimationSetEndActionN(void)
893 TestApplication application;
895 Actor actor = Actor::New();
896 application.GetScene().Add(actor);
898 // Build the animation
899 float durationSeconds(1.0f);
900 Animation animation = Animation::New(durationSeconds);
901 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
903 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
904 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
906 // Start the animation
909 bool signalReceived(false);
910 AnimationFinishCheck finishCheck(signalReceived);
911 animation.FinishedSignal().Connect(&application, finishCheck);
913 application.SendNotification();
914 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
916 // We did expect the animation to finish
917 application.SendNotification();
918 finishCheck.CheckSignalReceived();
919 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
921 // Go back to the start
922 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
923 application.SendNotification();
924 application.Render(0);
925 DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
927 // Test BakeFinal, animate again, for half the duration
929 animation.SetEndAction(Animation::BAKE_FINAL);
930 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
933 application.SendNotification();
934 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f) /*half of the animation duration*/);
936 // Stop the animation early
939 // We did NOT expect the animation to finish
940 application.SendNotification();
941 finishCheck.CheckSignalNotReceived();
942 DALI_TEST_EQUALS(targetPosition * 0.5f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), VECTOR4_EPSILON, TEST_LOCATION);
944 // The position should be same with target position in the next frame
945 application.Render(0);
946 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
948 // Go back to the start
949 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
950 application.SendNotification();
951 application.Render(0);
952 DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
954 // Test EndAction::Discard, animate again, but don't bake this time
956 animation.SetEndAction(Animation::DISCARD);
957 DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
960 application.SendNotification();
961 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
963 // We did expect the animation to finish
964 application.SendNotification();
965 finishCheck.CheckSignalReceived();
966 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
968 // The position should be discarded in the next frame
969 application.Render(0);
970 DALI_TEST_EQUALS(Vector3::ZERO /*discarded*/, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
972 // Check that nothing has changed after a couple of buffer swaps
973 application.Render(0);
974 DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
975 application.Render(0);
976 DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
980 int UtcDaliAnimationGetEndActionP(void)
982 TestApplication application;
984 Animation animation = Animation::New(1.0f);
985 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
987 animation.SetEndAction(Animation::DISCARD);
988 DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
990 animation.SetEndAction(Animation::BAKE_FINAL);
991 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
996 int UtcDaliAnimationSetDisconnectActionP(void)
998 TestApplication application;
999 Integration::Scene stage(application.GetScene());
1001 // Default: BakeFinal
1003 Actor actor = Actor::New();
1006 // Build the animation
1007 float durationSeconds(1.0f);
1008 Animation animation = Animation::New(durationSeconds);
1009 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL);
1011 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1012 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1014 // Start the animation
1017 application.SendNotification();
1018 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1022 application.SendNotification();
1023 application.Render();
1025 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1030 Actor actor = Actor::New();
1033 // Build the animation
1034 float durationSeconds(1.0f);
1035 Animation animation = Animation::New(durationSeconds);
1036 animation.SetDisconnectAction(Animation::BAKE);
1038 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1039 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1041 // Start the animation
1044 application.SendNotification();
1045 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1049 application.SendNotification();
1050 application.Render();
1052 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition * 0.5f, TEST_LOCATION);
1057 Actor actor = Actor::New();
1060 // Build the animation
1061 float durationSeconds(1.0f);
1062 Animation animation = Animation::New(durationSeconds);
1063 animation.SetDisconnectAction(Animation::DISCARD);
1065 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1066 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1068 // Start the animation
1071 application.SendNotification();
1072 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1076 application.SendNotification();
1077 application.Render();
1079 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1082 // Don't play the animation: disconnect action should not be applied
1084 Actor actor = Actor::New();
1087 // Build the animation
1088 float durationSeconds(1.0f);
1089 Animation animation = Animation::New(durationSeconds);
1091 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1092 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1094 application.SendNotification();
1095 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1099 application.SendNotification();
1100 application.Render();
1102 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1108 int UtcDaliAnimationGetDisconnectActionP(void)
1110 TestApplication application;
1111 Animation animation = Animation::New(1.0f);
1112 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL); // default!
1114 animation.SetDisconnectAction(Animation::DISCARD);
1115 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::DISCARD);
1117 animation.SetDisconnectAction(Animation::BAKE);
1118 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE);
1123 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1125 TestApplication application;
1127 Animation animation = Animation::New(1.0f);
1128 AlphaFunction func = animation.GetDefaultAlphaFunction();
1129 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1131 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1132 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1133 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1137 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1139 TestApplication application;
1141 Animation animation = Animation::New(1.0f);
1142 AlphaFunction func = animation.GetDefaultAlphaFunction();
1144 // Test that the default is linear
1145 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1147 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1148 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1149 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1154 int UtcDaliAnimationSetCurrentProgressP(void)
1156 TestApplication application;
1158 Actor actor = Actor::New();
1159 application.GetScene().Add(actor);
1161 // Build the animation
1162 Animation animation = Animation::New(0.0f);
1165 float durationSeconds(1.0f);
1166 animation.SetDuration(durationSeconds);
1168 bool signalReceived(false);
1169 AnimationFinishCheck finishCheck(signalReceived);
1170 animation.FinishedSignal().Connect(&application, finishCheck);
1171 application.SendNotification();
1173 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1174 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1176 // Start the animation from 40% progress
1177 animation.SetCurrentProgress(0.4f);
1180 application.SendNotification();
1181 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1183 // We didn't expect the animation to finish yet
1184 application.SendNotification();
1185 finishCheck.CheckSignalNotReceived();
1186 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1187 DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1189 animation.Play(); // Test that calling play has no effect, when animation is already playing
1190 application.SendNotification();
1192 //Set the progress to 70%
1193 animation.SetCurrentProgress(0.7f);
1194 application.SendNotification();
1195 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1196 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1198 application.SendNotification();
1199 finishCheck.CheckSignalNotReceived();
1200 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1201 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1203 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1204 // We did expect the animation to finish
1205 application.SendNotification();
1206 finishCheck.CheckSignalReceived();
1207 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1209 // Check that nothing has changed after a couple of buffer swaps
1210 application.Render(0);
1211 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1212 application.Render(0);
1213 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1217 int UtcDaliAnimationSetCurrentProgressN(void)
1219 TestApplication application;
1221 Actor actor = Actor::New();
1222 application.GetScene().Add(actor);
1224 // Build the animation
1225 Animation animation = Animation::New(0.0f);
1228 float durationSeconds(1.0f);
1229 animation.SetDuration(durationSeconds);
1231 bool signalReceived(false);
1232 AnimationFinishCheck finishCheck(signalReceived);
1233 animation.FinishedSignal().Connect(&application, finishCheck);
1234 application.SendNotification();
1236 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1237 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1239 //Trying to set the current cursor outside the range [0..1] is ignored
1240 animation.SetCurrentProgress(-1.0f);
1241 application.SendNotification();
1242 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1244 animation.SetCurrentProgress(100.0f);
1245 application.SendNotification();
1246 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1250 int UtcDaliAnimationGetCurrentProgressP(void)
1252 TestApplication application;
1254 Actor actor = Actor::New();
1255 application.GetScene().Add(actor);
1257 // Build the animation
1258 Animation animation = Animation::New(0.0f);
1261 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1262 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1264 animation.SetCurrentProgress(0.5f);
1265 application.SendNotification();
1266 application.Render(static_cast<unsigned int>(100.0f));
1268 //Progress should still be 0.0
1269 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1272 float durationSeconds(1.0f);
1273 animation.SetDuration(durationSeconds);
1274 application.SendNotification();
1276 bool signalReceived(false);
1277 AnimationFinishCheck finishCheck(signalReceived);
1278 animation.FinishedSignal().Connect(&application, finishCheck);
1279 application.SendNotification();
1281 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1282 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1284 // Start the animation from 40% progress
1285 animation.SetCurrentProgress(0.4f);
1288 application.SendNotification();
1289 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1291 // We didn't expect the animation to finish yet
1292 application.SendNotification();
1293 finishCheck.CheckSignalNotReceived();
1294 DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1296 animation.Play(); // Test that calling play has no effect, when animation is already playing
1297 application.SendNotification();
1299 //Set the progress to 70%
1300 animation.SetCurrentProgress(0.7f);
1301 application.SendNotification();
1302 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1303 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1305 application.SendNotification();
1306 finishCheck.CheckSignalNotReceived();
1307 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1309 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1310 // We did expect the animation to finish
1311 application.SendNotification();
1312 finishCheck.CheckSignalReceived();
1316 int UtcDaliAnimationSetSpeedFactorP1(void)
1318 TestApplication application;
1320 tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1322 Actor actor = Actor::New();
1323 application.GetScene().Add(actor);
1325 // Build the animation
1326 float durationSeconds(1.0f);
1327 Animation animation = Animation::New(durationSeconds);
1329 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1330 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1332 KeyFrames keyframes = KeyFrames::New();
1333 keyframes.Add(0.0f, initialPosition);
1334 keyframes.Add(1.0f, targetPosition);
1335 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1337 //Set speed to be x2
1338 animation.SetSpeedFactor(2.0f);
1340 // Start the animation
1343 bool signalReceived(false);
1344 AnimationFinishCheck finishCheck(signalReceived);
1345 animation.FinishedSignal().Connect(&application, finishCheck);
1347 application.SendNotification();
1348 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1350 // We didn't expect the animation to finish yet
1351 application.SendNotification();
1352 finishCheck.CheckSignalNotReceived();
1353 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1355 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1357 // We didn't expect the animation to finish yet
1358 application.SendNotification();
1359 finishCheck.CheckSignalNotReceived();
1360 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1362 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond half the duration*/);
1364 // We did expect the animation to finish
1365 application.SendNotification();
1366 finishCheck.CheckSignalReceived();
1367 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1369 // Check that nothing has changed after a couple of buffer swaps
1370 application.Render(0);
1371 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1372 application.Render(0);
1373 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1378 int UtcDaliAnimationSetSpeedFactorP2(void)
1380 TestApplication application;
1382 Actor actor = Actor::New();
1383 application.GetScene().Add(actor);
1385 // Build the animation
1386 float durationSeconds(1.0f);
1387 Animation animation = Animation::New(durationSeconds);
1389 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1390 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1392 KeyFrames keyframes = KeyFrames::New();
1393 keyframes.Add(0.0f, initialPosition);
1394 keyframes.Add(1.0f, targetPosition);
1395 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1397 tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1398 animation.SetSpeedFactor(-1.0f);
1400 // Start the animation
1403 bool signalReceived(false);
1404 AnimationFinishCheck finishCheck(signalReceived);
1405 animation.FinishedSignal().Connect(&application, finishCheck);
1407 application.SendNotification();
1408 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1410 // We didn't expect the animation to finish yet
1411 application.SendNotification();
1412 finishCheck.CheckSignalNotReceived();
1413 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1415 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1417 // We didn't expect the animation to finish yet
1418 application.SendNotification();
1419 finishCheck.CheckSignalNotReceived();
1420 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1422 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1424 // We didn't expect the animation to finish yet
1425 application.SendNotification();
1426 finishCheck.CheckSignalNotReceived();
1427 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1429 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1431 // We didn't expect the animation to finish yet
1432 application.SendNotification();
1433 finishCheck.CheckSignalNotReceived();
1434 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1436 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1438 // We did expect the animation to finish
1439 application.SendNotification();
1440 finishCheck.CheckSignalReceived();
1441 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1443 // Check that nothing has changed after a couple of buffer swaps
1444 application.Render(0);
1445 DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1446 application.Render(0);
1447 DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1452 int UtcDaliAnimationSetSpeedFactorP3(void)
1454 TestApplication application;
1456 Actor actor = Actor::New();
1457 application.GetScene().Add(actor);
1459 // Build the animation
1460 float durationSeconds(1.0f);
1461 Animation animation = Animation::New(durationSeconds);
1463 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1464 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1466 KeyFrames keyframes = KeyFrames::New();
1467 keyframes.Add(0.0f, initialPosition);
1468 keyframes.Add(1.0f, targetPosition);
1469 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1471 bool signalReceived(false);
1472 AnimationFinishCheck finishCheck(signalReceived);
1473 animation.FinishedSignal().Connect(&application, finishCheck);
1475 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1477 //Set speed to be half of normal speed
1478 animation.SetSpeedFactor(0.5f);
1480 // Start the animation
1483 application.SendNotification();
1484 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1486 // We didn't expect the animation to finish yet
1487 application.SendNotification();
1488 finishCheck.CheckSignalNotReceived();
1489 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1491 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1493 // We didn't expect the animation to finish yet
1494 application.SendNotification();
1495 finishCheck.CheckSignalNotReceived();
1496 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1498 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1500 // We didn't expect the animation to finish yet
1501 application.SendNotification();
1502 finishCheck.CheckSignalNotReceived();
1503 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1505 application.SendNotification();
1506 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1508 // We didn't expect the animation to finish yet
1509 application.SendNotification();
1510 finishCheck.CheckSignalNotReceived();
1511 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1513 application.Render(static_cast<unsigned int>(durationSeconds * 1200.0f) + 1u /*just beyond the animation duration*/);
1515 // We did expect the animation to finish
1516 application.SendNotification();
1517 finishCheck.CheckSignalReceived();
1518 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1520 // Check that nothing has changed after a couple of buffer swaps
1521 application.Render(0);
1522 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1523 application.Render(0);
1524 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1528 int UtcDaliAnimationSetSpeedFactorP4(void)
1530 TestApplication application;
1532 Actor actor = Actor::New();
1533 application.GetScene().Add(actor);
1535 // Build the animation
1536 float durationSeconds(1.0f);
1537 Animation animation = Animation::New(durationSeconds);
1539 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1540 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1542 KeyFrames keyframes = KeyFrames::New();
1543 keyframes.Add(0.0f, initialPosition);
1544 keyframes.Add(1.0f, targetPosition);
1545 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1547 bool signalReceived(false);
1548 AnimationFinishCheck finishCheck(signalReceived);
1549 animation.FinishedSignal().Connect(&application, finishCheck);
1551 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1553 tet_printf("Set speed to be half of normal speed\n");
1554 tet_printf("SetSpeedFactor(0.5f)\n");
1555 animation.SetSpeedFactor(0.5f);
1557 // Start the animation
1560 application.SendNotification();
1561 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1563 // We didn't expect the animation to finish yet
1564 application.SendNotification();
1565 finishCheck.CheckSignalNotReceived();
1566 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1568 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1570 // We didn't expect the animation to finish yet
1571 application.SendNotification();
1572 finishCheck.CheckSignalNotReceived();
1573 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1575 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1577 // We didn't expect the animation to finish yet
1578 application.SendNotification();
1579 finishCheck.CheckSignalNotReceived();
1580 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1582 tet_printf("Reverse direction of animation whilst playing\n");
1583 tet_printf("SetSpeedFactor(-0.5f)\n");
1584 animation.SetSpeedFactor(-0.5f);
1586 application.SendNotification();
1587 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1589 // We didn't expect the animation to finish yet
1590 application.SendNotification();
1591 finishCheck.CheckSignalNotReceived();
1592 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1594 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1596 // We didn't expect the animation to finish yet
1597 application.SendNotification();
1598 finishCheck.CheckSignalNotReceived();
1599 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), 0.0001, TEST_LOCATION);
1601 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1603 // We did expect the animation to finish
1604 application.SendNotification();
1605 finishCheck.CheckSignalReceived();
1606 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1608 // Check that nothing has changed after a couple of buffer swaps
1609 application.Render(0);
1610 DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1611 application.Render(0);
1612 DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1616 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1618 TestApplication application;
1620 const unsigned int NUM_FRAMES(15);
1628 float expected[NUM_FRAMES];
1631 TestData testData[] = {
1633 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1634 /* |----------PlayRange---------------| */
1636 {0.0f, 1.0f, // TimePeriod
1640 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1644 60.0f, /* Reverse direction */
1654 // ACTOR 1 - Across start of range
1655 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1656 /* |----------PlayRange---------------| */
1658 {0.2f, 0.5f, // TimePeriod
1661 {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1665 50.0f, /* Reverse direction @ frame #9 */
1673 // ACTOR 2 - Across end of range
1674 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1675 /* |----------PlayRange---------------| */
1677 {/**/ 0.5f, 0.9f, // TimePeriod
1689 60.0f, /* Reverse direction @ frame #9 */
1698 // ACTOR 3 - Before beginning of range
1699 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1700 /* |----------PlayRange---------------| */
1702 {/**/ 0.1f, 0.25f, // TimePeriod
1725 // ACTOR 4 - After end of range
1726 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1727 /* |----------PlayRange---------------| */
1729 {/**/ 0.85f, 1.0f, // TimePeriod
1751 // Actor 5 - Middle of range
1752 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1753 /* |----------PlayRange---------------| */
1755 {/**/ 0.4f, 0.65f, // Time Period
1776 const size_t NUM_ENTRIES(sizeof(testData) / sizeof(TestData));
1778 // Build the animation
1779 float durationSeconds(1.0f);
1780 Animation animation = Animation::New(durationSeconds);
1781 bool signalReceived(false);
1782 AnimationFinishCheck finishCheck(signalReceived);
1783 animation.FinishedSignal().Connect(&application, finishCheck);
1785 std::vector<Dali::Actor> actors;
1787 for(unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex)
1789 Actor actor = Actor::New();
1790 actor.SetProperty(Actor::Property::POSITION, Vector3(testData[actorIndex].startX, 0, 0));
1791 actors.push_back(actor);
1792 application.GetScene().Add(actor);
1794 if(actorIndex == 0 || actorIndex == NUM_ENTRIES - 1)
1796 KeyFrames keyframes = KeyFrames::New();
1797 keyframes.Add(testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1798 keyframes.Add(testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1799 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1803 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(testData[actorIndex].endX, 0, 0), TimePeriod(testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime));
1807 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1808 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1809 tet_printf("SetSpeedFactor(0.5f)\n");
1810 animation.SetSpeedFactor(0.5f);
1811 animation.SetPlayRange(Vector2(0.3f, 0.8f));
1812 animation.SetLooping(true);
1814 // Start the animation
1816 application.SendNotification();
1817 application.Render(0); // Frame 0 tests initial values
1819 for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1821 unsigned int actorIndex = 0u;
1822 for(actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex)
1824 DALI_TEST_EQUALS(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION);
1825 if(!Equals(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame]))
1827 tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex);
1833 tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1834 tet_printf("SetSpeedFactor(-0.5f)\n");
1835 animation.SetSpeedFactor(-0.5f);
1836 application.SendNotification();
1838 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1840 // We didn't expect the animation to finish yet
1841 application.SendNotification();
1842 finishCheck.CheckSignalNotReceived();
1848 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1850 TestApplication application;
1852 const unsigned int NUM_FRAMES(15);
1860 float expected[NUM_FRAMES];
1865 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1866 /* |----------PlayRange---------------| */
1867 {0.0f, 1.0f, // TimePeriod
1871 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1885 // Build the animation
1886 float durationSeconds(1.0f);
1887 Animation animation = Animation::New(durationSeconds);
1888 bool signalReceived(false);
1889 AnimationFinishCheck finishCheck(signalReceived);
1890 animation.FinishedSignal().Connect(&application, finishCheck);
1892 std::vector<Dali::Actor> actors;
1894 Actor actor = Actor::New();
1895 actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1896 actors.push_back(actor);
1897 application.GetScene().Add(actor);
1899 KeyFrames keyframes = KeyFrames::New();
1900 keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1901 keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1902 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1904 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1905 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1906 tet_printf("SetSpeedFactor(0.5f)\n");
1907 tet_printf("SetLoopCount(3)\n");
1908 animation.SetSpeedFactor(0.5f);
1909 animation.SetPlayRange(Vector2(0.3f, 0.8f));
1910 animation.SetLoopCount(3);
1912 // Start the animation
1914 application.SendNotification();
1915 application.Render(0); // Frame 0 tests initial values
1917 for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1919 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
1921 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1923 if(frame < NUM_FRAMES - 1)
1925 // We didn't expect the animation to finish yet
1926 application.SendNotification();
1927 finishCheck.CheckSignalNotReceived();
1931 // We did expect the animation to finish
1932 application.SendNotification();
1933 finishCheck.CheckSignalReceived();
1934 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 80.0f, 0.001, TEST_LOCATION);
1939 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1941 TestApplication application;
1943 const unsigned int NUM_FRAMES(15);
1951 float expected[NUM_FRAMES];
1956 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1957 /* |----------PlayRange---------------| */
1958 {0.0f, 1.0f, // TimePeriod
1979 // Build the animation
1980 float durationSeconds(1.0f);
1981 Animation animation = Animation::New(durationSeconds);
1982 bool signalReceived(false);
1983 AnimationFinishCheck finishCheck(signalReceived);
1984 animation.FinishedSignal().Connect(&application, finishCheck);
1986 std::vector<Dali::Actor> actors;
1988 Actor actor = Actor::New();
1989 actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1990 actors.push_back(actor);
1991 application.GetScene().Add(actor);
1993 KeyFrames keyframes = KeyFrames::New();
1994 keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1995 keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1996 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1998 tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1999 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
2000 tet_printf("SetSpeedFactor(-0.5f)\n");
2001 tet_printf("SetLoopCount(3)\n");
2002 animation.SetSpeedFactor(-0.5f);
2003 animation.SetPlayRange(Vector2(0.3f, 0.8f));
2004 animation.SetLoopCount(3);
2006 // Start the animation
2008 application.SendNotification();
2009 application.Render(0); // Frame 0 tests initial values
2011 for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
2013 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
2015 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
2017 if(frame < NUM_FRAMES - 1)
2019 // We didn't expect the animation to finish yet
2020 application.SendNotification();
2021 finishCheck.CheckSignalNotReceived();
2025 // We did expect the animation to finish
2026 application.SendNotification();
2027 finishCheck.CheckSignalReceived();
2028 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 30.0f, 0.001, TEST_LOCATION);
2033 int UtcDaliAnimationGetSpeedFactorP(void)
2035 TestApplication application;
2037 Animation animation = Animation::New(1.0f);
2038 animation.SetSpeedFactor(0.5f);
2039 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
2041 animation.SetSpeedFactor(-2.5f);
2042 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
2046 int UtcDaliAnimationSetPlayRangeP(void)
2048 TestApplication application;
2050 Actor actor = Actor::New();
2051 application.GetScene().Add(actor);
2053 // Build the animation
2054 float durationSeconds(1.0f);
2055 Animation animation = Animation::New(durationSeconds);
2057 bool signalReceived(false);
2058 AnimationFinishCheck finishCheck(signalReceived);
2059 animation.FinishedSignal().Connect(&application, finishCheck);
2060 application.SendNotification();
2062 // Set range between 0.4 and 0.8
2063 animation.SetPlayRange(Vector2(0.4f, 0.9f));
2064 application.SendNotification();
2065 DALI_TEST_EQUALS(Vector2(0.4f, 0.9f), animation.GetPlayRange(), TEST_LOCATION);
2067 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2068 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2070 // Start the animation from 40% progress
2073 application.SendNotification();
2074 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2076 // We didn't expect the animation to finish yet
2077 application.SendNotification();
2078 finishCheck.CheckSignalNotReceived();
2079 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2081 application.SendNotification();
2082 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2084 application.SendNotification();
2085 finishCheck.CheckSignalNotReceived();
2086 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2088 application.SendNotification();
2089 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond the animation duration*/);
2091 // We did expect the animation to finish
2092 application.SendNotification();
2093 finishCheck.CheckSignalReceived();
2094 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION);
2098 int UtcDaliAnimationSetPlayRangeN(void)
2100 TestApplication application;
2102 Actor actor = Actor::New();
2103 application.GetScene().Add(actor);
2105 // Build the animation
2106 Animation animation = Animation::New(0);
2107 application.SendNotification();
2109 //PlayRange out of bounds
2110 animation.SetPlayRange(Vector2(-1.0f, 1.0f));
2111 application.SendNotification();
2112 DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2113 animation.SetPlayRange(Vector2(0.0f, 2.0f));
2114 application.SendNotification();
2115 DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2117 //If playRange is not in the correct order it has to be ordered
2118 animation.SetPlayRange(Vector2(0.8f, 0.2f));
2119 application.SendNotification();
2120 DALI_TEST_EQUALS(Vector2(0.2f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2125 int UtcDaliAnimationGetPlayRangeP(void)
2127 TestApplication application;
2129 Actor actor = Actor::New();
2130 application.GetScene().Add(actor);
2132 // Build the animation
2133 Animation animation = Animation::New(1.0f);
2134 application.SendNotification();
2136 //If PlayRange not specified it should be 0.0-1.0 by default
2137 DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2139 // Set range between 0.4 and 0.8
2140 animation.SetPlayRange(Vector2(0.4f, 0.8f));
2141 application.SendNotification();
2142 DALI_TEST_EQUALS(Vector2(0.4f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2147 int UtcDaliAnimationPlayP(void)
2149 TestApplication application;
2151 Actor actor = Actor::New();
2152 application.GetScene().Add(actor);
2154 // Build the animation
2155 float durationSeconds(1.0f);
2156 Animation animation = Animation::New(durationSeconds);
2157 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2158 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2160 // Start the animation
2163 bool signalReceived(false);
2164 AnimationFinishCheck finishCheck(signalReceived);
2165 animation.FinishedSignal().Connect(&application, finishCheck);
2167 application.SendNotification();
2168 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2170 // We didn't expect the animation to finish yet
2171 application.SendNotification();
2172 finishCheck.CheckSignalNotReceived();
2173 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2175 animation.Play(); // Test that calling play has no effect, when animation is already playing
2176 application.SendNotification();
2177 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2179 // We didn't expect the animation to finish yet
2180 application.SendNotification();
2181 finishCheck.CheckSignalNotReceived();
2182 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2184 animation.Play(); // Test that calling play has no effect, when animation is already playing
2185 application.SendNotification();
2186 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2188 // We didn't expect the animation to finish yet
2189 application.SendNotification();
2190 finishCheck.CheckSignalNotReceived();
2191 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2193 animation.Play(); // Test that calling play has no effect, when animation is already playing
2194 application.SendNotification();
2195 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2197 // We didn't expect the animation to finish yet
2198 application.SendNotification();
2199 finishCheck.CheckSignalNotReceived();
2200 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2202 animation.Play(); // Test that calling play has no effect, when animation is already playing
2203 application.SendNotification();
2204 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2206 // We did expect the animation to finish
2207 application.SendNotification();
2208 finishCheck.CheckSignalReceived();
2209 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2211 // Check that nothing has changed after a couple of buffer swaps
2212 application.Render(0);
2213 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2214 application.Render(0);
2215 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2219 int UtcDaliAnimationPlayOffSceneP(void)
2221 // Test that an animation cannot be played, when the actor is off-stage.
2222 // And the property value and the current property value should not be changed in the case.
2224 TestApplication application;
2226 Actor actor = Actor::New();
2227 Vector3 basePosition(Vector3::ZERO);
2228 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2229 // Not added to the stage yet!
2231 // Build the animation
2232 float durationSeconds(1.0f);
2233 Animation animation = Animation::New(durationSeconds);
2234 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2235 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2237 // Start the animation
2240 bool signalReceived(false);
2241 AnimationFinishCheck finishCheck(signalReceived);
2242 animation.FinishedSignal().Connect(&application, finishCheck);
2244 application.SendNotification();
2245 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2247 application.SendNotification();
2248 finishCheck.CheckSignalReceived();
2250 // An animation can't be played. The position shouldn't be changed.
2251 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2252 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2255 application.GetScene().Add(actor);
2257 // Start the animation again
2260 application.SendNotification();
2261 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2263 // We did expect the animation to finish
2264 application.SendNotification();
2265 finishCheck.CheckSignalReceived();
2267 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2268 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2270 // Reset the position
2271 actor[Actor::Property::POSITION] = basePosition;
2273 application.SendNotification();
2274 application.Render();
2276 // Create an animator again
2278 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2280 // Remove from the stage
2281 application.GetScene().Remove(actor);
2283 signalReceived = false;
2285 // Start the animation again
2288 application.SendNotification();
2289 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2291 application.SendNotification();
2292 finishCheck.CheckSignalReceived();
2294 // An animation can't be played. The position shouldn't be changed.
2295 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2296 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2301 int UtcDaliAnimationPlayOffSceneDiscardP(void)
2303 // Test that an animation cannot be played, when the actor is off-stage.
2304 // When the actor is added to the stage, it should appear at the current position
2305 // i.e. where it would have been anyway, if on-stage from the beginning.
2307 TestApplication application;
2309 Actor actor = Actor::New();
2310 Vector3 basePosition(Vector3::ZERO);
2311 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2312 // Not added to the stage yet!
2314 // Build the animation
2315 float durationSeconds(1.0f);
2316 Animation animation = Animation::New(durationSeconds);
2317 animation.SetDisconnectAction(Animation::DISCARD);
2318 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2319 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2321 // Start the animation
2324 bool signalReceived(false);
2325 AnimationFinishCheck finishCheck(signalReceived);
2326 animation.FinishedSignal().Connect(&application, finishCheck);
2328 application.SendNotification();
2329 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2331 // We didn't expect the animation to finish yet
2332 application.SendNotification();
2333 finishCheck.CheckSignalNotReceived();
2335 // An animation can't be played. The position shouldn't be changed.
2336 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2339 application.GetScene().Add(actor);
2341 application.SendNotification();
2342 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2344 // We didn't expect the animation to finish yet
2345 application.SendNotification();
2346 finishCheck.CheckSignalNotReceived();
2347 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2349 // Remove from the stage
2350 application.GetScene().Remove(actor);
2352 application.SendNotification();
2353 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2355 // We didn't expect the animation to finish yet
2356 application.SendNotification();
2357 finishCheck.CheckSignalNotReceived();
2358 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*back to start position as disconnect behaviour is discard*/, TEST_LOCATION);
2359 // Check that nothing has changed after a couple of buffer swaps
2360 application.Render(0);
2361 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2362 application.Render(0);
2363 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2364 application.Render(0);
2365 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2368 application.GetScene().Add(actor);
2370 application.SendNotification();
2371 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2373 // We didn't expect the animation to finish yet
2374 application.SendNotification();
2375 finishCheck.CheckSignalNotReceived();
2376 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(80, 80, 80), TEST_LOCATION);
2378 application.SendNotification();
2379 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2381 // We did expect the animation to finish
2382 application.SendNotification();
2383 finishCheck.CheckSignalReceived();
2384 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2386 // Check that nothing has changed after a couple of buffer swaps
2387 application.Render(0);
2388 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2390 application.Render(0);
2391 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2395 int UtcDaliAnimationPlayOffSceneBakeFinalP(void)
2397 // Test that an animation cannot be played, when the actor is off-stage.
2398 // When the actor is added to the stage, it should appear at the current position
2399 // i.e. where it would have been anyway, if on-stage from the beginning.
2401 TestApplication application;
2403 Actor actor = Actor::New();
2404 Vector3 basePosition(Vector3::ZERO);
2405 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2406 // Not added to the stage!
2408 // Build the animation
2409 float durationSeconds(1.0f);
2410 Animation animation = Animation::New(durationSeconds);
2411 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2412 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2414 // Start the animation
2417 bool signalReceived(false);
2418 AnimationFinishCheck finishCheck(signalReceived);
2419 animation.FinishedSignal().Connect(&application, finishCheck);
2421 application.SendNotification();
2422 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2424 // We didn't expect the animation to finish yet
2425 application.SendNotification();
2426 finishCheck.CheckSignalNotReceived();
2428 // An animation can't be played. The position shouldn't be changed.
2429 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2432 application.GetScene().Add(actor);
2434 application.SendNotification();
2435 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2437 // We didn't expect the animation to finish yet
2438 application.SendNotification();
2439 finishCheck.CheckSignalNotReceived();
2440 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2442 // Remove from the stage
2443 application.GetScene().Remove(actor);
2445 application.SendNotification();
2446 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2448 // We didn't expect the animation to finish yet
2449 application.SendNotification();
2450 finishCheck.CheckSignalNotReceived();
2451 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final*/, TEST_LOCATION);
2454 application.GetScene().Add(actor);
2456 application.SendNotification();
2457 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2459 // We didn't expect the animation to finish yet
2460 application.SendNotification();
2461 finishCheck.CheckSignalNotReceived();
2462 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final removed the */, TEST_LOCATION);
2464 application.SendNotification();
2465 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2467 // We did expect the animation to finish
2468 application.SendNotification();
2469 finishCheck.CheckSignalReceived();
2470 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2472 // Check that nothing has changed after a couple of buffer swaps
2473 application.Render(0);
2474 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2476 application.Render(0);
2477 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2481 int UtcDaliAnimationPlayOffSceneBakeP(void)
2483 // Test that an animation cannot be played, when the actor is off-stage.
2484 // When the actor is added to the stage, it should appear at the current position
2485 // i.e. where it would have been anyway, if on-stage from the beginning.
2487 TestApplication application;
2489 Actor actor = Actor::New();
2490 Vector3 basePosition(Vector3::ZERO);
2491 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2492 // Not added to the stage!
2494 // Build the animation
2495 float durationSeconds(1.0f);
2496 Animation animation = Animation::New(durationSeconds);
2497 animation.SetDisconnectAction(Animation::BAKE);
2498 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2499 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2501 // Start the animation
2504 bool signalReceived(false);
2505 AnimationFinishCheck finishCheck(signalReceived);
2506 animation.FinishedSignal().Connect(&application, finishCheck);
2508 application.SendNotification();
2509 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2511 // We didn't expect the animation to finish yet
2512 application.SendNotification();
2513 finishCheck.CheckSignalNotReceived();
2515 // An animation can't be played. The position shouldn't be changed.
2516 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2519 application.GetScene().Add(actor);
2521 application.SendNotification();
2522 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2524 // We didn't expect the animation to finish yet
2525 application.SendNotification();
2526 finishCheck.CheckSignalNotReceived();
2527 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2529 // Remove from the stage
2530 application.GetScene().Remove(actor); // baked here
2532 application.SendNotification();
2533 // this render is a no-op in this case as animator is disabled while off stage
2534 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2535 // We didn't expect the animation to finish yet
2536 application.SendNotification();
2537 finishCheck.CheckSignalNotReceived();
2538 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*baked value*/, TEST_LOCATION);
2540 // Add back to the stage
2541 application.GetScene().Add(actor);
2543 application.SendNotification();
2544 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2545 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION);
2546 application.Render(static_cast<unsigned int>(0.0f));
2547 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2548 application.Render(static_cast<unsigned int>(0.0f));
2549 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2551 // Remove from the stage
2552 application.GetScene().Remove(actor); // baked here
2554 application.SendNotification();
2555 // this render is a no-op in this case as animator is disabled while off stage
2556 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2557 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2558 application.Render(static_cast<unsigned int>(0.0f));
2559 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2560 application.Render(static_cast<unsigned int>(0.0f));
2561 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2563 // Add back to the stage
2564 application.GetScene().Add(actor);
2566 // We didn't expect the animation to finish yet
2567 application.SendNotification();
2568 finishCheck.CheckSignalNotReceived();
2569 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88), TEST_LOCATION);
2571 application.SendNotification();
2572 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2574 // We did expect the animation to finish
2575 application.SendNotification();
2576 finishCheck.CheckSignalReceived();
2577 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2579 // Check that nothing has changed after a couple of buffer swaps
2580 application.Render(0);
2581 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2583 application.Render(0);
2584 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2588 int UtcDaliAnimationPlayDiscardHandleP(void)
2590 TestApplication application;
2592 Actor actor = Actor::New();
2593 application.GetScene().Add(actor);
2595 // Build the animation
2596 float durationSeconds(1.0f);
2597 Animation animation = Animation::New(durationSeconds);
2598 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2599 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2601 bool signalReceived(false);
2602 AnimationFinishCheck finishCheck(signalReceived);
2603 animation.FinishedSignal().Connect(&application, finishCheck);
2605 // Start the animation
2608 // This is a test of the "Fire and Forget" behaviour
2609 // Discard the animation handle!
2611 DALI_TEST_CHECK(!animation);
2613 application.SendNotification();
2614 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2616 // We didn't expect the animation to finish yet
2617 application.SendNotification();
2618 finishCheck.CheckSignalNotReceived();
2619 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2621 application.SendNotification();
2622 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2624 // We didn't expect the animation to finish yet
2625 application.SendNotification();
2626 finishCheck.CheckSignalNotReceived();
2627 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2629 application.SendNotification();
2630 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2632 // We didn't expect the animation to finish yet
2633 application.SendNotification();
2634 finishCheck.CheckSignalNotReceived();
2635 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2637 application.SendNotification();
2638 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2640 // We didn't expect the animation to finish yet
2641 application.SendNotification();
2642 finishCheck.CheckSignalNotReceived();
2643 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2645 application.SendNotification();
2646 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2648 // We did expect the animation to finish
2649 application.SendNotification();
2650 finishCheck.CheckSignalReceived();
2651 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2653 // Check that nothing has changed after a couple of buffer swaps
2654 application.Render(0);
2655 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2656 application.Render(0);
2657 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2661 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2663 TestApplication application;
2665 Actor actor = Actor::New();
2666 application.GetScene().Add(actor);
2668 // Build the animation
2669 float durationSeconds(1.0f);
2670 Animation animation = Animation::New(durationSeconds);
2671 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2672 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2674 // Start the animation
2677 bool signalReceived(false);
2678 AnimationFinishCheck finishCheck(signalReceived);
2679 animation.FinishedSignal().Connect(&application, finishCheck);
2681 application.SendNotification();
2682 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2684 // We didn't expect the animation to finish yet
2685 application.SendNotification();
2686 finishCheck.CheckSignalNotReceived();
2687 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2689 // This is a test of the "Fire and Forget" behaviour
2690 // Stop the animation, and Discard the animation handle!
2693 DALI_TEST_CHECK(!animation);
2695 application.SendNotification();
2696 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2698 // We expect the animation to finish at 20% progress
2699 application.SendNotification();
2700 finishCheck.CheckSignalReceived();
2701 finishCheck.Reset();
2702 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2704 application.SendNotification();
2705 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2707 // Check that nothing has changed
2708 application.SendNotification();
2709 finishCheck.CheckSignalNotReceived();
2710 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2712 application.SendNotification();
2713 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2715 // Check that nothing has changed
2716 application.SendNotification();
2717 finishCheck.CheckSignalNotReceived();
2718 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2720 application.SendNotification();
2721 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2723 // Check that nothing has changed
2724 application.SendNotification();
2725 finishCheck.CheckSignalNotReceived();
2726 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2730 int UtcDaliAnimationPlayRangeP(void)
2732 TestApplication application;
2734 Actor actor = Actor::New();
2735 application.GetScene().Add(actor);
2737 // Build the animation
2738 float durationSeconds(1.0f);
2739 Animation animation = Animation::New(durationSeconds);
2740 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2741 KeyFrames keyframes = KeyFrames::New();
2742 keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
2743 keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
2745 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
2747 // Set range between 0.4 and 0.8
2748 animation.SetPlayRange(Vector2(0.4f, 0.8f));
2751 bool signalReceived(false);
2752 AnimationFinishCheck finishCheck(signalReceived);
2753 animation.FinishedSignal().Connect(&application, finishCheck);
2755 //Test that setting progress outside the range doesn't work
2756 animation.SetCurrentProgress(0.9f);
2757 application.SendNotification();
2758 application.Render(0);
2759 DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2760 animation.SetCurrentProgress(0.2f);
2761 application.SendNotification();
2762 application.Render(0);
2763 DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2765 application.SendNotification();
2766 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2768 // We didn't expect the animation to finish yet
2769 application.SendNotification();
2770 finishCheck.CheckSignalNotReceived();
2771 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2773 animation.Play(); // Test that calling play has no effect, when animation is already playing
2774 application.SendNotification();
2775 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /* 80% progress */);
2777 // We did expect the animation to finish
2778 application.SendNotification();
2779 finishCheck.CheckSignalReceived();
2780 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2782 // Check that nothing has changed after a couple of buffer swaps
2783 application.Render(0);
2784 DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2785 application.Render(0);
2786 DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2788 //Loop inside the range
2789 finishCheck.Reset();
2790 animation.SetLooping(true);
2792 application.SendNotification();
2793 float intervalSeconds = 0.1f;
2794 float progress = 0.4f;
2795 for(int iterations = 0; iterations < 10; ++iterations)
2797 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2799 progress += intervalSeconds;
2802 progress = progress - 0.4f;
2805 DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2808 // We didn't expect the animation to finish yet
2809 application.SendNotification();
2810 finishCheck.CheckSignalNotReceived();
2812 //Test change range on the fly
2813 animation.SetPlayRange(Vector2(0.2f, 0.9f));
2814 application.SendNotification();
2816 for(int iterations = 0; iterations < 10; ++iterations)
2818 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2820 progress += intervalSeconds;
2823 progress = progress - 0.7f;
2826 DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2832 int UtcDaliAnimationPlayFromP(void)
2834 TestApplication application;
2836 Actor actor = Actor::New();
2837 application.GetScene().Add(actor);
2839 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2841 // Build the animation
2842 float durationSeconds(1.0f);
2843 Animation animation = Animation::New(durationSeconds);
2844 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2845 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2847 // Start the animation from 40% progress
2848 animation.PlayFrom(0.4f);
2850 // Target value should be updated straight away
2851 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2853 bool signalReceived(false);
2854 AnimationFinishCheck finishCheck(signalReceived);
2855 animation.FinishedSignal().Connect(&application, finishCheck);
2857 application.SendNotification();
2858 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2860 // We didn't expect the animation to finish yet
2861 application.SendNotification();
2862 finishCheck.CheckSignalNotReceived();
2863 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2865 animation.Play(); // Test that calling play has no effect, when animation is already playing
2866 application.SendNotification();
2867 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2869 // We didn't expect the animation to finish yet
2870 application.SendNotification();
2871 finishCheck.CheckSignalNotReceived();
2872 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2874 application.Render(static_cast<unsigned int>(durationSeconds * 200.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.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2880 // Check that nothing has changed after a couple of buffer swaps
2881 application.Render(0);
2882 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2883 application.Render(0);
2884 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2888 int UtcDaliAnimationPlayFromN(void)
2890 TestApplication application;
2892 Actor actor = Actor::New();
2893 application.GetScene().Add(actor);
2895 // Build the animation
2896 float durationSeconds(1.0f);
2897 Animation animation = Animation::New(durationSeconds);
2898 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2899 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2901 //PlayFrom with an argument outside the range [0..1] will be ignored
2902 animation.PlayFrom(-1.0f);
2903 application.SendNotification();
2904 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2906 animation.PlayFrom(100.0f);
2907 application.SendNotification();
2908 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2912 int UtcDaliAnimationPauseP(void)
2914 TestApplication application;
2916 Actor actor = Actor::New();
2917 application.GetScene().Add(actor);
2919 // Build the animation
2920 float durationSeconds(1.0f);
2921 Animation animation = Animation::New(durationSeconds);
2922 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2923 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2925 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2927 // Start the animation
2930 bool signalReceived(false);
2931 AnimationFinishCheck finishCheck(signalReceived);
2932 animation.FinishedSignal().Connect(&application, finishCheck);
2934 application.SendNotification();
2935 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
2937 // We didn't expect the animation to finish yet
2938 application.SendNotification();
2939 finishCheck.CheckSignalNotReceived();
2940 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
2942 // Pause the animation
2944 application.SendNotification();
2947 for(int i = 0; i < 5; ++i)
2949 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
2951 // We didn't expect the animation to finish yet
2952 application.SendNotification();
2953 finishCheck.CheckSignalNotReceived();
2954 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
2959 application.SendNotification();
2960 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2962 // We didn't expect the animation to finish yet
2963 application.SendNotification();
2964 finishCheck.CheckSignalNotReceived();
2966 application.SendNotification();
2967 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
2969 // We did expect the animation to finish
2970 application.SendNotification();
2971 finishCheck.CheckSignalReceived();
2972 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2974 // Check that nothing has changed after a couple of buffer swaps
2975 application.Render(0);
2976 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2977 application.Render(0);
2978 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2982 int UtcDaliAnimationGetStateP(void)
2984 TestApplication application;
2986 Actor actor = Actor::New();
2987 application.GetScene().Add(actor);
2989 // Build the animation
2990 float durationSeconds(1.0f);
2991 Animation animation = Animation::New(durationSeconds);
2992 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2993 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2994 DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2996 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2998 // Start the animation
3001 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3003 bool signalReceived(false);
3004 AnimationFinishCheck finishCheck(signalReceived);
3005 animation.FinishedSignal().Connect(&application, finishCheck);
3007 application.SendNotification();
3008 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3010 // We didn't expect the animation to finish yet
3011 application.SendNotification();
3012 finishCheck.CheckSignalNotReceived();
3013 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3014 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3016 // Pause the animation
3018 DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3019 application.SendNotification();
3020 application.Render(0.f);
3023 for(int i = 0; i < 5; ++i)
3025 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3027 // We didn't expect the animation to finish yet
3028 application.SendNotification();
3029 finishCheck.CheckSignalNotReceived();
3030 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
3031 DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3035 finishCheck.Reset();
3037 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3038 application.SendNotification();
3039 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3040 // We didn't expect the animation to finish yet
3041 application.SendNotification();
3042 finishCheck.CheckSignalNotReceived();
3043 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3045 application.SendNotification();
3046 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
3048 // We did expect the animation to finish
3049 application.SendNotification();
3050 finishCheck.CheckSignalReceived();
3051 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
3052 DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3054 // Check that nothing has changed after a couple of buffer swaps
3055 application.Render(0);
3056 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3057 application.Render(0);
3058 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3059 DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3062 finishCheck.Reset();
3064 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3065 application.SendNotification();
3066 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3067 application.SendNotification();
3068 finishCheck.CheckSignalNotReceived();
3069 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3074 int UtcDaliAnimationStopP(void)
3076 TestApplication application;
3078 Actor actor = Actor::New();
3079 application.GetScene().Add(actor);
3081 // Build the animation
3082 float durationSeconds(1.0f);
3083 Animation animation = Animation::New(durationSeconds);
3084 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3085 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3087 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3089 // Start the animation
3092 bool signalReceived(false);
3093 AnimationFinishCheck finishCheck(signalReceived);
3094 animation.FinishedSignal().Connect(&application, finishCheck);
3096 application.SendNotification();
3097 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3099 // We didn't expect the animation to finish yet
3100 application.SendNotification();
3101 finishCheck.CheckSignalNotReceived();
3102 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3104 // Stop the animation
3106 application.SendNotification();
3109 for(int i = 0; i < 5; ++i)
3111 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3113 // We did expect the animation to finish
3114 application.SendNotification();
3115 finishCheck.CheckSignalReceived();
3116 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when stopped */, TEST_LOCATION);
3121 int UtcDaliAnimationStopSetPositionP(void)
3123 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
3124 // i.e. to check that the animation does not interfere with the position set.
3126 TestApplication application;
3128 Actor actor = Actor::New();
3129 application.GetScene().Add(actor);
3131 // Build the animation
3132 float durationSeconds(1.0f);
3133 Animation animation = Animation::New(durationSeconds);
3134 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3135 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3137 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3139 // Start the animation
3142 bool signalReceived(false);
3143 AnimationFinishCheck finishCheck(signalReceived);
3144 animation.FinishedSignal().Connect(&application, finishCheck);
3146 application.SendNotification();
3147 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3149 // We didn't expect the animation to finish yet
3150 application.SendNotification();
3151 finishCheck.CheckSignalNotReceived();
3152 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3154 // Stop the animation
3156 Vector3 positionSet(2.0f, 3.0f, 4.0f);
3157 actor.SetProperty(Actor::Property::POSITION, positionSet);
3158 application.SendNotification();
3161 for(int i = 0; i < 5; ++i)
3163 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3165 // We did expect the animation to finish
3166 application.SendNotification();
3167 finishCheck.CheckSignalReceived();
3168 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), positionSet /*Animation should not interfere with this*/, TEST_LOCATION);
3173 int UtcDaliAnimationClearP(void)
3175 TestApplication application;
3177 Actor actor = Actor::New();
3178 application.GetScene().Add(actor);
3180 // Build the animation
3181 float durationSeconds(1.0f);
3182 Animation animation = Animation::New(durationSeconds);
3183 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3184 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3186 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3188 // Start the animation
3191 bool signalReceived(false);
3192 AnimationFinishCheck finishCheck(signalReceived);
3193 animation.FinishedSignal().Connect(&application, finishCheck);
3195 application.SendNotification();
3196 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3198 // We didn't expect the animation to finish yet
3199 application.SendNotification();
3200 finishCheck.CheckSignalNotReceived();
3201 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3203 // Clear the animation
3205 application.SendNotification();
3207 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3209 // We don't expect the animation to finish now
3210 application.SendNotification();
3211 finishCheck.CheckSignalNotReceived();
3212 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
3214 // Restart as a scale animation; this should not move the actor's position
3215 finishCheck.Reset();
3216 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
3217 Vector3 targetScale(3.0f, 3.0f, 3.0f);
3218 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
3221 application.SendNotification();
3222 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3224 // We didn't expect the animation to finish yet
3225 application.SendNotification();
3226 finishCheck.CheckSignalNotReceived();
3227 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3228 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
3230 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3232 // We did expect the animation to finish
3233 application.SendNotification();
3234 finishCheck.CheckSignalReceived();
3235 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3236 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
3240 int UtcDaliAnimationFinishedSignalP(void)
3242 TestApplication application;
3244 // Start the empty animation
3245 float durationSeconds(1.0f);
3246 Animation animation = Animation::New(durationSeconds);
3249 bool signalReceived(false);
3250 AnimationFinishCheck finishCheck(signalReceived);
3251 animation.FinishedSignal().Connect(&application, finishCheck);
3253 application.SendNotification();
3254 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
3256 // We did expect the animation to finish
3257 application.SendNotification();
3258 finishCheck.CheckSignalReceived();
3262 int UtcDaliAnimationAnimateByBooleanP(void)
3264 TestApplication application;
3266 Actor actor = Actor::New();
3268 // Register a boolean property
3269 bool startValue(false);
3270 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3271 application.GetScene().Add(actor);
3272 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3273 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3275 // Build the animation
3276 float durationSeconds(2.0f);
3277 Animation animation = Animation::New(durationSeconds);
3278 const bool relativeValue(true);
3279 const bool finalValue(false || relativeValue);
3280 animation.AnimateBy(Property(actor, index), relativeValue);
3282 // Start the animation
3285 // Target value should be retrievable straight away
3286 DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
3288 bool signalReceived(false);
3289 AnimationFinishCheck finishCheck(signalReceived);
3290 animation.FinishedSignal().Connect(&application, finishCheck);
3292 application.SendNotification();
3293 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3295 // We didn't expect the animation to finish yet
3296 application.SendNotification();
3297 finishCheck.CheckSignalNotReceived();
3298 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3300 application.SendNotification();
3301 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3303 // We did expect the animation to finish
3304 application.SendNotification();
3305 finishCheck.CheckSignalReceived();
3306 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3308 // Check that nothing has changed after a couple of buffer swaps
3309 application.Render(0);
3310 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3311 application.Render(0);
3312 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3314 // Repeat with relative value "false" - this should be an NOOP
3315 animation = Animation::New(durationSeconds);
3316 bool noOpValue(false);
3317 animation.AnimateBy(Property(actor, index), noOpValue);
3319 // Start the animation
3322 finishCheck.Reset();
3323 animation.FinishedSignal().Connect(&application, finishCheck);
3325 application.SendNotification();
3326 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3328 // We didn't expect the animation to finish yet
3329 application.SendNotification();
3330 finishCheck.CheckSignalNotReceived();
3331 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3333 application.SendNotification();
3334 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3336 // We did expect the animation to finish
3337 application.SendNotification();
3338 finishCheck.CheckSignalReceived();
3339 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3341 // Check that nothing has changed after a couple of buffer swaps
3342 application.Render(0);
3343 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3344 application.Render(0);
3345 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3349 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3351 TestApplication application;
3353 Actor actor = Actor::New();
3355 // Register a boolean property
3356 bool startValue(false);
3357 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3358 application.GetScene().Add(actor);
3359 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3360 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3362 // Build the animation
3363 float durationSeconds(2.0f);
3364 Animation animation = Animation::New(durationSeconds);
3365 bool relativeValue(true);
3366 bool finalValue(false || relativeValue);
3367 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3369 // Start the animation
3372 bool signalReceived(false);
3373 AnimationFinishCheck finishCheck(signalReceived);
3374 animation.FinishedSignal().Connect(&application, finishCheck);
3376 application.SendNotification();
3377 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3379 // We didn't expect the animation to finish yet
3380 application.SendNotification();
3381 finishCheck.CheckSignalNotReceived();
3382 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3384 application.SendNotification();
3385 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3387 // We did expect the animation to finish
3388 application.SendNotification();
3389 finishCheck.CheckSignalReceived();
3390 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3392 // Check that nothing has changed after a couple of buffer swaps
3393 application.Render(0);
3394 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3395 application.Render(0);
3396 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3398 // Repeat with relative value "false" - this should be an NOOP
3399 animation = Animation::New(durationSeconds);
3400 bool noOpValue(false);
3401 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3403 // Start the animation
3406 finishCheck.Reset();
3407 animation.FinishedSignal().Connect(&application, finishCheck);
3409 application.SendNotification();
3410 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3412 // We didn't expect the animation to finish yet
3413 application.SendNotification();
3414 finishCheck.CheckSignalNotReceived();
3415 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3417 application.SendNotification();
3418 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3420 // We did expect the animation to finish
3421 application.SendNotification();
3422 finishCheck.CheckSignalReceived();
3423 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3427 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3429 TestApplication application;
3431 Actor actor = Actor::New();
3433 // Register a boolean property
3434 bool startValue(false);
3435 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3436 application.GetScene().Add(actor);
3437 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3438 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3440 // Build the animation
3441 float durationSeconds(2.0f);
3442 Animation animation = Animation::New(durationSeconds);
3443 bool relativeValue(true);
3444 bool finalValue(false || relativeValue);
3445 float animatorDurationSeconds(durationSeconds * 0.5f);
3446 animation.AnimateBy(Property(actor, index),
3448 TimePeriod(animatorDurationSeconds));
3450 // Start the animation
3453 bool signalReceived(false);
3454 AnimationFinishCheck finishCheck(signalReceived);
3455 animation.FinishedSignal().Connect(&application, finishCheck);
3457 application.SendNotification();
3458 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3460 // We didn't expect the animation to finish yet
3461 application.SendNotification();
3462 finishCheck.CheckSignalNotReceived();
3463 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3465 application.SendNotification();
3466 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3468 // We didn't expect the animation to finish yet...
3469 application.SendNotification();
3470 finishCheck.CheckSignalNotReceived();
3472 // ...however we should have reached the final value
3473 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3475 application.SendNotification();
3476 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3478 // We did expect the animation to finish
3479 application.SendNotification();
3480 finishCheck.CheckSignalReceived();
3481 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3483 // Check that nothing has changed after a couple of buffer swaps
3484 application.Render(0);
3485 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3486 application.Render(0);
3487 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3491 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3493 TestApplication application;
3495 Actor actor = Actor::New();
3497 // Register a boolean property
3498 bool startValue(false);
3499 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3500 application.GetScene().Add(actor);
3501 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3502 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3504 // Build the animation
3505 float durationSeconds(2.0f);
3506 Animation animation = Animation::New(durationSeconds);
3507 bool relativeValue(true);
3508 bool finalValue(false || relativeValue);
3509 float animatorDurationSeconds(durationSeconds * 0.5f);
3510 animation.AnimateBy(Property(actor, index),
3512 AlphaFunction::EASE_IN_OUT,
3513 TimePeriod(animatorDurationSeconds));
3515 // Start the animation
3518 bool signalReceived(false);
3519 AnimationFinishCheck finishCheck(signalReceived);
3520 animation.FinishedSignal().Connect(&application, finishCheck);
3522 application.SendNotification();
3523 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3525 // We didn't expect the animation to finish yet
3526 application.SendNotification();
3527 finishCheck.CheckSignalNotReceived();
3528 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3530 application.SendNotification();
3531 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3533 // We didn't expect the animation to finish yet...
3534 application.SendNotification();
3535 finishCheck.CheckSignalNotReceived();
3537 // ...however we should have reached the final value
3538 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3540 application.SendNotification();
3541 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3543 // We did expect the animation to finish
3544 application.SendNotification();
3545 finishCheck.CheckSignalReceived();
3546 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3548 // Check that nothing has changed after a couple of buffer swaps
3549 application.Render(0);
3550 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3551 application.Render(0);
3552 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3556 int UtcDaliAnimationAnimateByFloatP(void)
3558 TestApplication application;
3560 Actor actor = Actor::New();
3562 // Register a float property
3563 float startValue(10.0f);
3564 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3565 application.GetScene().Add(actor);
3566 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3567 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3569 // Build the animation
3570 float durationSeconds(2.0f);
3571 Animation animation = Animation::New(durationSeconds);
3572 float targetValue(50.0f);
3573 float relativeValue(targetValue - startValue);
3574 animation.AnimateBy(Property(actor, index), relativeValue);
3576 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3578 // Start the animation
3581 // Target value should be retrievable straight away
3582 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
3584 bool signalReceived(false);
3585 AnimationFinishCheck finishCheck(signalReceived);
3586 animation.FinishedSignal().Connect(&application, finishCheck);
3588 application.SendNotification();
3589 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3591 // We didn't expect the animation to finish yet
3592 application.SendNotification();
3593 finishCheck.CheckSignalNotReceived();
3594 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
3596 application.SendNotification();
3597 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3599 // We did expect the animation to finish
3600 application.SendNotification();
3601 finishCheck.CheckSignalReceived();
3602 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3604 // Check that nothing has changed after a couple of buffer swaps
3605 application.Render(0);
3606 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3607 application.Render(0);
3608 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3612 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3614 TestApplication application;
3616 Actor actor = Actor::New();
3618 // Register a float property
3619 float startValue(10.0f);
3620 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3621 application.GetScene().Add(actor);
3622 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3623 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3625 // Build the animation
3626 float durationSeconds(1.0f);
3627 Animation animation = Animation::New(durationSeconds);
3628 float targetValue(90.0f);
3629 float relativeValue(targetValue - startValue);
3630 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3632 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3634 // Start the animation
3637 bool signalReceived(false);
3638 AnimationFinishCheck finishCheck(signalReceived);
3639 animation.FinishedSignal().Connect(&application, finishCheck);
3641 application.SendNotification();
3642 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3644 // We didn't expect the animation to finish yet
3645 application.SendNotification();
3646 finishCheck.CheckSignalNotReceived();
3648 // The position should have moved more, than with a linear alpha function
3649 float current(actor.GetCurrentProperty<float>(index));
3650 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3652 application.SendNotification();
3653 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3655 // We did expect the animation to finish
3656 application.SendNotification();
3657 finishCheck.CheckSignalReceived();
3658 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3660 // Check that nothing has changed after a couple of buffer swaps
3661 application.Render(0);
3662 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3663 application.Render(0);
3664 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3668 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3670 TestApplication application;
3672 Actor actor = Actor::New();
3674 // Register a float property
3675 float startValue(10.0f);
3676 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3677 application.GetScene().Add(actor);
3678 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3679 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3681 // Build the animation
3682 float durationSeconds(1.0f);
3683 Animation animation = Animation::New(durationSeconds);
3684 float targetValue(30.0f);
3685 float relativeValue(targetValue - startValue);
3687 animation.AnimateBy(Property(actor, index),
3689 TimePeriod(delay, durationSeconds - delay));
3691 // Start the animation
3694 bool signalReceived(false);
3695 AnimationFinishCheck finishCheck(signalReceived);
3696 animation.FinishedSignal().Connect(&application, finishCheck);
3698 application.SendNotification();
3699 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3701 // We didn't expect the animation to finish yet
3702 application.SendNotification();
3703 finishCheck.CheckSignalNotReceived();
3704 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3706 application.SendNotification();
3707 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3709 // We didn't expect the animation to finish yet
3710 application.SendNotification();
3711 finishCheck.CheckSignalNotReceived();
3712 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3714 application.SendNotification();
3715 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3717 // We did expect the animation to finish
3718 application.SendNotification();
3719 finishCheck.CheckSignalReceived();
3720 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3722 // Check that nothing has changed after a couple of buffer swaps
3723 application.Render(0);
3724 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3725 application.Render(0);
3726 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3730 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3732 TestApplication application;
3734 Actor actor = Actor::New();
3736 // Register a float property
3737 float startValue(10.0f);
3738 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3739 application.GetScene().Add(actor);
3740 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3741 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3743 // Build the animation
3744 float durationSeconds(1.0f);
3745 Animation animation = Animation::New(durationSeconds);
3746 float targetValue(30.0f);
3747 float relativeValue(targetValue - startValue);
3749 animation.AnimateBy(Property(actor, index),
3751 AlphaFunction::LINEAR,
3752 TimePeriod(delay, durationSeconds - delay));
3754 // Start the animation
3757 bool signalReceived(false);
3758 AnimationFinishCheck finishCheck(signalReceived);
3759 animation.FinishedSignal().Connect(&application, finishCheck);
3761 application.SendNotification();
3762 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3764 // We didn't expect the animation to finish yet
3765 application.SendNotification();
3766 finishCheck.CheckSignalNotReceived();
3767 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3769 application.SendNotification();
3770 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3772 // We didn't expect the animation to finish yet
3773 application.SendNotification();
3774 finishCheck.CheckSignalNotReceived();
3775 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3777 application.SendNotification();
3778 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3780 // We did expect the animation to finish
3781 application.SendNotification();
3782 finishCheck.CheckSignalReceived();
3783 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3785 // Check that nothing has changed after a couple of buffer swaps
3786 application.Render(0);
3787 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3788 application.Render(0);
3789 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3793 int UtcDaliAnimationAnimateByIntegerP(void)
3795 TestApplication application;
3797 Actor actor = Actor::New();
3799 // Register an integer property
3801 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3802 application.GetScene().Add(actor);
3803 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3804 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3806 // Build the animation
3807 float durationSeconds(2.0f);
3808 Animation animation = Animation::New(durationSeconds);
3809 int targetValue(50);
3810 int relativeValue(targetValue - startValue);
3811 animation.AnimateBy(Property(actor, index), relativeValue);
3813 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3815 // Start the animation
3818 // Target value should be retrievable straight away
3819 DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
3821 bool signalReceived(false);
3822 AnimationFinishCheck finishCheck(signalReceived);
3823 animation.FinishedSignal().Connect(&application, finishCheck);
3825 application.SendNotification();
3826 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3828 // We didn't expect the animation to finish yet
3829 application.SendNotification();
3830 finishCheck.CheckSignalNotReceived();
3831 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
3833 application.SendNotification();
3834 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3836 // We did expect the animation to finish
3837 application.SendNotification();
3838 finishCheck.CheckSignalReceived();
3839 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3841 // Check that nothing has changed after a couple of buffer swaps
3842 application.Render(0);
3843 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3844 application.Render(0);
3845 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3849 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3851 TestApplication application;
3853 Actor actor = Actor::New();
3855 // Register an integer property
3857 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3858 application.GetScene().Add(actor);
3859 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3860 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3862 // Build the animation
3863 float durationSeconds(1.0f);
3864 Animation animation = Animation::New(durationSeconds);
3865 int targetValue(90);
3866 int relativeValue(targetValue - startValue);
3867 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3869 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3871 // Start the animation
3874 bool signalReceived(false);
3875 AnimationFinishCheck finishCheck(signalReceived);
3876 animation.FinishedSignal().Connect(&application, finishCheck);
3878 application.SendNotification();
3879 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3881 // We didn't expect the animation to finish yet
3882 application.SendNotification();
3883 finishCheck.CheckSignalNotReceived();
3885 // The position should have moved more, than with a linear alpha function
3886 int current(actor.GetCurrentProperty<int>(index));
3887 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3889 application.SendNotification();
3890 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3892 // We did expect the animation to finish
3893 application.SendNotification();
3894 finishCheck.CheckSignalReceived();
3895 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3897 // Check that nothing has changed after a couple of buffer swaps
3898 application.Render(0);
3899 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3900 application.Render(0);
3901 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3905 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3907 TestApplication application;
3909 Actor actor = Actor::New();
3911 // Register an integer property
3913 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3914 application.GetScene().Add(actor);
3915 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3916 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3918 // Build the animation
3919 float durationSeconds(1.0f);
3920 Animation animation = Animation::New(durationSeconds);
3921 int targetValue(30);
3922 int relativeValue(targetValue - startValue);
3924 animation.AnimateBy(Property(actor, index),
3926 TimePeriod(delay, durationSeconds - delay));
3928 // Start the animation
3931 bool signalReceived(false);
3932 AnimationFinishCheck finishCheck(signalReceived);
3933 animation.FinishedSignal().Connect(&application, finishCheck);
3935 application.SendNotification();
3936 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3938 // We didn't expect the animation to finish yet
3939 application.SendNotification();
3940 finishCheck.CheckSignalNotReceived();
3941 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3943 application.SendNotification();
3944 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3946 // We didn't expect the animation to finish yet
3947 application.SendNotification();
3948 finishCheck.CheckSignalNotReceived();
3949 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
3951 application.SendNotification();
3952 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3954 // We did expect the animation to finish
3955 application.SendNotification();
3956 finishCheck.CheckSignalReceived();
3957 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3959 // Check that nothing has changed after a couple of buffer swaps
3960 application.Render(0);
3961 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3962 application.Render(0);
3963 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3967 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3969 TestApplication application;
3971 Actor actor = Actor::New();
3973 // Register an integer property
3975 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3976 application.GetScene().Add(actor);
3977 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3978 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3980 // Build the animation
3981 float durationSeconds(1.0f);
3982 Animation animation = Animation::New(durationSeconds);
3983 int targetValue(30);
3984 int relativeValue(targetValue - startValue);
3986 animation.AnimateBy(Property(actor, index),
3988 AlphaFunction::LINEAR,
3989 TimePeriod(delay, durationSeconds - delay));
3991 // Start the animation
3994 bool signalReceived(false);
3995 AnimationFinishCheck finishCheck(signalReceived);
3996 animation.FinishedSignal().Connect(&application, finishCheck);
3998 application.SendNotification();
3999 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4001 // We didn't expect the animation to finish yet
4002 application.SendNotification();
4003 finishCheck.CheckSignalNotReceived();
4004 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4006 application.SendNotification();
4007 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4009 // We didn't expect the animation to finish yet
4010 application.SendNotification();
4011 finishCheck.CheckSignalNotReceived();
4012 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
4014 application.SendNotification();
4015 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4017 // We did expect the animation to finish
4018 application.SendNotification();
4019 finishCheck.CheckSignalReceived();
4020 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4022 // Check that nothing has changed after a couple of buffer swaps
4023 application.Render(0);
4024 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4025 application.Render(0);
4026 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4030 int UtcDaliAnimationAnimateByQuaternionP(void)
4032 TestApplication application;
4034 Actor actor = Actor::New();
4036 // Register a quaternion property
4037 const Quaternion startValue(Degree(90), Vector3::XAXIS);
4038 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4039 application.GetScene().Add(actor);
4040 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4041 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4043 // Build the animation
4044 float durationSeconds(2.0f);
4045 Animation animation = Animation::New(durationSeconds);
4046 const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
4047 const Quaternion finalValue(startValue * relativeValue);
4048 animation.AnimateBy(Property(actor, index), relativeValue);
4050 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4051 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4053 // Start the animation
4056 // Target value should be retrievable straight away
4057 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4059 application.SendNotification();
4060 application.Render(2000); // animation complete
4062 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4063 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
4068 int UtcDaliAnimationAnimateByVector2P(void)
4070 TestApplication application;
4072 Actor actor = Actor::New();
4074 // Register a Vector2 property
4075 Vector2 startValue(10.0f, 10.0f);
4076 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4077 application.GetScene().Add(actor);
4078 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4079 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4081 // Build the animation
4082 float durationSeconds(2.0f);
4083 Animation animation = Animation::New(durationSeconds);
4084 Vector2 targetValue(60.0f, 60.0f);
4085 Vector2 relativeValue(targetValue - startValue);
4086 animation.AnimateBy(Property(actor, index), relativeValue);
4088 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4090 // Start the animation
4093 // Target value should be retrievable straight away
4094 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
4096 bool signalReceived(false);
4097 AnimationFinishCheck finishCheck(signalReceived);
4098 animation.FinishedSignal().Connect(&application, finishCheck);
4100 application.SendNotification();
4101 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4103 // We didn't expect the animation to finish yet
4104 application.SendNotification();
4105 finishCheck.CheckSignalNotReceived();
4106 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
4108 application.SendNotification();
4109 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4111 // We did expect the animation to finish
4112 application.SendNotification();
4113 finishCheck.CheckSignalReceived();
4114 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4116 // Check that nothing has changed after a couple of buffer swaps
4117 application.Render(0);
4118 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4119 application.Render(0);
4120 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4124 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
4126 TestApplication application;
4128 Actor actor = Actor::New();
4130 // Register a Vector2 property
4131 Vector2 startValue(100.0f, 100.0f);
4132 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4133 application.GetScene().Add(actor);
4134 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4135 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4137 // Build the animation
4138 float durationSeconds(1.0f);
4139 Animation animation = Animation::New(durationSeconds);
4140 Vector2 targetValue(20.0f, 20.0f);
4141 Vector2 relativeValue(targetValue - startValue);
4142 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4144 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4146 // Start the animation
4149 bool signalReceived(false);
4150 AnimationFinishCheck finishCheck(signalReceived);
4151 animation.FinishedSignal().Connect(&application, finishCheck);
4153 application.SendNotification();
4154 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4156 // We didn't expect the animation to finish yet
4157 application.SendNotification();
4158 finishCheck.CheckSignalNotReceived();
4160 // The position should have moved more, than with a linear alpha function
4161 Vector2 current(actor.GetCurrentProperty<Vector2>(index));
4162 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4163 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4165 application.SendNotification();
4166 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4168 // We did expect the animation to finish
4169 application.SendNotification();
4170 finishCheck.CheckSignalReceived();
4171 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4173 // Check that nothing has changed after a couple of buffer swaps
4174 application.Render(0);
4175 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4176 application.Render(0);
4177 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4181 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4183 TestApplication application;
4185 Actor actor = Actor::New();
4187 // Register a Vector2 property
4188 Vector2 startValue(10.0f, 10.0f);
4189 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4190 application.GetScene().Add(actor);
4191 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4192 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4194 // Build the animation
4195 float durationSeconds(1.0f);
4196 Animation animation = Animation::New(durationSeconds);
4197 Vector2 targetValue(30.0f, 30.0f);
4198 Vector2 relativeValue(targetValue - startValue);
4200 animation.AnimateBy(Property(actor, index),
4202 TimePeriod(delay, durationSeconds - delay));
4204 // Start the animation
4207 bool signalReceived(false);
4208 AnimationFinishCheck finishCheck(signalReceived);
4209 animation.FinishedSignal().Connect(&application, finishCheck);
4211 application.SendNotification();
4212 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4214 // We didn't expect the animation to finish yet
4215 application.SendNotification();
4216 finishCheck.CheckSignalNotReceived();
4217 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4219 application.SendNotification();
4220 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4222 // We didn't expect the animation to finish yet
4223 application.SendNotification();
4224 finishCheck.CheckSignalNotReceived();
4225 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4227 application.SendNotification();
4228 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4230 // We did expect the animation to finish
4231 application.SendNotification();
4232 finishCheck.CheckSignalReceived();
4233 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4235 // Check that nothing has changed after a couple of buffer swaps
4236 application.Render(0);
4237 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4238 application.Render(0);
4239 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4243 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4245 TestApplication application;
4247 Actor actor = Actor::New();
4249 // Register a Vector2 property
4250 Vector2 startValue(5.0f, 5.0f);
4251 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4252 application.GetScene().Add(actor);
4253 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4254 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4256 // Build the animation
4257 float durationSeconds(1.0f);
4258 Animation animation = Animation::New(durationSeconds);
4259 Vector2 targetValue(10.0f, 10.0f);
4260 Vector2 relativeValue(targetValue - startValue);
4262 animation.AnimateBy(Property(actor, index),
4264 AlphaFunction::LINEAR,
4265 TimePeriod(delay, durationSeconds - delay));
4267 // Start the animation
4270 bool signalReceived(false);
4271 AnimationFinishCheck finishCheck(signalReceived);
4272 animation.FinishedSignal().Connect(&application, finishCheck);
4274 application.SendNotification();
4275 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4277 // We didn't expect the animation to finish yet
4278 application.SendNotification();
4279 finishCheck.CheckSignalNotReceived();
4280 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4282 application.SendNotification();
4283 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4285 // We didn't expect the animation to finish yet
4286 application.SendNotification();
4287 finishCheck.CheckSignalNotReceived();
4288 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4290 application.SendNotification();
4291 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4293 // We did expect the animation to finish
4294 application.SendNotification();
4295 finishCheck.CheckSignalReceived();
4296 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4298 // Check that nothing has changed after a couple of buffer swaps
4299 application.Render(0);
4300 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4301 application.Render(0);
4302 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4306 int UtcDaliAnimationAnimateByVector3P(void)
4308 TestApplication application;
4310 Actor actor = Actor::New();
4312 // Register a Vector3 property
4313 Vector3 startValue(10.0f, 10.0f, 10.0f);
4314 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4315 application.GetScene().Add(actor);
4316 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4317 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4319 // Build the animation
4320 float durationSeconds(2.0f);
4321 Animation animation = Animation::New(durationSeconds);
4322 Vector3 targetValue(60.0f, 60.0f, 60.0f);
4323 Vector3 relativeValue(targetValue - startValue);
4324 animation.AnimateBy(Property(actor, index), relativeValue);
4326 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4328 // Start the animation
4331 // Target value should be retrievable straight away
4332 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
4334 bool signalReceived(false);
4335 AnimationFinishCheck finishCheck(signalReceived);
4336 animation.FinishedSignal().Connect(&application, finishCheck);
4338 application.SendNotification();
4339 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4341 // We didn't expect the animation to finish yet
4342 application.SendNotification();
4343 finishCheck.CheckSignalNotReceived();
4344 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
4346 application.SendNotification();
4347 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4349 // We did expect the animation to finish
4350 application.SendNotification();
4351 finishCheck.CheckSignalReceived();
4352 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4354 // Check that nothing has changed after a couple of buffer swaps
4355 application.Render(0);
4356 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4357 application.Render(0);
4358 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4362 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4364 TestApplication application;
4366 Actor actor = Actor::New();
4368 // Register a Vector3 property
4369 Vector3 startValue(100.0f, 100.0f, 100.0f);
4370 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4371 application.GetScene().Add(actor);
4372 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4373 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4375 // Build the animation
4376 float durationSeconds(1.0f);
4377 Animation animation = Animation::New(durationSeconds);
4378 Vector3 targetValue(20.0f, 20.0f, 20.0f);
4379 Vector3 relativeValue(targetValue - startValue);
4380 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4382 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4384 // Start the animation
4387 bool signalReceived(false);
4388 AnimationFinishCheck finishCheck(signalReceived);
4389 animation.FinishedSignal().Connect(&application, finishCheck);
4391 application.SendNotification();
4392 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4394 // We didn't expect the animation to finish yet
4395 application.SendNotification();
4396 finishCheck.CheckSignalNotReceived();
4398 // The position should have moved more, than with a linear alpha function
4399 Vector3 current(actor.GetCurrentProperty<Vector3>(index));
4400 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4401 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4402 DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4404 application.SendNotification();
4405 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4407 // We did expect the animation to finish
4408 application.SendNotification();
4409 finishCheck.CheckSignalReceived();
4410 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4412 // Check that nothing has changed after a couple of buffer swaps
4413 application.Render(0);
4414 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4415 application.Render(0);
4416 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4420 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4422 TestApplication application;
4424 Actor actor = Actor::New();
4426 // Register a Vector3 property
4427 Vector3 startValue(10.0f, 10.0f, 10.0f);
4428 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4429 application.GetScene().Add(actor);
4430 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4431 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4433 // Build the animation
4434 float durationSeconds(1.0f);
4435 Animation animation = Animation::New(durationSeconds);
4436 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4437 Vector3 relativeValue(targetValue - startValue);
4439 animation.AnimateBy(Property(actor, index),
4441 TimePeriod(delay, durationSeconds - delay));
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.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4458 application.SendNotification();
4459 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4461 // We didn't expect the animation to finish yet
4462 application.SendNotification();
4463 finishCheck.CheckSignalNotReceived();
4464 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4466 application.SendNotification();
4467 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 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.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4474 // Check that nothing has changed after a couple of buffer swaps
4475 application.Render(0);
4476 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4477 application.Render(0);
4478 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4482 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4484 TestApplication application;
4486 Actor actor = Actor::New();
4488 // Register a Vector3 property
4489 Vector3 startValue(5.0f, 5.0f, 5.0f);
4490 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4491 application.GetScene().Add(actor);
4492 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4493 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4495 // Build the animation
4496 float durationSeconds(1.0f);
4497 Animation animation = Animation::New(durationSeconds);
4498 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4499 Vector3 relativeValue(targetValue - startValue);
4501 animation.AnimateBy(Property(actor, index),
4503 AlphaFunction::LINEAR,
4504 TimePeriod(delay, durationSeconds - delay));
4506 // Start the animation
4509 bool signalReceived(false);
4510 AnimationFinishCheck finishCheck(signalReceived);
4511 animation.FinishedSignal().Connect(&application, finishCheck);
4513 application.SendNotification();
4514 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4516 // We didn't expect the animation to finish yet
4517 application.SendNotification();
4518 finishCheck.CheckSignalNotReceived();
4519 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4521 application.SendNotification();
4522 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4524 // We didn't expect the animation to finish yet
4525 application.SendNotification();
4526 finishCheck.CheckSignalNotReceived();
4527 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4529 application.SendNotification();
4530 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4532 // We did expect the animation to finish
4533 application.SendNotification();
4534 finishCheck.CheckSignalReceived();
4535 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4537 // Check that nothing has changed after a couple of buffer swaps
4538 application.Render(0);
4539 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4540 application.Render(0);
4541 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4545 int UtcDaliAnimationAnimateByVector4P(void)
4547 TestApplication application;
4549 Actor actor = Actor::New();
4551 // Register a Vector4 property
4552 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4553 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4554 application.GetScene().Add(actor);
4555 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4556 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4558 // Build the animation
4559 float durationSeconds(2.0f);
4560 Animation animation = Animation::New(durationSeconds);
4561 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4562 Vector4 relativeValue(targetValue - startValue);
4563 animation.AnimateBy(Property(actor, index), relativeValue);
4565 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4567 // Start the animation
4570 // Target value should be retrievable straight away
4571 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
4573 bool signalReceived(false);
4574 AnimationFinishCheck finishCheck(signalReceived);
4575 animation.FinishedSignal().Connect(&application, finishCheck);
4577 application.SendNotification();
4578 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4580 // We didn't expect the animation to finish yet
4581 application.SendNotification();
4582 finishCheck.CheckSignalNotReceived();
4583 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
4585 application.SendNotification();
4586 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4588 // We did expect the animation to finish
4589 application.SendNotification();
4590 finishCheck.CheckSignalReceived();
4591 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4593 // Check that nothing has changed after a couple of buffer swaps
4594 application.Render(0);
4595 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4596 application.Render(0);
4597 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4601 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4603 TestApplication application;
4605 Actor actor = Actor::New();
4607 // Register a Vector4 property
4608 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4609 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4610 application.GetScene().Add(actor);
4611 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4612 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4614 // Build the animation
4615 float durationSeconds(1.0f);
4616 Animation animation = Animation::New(durationSeconds);
4617 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4618 Vector4 relativeValue(targetValue - startValue);
4619 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4621 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4623 // Start the animation
4626 bool signalReceived(false);
4627 AnimationFinishCheck finishCheck(signalReceived);
4628 animation.FinishedSignal().Connect(&application, finishCheck);
4630 application.SendNotification();
4631 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4633 // We didn't expect the animation to finish yet
4634 application.SendNotification();
4635 finishCheck.CheckSignalNotReceived();
4637 // The position should have moved more, than with a linear alpha function
4638 Vector4 current(actor.GetCurrentProperty<Vector4>(index));
4639 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4640 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4641 DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4642 DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
4644 application.SendNotification();
4645 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4647 // We did expect the animation to finish
4648 application.SendNotification();
4649 finishCheck.CheckSignalReceived();
4650 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4652 // Check that nothing has changed after a couple of buffer swaps
4653 application.Render(0);
4654 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4655 application.Render(0);
4656 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4660 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4662 TestApplication application;
4664 Actor actor = Actor::New();
4666 // Register a Vector4 property
4667 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4668 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4669 application.GetScene().Add(actor);
4670 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4671 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4673 // Build the animation
4674 float durationSeconds(1.0f);
4675 Animation animation = Animation::New(durationSeconds);
4676 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4677 Vector4 relativeValue(targetValue - startValue);
4679 animation.AnimateBy(Property(actor, index),
4681 TimePeriod(delay, durationSeconds - delay));
4683 // Start the animation
4686 bool signalReceived(false);
4687 AnimationFinishCheck finishCheck(signalReceived);
4688 animation.FinishedSignal().Connect(&application, finishCheck);
4690 application.SendNotification();
4691 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4693 // We didn't expect the animation to finish yet
4694 application.SendNotification();
4695 finishCheck.CheckSignalNotReceived();
4696 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4698 application.SendNotification();
4699 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4701 // We didn't expect the animation to finish yet
4702 application.SendNotification();
4703 finishCheck.CheckSignalNotReceived();
4704 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4706 application.SendNotification();
4707 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4709 // We did expect the animation to finish
4710 application.SendNotification();
4711 finishCheck.CheckSignalReceived();
4712 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4714 // Check that nothing has changed after a couple of buffer swaps
4715 application.Render(0);
4716 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4717 application.Render(0);
4718 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4722 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4724 TestApplication application;
4726 Actor actor = Actor::New();
4728 // Register a Vector4 property
4729 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4730 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4731 application.GetScene().Add(actor);
4732 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4733 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4735 // Build the animation
4736 float durationSeconds(1.0f);
4737 Animation animation = Animation::New(durationSeconds);
4738 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4739 Vector4 relativeValue(targetValue - startValue);
4741 animation.AnimateBy(Property(actor, index),
4743 AlphaFunction::LINEAR,
4744 TimePeriod(delay, durationSeconds - delay));
4746 // Start the animation
4749 bool signalReceived(false);
4750 AnimationFinishCheck finishCheck(signalReceived);
4751 animation.FinishedSignal().Connect(&application, finishCheck);
4753 application.SendNotification();
4754 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4756 // We didn't expect the animation to finish yet
4757 application.SendNotification();
4758 finishCheck.CheckSignalNotReceived();
4759 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4761 application.SendNotification();
4762 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4764 // We didn't expect the animation to finish yet
4765 application.SendNotification();
4766 finishCheck.CheckSignalNotReceived();
4767 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4769 application.SendNotification();
4770 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4772 // We did expect the animation to finish
4773 application.SendNotification();
4774 finishCheck.CheckSignalReceived();
4775 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4777 // Check that nothing has changed after a couple of buffer swaps
4778 application.Render(0);
4779 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4780 application.Render(0);
4781 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4785 int UtcDaliAnimationAnimateByActorPositionP(void)
4787 TestApplication application;
4789 Actor actor = Actor::New();
4790 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4791 actor.SetProperty(Actor::Property::POSITION, startPosition);
4792 application.GetScene().Add(actor);
4793 application.SendNotification();
4794 application.Render(0);
4795 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4797 // Build the animation
4798 float durationSeconds(1.0f);
4799 Animation animation = Animation::New(durationSeconds);
4800 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4801 Vector3 relativePosition(targetPosition - startPosition);
4802 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4804 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4806 // Start the animation
4809 // Target value should be retrievable straight away
4810 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4812 bool signalReceived(false);
4813 AnimationFinishCheck finishCheck(signalReceived);
4814 animation.FinishedSignal().Connect(&application, finishCheck);
4816 application.SendNotification();
4817 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4819 // We didn't expect the animation to finish yet
4820 application.SendNotification();
4821 finishCheck.CheckSignalNotReceived();
4822 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
4824 application.SendNotification();
4825 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4827 // We did expect the animation to finish
4828 application.SendNotification();
4829 finishCheck.CheckSignalReceived();
4830 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4832 // Check that nothing has changed after a couple of buffer swaps
4833 application.Render(0);
4834 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4835 application.Render(0);
4836 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4840 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4842 TestApplication application;
4844 Actor actor = Actor::New();
4845 application.GetScene().Add(actor);
4846 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4848 // Build the animation
4849 float durationSeconds(1.0f);
4850 Animation animation = Animation::New(durationSeconds);
4851 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4852 Vector3 relativePosition(targetPosition - Vector3::ZERO);
4853 animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
4854 animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
4855 animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
4857 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4858 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4860 // Start the animation
4863 // Target value should be retrievable straight away
4864 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4865 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
4866 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
4867 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
4869 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
4871 application.SendNotification();
4872 application.Render(1000); // 1 second progress
4874 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4879 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4881 TestApplication application;
4883 Actor actor = Actor::New();
4884 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4885 actor.SetProperty(Actor::Property::POSITION, startPosition);
4886 application.GetScene().Add(actor);
4887 application.SendNotification();
4888 application.Render(0);
4889 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4891 // Build the animation
4892 float durationSeconds(1.0f);
4893 Animation animation = Animation::New(durationSeconds);
4894 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4895 Vector3 relativePosition(targetPosition - startPosition);
4896 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4898 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4900 // Start the animation
4903 bool signalReceived(false);
4904 AnimationFinishCheck finishCheck(signalReceived);
4905 animation.FinishedSignal().Connect(&application, finishCheck);
4907 application.SendNotification();
4908 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4910 // We didn't expect the animation to finish yet
4911 application.SendNotification();
4912 finishCheck.CheckSignalNotReceived();
4914 // The position should have moved more, than with a linear alpha function
4915 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
4916 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
4917 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
4918 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
4920 application.SendNotification();
4921 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4923 // We did expect the animation to finish
4924 application.SendNotification();
4925 finishCheck.CheckSignalReceived();
4926 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4928 // Check that nothing has changed after a couple of buffer swaps
4929 application.Render(0);
4930 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4931 application.Render(0);
4932 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4936 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4938 TestApplication application;
4940 Actor actor = Actor::New();
4941 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4942 actor.SetProperty(Actor::Property::POSITION, startPosition);
4943 application.GetScene().Add(actor);
4944 application.SendNotification();
4945 application.Render(0);
4946 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4948 // Build the animation
4949 float durationSeconds(1.0f);
4950 Animation animation = Animation::New(durationSeconds);
4951 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4952 Vector3 relativePosition(targetPosition - startPosition);
4954 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4956 TimePeriod(delay, durationSeconds - delay));
4958 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4960 // Start the animation
4963 bool signalReceived(false);
4964 AnimationFinishCheck finishCheck(signalReceived);
4965 animation.FinishedSignal().Connect(&application, finishCheck);
4967 application.SendNotification();
4968 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4970 // We didn't expect the animation to finish yet
4971 application.SendNotification();
4972 finishCheck.CheckSignalNotReceived();
4973 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4975 application.SendNotification();
4976 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
4978 // We did expect the animation to finish
4979 application.SendNotification();
4980 finishCheck.CheckSignalReceived();
4981 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4983 // Check that nothing has changed after a couple of buffer swaps
4984 application.Render(0);
4985 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4986 application.Render(0);
4987 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4991 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4993 TestApplication application;
4995 Actor actor = Actor::New();
4996 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4997 actor.SetProperty(Actor::Property::POSITION, startPosition);
4998 application.GetScene().Add(actor);
4999 application.SendNotification();
5000 application.Render(0);
5001 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5003 // Build the animation
5004 float durationSeconds(1.0f);
5005 Animation animation = Animation::New(durationSeconds);
5006 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5007 Vector3 relativePosition(targetPosition - startPosition);
5009 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
5011 AlphaFunction::LINEAR,
5012 TimePeriod(delay, durationSeconds - delay));
5014 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5016 // Start the animation
5019 bool signalReceived(false);
5020 AnimationFinishCheck finishCheck(signalReceived);
5021 animation.FinishedSignal().Connect(&application, finishCheck);
5023 application.SendNotification();
5024 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5026 // We didn't expect the animation to finish yet
5027 application.SendNotification();
5028 finishCheck.CheckSignalNotReceived();
5029 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5031 application.SendNotification();
5032 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5034 // We did expect the animation to finish
5035 application.SendNotification();
5036 finishCheck.CheckSignalReceived();
5037 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5039 // Check that nothing has changed after a couple of buffer swaps
5040 application.Render(0);
5041 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5042 application.Render(0);
5043 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5047 int UtcDaliAnimationAnimateByActorOrientationP1(void)
5049 TestApplication application;
5051 Actor actor = Actor::New();
5052 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5053 application.GetScene().Add(actor);
5054 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5056 // Build the animation
5057 float durationSeconds(1.0f);
5058 Animation animation = Animation::New(durationSeconds);
5059 Degree relativeRotationDegrees(360.0f);
5060 Radian relativeRotationRadians(relativeRotationDegrees);
5061 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
5063 // Start the animation
5066 // Target value should be retrievable straight away
5067 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
5069 bool signalReceived(false);
5070 AnimationFinishCheck finishCheck(signalReceived);
5071 animation.FinishedSignal().Connect(&application, finishCheck);
5073 application.SendNotification();
5074 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5076 // We didn't expect the animation to finish yet
5077 application.SendNotification();
5078 finishCheck.CheckSignalNotReceived();
5079 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5081 application.SendNotification();
5082 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5084 // We didn't expect the animation to finish yet
5085 application.SendNotification();
5086 finishCheck.CheckSignalNotReceived();
5087 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5089 application.SendNotification();
5090 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5092 // We didn't expect the animation to finish yet
5093 application.SendNotification();
5094 finishCheck.CheckSignalNotReceived();
5095 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5097 application.SendNotification();
5098 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5100 // We did expect the animation to finish
5101 application.SendNotification();
5102 finishCheck.CheckSignalReceived();
5103 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5107 int UtcDaliAnimationAnimateByActorOrientationP2(void)
5109 TestApplication application;
5111 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
5113 Actor actor = Actor::New();
5114 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5115 application.GetScene().Add(actor);
5116 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5118 // Build the animation
5119 float durationSeconds(1.0f);
5120 Animation animation = Animation::New(durationSeconds);
5121 Degree relativeRotationDegrees(710.0f);
5122 Radian relativeRotationRadians(relativeRotationDegrees);
5124 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
5126 // Start the animation
5129 bool signalReceived(false);
5130 AnimationFinishCheck finishCheck(signalReceived);
5131 animation.FinishedSignal().Connect(&application, finishCheck);
5133 application.SendNotification();
5134 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5136 // We didn't expect the animation to finish yet
5137 application.SendNotification();
5138 finishCheck.CheckSignalNotReceived();
5139 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5141 application.SendNotification();
5142 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5144 // We didn't expect the animation to finish yet
5145 application.SendNotification();
5146 finishCheck.CheckSignalNotReceived();
5147 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5149 application.SendNotification();
5150 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5152 // We didn't expect the animation to finish yet
5153 application.SendNotification();
5154 finishCheck.CheckSignalNotReceived();
5155 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5157 application.SendNotification();
5158 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5160 // We did expect the animation to finish
5161 application.SendNotification();
5162 finishCheck.CheckSignalReceived();
5163 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5167 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5169 TestApplication application;
5171 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5173 Actor actor = Actor::New();
5174 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5175 application.GetScene().Add(actor);
5176 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5178 // Build the animation
5179 float durationSeconds(1.0f);
5180 Animation animation = Animation::New(durationSeconds);
5181 Degree relativeRotationDegrees(730.0f);
5182 Radian relativeRotationRadians(relativeRotationDegrees);
5184 Radian actualRotationRadians(Degree(10.0f));
5186 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
5188 // Start the animation
5191 bool signalReceived(false);
5192 AnimationFinishCheck finishCheck(signalReceived);
5193 animation.FinishedSignal().Connect(&application, finishCheck);
5195 application.SendNotification();
5196 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5198 // We didn't expect the animation to finish yet
5199 application.SendNotification();
5200 finishCheck.CheckSignalNotReceived();
5201 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5203 application.SendNotification();
5204 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5206 // We didn't expect the animation to finish yet
5207 application.SendNotification();
5208 finishCheck.CheckSignalNotReceived();
5209 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5211 application.SendNotification();
5212 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5214 // We didn't expect the animation to finish yet
5215 application.SendNotification();
5216 finishCheck.CheckSignalNotReceived();
5217 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5219 application.SendNotification();
5220 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5222 // We did expect the animation to finish
5223 application.SendNotification();
5224 finishCheck.CheckSignalReceived();
5225 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5226 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5230 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5232 TestApplication application;
5234 Actor actor = Actor::New();
5235 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5236 application.GetScene().Add(actor);
5237 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5239 // Build the animation
5240 float durationSeconds(1.0f);
5241 Animation animation = Animation::New(durationSeconds);
5242 Degree relativeRotationDegrees(360.0f);
5243 Radian relativeRotationRadians(relativeRotationDegrees);
5244 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
5246 // Start the animation
5249 bool signalReceived(false);
5250 AnimationFinishCheck finishCheck(signalReceived);
5251 animation.FinishedSignal().Connect(&application, finishCheck);
5253 application.SendNotification();
5254 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5256 // We didn't expect the animation to finish yet
5257 application.SendNotification();
5258 finishCheck.CheckSignalNotReceived();
5259 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5261 application.SendNotification();
5262 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5264 // We didn't expect the animation to finish yet
5265 application.SendNotification();
5266 finishCheck.CheckSignalNotReceived();
5267 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5269 application.SendNotification();
5270 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5272 // We didn't expect the animation to finish yet
5273 application.SendNotification();
5274 finishCheck.CheckSignalNotReceived();
5275 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5277 application.SendNotification();
5278 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5280 // We did expect the animation to finish
5281 application.SendNotification();
5282 finishCheck.CheckSignalReceived();
5283 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5287 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5289 TestApplication application;
5291 Actor actor = Actor::New();
5292 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5293 application.GetScene().Add(actor);
5294 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5296 // Build the animation
5297 float durationSeconds(1.0f);
5298 Animation animation = Animation::New(durationSeconds);
5299 Degree relativeRotationDegrees(360.0f);
5300 Radian relativeRotationRadians(relativeRotationDegrees);
5302 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
5304 // Start the animation
5307 bool signalReceived(false);
5308 AnimationFinishCheck finishCheck(signalReceived);
5309 animation.FinishedSignal().Connect(&application, finishCheck);
5311 application.SendNotification();
5312 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5314 // We didn't expect the animation to finish yet
5315 application.SendNotification();
5316 finishCheck.CheckSignalNotReceived();
5317 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5318 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5320 application.SendNotification();
5321 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5323 // We didn't expect the animation to finish yet
5324 application.SendNotification();
5325 finishCheck.CheckSignalNotReceived();
5326 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5327 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5329 application.SendNotification();
5330 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5332 // We didn't expect the animation to finish yet
5333 application.SendNotification();
5334 finishCheck.CheckSignalNotReceived();
5335 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5336 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5338 application.SendNotification();
5339 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5341 // We did expect the animation to finish
5342 application.SendNotification();
5343 finishCheck.CheckSignalReceived();
5344 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5348 int UtcDaliAnimationAnimateByActorScaleP(void)
5350 TestApplication application;
5352 Actor actor = Actor::New();
5353 application.GetScene().Add(actor);
5354 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5356 // Build the animation
5357 float durationSeconds(1.0f);
5358 Animation animation = Animation::New(durationSeconds);
5359 Vector3 targetScale(2.0f, 2.0f, 2.0f);
5360 Vector3 relativeScale(targetScale - Vector3::ONE);
5361 animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
5363 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
5365 // Start the animation
5368 // Target value should be retrievable straight away
5369 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5371 bool signalReceived(false);
5372 AnimationFinishCheck finishCheck(signalReceived);
5373 animation.FinishedSignal().Connect(&application, finishCheck);
5375 application.SendNotification();
5376 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5378 // We didn't expect the animation to finish yet
5379 application.SendNotification();
5380 finishCheck.CheckSignalNotReceived();
5381 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
5383 application.SendNotification();
5384 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5386 // We did expect the animation to finish
5387 application.SendNotification();
5388 finishCheck.CheckSignalReceived();
5389 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5392 finishCheck.Reset();
5393 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5394 application.SendNotification();
5395 application.Render(0);
5396 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5398 // Repeat with a different (ease-in) alpha function
5399 animation = Animation::New(durationSeconds);
5400 animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
5401 animation.FinishedSignal().Connect(&application, finishCheck);
5404 application.SendNotification();
5405 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5407 // We didn't expect the animation to finish yet
5408 application.SendNotification();
5409 finishCheck.CheckSignalNotReceived();
5411 // The scale should have grown less, than with a linear alpha function
5412 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
5413 DALI_TEST_CHECK(current.x > 1.0f);
5414 DALI_TEST_CHECK(current.y > 1.0f);
5415 DALI_TEST_CHECK(current.z > 1.0f);
5416 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
5417 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
5418 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
5420 application.SendNotification();
5421 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5423 // We did expect the animation to finish
5424 application.SendNotification();
5425 finishCheck.CheckSignalReceived();
5426 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5429 finishCheck.Reset();
5430 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5431 application.SendNotification();
5432 application.Render(0);
5433 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5435 // Repeat with a delay
5437 animation = Animation::New(durationSeconds);
5438 animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5439 animation.FinishedSignal().Connect(&application, finishCheck);
5442 application.SendNotification();
5443 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5445 // We didn't expect the animation to finish yet
5446 application.SendNotification();
5447 finishCheck.CheckSignalNotReceived();
5448 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5450 application.SendNotification();
5451 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5453 // We did expect the animation to finish
5454 application.SendNotification();
5455 finishCheck.CheckSignalReceived();
5456 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5460 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5462 TestApplication application;
5464 Actor actor = Actor::New();
5465 application.GetScene().Add(actor);
5466 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5468 // Build the animation
5469 float durationSeconds(1.0f);
5470 Animation animation = Animation::New(durationSeconds);
5471 Vector3 targetScale(2.0f, 3.0f, 4.0f);
5472 Vector3 relativeScale(targetScale - Vector3::ONE);
5473 animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
5474 animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
5475 animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
5477 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5478 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5480 // Start the animation
5483 // Target value should be retrievable straight away
5484 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5485 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
5486 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
5487 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
5489 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
5491 application.SendNotification();
5492 application.Render(1000); // 1 second progress
5494 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5499 int UtcDaliAnimationAnimateByActorColorP(void)
5501 TestApplication application;
5503 Actor actor = Actor::New();
5504 application.GetScene().Add(actor);
5505 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5507 // Build the animation
5508 float durationSeconds(1.0f);
5509 Animation animation = Animation::New(durationSeconds);
5510 Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5511 Vector4 relativeColor(targetColor - Color::WHITE);
5512 animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
5514 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5515 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5517 // Start the animation
5520 // Target value should be retrievable straight away
5521 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5522 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5523 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5524 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5525 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5527 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5529 application.SendNotification();
5530 application.Render(1000); // 1 second progress
5532 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5537 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5539 TestApplication application;
5541 Actor actor = Actor::New();
5542 application.GetScene().Add(actor);
5543 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5545 // Build the animation
5546 float durationSeconds(1.0f);
5547 Animation animation = Animation::New(durationSeconds);
5548 Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5549 Vector4 relativeColor(targetColor - Color::WHITE);
5550 animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
5551 animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
5552 animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
5553 animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
5555 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5556 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5558 // Start the animation
5561 // Target value should be retrievable straight away
5562 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5563 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5564 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5565 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5566 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5568 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5570 application.SendNotification();
5571 application.Render(1000); // 1 second progress
5573 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5578 int UtcDaliAnimationAnimateByActorSizeP(void)
5580 TestApplication application;
5582 Actor actor = Actor::New();
5583 application.GetScene().Add(actor);
5584 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5586 // Build the animation
5587 float durationSeconds(1.0f);
5588 Animation animation = Animation::New(durationSeconds);
5589 Vector3 targetSize(100.0f, 200.0f, 300.0f);
5590 Vector3 relativeSize(targetSize - Vector3::ZERO);
5591 animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
5593 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5594 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5596 // Start the animation
5599 // Target value should be retrievable straight away
5600 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5601 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5602 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5603 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5605 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5607 application.SendNotification();
5608 application.Render(1000); // 1 second progress
5610 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5615 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5617 TestApplication application;
5619 Actor actor = Actor::New();
5620 application.GetScene().Add(actor);
5621 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5623 // Build the animation
5624 float durationSeconds(1.0f);
5625 Animation animation = Animation::New(durationSeconds);
5626 Vector3 targetSize(100.0f, 200.0f, 300.0f);
5627 Vector3 relativeSize(targetSize - Vector3::ZERO);
5628 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
5629 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
5630 animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
5632 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5633 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5635 // Start the animation
5638 // Target value should be retrievable straight away
5639 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5640 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5641 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5642 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5644 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5646 application.SendNotification();
5647 application.Render(1000); // 1 second progress
5649 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5654 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5656 TestApplication application;
5658 Actor actor = Actor::New();
5659 application.GetScene().Add(actor);
5660 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5662 actor.SetProperty(Actor::Property::VISIBLE, false);
5664 application.SendNotification();
5665 application.Render();
5667 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5669 // Build the animation
5670 float durationSeconds(1.0f);
5671 Animation animation = Animation::New(durationSeconds);
5672 bool targetVisibility(true);
5673 bool relativeVisibility(targetVisibility);
5674 animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
5676 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5678 // Start the animation
5681 // Target value should be retrievable straight away
5682 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
5683 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
5685 application.SendNotification();
5686 application.Render(1000); // 1 second progress
5688 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5693 int UtcDaliAnimationAnimateToBooleanP(void)
5695 TestApplication application;
5697 Actor actor = Actor::New();
5699 // Register a boolean property
5700 const bool startValue(false);
5701 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5702 application.GetScene().Add(actor);
5703 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5704 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5706 // Build the animation
5707 float durationSeconds(2.0f);
5708 Animation animation = Animation::New(durationSeconds);
5709 const bool targetValue(!startValue);
5710 animation.AnimateTo(Property(actor, index), targetValue);
5712 // Start the animation
5715 bool signalReceived(false);
5716 AnimationFinishCheck finishCheck(signalReceived);
5717 animation.FinishedSignal().Connect(&application, finishCheck);
5719 application.SendNotification();
5720 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5722 // We didn't expect the animation to finish yet
5723 application.SendNotification();
5724 finishCheck.CheckSignalNotReceived();
5725 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5727 application.SendNotification();
5728 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5730 // We did expect the animation to finish
5731 application.SendNotification();
5732 finishCheck.CheckSignalReceived();
5733 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5735 // Check that nothing has changed after a couple of buffer swaps
5736 application.Render(0);
5737 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5738 application.Render(0);
5739 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5741 // Repeat with target value "false"
5742 animation = Animation::New(durationSeconds);
5743 const bool finalValue(!targetValue);
5744 animation.AnimateTo(Property(actor, index), finalValue);
5746 // Start the animation
5749 finishCheck.Reset();
5750 animation.FinishedSignal().Connect(&application, finishCheck);
5752 application.SendNotification();
5753 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5755 // We didn't expect the animation to finish yet
5756 application.SendNotification();
5757 finishCheck.CheckSignalNotReceived();
5758 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5760 application.SendNotification();
5761 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5763 // We did expect the animation to finish
5764 application.SendNotification();
5765 finishCheck.CheckSignalReceived();
5766 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5768 // Check that nothing has changed after a couple of buffer swaps
5769 application.Render(0);
5770 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5771 application.Render(0);
5772 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5776 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5778 TestApplication application;
5780 Actor actor = Actor::New();
5782 // Register a boolean property
5783 const bool startValue(false);
5784 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5785 application.GetScene().Add(actor);
5786 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5787 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5789 // Build the animation
5790 float durationSeconds(2.0f);
5791 Animation animation = Animation::New(durationSeconds);
5792 const bool targetValue(!startValue);
5793 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5795 // Start the animation
5798 bool signalReceived(false);
5799 AnimationFinishCheck finishCheck(signalReceived);
5800 animation.FinishedSignal().Connect(&application, finishCheck);
5802 application.SendNotification();
5803 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5805 // We didn't expect the animation to finish yet
5806 application.SendNotification();
5807 finishCheck.CheckSignalNotReceived();
5808 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5810 application.SendNotification();
5811 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5813 // We did expect the animation to finish
5814 application.SendNotification();
5815 finishCheck.CheckSignalReceived();
5816 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5818 // Check that nothing has changed after a couple of buffer swaps
5819 application.Render(0);
5820 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5821 application.Render(0);
5822 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5824 // Repeat with target value "false"
5825 animation = Animation::New(durationSeconds);
5826 const bool finalValue(!targetValue);
5827 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5829 // Start the animation
5832 finishCheck.Reset();
5833 animation.FinishedSignal().Connect(&application, finishCheck);
5835 application.SendNotification();
5836 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5838 // We didn't expect the animation to finish yet
5839 application.SendNotification();
5840 finishCheck.CheckSignalNotReceived();
5841 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5843 application.SendNotification();
5844 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5846 // We did expect the animation to finish
5847 application.SendNotification();
5848 finishCheck.CheckSignalReceived();
5849 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5851 // Check that nothing has changed after a couple of buffer swaps
5852 application.Render(0);
5853 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5854 application.Render(0);
5855 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5859 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5861 TestApplication application;
5863 Actor actor = Actor::New();
5865 // Register a boolean property
5866 bool startValue(false);
5867 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5868 application.GetScene().Add(actor);
5869 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5870 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5872 // Build the animation
5873 float durationSeconds(2.0f);
5874 Animation animation = Animation::New(durationSeconds);
5875 bool finalValue(!startValue);
5876 float animatorDurationSeconds(durationSeconds * 0.5f);
5877 animation.AnimateTo(Property(actor, index),
5879 TimePeriod(animatorDurationSeconds));
5881 // Start the animation
5884 bool signalReceived(false);
5885 AnimationFinishCheck finishCheck(signalReceived);
5886 animation.FinishedSignal().Connect(&application, finishCheck);
5888 application.SendNotification();
5889 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5891 // We didn't expect the animation to finish yet
5892 application.SendNotification();
5893 finishCheck.CheckSignalNotReceived();
5894 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5896 application.SendNotification();
5897 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5899 // We didn't expect the animation to finish yet...
5900 application.SendNotification();
5901 finishCheck.CheckSignalNotReceived();
5903 // ...however we should have reached the final value
5904 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5906 application.SendNotification();
5907 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5909 // We did expect the animation to finish
5910 application.SendNotification();
5911 finishCheck.CheckSignalReceived();
5912 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5914 // Check that nothing has changed after a couple of buffer swaps
5915 application.Render(0);
5916 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5917 application.Render(0);
5918 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5922 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5924 TestApplication application;
5926 Actor actor = Actor::New();
5928 // Register a boolean property
5929 bool startValue(false);
5930 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5931 application.GetScene().Add(actor);
5932 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5933 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5935 // Build the animation
5936 float durationSeconds(2.0f);
5937 Animation animation = Animation::New(durationSeconds);
5938 bool finalValue(!startValue);
5939 float animatorDurationSeconds(durationSeconds * 0.5f);
5940 animation.AnimateTo(Property(actor, index),
5942 AlphaFunction::LINEAR,
5943 TimePeriod(animatorDurationSeconds));
5945 // Start the animation
5948 bool signalReceived(false);
5949 AnimationFinishCheck finishCheck(signalReceived);
5950 animation.FinishedSignal().Connect(&application, finishCheck);
5952 application.SendNotification();
5953 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5955 // We didn't expect the animation to finish yet
5956 application.SendNotification();
5957 finishCheck.CheckSignalNotReceived();
5958 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5960 application.SendNotification();
5961 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5963 // We didn't expect the animation to finish yet...
5964 application.SendNotification();
5965 finishCheck.CheckSignalNotReceived();
5967 // ...however we should have reached the final value
5968 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5970 application.SendNotification();
5971 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5973 // We did expect the animation to finish
5974 application.SendNotification();
5975 finishCheck.CheckSignalReceived();
5976 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5978 // Check that nothing has changed after a couple of buffer swaps
5979 application.Render(0);
5980 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5981 application.Render(0);
5982 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5986 int UtcDaliAnimationAnimateToFloatP(void)
5988 TestApplication application;
5990 Actor actor = Actor::New();
5992 // Register a float property
5993 float startValue(10.0f);
5994 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5995 application.GetScene().Add(actor);
5996 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
5997 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
5999 // Build the animation
6000 float durationSeconds(2.0f);
6001 Animation animation = Animation::New(durationSeconds);
6002 float targetValue(50.0f);
6003 float relativeValue(targetValue - startValue);
6004 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6006 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6008 // Start the animation
6011 bool signalReceived(false);
6012 AnimationFinishCheck finishCheck(signalReceived);
6013 animation.FinishedSignal().Connect(&application, finishCheck);
6015 application.SendNotification();
6016 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6018 // We didn't expect the animation to finish yet
6019 application.SendNotification();
6020 finishCheck.CheckSignalNotReceived();
6021 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
6023 application.SendNotification();
6024 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6026 // We did expect the animation to finish
6027 application.SendNotification();
6028 finishCheck.CheckSignalReceived();
6029 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6033 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
6035 TestApplication application;
6037 Actor actor = Actor::New();
6039 // Register a float property
6040 float startValue(10.0f);
6041 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6042 application.GetScene().Add(actor);
6043 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6044 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6046 // Build the animation
6047 float durationSeconds(1.0f);
6048 Animation animation = Animation::New(durationSeconds);
6049 float targetValue(90.0f);
6050 float relativeValue(targetValue - startValue);
6051 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6053 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6055 // Start the animation
6058 bool signalReceived(false);
6059 AnimationFinishCheck finishCheck(signalReceived);
6060 animation.FinishedSignal().Connect(&application, finishCheck);
6062 application.SendNotification();
6063 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6065 // We didn't expect the animation to finish yet
6066 application.SendNotification();
6067 finishCheck.CheckSignalNotReceived();
6069 // The position should have moved more, than with a linear alpha function
6070 float current(actor.GetCurrentProperty<float>(index));
6071 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6073 application.SendNotification();
6074 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6076 // We did expect the animation to finish
6077 application.SendNotification();
6078 finishCheck.CheckSignalReceived();
6079 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6083 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
6085 TestApplication application;
6087 Actor actor = Actor::New();
6089 // Register a float property
6090 float startValue(10.0f);
6091 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6092 application.GetScene().Add(actor);
6093 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6094 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6096 // Build the animation
6097 float durationSeconds(1.0f);
6098 Animation animation = Animation::New(durationSeconds);
6099 float targetValue(30.0f);
6100 float relativeValue(targetValue - startValue);
6102 animation.AnimateTo(Property(actor, index),
6104 TimePeriod(delay, durationSeconds - delay));
6106 // Start the animation
6109 bool signalReceived(false);
6110 AnimationFinishCheck finishCheck(signalReceived);
6111 animation.FinishedSignal().Connect(&application, finishCheck);
6113 application.SendNotification();
6114 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6116 // We didn't expect the animation to finish yet
6117 application.SendNotification();
6118 finishCheck.CheckSignalNotReceived();
6119 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6121 application.SendNotification();
6122 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6124 // We didn't expect the animation to finish yet
6125 application.SendNotification();
6126 finishCheck.CheckSignalNotReceived();
6127 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6129 application.SendNotification();
6130 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6132 // We did expect the animation to finish
6133 application.SendNotification();
6134 finishCheck.CheckSignalReceived();
6135 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6139 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
6141 TestApplication application;
6143 Actor actor = Actor::New();
6145 // Register a float property
6146 float startValue(10.0f);
6147 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6148 application.GetScene().Add(actor);
6149 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6150 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6152 // Build the animation
6153 float durationSeconds(1.0f);
6154 Animation animation = Animation::New(durationSeconds);
6155 float targetValue(30.0f);
6156 float relativeValue(targetValue - startValue);
6158 animation.AnimateTo(Property(actor, index),
6160 AlphaFunction::LINEAR,
6161 TimePeriod(delay, durationSeconds - delay));
6163 // Start the animation
6166 bool signalReceived(false);
6167 AnimationFinishCheck finishCheck(signalReceived);
6168 animation.FinishedSignal().Connect(&application, finishCheck);
6170 application.SendNotification();
6171 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6173 // We didn't expect the animation to finish yet
6174 application.SendNotification();
6175 finishCheck.CheckSignalNotReceived();
6176 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6178 application.SendNotification();
6179 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6181 // We didn't expect the animation to finish yet
6182 application.SendNotification();
6183 finishCheck.CheckSignalNotReceived();
6184 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6186 application.SendNotification();
6187 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6189 // We did expect the animation to finish
6190 application.SendNotification();
6191 finishCheck.CheckSignalReceived();
6192 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6196 int UtcDaliAnimationAnimateToIntegerP(void)
6198 TestApplication application;
6200 Actor actor = Actor::New();
6202 // Register an integer property
6204 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6205 application.GetScene().Add(actor);
6206 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6207 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6209 // Build the animation
6210 float durationSeconds(2.0f);
6211 Animation animation = Animation::New(durationSeconds);
6212 int targetValue(50);
6213 int relativeValue(targetValue - startValue);
6214 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6216 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
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 * 950.0f) /* 95% progress */);
6228 // We didn't expect the animation to finish yet
6229 application.SendNotification();
6230 finishCheck.CheckSignalNotReceived();
6231 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
6233 application.SendNotification();
6234 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6236 // We did expect the animation to finish
6237 application.SendNotification();
6238 finishCheck.CheckSignalReceived();
6239 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6243 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6245 TestApplication application;
6247 Actor actor = Actor::New();
6249 // Register an integer property
6251 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6252 application.GetScene().Add(actor);
6253 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6254 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6256 // Build the animation
6257 float durationSeconds(1.0f);
6258 Animation animation = Animation::New(durationSeconds);
6259 int targetValue(90);
6260 int relativeValue(targetValue - startValue);
6261 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6263 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6265 // Start the animation
6268 bool signalReceived(false);
6269 AnimationFinishCheck finishCheck(signalReceived);
6270 animation.FinishedSignal().Connect(&application, finishCheck);
6272 application.SendNotification();
6273 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6275 // We didn't expect the animation to finish yet
6276 application.SendNotification();
6277 finishCheck.CheckSignalNotReceived();
6279 // The position should have moved more, than with a linear alpha function
6280 int current(actor.GetCurrentProperty<int>(index));
6281 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6283 application.SendNotification();
6284 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6286 // We did expect the animation to finish
6287 application.SendNotification();
6288 finishCheck.CheckSignalReceived();
6289 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6293 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6295 TestApplication application;
6297 Actor actor = Actor::New();
6299 // Register an integer property
6301 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6302 application.GetScene().Add(actor);
6303 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6304 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6306 // Build the animation
6307 float durationSeconds(1.0f);
6308 Animation animation = Animation::New(durationSeconds);
6309 int targetValue(30);
6310 int relativeValue(targetValue - startValue);
6312 animation.AnimateTo(Property(actor, index),
6314 TimePeriod(delay, durationSeconds - delay));
6316 // Start the animation
6319 bool signalReceived(false);
6320 AnimationFinishCheck finishCheck(signalReceived);
6321 animation.FinishedSignal().Connect(&application, finishCheck);
6323 application.SendNotification();
6324 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6326 // We didn't expect the animation to finish yet
6327 application.SendNotification();
6328 finishCheck.CheckSignalNotReceived();
6329 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6331 application.SendNotification();
6332 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6334 // We didn't expect the animation to finish yet
6335 application.SendNotification();
6336 finishCheck.CheckSignalNotReceived();
6337 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6339 application.SendNotification();
6340 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6342 // We did expect the animation to finish
6343 application.SendNotification();
6344 finishCheck.CheckSignalReceived();
6345 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6349 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6351 TestApplication application;
6353 Actor actor = Actor::New();
6355 // Register an integer property
6357 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6358 application.GetScene().Add(actor);
6359 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6360 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6362 // Build the animation
6363 float durationSeconds(1.0f);
6364 Animation animation = Animation::New(durationSeconds);
6365 int targetValue(30);
6366 int relativeValue(targetValue - startValue);
6368 animation.AnimateTo(Property(actor, index),
6370 AlphaFunction::LINEAR,
6371 TimePeriod(delay, durationSeconds - delay));
6373 // Start the animation
6376 bool signalReceived(false);
6377 AnimationFinishCheck finishCheck(signalReceived);
6378 animation.FinishedSignal().Connect(&application, finishCheck);
6380 application.SendNotification();
6381 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6383 // We didn't expect the animation to finish yet
6384 application.SendNotification();
6385 finishCheck.CheckSignalNotReceived();
6386 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6388 application.SendNotification();
6389 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6391 // We didn't expect the animation to finish yet
6392 application.SendNotification();
6393 finishCheck.CheckSignalNotReceived();
6394 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6396 application.SendNotification();
6397 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6399 // We did expect the animation to finish
6400 application.SendNotification();
6401 finishCheck.CheckSignalReceived();
6402 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6406 int UtcDaliAnimationAnimateToVector2P(void)
6408 TestApplication application;
6410 Actor actor = Actor::New();
6412 // Register a Vector2 property
6413 Vector2 startValue(-50.0f, -50.0f);
6414 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6415 application.GetScene().Add(actor);
6416 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6417 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6419 // Build the animation
6420 float durationSeconds(2.0f);
6421 Animation animation = Animation::New(durationSeconds);
6422 Vector2 targetValue(50.0f, 50.0f);
6423 Vector2 relativeValue(targetValue - startValue);
6424 animation.AnimateTo(Property(actor, index), targetValue);
6426 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6428 // Start the animation
6431 bool signalReceived(false);
6432 AnimationFinishCheck finishCheck(signalReceived);
6433 animation.FinishedSignal().Connect(&application, finishCheck);
6435 application.SendNotification();
6436 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6438 // We didn't expect the animation to finish yet
6439 application.SendNotification();
6440 finishCheck.CheckSignalNotReceived();
6441 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
6443 application.SendNotification();
6444 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6446 // We did expect the animation to finish
6447 application.SendNotification();
6448 finishCheck.CheckSignalReceived();
6449 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6453 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6455 TestApplication application;
6457 Actor actor = Actor::New();
6459 // Register a Vector2 property
6460 Vector2 startValue(1000.0f, 1000.0f);
6461 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6462 application.GetScene().Add(actor);
6463 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6464 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6466 // Build the animation
6467 float durationSeconds(1.0f);
6468 Animation animation = Animation::New(durationSeconds);
6469 Vector2 targetValue(9000.0f, 9000.0f);
6470 Vector2 relativeValue(targetValue - startValue);
6471 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6473 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6475 // Start the animation
6478 bool signalReceived(false);
6479 AnimationFinishCheck finishCheck(signalReceived);
6480 animation.FinishedSignal().Connect(&application, finishCheck);
6482 application.SendNotification();
6483 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6485 // We didn't expect the animation to finish yet
6486 application.SendNotification();
6487 finishCheck.CheckSignalNotReceived();
6489 // The position should have moved more, than with a linear alpha function
6490 Vector2 current(actor.GetCurrentProperty<Vector2>(index));
6491 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6492 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6494 application.SendNotification();
6495 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6497 // We did expect the animation to finish
6498 application.SendNotification();
6499 finishCheck.CheckSignalReceived();
6500 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6504 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6506 TestApplication application;
6508 Actor actor = Actor::New();
6510 // Register a Vector2 property
6511 Vector2 startValue(10.0f, 10.0f);
6512 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6513 application.GetScene().Add(actor);
6514 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6515 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6517 // Build the animation
6518 float durationSeconds(1.0f);
6519 Animation animation = Animation::New(durationSeconds);
6520 Vector2 targetValue(-10.0f, 20.0f);
6521 Vector2 relativeValue(targetValue - startValue);
6523 animation.AnimateTo(Property(actor, index),
6525 TimePeriod(delay, durationSeconds - delay));
6527 // Start the animation
6530 bool signalReceived(false);
6531 AnimationFinishCheck finishCheck(signalReceived);
6532 animation.FinishedSignal().Connect(&application, finishCheck);
6534 application.SendNotification();
6535 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6537 // We didn't expect the animation to finish yet
6538 application.SendNotification();
6539 finishCheck.CheckSignalNotReceived();
6540 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6542 application.SendNotification();
6543 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6545 // We didn't expect the animation to finish yet
6546 application.SendNotification();
6547 finishCheck.CheckSignalNotReceived();
6548 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6550 application.SendNotification();
6551 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6553 // We did expect the animation to finish
6554 application.SendNotification();
6555 finishCheck.CheckSignalReceived();
6556 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6560 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6562 TestApplication application;
6564 Actor actor = Actor::New();
6566 // Register a Vector2 property
6567 Vector2 startValue(10.0f, 10.0f);
6568 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6569 application.GetScene().Add(actor);
6570 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6571 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6573 // Build the animation
6574 float durationSeconds(1.0f);
6575 Animation animation = Animation::New(durationSeconds);
6576 Vector2 targetValue(30.0f, 30.0f);
6577 Vector2 relativeValue(targetValue - startValue);
6579 animation.AnimateTo(Property(actor, index),
6581 AlphaFunction::LINEAR,
6582 TimePeriod(delay, durationSeconds - delay));
6584 // Start the animation
6587 bool signalReceived(false);
6588 AnimationFinishCheck finishCheck(signalReceived);
6589 animation.FinishedSignal().Connect(&application, finishCheck);
6591 application.SendNotification();
6592 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6594 // We didn't expect the animation to finish yet, but cached value should be the final one
6595 application.SendNotification();
6596 finishCheck.CheckSignalNotReceived();
6597 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6598 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6600 application.SendNotification();
6601 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6603 // We didn't expect the animation to finish yet
6604 application.SendNotification();
6605 finishCheck.CheckSignalNotReceived();
6606 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6608 application.SendNotification();
6609 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6611 // We did expect the animation to finish
6612 application.SendNotification();
6613 finishCheck.CheckSignalReceived();
6614 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6615 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6619 int UtcDaliAnimationAnimateToVector3P(void)
6621 TestApplication application;
6623 Actor actor = Actor::New();
6625 // Register a Vector3 property
6626 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6627 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6628 application.GetScene().Add(actor);
6629 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6630 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6632 // Build the animation
6633 float durationSeconds(2.0f);
6634 Animation animation = Animation::New(durationSeconds);
6635 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6636 Vector3 relativeValue(targetValue - startValue);
6637 animation.AnimateTo(Property(actor, index), targetValue);
6639 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6641 // Start the animation
6644 bool signalReceived(false);
6645 AnimationFinishCheck finishCheck(signalReceived);
6646 animation.FinishedSignal().Connect(&application, finishCheck);
6648 application.SendNotification();
6649 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6651 // We didn't expect the animation to finish yet
6652 application.SendNotification();
6653 finishCheck.CheckSignalNotReceived();
6654 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
6656 application.SendNotification();
6657 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6659 // We did expect the animation to finish
6660 application.SendNotification();
6661 finishCheck.CheckSignalReceived();
6662 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6666 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6668 TestApplication application;
6670 Actor actor = Actor::New();
6672 // Register a Vector3 property
6673 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6674 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6675 application.GetScene().Add(actor);
6676 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6677 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6679 // Build the animation
6680 float durationSeconds(1.0f);
6681 Animation animation = Animation::New(durationSeconds);
6682 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6683 Vector3 relativeValue(targetValue - startValue);
6684 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6686 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6688 // Start the animation
6691 bool signalReceived(false);
6692 AnimationFinishCheck finishCheck(signalReceived);
6693 animation.FinishedSignal().Connect(&application, finishCheck);
6695 application.SendNotification();
6696 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6698 // We didn't expect the animation to finish yet
6699 application.SendNotification();
6700 finishCheck.CheckSignalNotReceived();
6702 // The position should have moved more, than with a linear alpha function
6703 Vector3 current(actor.GetCurrentProperty<Vector3>(index));
6704 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6705 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6706 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6708 application.SendNotification();
6709 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6711 // We did expect the animation to finish
6712 application.SendNotification();
6713 finishCheck.CheckSignalReceived();
6714 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6718 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6720 TestApplication application;
6722 Actor actor = Actor::New();
6724 // Register a Vector3 property
6725 Vector3 startValue(10.0f, 10.0f, 10.0f);
6726 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6727 application.GetScene().Add(actor);
6728 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6729 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6731 // Build the animation
6732 float durationSeconds(1.0f);
6733 Animation animation = Animation::New(durationSeconds);
6734 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6735 Vector3 relativeValue(targetValue - startValue);
6737 animation.AnimateTo(Property(actor, index),
6739 TimePeriod(delay, durationSeconds - delay));
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 * 500.0f) /* 50% animation progress, 0% animator progress */);
6751 // We didn't expect the animation to finish yet
6752 application.SendNotification();
6753 finishCheck.CheckSignalNotReceived();
6754 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6756 application.SendNotification();
6757 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6759 // We didn't expect the animation to finish yet
6760 application.SendNotification();
6761 finishCheck.CheckSignalNotReceived();
6762 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6764 application.SendNotification();
6765 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6767 // We did expect the animation to finish
6768 application.SendNotification();
6769 finishCheck.CheckSignalReceived();
6770 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6774 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6776 TestApplication application;
6778 Actor actor = Actor::New();
6780 // Register a Vector3 property
6781 Vector3 startValue(10.0f, 10.0f, 10.0f);
6782 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6783 application.GetScene().Add(actor);
6784 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6785 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6787 // Build the animation
6788 float durationSeconds(1.0f);
6789 Animation animation = Animation::New(durationSeconds);
6790 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6791 Vector3 relativeValue(targetValue - startValue);
6793 animation.AnimateTo(Property(actor, "testProperty"),
6795 AlphaFunction::LINEAR,
6796 TimePeriod(delay, durationSeconds - delay));
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 * 500.0f) /* 50% animation progress, 0% animator progress */);
6808 // We didn't expect the animation to finish yet
6809 application.SendNotification();
6810 finishCheck.CheckSignalNotReceived();
6811 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6813 application.SendNotification();
6814 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6816 // We didn't expect the animation to finish yet
6817 application.SendNotification();
6818 finishCheck.CheckSignalNotReceived();
6819 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6821 application.SendNotification();
6822 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6824 // We did expect the animation to finish
6825 application.SendNotification();
6826 finishCheck.CheckSignalReceived();
6827 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6831 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6833 TestApplication application;
6835 Actor actor = Actor::New();
6837 // Register a Vector3 property
6838 Vector3 startValue(10.0f, 10.0f, 10.0f);
6839 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6840 application.GetScene().Add(actor);
6841 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6842 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6844 // Build the animation
6845 float durationSeconds(1.0f);
6846 Animation animation = Animation::New(durationSeconds);
6847 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6848 Vector3 relativeValue(targetValue - startValue);
6850 animation.AnimateTo(Property(actor, "testProperty", 0),
6852 AlphaFunction::LINEAR,
6853 TimePeriod(delay, durationSeconds - delay));
6854 animation.AnimateTo(Property(actor, index, 1),
6856 AlphaFunction::LINEAR,
6857 TimePeriod(delay, durationSeconds - delay));
6859 // Start the animation
6862 bool signalReceived(false);
6863 AnimationFinishCheck finishCheck(signalReceived);
6864 animation.FinishedSignal().Connect(&application, finishCheck);
6866 application.SendNotification();
6867 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6869 // We didn't expect the animation to finish yet
6870 application.SendNotification();
6871 finishCheck.CheckSignalNotReceived();
6872 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6874 application.SendNotification();
6875 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6877 // We didn't expect the animation to finish yet
6878 application.SendNotification();
6879 finishCheck.CheckSignalNotReceived();
6880 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6882 application.SendNotification();
6883 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6885 // We did expect the animation to finish
6886 application.SendNotification();
6887 finishCheck.CheckSignalReceived();
6888 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6892 int UtcDaliAnimationAnimateToVector4P(void)
6894 TestApplication application;
6896 Actor actor = Actor::New();
6898 // Register a Vector4 property
6899 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6900 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6901 application.GetScene().Add(actor);
6902 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6903 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6905 // Build the animation
6906 float durationSeconds(2.0f);
6907 Animation animation = Animation::New(durationSeconds);
6908 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6909 Vector4 relativeValue(targetValue - startValue);
6910 animation.AnimateTo(Property(actor, index), targetValue);
6912 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6914 // Start the animation
6917 bool signalReceived(false);
6918 AnimationFinishCheck finishCheck(signalReceived);
6919 animation.FinishedSignal().Connect(&application, finishCheck);
6921 application.SendNotification();
6922 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6924 // We didn't expect the animation to finish yet
6925 application.SendNotification();
6926 finishCheck.CheckSignalNotReceived();
6927 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
6929 application.SendNotification();
6930 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6932 // We did expect the animation to finish
6933 application.SendNotification();
6934 finishCheck.CheckSignalReceived();
6935 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6939 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6941 TestApplication application;
6943 Actor actor = Actor::New();
6945 // Register a Vector4 property
6946 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6947 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6948 application.GetScene().Add(actor);
6949 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6950 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6952 // Build the animation
6953 float durationSeconds(1.0f);
6954 Animation animation = Animation::New(durationSeconds);
6955 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6956 Vector4 relativeValue(targetValue - startValue);
6957 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6959 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6961 // Start the animation
6964 bool signalReceived(false);
6965 AnimationFinishCheck finishCheck(signalReceived);
6966 animation.FinishedSignal().Connect(&application, finishCheck);
6968 application.SendNotification();
6969 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6971 // We didn't expect the animation to finish yet
6972 application.SendNotification();
6973 finishCheck.CheckSignalNotReceived();
6975 // The position should have moved more, than with a linear alpha function
6976 Vector4 current(actor.GetCurrentProperty<Vector4>(index));
6977 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6978 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6979 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6980 DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
6982 application.SendNotification();
6983 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6985 // We did expect the animation to finish
6986 application.SendNotification();
6987 finishCheck.CheckSignalReceived();
6988 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6992 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6994 TestApplication application;
6996 Actor actor = Actor::New();
6998 // Register a Vector4 property
6999 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
7000 Property::Index index = actor.RegisterProperty("testProperty", startValue);
7001 application.GetScene().Add(actor);
7002 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7003 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7005 // Build the animation
7006 float durationSeconds(1.0f);
7007 Animation animation = Animation::New(durationSeconds);
7008 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
7009 Vector4 relativeValue(targetValue - startValue);
7011 animation.AnimateTo(Property(actor, index),
7013 TimePeriod(delay, durationSeconds - delay));
7015 // Start the animation
7018 bool signalReceived(false);
7019 AnimationFinishCheck finishCheck(signalReceived);
7020 animation.FinishedSignal().Connect(&application, finishCheck);
7022 application.SendNotification();
7023 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7025 // We didn't expect the animation to finish yet
7026 application.SendNotification();
7027 finishCheck.CheckSignalNotReceived();
7028 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7030 application.SendNotification();
7031 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7033 // We didn't expect the animation to finish yet
7034 application.SendNotification();
7035 finishCheck.CheckSignalNotReceived();
7036 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
7038 application.SendNotification();
7039 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7041 // We did expect the animation to finish
7042 application.SendNotification();
7043 finishCheck.CheckSignalReceived();
7044 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
7048 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
7050 TestApplication application;
7052 Actor actor = Actor::New();
7054 // Register a Vector4 property
7055 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
7056 Property::Index index = actor.RegisterProperty("testProperty", startValue);
7057 application.GetScene().Add(actor);
7058 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7059 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7061 // Build the animation
7062 float durationSeconds(1.0f);
7063 Animation animation = Animation::New(durationSeconds);
7064 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
7065 Vector4 relativeValue(targetValue - startValue);
7067 animation.AnimateTo(Property(actor, index),
7069 AlphaFunction::LINEAR,
7070 TimePeriod(delay, durationSeconds - delay));
7072 // Start the animation
7075 bool signalReceived(false);
7076 AnimationFinishCheck finishCheck(signalReceived);
7077 animation.FinishedSignal().Connect(&application, finishCheck);
7079 application.SendNotification();
7080 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7082 // We didn't expect the animation to finish yet
7083 application.SendNotification();
7084 finishCheck.CheckSignalNotReceived();
7085 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7087 application.SendNotification();
7088 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7090 // We didn't expect the animation to finish yet
7091 application.SendNotification();
7092 finishCheck.CheckSignalNotReceived();
7093 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7095 application.SendNotification();
7096 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7098 // We did expect the animation to finish
7099 application.SendNotification();
7100 finishCheck.CheckSignalReceived();
7101 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7105 int UtcDaliAnimationAnimateToActorParentOriginP(void)
7107 TestApplication application;
7109 Actor actor = Actor::New();
7110 application.GetScene().Add(actor);
7111 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
7113 // Build the animation
7114 float durationSeconds(1.0f);
7115 Animation animation = Animation::New(durationSeconds);
7116 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
7118 DALI_TEST_ASSERTION(
7120 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
7122 "Property is not animatable");
7127 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
7129 TestApplication application;
7131 Actor actor = Actor::New();
7132 application.GetScene().Add(actor);
7133 float startValue(0.0f);
7134 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
7135 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
7137 // Build the animation
7138 float durationSeconds(1.0f);
7139 Animation animation = Animation::New(durationSeconds);
7140 float targetX(1.0f);
7142 DALI_TEST_ASSERTION(
7144 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
7146 "Property is not animatable");
7151 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7153 TestApplication application;
7155 Actor actor = Actor::New();
7156 application.GetScene().Add(actor);
7157 float startValue(0.0f);
7158 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
7159 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
7161 // Build the animation
7162 float durationSeconds(1.0f);
7163 Animation animation = Animation::New(durationSeconds);
7164 float targetY(1.0f);
7166 DALI_TEST_ASSERTION(
7168 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
7170 "Property is not animatable");
7175 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7177 TestApplication application;
7179 Actor actor = Actor::New();
7180 application.GetScene().Add(actor);
7181 float startValue(0.5f);
7182 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
7183 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
7185 // Build the animation
7186 float durationSeconds(1.0f);
7187 Animation animation = Animation::New(durationSeconds);
7188 float targetZ(1.0f);
7190 DALI_TEST_ASSERTION(
7192 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
7194 "Property is not animatable");
7199 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7201 TestApplication application;
7203 Actor actor = Actor::New();
7204 application.GetScene().Add(actor);
7205 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
7207 // Build the animation
7208 float durationSeconds(1.0f);
7209 Animation animation = Animation::New(durationSeconds);
7210 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
7212 DALI_TEST_ASSERTION(
7214 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7216 "Property is not animatable");
7221 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7223 TestApplication application;
7225 Actor actor = Actor::New();
7226 application.GetScene().Add(actor);
7227 float startValue(0.5f);
7228 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
7229 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
7231 // Build the animation
7232 float durationSeconds(1.0f);
7233 Animation animation = Animation::New(durationSeconds);
7234 float targetX(1.0f);
7236 DALI_TEST_ASSERTION(
7238 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
7240 "Property is not animatable");
7245 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7247 TestApplication application;
7249 Actor actor = Actor::New();
7250 application.GetScene().Add(actor);
7251 float startValue(0.5f);
7252 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
7253 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
7255 // Build the animation
7256 float durationSeconds(1.0f);
7257 Animation animation = Animation::New(durationSeconds);
7258 float targetY(0.0f);
7260 DALI_TEST_ASSERTION(
7262 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
7264 "Property is not animatable");
7269 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7271 TestApplication application;
7273 Actor actor = Actor::New();
7274 application.GetScene().Add(actor);
7275 float startValue(0.5f);
7276 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
7277 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
7279 // Build the animation
7280 float durationSeconds(1.0f);
7281 Animation animation = Animation::New(durationSeconds);
7282 float targetZ(100.0f);
7284 DALI_TEST_ASSERTION(
7286 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
7288 "Property is not animatable");
7293 int UtcDaliAnimationAnimateToActorSizeP(void)
7295 TestApplication application;
7297 Actor actor = Actor::New();
7298 application.GetScene().Add(actor);
7299 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7301 // Build the animation
7302 float durationSeconds(1.0f);
7303 Animation animation = Animation::New(durationSeconds);
7304 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7305 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7307 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7309 // Should return the initial properties before play
7310 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7311 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
7312 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
7313 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
7315 // Start the animation
7318 // Should return the target property after play
7319 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7320 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
7321 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
7322 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
7324 bool signalReceived(false);
7325 AnimationFinishCheck finishCheck(signalReceived);
7326 animation.FinishedSignal().Connect(&application, finishCheck);
7328 application.SendNotification();
7329 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7331 // We didn't expect the animation to finish yet
7332 application.SendNotification();
7333 finishCheck.CheckSignalNotReceived();
7334 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7336 application.SendNotification();
7337 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7339 // We did expect the animation to finish
7340 application.SendNotification();
7341 finishCheck.CheckSignalReceived();
7342 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7345 finishCheck.Reset();
7346 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7347 application.SendNotification();
7348 application.Render(0);
7349 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7351 // Repeat with a different (ease-in) alpha function
7352 animation = Animation::New(durationSeconds);
7353 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7354 animation.FinishedSignal().Connect(&application, finishCheck);
7357 application.SendNotification();
7358 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7360 // We didn't expect the animation to finish yet
7361 application.SendNotification();
7362 finishCheck.CheckSignalNotReceived();
7364 // The size should have travelled less, than with a linear alpha function
7365 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7366 DALI_TEST_CHECK(current.x > 0.0f);
7367 DALI_TEST_CHECK(current.y > 0.0f);
7368 DALI_TEST_CHECK(current.z > 0.0f);
7369 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7370 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7371 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
7373 application.SendNotification();
7374 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7376 // We did expect the animation to finish
7377 application.SendNotification();
7378 finishCheck.CheckSignalReceived();
7379 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7382 finishCheck.Reset();
7383 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7384 application.SendNotification();
7385 application.Render(0);
7386 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7388 // Repeat with a delay
7390 animation = Animation::New(durationSeconds);
7391 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7392 animation.FinishedSignal().Connect(&application, finishCheck);
7395 application.SendNotification();
7396 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7398 // We didn't expect the animation to finish yet
7399 application.SendNotification();
7400 finishCheck.CheckSignalNotReceived();
7401 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7403 application.SendNotification();
7404 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7406 // We did expect the animation to finish
7407 application.SendNotification();
7408 finishCheck.CheckSignalReceived();
7409 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7413 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7415 TestApplication application;
7417 Actor actor = Actor::New();
7418 application.GetScene().Add(actor);
7419 float startValue(0.0f);
7420 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
7421 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7423 // Build the animation
7424 float durationSeconds(1.0f);
7425 Animation animation = Animation::New(durationSeconds);
7426 float targetWidth(10.0f);
7427 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
7429 float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
7431 // Should return the initial properties before play
7432 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7433 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7435 // Start the animation
7438 // Should return the target property after play
7439 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
7440 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7442 bool signalReceived(false);
7443 AnimationFinishCheck finishCheck(signalReceived);
7444 animation.FinishedSignal().Connect(&application, finishCheck);
7446 application.SendNotification();
7447 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7449 // We didn't expect the animation to finish yet
7450 application.SendNotification();
7451 finishCheck.CheckSignalNotReceived();
7452 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
7454 application.SendNotification();
7455 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7457 // We did expect the animation to finish
7458 application.SendNotification();
7459 finishCheck.CheckSignalReceived();
7460 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
7461 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7465 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7467 TestApplication application;
7469 Actor actor = Actor::New();
7470 application.GetScene().Add(actor);
7471 float startValue(0.0f);
7472 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
7473 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7475 // Build the animation
7476 float durationSeconds(1.0f);
7477 Animation animation = Animation::New(durationSeconds);
7478 float targetHeight(-10.0f);
7479 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
7481 float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
7483 // Should return the initial properties before play
7484 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7485 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7487 // Start the animation
7490 // Should return the target property after play
7491 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
7492 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7494 bool signalReceived(false);
7495 AnimationFinishCheck finishCheck(signalReceived);
7496 animation.FinishedSignal().Connect(&application, finishCheck);
7498 application.SendNotification();
7499 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7501 // We didn't expect the animation to finish yet
7502 application.SendNotification();
7503 finishCheck.CheckSignalNotReceived();
7504 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
7506 application.SendNotification();
7507 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7509 // We did expect the animation to finish
7510 application.SendNotification();
7511 finishCheck.CheckSignalReceived();
7512 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
7513 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7517 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7519 TestApplication application;
7521 Actor actor = Actor::New();
7522 application.GetScene().Add(actor);
7523 float startValue(0.0f);
7524 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
7525 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7527 // Build the animation
7528 float durationSeconds(1.0f);
7529 Animation animation = Animation::New(durationSeconds);
7530 float targetDepth(-10.0f);
7531 animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
7533 float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
7535 // Should return the initial properties before play
7536 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7537 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7539 // Start the animation
7542 // Should return the target property after play
7543 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
7544 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7546 bool signalReceived(false);
7547 AnimationFinishCheck finishCheck(signalReceived);
7548 animation.FinishedSignal().Connect(&application, finishCheck);
7550 application.SendNotification();
7551 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7553 // We didn't expect the animation to finish yet
7554 application.SendNotification();
7555 finishCheck.CheckSignalNotReceived();
7556 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
7558 application.SendNotification();
7559 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7561 // We did expect the animation to finish
7562 application.SendNotification();
7563 finishCheck.CheckSignalReceived();
7564 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
7565 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7569 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7571 TestApplication application;
7573 Actor actor = Actor::New();
7574 application.GetScene().Add(actor);
7575 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7577 // Build the animation
7578 float durationSeconds(1.0f);
7579 Animation animation = Animation::New(durationSeconds);
7580 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7581 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7583 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7585 // Start the animation
7588 bool signalReceived(false);
7589 AnimationFinishCheck finishCheck(signalReceived);
7590 animation.FinishedSignal().Connect(&application, finishCheck);
7592 application.SendNotification();
7593 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7595 // We didn't expect the animation to finish yet
7596 application.SendNotification();
7597 finishCheck.CheckSignalNotReceived();
7598 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7600 application.SendNotification();
7601 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7603 // We did expect the animation to finish
7604 application.SendNotification();
7605 finishCheck.CheckSignalReceived();
7606 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7609 finishCheck.Reset();
7610 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7611 application.SendNotification();
7612 application.Render(0);
7613 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7615 // Repeat with a different (ease-in) alpha function
7616 animation = Animation::New(durationSeconds);
7617 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
7618 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
7619 animation.FinishedSignal().Connect(&application, finishCheck);
7622 application.SendNotification();
7623 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7625 // We didn't expect the animation to finish yet
7626 application.SendNotification();
7627 finishCheck.CheckSignalNotReceived();
7629 // The size should have travelled less, than with a linear alpha function
7630 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7631 DALI_TEST_CHECK(current.x > 0.0f);
7632 DALI_TEST_CHECK(current.y > 0.0f);
7633 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7634 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7636 application.SendNotification();
7637 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7639 // We did expect the animation to finish
7640 application.SendNotification();
7641 finishCheck.CheckSignalReceived();
7642 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7643 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7646 finishCheck.Reset();
7647 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7648 application.SendNotification();
7649 application.Render(0);
7650 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7652 // Repeat with a delay
7654 animation = Animation::New(durationSeconds);
7655 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7656 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7657 animation.FinishedSignal().Connect(&application, finishCheck);
7660 application.SendNotification();
7661 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7663 // We didn't expect the animation to finish yet
7664 application.SendNotification();
7665 finishCheck.CheckSignalNotReceived();
7666 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7668 application.SendNotification();
7669 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7671 // We did expect the animation to finish
7672 application.SendNotification();
7673 finishCheck.CheckSignalReceived();
7674 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7675 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7679 int UtcDaliAnimationAnimateToActorPositionP(void)
7681 TestApplication application;
7683 Actor actor = Actor::New();
7684 application.GetScene().Add(actor);
7685 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7687 // Build the animation
7688 float durationSeconds(1.0f);
7689 Animation animation = Animation::New(durationSeconds);
7690 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7691 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7693 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7695 // Should return the initial properties before play
7696 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7697 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
7698 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
7699 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
7701 // Start the animation
7704 // Should return the target property after play
7705 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7706 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
7707 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
7708 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
7710 bool signalReceived(false);
7711 AnimationFinishCheck finishCheck(signalReceived);
7712 animation.FinishedSignal().Connect(&application, finishCheck);
7714 application.SendNotification();
7715 application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7717 // We didn't expect the animation to finish yet
7718 application.SendNotification();
7719 finishCheck.CheckSignalNotReceived();
7720 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7722 application.SendNotification();
7723 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7725 // We did expect the animation to finish
7726 application.SendNotification();
7727 finishCheck.CheckSignalReceived();
7728 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7732 int UtcDaliAnimationAnimateToActorPositionXP(void)
7734 TestApplication application;
7736 Actor actor = Actor::New();
7737 application.GetScene().Add(actor);
7738 float startValue(0.0f);
7739 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
7740 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7741 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7742 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7744 // Build the animation
7745 float durationSeconds(1.0f);
7746 Animation animation = Animation::New(durationSeconds);
7747 float targetX(1.0f);
7748 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
7750 float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
7752 // Should return the initial properties before play
7753 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7754 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7756 // Start the animation
7759 // Should return the target property after play
7760 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
7761 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7763 bool signalReceived(false);
7764 AnimationFinishCheck finishCheck(signalReceived);
7765 animation.FinishedSignal().Connect(&application, finishCheck);
7767 application.SendNotification();
7768 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7770 // We didn't expect the animation to finish yet
7771 application.SendNotification();
7772 finishCheck.CheckSignalNotReceived();
7773 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
7775 application.SendNotification();
7776 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7778 // We did expect the animation to finish
7779 application.SendNotification();
7780 finishCheck.CheckSignalReceived();
7781 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
7782 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7783 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7784 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7788 int UtcDaliAnimationAnimateToActorPositionYP(void)
7790 TestApplication application;
7792 Actor actor = Actor::New();
7793 application.GetScene().Add(actor);
7794 float startValue(0.0f);
7795 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
7796 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7797 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7798 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7800 // Build the animation
7801 float durationSeconds(1.0f);
7802 Animation animation = Animation::New(durationSeconds);
7803 float targetY(10.0f);
7804 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
7806 float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
7808 // Should return the initial properties before play
7809 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7810 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7812 // Start the animation
7815 // Should return the target property after play
7816 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
7817 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7819 bool signalReceived(false);
7820 AnimationFinishCheck finishCheck(signalReceived);
7821 animation.FinishedSignal().Connect(&application, finishCheck);
7823 application.SendNotification();
7824 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7826 // We didn't expect the animation to finish yet
7827 application.SendNotification();
7828 finishCheck.CheckSignalNotReceived();
7829 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
7831 application.SendNotification();
7832 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7834 // We did expect the animation to finish
7835 application.SendNotification();
7836 finishCheck.CheckSignalReceived();
7837 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
7838 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7839 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7840 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7844 int UtcDaliAnimationAnimateToActorPositionZP(void)
7846 TestApplication application;
7848 Actor actor = Actor::New();
7849 application.GetScene().Add(actor);
7850 float startValue(0.0f);
7851 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
7852 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7853 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7854 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7856 // Build the animation
7857 float durationSeconds(1.0f);
7858 Animation animation = Animation::New(durationSeconds);
7859 float targetZ(-5.0f);
7860 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
7862 float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
7864 // Should return the initial properties before play
7865 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7866 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7868 // Start the animation
7871 // Should return the target property after play
7872 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
7873 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7875 bool signalReceived(false);
7876 AnimationFinishCheck finishCheck(signalReceived);
7877 animation.FinishedSignal().Connect(&application, finishCheck);
7879 application.SendNotification();
7880 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7882 // We didn't expect the animation to finish yet
7883 application.SendNotification();
7884 finishCheck.CheckSignalNotReceived();
7885 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
7887 application.SendNotification();
7888 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7890 // We did expect the animation to finish
7891 application.SendNotification();
7892 finishCheck.CheckSignalReceived();
7893 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
7894 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7895 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7896 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7900 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7902 TestApplication application;
7904 Actor actor = Actor::New();
7905 application.GetScene().Add(actor);
7906 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7908 // Build the animation
7909 float durationSeconds(1.0f);
7910 Animation animation = Animation::New(durationSeconds);
7911 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7912 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7914 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7916 // Start the animation
7919 bool signalReceived(false);
7920 AnimationFinishCheck finishCheck(signalReceived);
7921 animation.FinishedSignal().Connect(&application, finishCheck);
7923 application.SendNotification();
7924 application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7926 // We didn't expect the animation to finish yet
7927 application.SendNotification();
7928 finishCheck.CheckSignalNotReceived();
7930 // The position should have moved less, than with a linear alpha function
7931 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
7932 DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
7933 DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
7934 DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
7935 DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
7936 DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
7937 DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
7939 application.SendNotification();
7940 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7942 // We did expect the animation to finish
7943 application.SendNotification();
7944 finishCheck.CheckSignalReceived();
7945 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7949 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7951 TestApplication application;
7953 Actor actor = Actor::New();
7954 application.GetScene().Add(actor);
7955 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7957 // Build the animation
7958 float durationSeconds(1.0f);
7959 Animation animation = Animation::New(durationSeconds);
7960 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7962 animation.AnimateTo(Property(actor, Actor::Property::POSITION),
7964 TimePeriod(delay, durationSeconds - delay));
7966 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7968 // Start the animation
7971 bool signalReceived(false);
7972 AnimationFinishCheck finishCheck(signalReceived);
7973 animation.FinishedSignal().Connect(&application, finishCheck);
7975 application.SendNotification();
7976 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7978 // We didn't expect the animation to finish yet
7979 application.SendNotification();
7980 finishCheck.CheckSignalNotReceived();
7981 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7983 application.SendNotification();
7984 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
7986 // We didn't expect the animation to finish yet
7987 application.SendNotification();
7988 finishCheck.CheckSignalNotReceived();
7989 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7991 application.SendNotification();
7992 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
7994 // We did expect the animation to finish
7995 application.SendNotification();
7996 finishCheck.CheckSignalReceived();
7997 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8001 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
8003 TestApplication application;
8005 Actor actor = Actor::New();
8006 application.GetScene().Add(actor);
8007 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8009 // Build the animation
8010 float durationSeconds(1.0f);
8011 Animation animation = Animation::New(durationSeconds);
8012 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8014 animation.AnimateTo(Property(actor, Actor::Property::POSITION),
8016 AlphaFunction::LINEAR,
8017 TimePeriod(delay, durationSeconds - delay));
8019 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8021 // Start the animation
8024 bool signalReceived(false);
8025 AnimationFinishCheck finishCheck(signalReceived);
8026 animation.FinishedSignal().Connect(&application, finishCheck);
8028 application.SendNotification();
8029 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8031 // We didn't expect the animation to finish yet
8032 application.SendNotification();
8033 finishCheck.CheckSignalNotReceived();
8034 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8036 application.SendNotification();
8037 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
8039 // We didn't expect the animation to finish yet
8040 application.SendNotification();
8041 finishCheck.CheckSignalNotReceived();
8042 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
8044 application.SendNotification();
8045 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
8047 // We did expect the animation to finish
8048 application.SendNotification();
8049 finishCheck.CheckSignalReceived();
8050 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8054 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
8056 TestApplication application;
8058 Actor actor = Actor::New();
8059 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8060 application.GetScene().Add(actor);
8061 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8063 // Build the animation
8064 float durationSeconds(1.0f);
8065 Animation animation = Animation::New(durationSeconds);
8066 Degree targetRotationDegrees(90.0f);
8067 Radian targetRotationRadians(targetRotationDegrees);
8068 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
8070 // Start the animation
8073 // Target value should be retrievable straight away
8074 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8076 bool signalReceived(false);
8077 AnimationFinishCheck finishCheck(signalReceived);
8078 animation.FinishedSignal().Connect(&application, finishCheck);
8080 application.SendNotification();
8081 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8083 // We didn't expect the animation to finish yet
8084 application.SendNotification();
8085 finishCheck.CheckSignalNotReceived();
8086 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8088 application.SendNotification();
8089 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8091 // We didn't expect the animation to finish yet
8092 application.SendNotification();
8093 finishCheck.CheckSignalNotReceived();
8094 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8096 application.SendNotification();
8097 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8099 // We didn't expect the animation to finish yet
8100 application.SendNotification();
8101 finishCheck.CheckSignalNotReceived();
8102 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8104 application.SendNotification();
8105 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8107 // We did expect the animation to finish
8108 application.SendNotification();
8109 finishCheck.CheckSignalReceived();
8110 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8114 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
8116 TestApplication application;
8118 Actor actor = Actor::New();
8119 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8120 application.GetScene().Add(actor);
8121 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8123 // Build the animation
8124 float durationSeconds(1.0f);
8125 Animation animation = Animation::New(durationSeconds);
8126 Degree targetRotationDegrees(90.0f);
8127 Radian targetRotationRadians(targetRotationDegrees);
8128 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8129 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
8131 // Start the animation
8134 bool signalReceived(false);
8135 AnimationFinishCheck finishCheck(signalReceived);
8136 animation.FinishedSignal().Connect(&application, finishCheck);
8138 application.SendNotification();
8139 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8141 // We didn't expect the animation to finish yet
8142 application.SendNotification();
8143 finishCheck.CheckSignalNotReceived();
8144 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8146 application.SendNotification();
8147 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8149 // We didn't expect the animation to finish yet
8150 application.SendNotification();
8151 finishCheck.CheckSignalNotReceived();
8152 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8154 application.SendNotification();
8155 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8157 // We didn't expect the animation to finish yet
8158 application.SendNotification();
8159 finishCheck.CheckSignalNotReceived();
8160 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8162 application.SendNotification();
8163 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8165 // We did expect the animation to finish
8166 application.SendNotification();
8167 finishCheck.CheckSignalReceived();
8168 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8172 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8174 TestApplication application;
8176 Actor actor = Actor::New();
8177 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8178 application.GetScene().Add(actor);
8179 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8181 // Build the animation
8182 float durationSeconds(1.0f);
8183 Animation animation = Animation::New(durationSeconds);
8184 Degree targetRotationDegrees(90.0f);
8185 Radian targetRotationRadians(targetRotationDegrees);
8186 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8188 // Start the animation
8191 bool signalReceived(false);
8192 AnimationFinishCheck finishCheck(signalReceived);
8193 animation.FinishedSignal().Connect(&application, finishCheck);
8195 application.SendNotification();
8196 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8198 // We didn't expect the animation to finish yet
8199 application.SendNotification();
8200 finishCheck.CheckSignalNotReceived();
8201 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8203 application.SendNotification();
8204 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8206 // We didn't expect the animation to finish yet
8207 application.SendNotification();
8208 finishCheck.CheckSignalNotReceived();
8209 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8211 application.SendNotification();
8212 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8214 // We didn't expect the animation to finish yet
8215 application.SendNotification();
8216 finishCheck.CheckSignalNotReceived();
8217 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8219 application.SendNotification();
8220 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8222 // We did expect the animation to finish
8223 application.SendNotification();
8224 finishCheck.CheckSignalReceived();
8225 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8229 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8231 TestApplication application;
8233 Actor actor = Actor::New();
8234 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8235 application.GetScene().Add(actor);
8236 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8238 // Build the animation
8239 float durationSeconds(1.0f);
8240 Animation animation = Animation::New(durationSeconds);
8241 Degree targetRotationDegrees(90.0f);
8242 Radian targetRotationRadians(targetRotationDegrees);
8244 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8246 // Start the animation
8249 bool signalReceived(false);
8250 AnimationFinishCheck finishCheck(signalReceived);
8251 animation.FinishedSignal().Connect(&application, finishCheck);
8253 application.SendNotification();
8254 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8256 // We didn't expect the animation to finish yet
8257 application.SendNotification();
8258 finishCheck.CheckSignalNotReceived();
8259 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8260 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8262 application.SendNotification();
8263 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8265 // We didn't expect the animation to finish yet
8266 application.SendNotification();
8267 finishCheck.CheckSignalNotReceived();
8268 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8269 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8271 application.SendNotification();
8272 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8274 // We didn't expect the animation to finish yet
8275 application.SendNotification();
8276 finishCheck.CheckSignalNotReceived();
8277 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8278 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8280 application.SendNotification();
8281 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8283 // We did expect the animation to finish
8284 application.SendNotification();
8285 finishCheck.CheckSignalReceived();
8286 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8290 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8292 TestApplication application;
8294 Actor actor = Actor::New();
8295 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8296 application.GetScene().Add(actor);
8297 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8299 // Build the animation
8300 float durationSeconds(1.0f);
8301 Animation animation = Animation::New(durationSeconds);
8302 Degree targetRotationDegrees(90.0f);
8303 Radian targetRotationRadians(targetRotationDegrees);
8305 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8307 // Start the animation
8310 bool signalReceived(false);
8311 AnimationFinishCheck finishCheck(signalReceived);
8312 animation.FinishedSignal().Connect(&application, finishCheck);
8314 application.SendNotification();
8315 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8317 // We didn't expect the animation to finish yet
8318 application.SendNotification();
8319 finishCheck.CheckSignalNotReceived();
8320 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8321 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8323 application.SendNotification();
8324 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8326 // We didn't expect the animation to finish yet
8327 application.SendNotification();
8328 finishCheck.CheckSignalNotReceived();
8329 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8330 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8332 application.SendNotification();
8333 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8335 // We didn't expect the animation to finish yet
8336 application.SendNotification();
8337 finishCheck.CheckSignalNotReceived();
8338 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8339 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8341 application.SendNotification();
8342 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8344 // We did expect the animation to finish
8345 application.SendNotification();
8346 finishCheck.CheckSignalReceived();
8347 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8351 int UtcDaliAnimationAnimateToActorScaleP(void)
8353 TestApplication application;
8355 Actor actor = Actor::New();
8356 application.GetScene().Add(actor);
8357 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8359 // Build the animation
8360 float durationSeconds(1.0f);
8361 Animation animation = Animation::New(durationSeconds);
8362 Vector3 targetScale(2.0f, 2.0f, 2.0f);
8363 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
8365 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
8367 // Start the animation
8370 // Target value should be retrievable straight away
8371 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8372 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
8373 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
8374 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
8376 bool signalReceived(false);
8377 AnimationFinishCheck finishCheck(signalReceived);
8378 animation.FinishedSignal().Connect(&application, finishCheck);
8380 application.SendNotification();
8381 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8383 // We didn't expect the animation to finish yet
8384 application.SendNotification();
8385 finishCheck.CheckSignalNotReceived();
8386 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
8388 application.SendNotification();
8389 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8391 // We did expect the animation to finish
8392 application.SendNotification();
8393 finishCheck.CheckSignalReceived();
8394 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8397 finishCheck.Reset();
8398 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8399 application.SendNotification();
8400 application.Render(0);
8401 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8403 // Repeat with a different (ease-in) alpha function
8404 animation = Animation::New(durationSeconds);
8405 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8406 animation.FinishedSignal().Connect(&application, finishCheck);
8409 application.SendNotification();
8410 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8412 // We didn't expect the animation to finish yet
8413 application.SendNotification();
8414 finishCheck.CheckSignalNotReceived();
8416 // The scale should have grown less, than with a linear alpha function
8417 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
8418 DALI_TEST_CHECK(current.x > 1.0f);
8419 DALI_TEST_CHECK(current.y > 1.0f);
8420 DALI_TEST_CHECK(current.z > 1.0f);
8421 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
8422 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
8423 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
8425 application.SendNotification();
8426 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8428 // We did expect the animation to finish
8429 application.SendNotification();
8430 finishCheck.CheckSignalReceived();
8431 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8434 finishCheck.Reset();
8435 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8436 application.SendNotification();
8437 application.Render(0);
8438 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8440 // Repeat with a delay
8442 animation = Animation::New(durationSeconds);
8443 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8444 animation.FinishedSignal().Connect(&application, finishCheck);
8447 application.SendNotification();
8448 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8450 // We didn't expect the animation to finish yet
8451 application.SendNotification();
8452 finishCheck.CheckSignalNotReceived();
8453 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8455 application.SendNotification();
8456 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8458 // We did expect the animation to finish
8459 application.SendNotification();
8460 finishCheck.CheckSignalReceived();
8461 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8465 int UtcDaliAnimationAnimateToActorScaleXP(void)
8467 TestApplication application;
8469 Actor actor = Actor::New();
8470 application.GetScene().Add(actor);
8471 float startValue(1.0f);
8472 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
8473 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8474 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8475 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8476 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8477 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8478 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8480 // Build the animation
8481 float durationSeconds(1.0f);
8482 Animation animation = Animation::New(durationSeconds);
8483 float targetX(10.0f);
8484 animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
8486 float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
8488 // Start the animation
8491 // Target value should be retrievable straight away
8492 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
8493 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8495 bool signalReceived(false);
8496 AnimationFinishCheck finishCheck(signalReceived);
8497 animation.FinishedSignal().Connect(&application, finishCheck);
8499 application.SendNotification();
8500 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8502 // We didn't expect the animation to finish yet
8503 application.SendNotification();
8504 finishCheck.CheckSignalNotReceived();
8505 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
8506 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
8507 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8508 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8510 application.SendNotification();
8511 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8513 // We did expect the animation to finish
8514 application.SendNotification();
8515 finishCheck.CheckSignalReceived();
8516 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
8517 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8518 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8519 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8523 int UtcDaliAnimationAnimateToActorScaleYP(void)
8525 TestApplication application;
8527 Actor actor = Actor::New();
8528 application.GetScene().Add(actor);
8529 float startValue(1.0f);
8530 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
8531 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8532 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8533 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8534 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8535 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8536 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8538 // Build the animation
8539 float durationSeconds(1.0f);
8540 Animation animation = Animation::New(durationSeconds);
8541 float targetY(1000.0f);
8542 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
8544 float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
8546 // Start the animation
8549 // Target value should be retrievable straight away
8550 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
8551 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8553 bool signalReceived(false);
8554 AnimationFinishCheck finishCheck(signalReceived);
8555 animation.FinishedSignal().Connect(&application, finishCheck);
8557 application.SendNotification();
8558 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8560 // We didn't expect the animation to finish yet
8561 application.SendNotification();
8562 finishCheck.CheckSignalNotReceived();
8563 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION);
8564 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8565 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION);
8566 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8568 application.SendNotification();
8569 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8571 // We did expect the animation to finish
8572 application.SendNotification();
8573 finishCheck.CheckSignalReceived();
8574 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
8575 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8576 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8577 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8581 int UtcDaliAnimationAnimateToActorScaleZP(void)
8583 TestApplication application;
8585 Actor actor = Actor::New();
8586 application.GetScene().Add(actor);
8587 float startValue(1.0f);
8588 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
8589 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8590 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8591 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8592 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8593 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8594 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8596 // Build the animation
8597 float durationSeconds(1.0f);
8598 Animation animation = Animation::New(durationSeconds);
8599 float targetZ(-1000.0f);
8600 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
8602 float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8604 // Start the animation
8607 // Target value should be retrievable straight away
8608 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
8609 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8611 bool signalReceived(false);
8612 AnimationFinishCheck finishCheck(signalReceived);
8613 animation.FinishedSignal().Connect(&application, finishCheck);
8615 application.SendNotification();
8616 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8618 // We didn't expect the animation to finish yet
8619 application.SendNotification();
8620 finishCheck.CheckSignalNotReceived();
8621 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION);
8622 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8623 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8624 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION);
8626 application.SendNotification();
8627 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8629 // We did expect the animation to finish
8630 application.SendNotification();
8631 finishCheck.CheckSignalReceived();
8632 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
8633 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8634 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8635 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8639 int UtcDaliAnimationAnimateToActorColorP(void)
8641 TestApplication application;
8643 Actor actor = Actor::New();
8644 application.GetScene().Add(actor);
8645 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8647 // Build the animation
8648 float durationSeconds(1.0f);
8649 Animation animation = Animation::New(durationSeconds);
8650 Vector4 targetColor(Color::RED);
8651 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
8653 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8654 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8656 // Start the animation
8659 // Target value should be retrievable straight away
8660 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8661 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
8662 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
8663 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
8664 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
8665 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
8667 bool signalReceived(false);
8668 AnimationFinishCheck finishCheck(signalReceived);
8669 animation.FinishedSignal().Connect(&application, finishCheck);
8671 application.SendNotification();
8672 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8674 // We didn't expect the animation to finish yet
8675 application.SendNotification();
8676 finishCheck.CheckSignalNotReceived();
8677 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
8679 application.SendNotification();
8680 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8682 // We did expect the animation to finish
8683 application.SendNotification();
8684 finishCheck.CheckSignalReceived();
8685 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8688 finishCheck.Reset();
8689 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8690 application.SendNotification();
8691 application.Render(0);
8692 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8694 // Repeat with a different (ease-in) alpha function
8695 animation = Animation::New(durationSeconds);
8696 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8697 animation.FinishedSignal().Connect(&application, finishCheck);
8700 application.SendNotification();
8701 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8703 // We didn't expect the animation to finish yet
8704 application.SendNotification();
8705 finishCheck.CheckSignalNotReceived();
8707 // The color should have changed less, than with a linear alpha function
8708 Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
8709 DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
8710 DALI_TEST_CHECK(current.y < 1.0f);
8711 DALI_TEST_CHECK(current.y > tenPercentProgress.y);
8712 DALI_TEST_CHECK(current.z < 1.0f);
8713 DALI_TEST_CHECK(current.z > tenPercentProgress.z);
8714 DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
8716 application.SendNotification();
8717 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8719 // We did expect the animation to finish
8720 application.SendNotification();
8721 finishCheck.CheckSignalReceived();
8722 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8725 finishCheck.Reset();
8726 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8727 application.SendNotification();
8728 application.Render(0);
8729 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8731 // Repeat with a shorter animator duration
8732 float animatorDuration = 0.5f;
8733 animation = Animation::New(durationSeconds);
8734 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8735 animation.FinishedSignal().Connect(&application, finishCheck);
8738 application.SendNotification();
8739 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
8741 // We didn't expect the animation to finish yet
8742 application.SendNotification();
8743 finishCheck.CheckSignalNotReceived();
8744 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
8746 application.SendNotification();
8747 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
8749 // We didn't expect the animation to finish yet
8750 application.SendNotification();
8751 finishCheck.CheckSignalNotReceived();
8752 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8754 application.SendNotification();
8755 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8757 // We did expect the animation to finish
8758 application.SendNotification();
8759 finishCheck.CheckSignalReceived();
8760 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8764 int UtcDaliAnimationAnimateToActorColorRedP(void)
8766 TestApplication application;
8768 Actor actor = Actor::New();
8769 application.GetScene().Add(actor);
8770 float startValue(1.0f);
8771 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
8772 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8773 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8774 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8775 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8776 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8777 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8778 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8779 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8781 // Build the animation
8782 float durationSeconds(1.0f);
8783 Animation animation = Animation::New(durationSeconds);
8784 float targetRed(0.5f);
8785 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
8787 float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
8789 // Start the animation
8792 // Target value should be retrievable straight away
8793 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
8794 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8796 bool signalReceived(false);
8797 AnimationFinishCheck finishCheck(signalReceived);
8798 animation.FinishedSignal().Connect(&application, finishCheck);
8800 application.SendNotification();
8801 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8803 // We didn't expect the animation to finish yet
8804 application.SendNotification();
8805 finishCheck.CheckSignalNotReceived();
8806 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
8807 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
8808 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8809 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8810 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8812 application.SendNotification();
8813 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8815 // We did expect the animation to finish
8816 application.SendNotification();
8817 finishCheck.CheckSignalReceived();
8818 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
8819 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8820 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8821 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8822 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8826 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8828 TestApplication application;
8830 Actor actor = Actor::New();
8831 application.GetScene().Add(actor);
8832 float startValue(1.0f);
8833 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
8834 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8835 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8836 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8837 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8838 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8839 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8840 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8841 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8843 // Build the animation
8844 float durationSeconds(1.0f);
8845 Animation animation = Animation::New(durationSeconds);
8846 float targetGreen(0.5f);
8847 animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
8849 float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
8851 // Start the animation
8854 // Target value should be retrievable straight away
8855 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
8856 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8858 bool signalReceived(false);
8859 AnimationFinishCheck finishCheck(signalReceived);
8860 animation.FinishedSignal().Connect(&application, finishCheck);
8862 application.SendNotification();
8863 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8865 // We didn't expect the animation to finish yet
8866 application.SendNotification();
8867 finishCheck.CheckSignalNotReceived();
8868 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
8869 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8870 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
8871 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8872 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8874 application.SendNotification();
8875 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8877 // We did expect the animation to finish
8878 application.SendNotification();
8879 finishCheck.CheckSignalReceived();
8880 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
8881 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8882 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8883 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8884 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8888 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8890 TestApplication application;
8892 Actor actor = Actor::New();
8893 application.GetScene().Add(actor);
8894 float startValue(1.0f);
8895 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
8896 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8897 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8898 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8899 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8900 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8901 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8902 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8903 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8905 // Build the animation
8906 float durationSeconds(1.0f);
8907 Animation animation = Animation::New(durationSeconds);
8908 float targetBlue(0.5f);
8909 animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
8911 float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
8913 // Start the animation
8916 // Target value should be retrievable straight away
8917 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
8918 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8920 bool signalReceived(false);
8921 AnimationFinishCheck finishCheck(signalReceived);
8922 animation.FinishedSignal().Connect(&application, finishCheck);
8924 application.SendNotification();
8925 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8927 // We didn't expect the animation to finish yet
8928 application.SendNotification();
8929 finishCheck.CheckSignalNotReceived();
8930 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
8931 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8932 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8933 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
8934 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8936 application.SendNotification();
8937 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8939 // We did expect the animation to finish
8940 application.SendNotification();
8941 finishCheck.CheckSignalReceived();
8942 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
8943 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8944 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8945 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8946 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8950 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8952 TestApplication application;
8954 Actor actor = Actor::New();
8955 application.GetScene().Add(actor);
8956 float startValue(1.0f);
8957 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
8958 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8959 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8960 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8961 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8962 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8963 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8964 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8965 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8967 // Build the animation
8968 float durationSeconds(1.0f);
8969 Animation animation = Animation::New(durationSeconds);
8970 float targetAlpha(0.5f);
8971 animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
8973 float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
8975 // Start the animation
8978 // Target value should be retrievable straight away
8979 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
8980 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
8981 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
8983 bool signalReceived(false);
8984 AnimationFinishCheck finishCheck(signalReceived);
8985 animation.FinishedSignal().Connect(&application, finishCheck);
8987 application.SendNotification();
8988 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8990 // We didn't expect the animation to finish yet
8991 application.SendNotification();
8992 finishCheck.CheckSignalNotReceived();
8993 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
8994 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8995 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8996 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8997 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
8999 application.SendNotification();
9000 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9002 // We did expect the animation to finish
9003 application.SendNotification();
9004 finishCheck.CheckSignalReceived();
9005 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
9006 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9007 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9008 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9009 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
9013 int UtcDaliAnimationKeyFrames01P(void)
9015 TestApplication application;
9017 KeyFrames keyFrames = KeyFrames::New();
9018 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9020 keyFrames.Add(0.0f, 0.1f);
9022 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9024 KeyFrames keyFrames2(keyFrames);
9025 DALI_TEST_CHECK(keyFrames2);
9026 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
9028 KeyFrames keyFrames3 = KeyFrames::New();
9029 keyFrames3.Add(0.6f, true);
9030 DALI_TEST_CHECK(keyFrames3);
9031 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
9033 keyFrames3 = keyFrames;
9034 DALI_TEST_CHECK(keyFrames3);
9035 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
9040 int UtcDaliAnimationKeyFrames02N(void)
9042 TestApplication application;
9044 KeyFrames keyFrames = KeyFrames::New();
9045 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9047 keyFrames.Add(0.0f, 0.1f);
9048 keyFrames.Add(0.2f, 0.5f);
9049 keyFrames.Add(0.4f, 0.0f);
9050 keyFrames.Add(0.6f, 1.0f);
9051 keyFrames.Add(0.8f, 0.7f);
9052 keyFrames.Add(1.0f, 0.9f);
9054 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9056 DALI_TEST_ASSERTION(
9058 keyFrames.Add(1.9f, false);
9060 "mType == value.GetType()");
9065 int UtcDaliAnimationKeyFrames03N(void)
9067 TestApplication application;
9069 KeyFrames keyFrames = KeyFrames::New();
9070 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9072 keyFrames.Add(0.0f, true);
9073 keyFrames.Add(0.2f, false);
9074 keyFrames.Add(0.4f, false);
9075 keyFrames.Add(0.6f, true);
9076 keyFrames.Add(0.8f, true);
9077 keyFrames.Add(1.0f, false);
9079 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
9081 DALI_TEST_ASSERTION(
9083 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9085 "mType == value.GetType()");
9090 int UtcDaliAnimationKeyFrames04N(void)
9092 TestApplication application;
9094 KeyFrames keyFrames = KeyFrames::New();
9095 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9097 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
9098 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
9099 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
9100 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
9101 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
9102 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
9104 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
9106 DALI_TEST_ASSERTION(
9108 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9110 "mType == value.GetType()");
9115 int UtcDaliAnimationKeyFrames05N(void)
9117 TestApplication application;
9119 KeyFrames keyFrames = KeyFrames::New();
9120 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9122 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
9123 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
9124 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
9125 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
9126 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
9127 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
9129 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
9131 DALI_TEST_ASSERTION(
9133 keyFrames.Add(0.7f, 1.0f);
9135 "mType == value.GetType()");
9140 int UtcDaliAnimationKeyFrames06N(void)
9142 TestApplication application;
9144 KeyFrames keyFrames = KeyFrames::New();
9145 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9147 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
9148 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9149 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
9150 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
9151 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
9152 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
9154 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
9156 DALI_TEST_ASSERTION(
9158 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9160 "mType == value.GetType()");
9165 int UtcDaliAnimationKeyFrames07N(void)
9167 TestApplication application;
9169 KeyFrames keyFrames = KeyFrames::New();
9170 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9172 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9173 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9174 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9175 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9176 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9177 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9179 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9181 DALI_TEST_ASSERTION(
9183 keyFrames.Add(0.7f, 1.1f);
9185 "mType == value.GetType()");
9190 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9192 TestApplication application;
9194 float startValue(1.0f);
9195 Actor actor = Actor::New();
9196 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9197 application.GetScene().Add(actor);
9199 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9200 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9201 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9202 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9203 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9204 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9205 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9206 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9207 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9209 // Build the animation
9210 float durationSeconds(1.0f);
9211 Animation animation = Animation::New(durationSeconds);
9213 KeyFrames keyFrames = KeyFrames::New();
9214 keyFrames.Add(0.0f, 0.1f);
9215 keyFrames.Add(0.2f, 0.5f);
9216 keyFrames.Add(0.4f, 0.0f);
9217 keyFrames.Add(0.6f, 1.0f);
9218 keyFrames.Add(0.8f, 0.7f);
9219 keyFrames.Add(1.0f, 0.9f);
9221 animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
9223 // Start the animation
9226 // Final key frame value should be retrievable straight away
9227 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
9229 bool signalReceived(false);
9230 AnimationFinishCheck finishCheck(signalReceived);
9231 animation.FinishedSignal().Connect(&application, finishCheck);
9232 application.SendNotification();
9233 application.Render(0);
9234 application.SendNotification();
9235 finishCheck.CheckSignalNotReceived();
9236 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9238 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9239 application.SendNotification();
9240 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9241 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9242 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9243 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION);
9244 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
9246 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9247 application.SendNotification();
9248 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9249 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9250 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9251 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION);
9252 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
9254 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9255 application.SendNotification();
9256 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9257 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9258 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9259 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9260 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9262 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9263 application.SendNotification();
9264 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9265 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9266 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9267 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9268 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9270 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9271 application.SendNotification();
9272 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9273 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9274 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9275 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
9276 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
9278 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9279 application.SendNotification();
9280 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9281 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9282 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9283 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9284 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9286 // We did expect the animation to finish
9288 finishCheck.CheckSignalReceived();
9292 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9294 TestApplication application;
9296 float startValue(1.0f);
9297 Actor actor = Actor::New();
9298 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9299 application.GetScene().Add(actor);
9301 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9302 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9303 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9304 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9305 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9306 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9307 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9308 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9309 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9311 // Build the animation
9312 float durationSeconds(1.0f);
9313 Animation animation = Animation::New(durationSeconds);
9315 KeyFrames keyFrames = KeyFrames::New();
9316 keyFrames.Add(0.0f, 0.1f);
9317 keyFrames.Add(0.2f, 0.5f);
9318 keyFrames.Add(0.4f, 0.0f);
9319 keyFrames.Add(0.6f, 1.0f);
9320 keyFrames.Add(0.8f, 0.7f);
9321 keyFrames.Add(1.0f, 0.9f);
9323 animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
9325 // Start the animation
9328 bool signalReceived(false);
9329 AnimationFinishCheck finishCheck(signalReceived);
9330 animation.FinishedSignal().Connect(&application, finishCheck);
9331 application.SendNotification();
9332 application.Render(0);
9333 application.SendNotification();
9334 finishCheck.CheckSignalNotReceived();
9335 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9337 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9338 application.SendNotification();
9339 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9340 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9341 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9342 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
9343 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
9345 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9346 application.SendNotification();
9347 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9348 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9349 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9350 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
9351 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
9353 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9354 application.SendNotification();
9355 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9356 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9357 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9358 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9359 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9361 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9362 application.SendNotification();
9363 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9364 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9365 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9366 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9367 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9369 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9370 application.SendNotification();
9371 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9372 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9373 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9374 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION);
9375 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
9377 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9378 application.SendNotification();
9379 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9380 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9381 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9382 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9383 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9385 // We did expect the animation to finish
9387 finishCheck.CheckSignalReceived();
9391 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9393 TestApplication application;
9395 float startValue(1.0f);
9396 Actor actor = Actor::New();
9397 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9398 application.GetScene().Add(actor);
9400 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9401 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9402 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9403 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9404 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9405 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9406 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9407 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9408 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9410 // Build the animation
9411 float durationSeconds(1.0f);
9412 Animation animation = Animation::New(durationSeconds);
9414 KeyFrames keyFrames = KeyFrames::New();
9415 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9416 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9417 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9419 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
9421 // Start the animation
9424 bool signalReceived(false);
9425 AnimationFinishCheck finishCheck(signalReceived);
9426 animation.FinishedSignal().Connect(&application, finishCheck);
9427 application.SendNotification();
9428 application.Render(0);
9429 application.SendNotification();
9430 finishCheck.CheckSignalNotReceived();
9431 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9432 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9433 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9434 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9436 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9437 application.SendNotification();
9438 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9439 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9440 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9441 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9443 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9444 application.SendNotification();
9445 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9446 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9447 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9448 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9450 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9451 application.SendNotification();
9452 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9453 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9454 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9455 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9457 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9458 application.SendNotification();
9459 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9460 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9461 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9462 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9464 // We did expect the animation to finish
9466 finishCheck.CheckSignalReceived();
9470 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9472 TestApplication application;
9474 float startValue(1.0f);
9475 Actor actor = Actor::New();
9476 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9477 application.GetScene().Add(actor);
9479 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9480 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9481 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9482 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9483 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9484 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9485 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9486 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9487 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9489 // Build the animation
9490 float durationSeconds(1.0f);
9491 Animation animation = Animation::New(durationSeconds);
9493 KeyFrames keyFrames = KeyFrames::New();
9494 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9495 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9496 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9498 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
9500 // Start the animation
9503 bool signalReceived(false);
9504 AnimationFinishCheck finishCheck(signalReceived);
9505 animation.FinishedSignal().Connect(&application, finishCheck);
9506 application.SendNotification();
9507 application.Render(0);
9508 application.SendNotification();
9509 finishCheck.CheckSignalNotReceived();
9510 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9511 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9512 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9513 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9515 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9516 application.SendNotification();
9517 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9518 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9519 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9520 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9522 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9523 application.SendNotification();
9524 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9525 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9526 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9527 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9529 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9530 application.SendNotification();
9531 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9532 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9533 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9534 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9536 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9537 application.SendNotification();
9538 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9539 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9540 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9541 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9543 // We did expect the animation to finish
9545 finishCheck.CheckSignalReceived();
9549 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9551 TestApplication application;
9553 Actor actor = Actor::New();
9554 AngleAxis aa(Degree(90), Vector3::XAXIS);
9555 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9556 application.GetScene().Add(actor);
9558 application.SendNotification();
9559 application.Render(0);
9561 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9563 // Build the animation
9564 float durationSeconds(1.0f);
9565 Animation animation = Animation::New(durationSeconds);
9567 KeyFrames keyFrames = KeyFrames::New();
9568 keyFrames.Add(0.0f, false);
9569 keyFrames.Add(0.2f, true);
9570 keyFrames.Add(0.4f, true);
9571 keyFrames.Add(0.8f, false);
9572 keyFrames.Add(1.0f, true);
9574 animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
9576 // Start the animation
9579 // Final key frame value should be retrievable straight away
9580 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9582 bool signalReceived(false);
9583 AnimationFinishCheck finishCheck(signalReceived);
9584 animation.FinishedSignal().Connect(&application, finishCheck);
9585 application.SendNotification();
9586 application.SendNotification();
9587 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9588 application.SendNotification();
9589 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9590 application.SendNotification();
9592 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9593 finishCheck.CheckSignalReceived();
9597 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9599 TestApplication application;
9601 Actor actor = Actor::New();
9602 AngleAxis aa(Degree(90), Vector3::XAXIS);
9603 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9604 application.GetScene().Add(actor);
9606 application.SendNotification();
9607 application.Render(0);
9609 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9611 // Build the animation
9612 float durationSeconds(1.0f);
9613 Animation animation = Animation::New(durationSeconds);
9615 KeyFrames keyFrames = KeyFrames::New();
9616 keyFrames.Add(0.0f, false);
9617 keyFrames.Add(0.2f, true);
9618 keyFrames.Add(0.4f, true);
9619 keyFrames.Add(0.8f, false);
9620 keyFrames.Add(1.0f, true);
9622 //Cubic interpolation for boolean values should be ignored
9623 animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
9625 // Start the animation
9628 bool signalReceived(false);
9629 AnimationFinishCheck finishCheck(signalReceived);
9630 animation.FinishedSignal().Connect(&application, finishCheck);
9631 application.SendNotification();
9632 application.SendNotification();
9633 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9634 application.SendNotification();
9635 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9636 application.SendNotification();
9638 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9639 finishCheck.CheckSignalReceived();
9643 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9645 TestApplication application;
9647 Actor actor = Actor::New();
9648 AngleAxis aa(Degree(90), Vector3::XAXIS);
9649 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9650 application.GetScene().Add(actor);
9652 application.SendNotification();
9653 application.Render(0);
9654 Quaternion start(Radian(aa.angle), aa.axis);
9655 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9657 // Build the animation
9658 float durationSeconds(1.0f);
9659 Animation animation = Animation::New(durationSeconds);
9661 KeyFrames keyFrames = KeyFrames::New();
9662 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9664 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9666 // Start the animation
9669 // Final key frame value should be retrievable straight away
9670 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
9672 bool signalReceived(false);
9673 AnimationFinishCheck finishCheck(signalReceived);
9674 animation.FinishedSignal().Connect(&application, finishCheck);
9675 application.SendNotification();
9676 application.SendNotification();
9677 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9678 application.SendNotification();
9679 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9680 application.SendNotification();
9682 Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9684 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9685 finishCheck.CheckSignalReceived();
9689 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9691 TestApplication application;
9693 Actor actor = Actor::New();
9694 AngleAxis aa(Degree(90), Vector3::XAXIS);
9695 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9696 application.SendNotification();
9697 application.Render(0);
9698 application.GetScene().Add(actor);
9700 Quaternion start(Radian(aa.angle), aa.axis);
9701 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9703 // Build the animation
9704 float durationSeconds(1.0f);
9705 Animation animation = Animation::New(durationSeconds);
9707 KeyFrames keyFrames = KeyFrames::New();
9708 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9709 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9710 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9712 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9714 // Start the animation
9717 bool signalReceived(false);
9718 AnimationFinishCheck finishCheck(signalReceived);
9719 animation.FinishedSignal().Connect(&application, finishCheck);
9720 application.SendNotification();
9721 application.Render(0);
9722 application.SendNotification();
9723 finishCheck.CheckSignalNotReceived();
9725 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9726 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9728 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9729 application.SendNotification();
9730 check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9731 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9733 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9734 application.SendNotification();
9735 check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9736 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9738 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9739 application.SendNotification();
9740 check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9741 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9743 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9744 application.SendNotification();
9745 check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9746 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9748 // We did expect the animation to finish
9750 finishCheck.CheckSignalReceived();
9754 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9756 TestApplication application;
9758 Actor actor = Actor::New();
9759 AngleAxis aa(Degree(90), Vector3::XAXIS);
9760 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9761 application.GetScene().Add(actor);
9763 application.SendNotification();
9764 application.Render(0);
9765 Quaternion start(Radian(aa.angle), aa.axis);
9766 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9768 // Build the animation
9769 float durationSeconds(1.0f);
9770 Animation animation = Animation::New(durationSeconds);
9772 KeyFrames keyFrames = KeyFrames::New();
9773 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9775 //Cubic interpolation should be ignored for quaternions
9776 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9778 // Start the animation
9781 bool signalReceived(false);
9782 AnimationFinishCheck finishCheck(signalReceived);
9783 animation.FinishedSignal().Connect(&application, finishCheck);
9784 application.SendNotification();
9785 application.SendNotification();
9786 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9787 application.SendNotification();
9788 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9789 application.SendNotification();
9791 Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9793 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9794 finishCheck.CheckSignalReceived();
9798 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9800 TestApplication application;
9802 Actor actor = Actor::New();
9803 AngleAxis aa(Degree(90), Vector3::XAXIS);
9804 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9805 application.SendNotification();
9806 application.Render(0);
9807 application.GetScene().Add(actor);
9809 Quaternion start(Radian(aa.angle), aa.axis);
9810 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9812 // Build the animation
9813 float durationSeconds(1.0f);
9814 Animation animation = Animation::New(durationSeconds);
9816 KeyFrames keyFrames = KeyFrames::New();
9817 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9818 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9819 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9821 //Cubic interpolation should be ignored for quaternions
9822 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9824 // Start the animation
9827 bool signalReceived(false);
9828 AnimationFinishCheck finishCheck(signalReceived);
9829 animation.FinishedSignal().Connect(&application, finishCheck);
9830 application.SendNotification();
9831 application.Render(0);
9832 application.SendNotification();
9833 finishCheck.CheckSignalNotReceived();
9835 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9836 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9838 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9839 application.SendNotification();
9840 check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9841 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9843 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9844 application.SendNotification();
9845 check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9846 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9848 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9849 application.SendNotification();
9850 check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9851 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9853 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9854 application.SendNotification();
9855 check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9856 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9858 // We did expect the animation to finish
9860 finishCheck.CheckSignalReceived();
9864 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9866 TestApplication application;
9868 float startValue(1.0f);
9869 Actor actor = Actor::New();
9870 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9871 application.GetScene().Add(actor);
9873 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9874 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9875 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9876 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9877 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9878 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9879 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9880 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9881 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9883 // Build the animation
9884 float durationSeconds(1.0f);
9885 Animation animation = Animation::New(durationSeconds);
9887 KeyFrames keyFrames = KeyFrames::New();
9888 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9889 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9890 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9892 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
9894 // Start the animation
9897 bool signalReceived(false);
9898 AnimationFinishCheck finishCheck(signalReceived);
9899 animation.FinishedSignal().Connect(&application, finishCheck);
9900 application.SendNotification();
9901 application.Render(0);
9902 application.SendNotification();
9903 finishCheck.CheckSignalNotReceived();
9904 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9905 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9906 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9907 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9909 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9910 application.SendNotification();
9911 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9912 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9913 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9914 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9916 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9917 application.SendNotification();
9918 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9919 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9920 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9921 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9923 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9924 application.SendNotification();
9925 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9926 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9927 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9928 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9930 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9931 application.SendNotification();
9932 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9933 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9934 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9935 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9937 // We did expect the animation to finish
9939 finishCheck.CheckSignalReceived();
9943 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9945 TestApplication application;
9947 float startValue(1.0f);
9948 Actor actor = Actor::New();
9949 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9950 application.GetScene().Add(actor);
9952 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9953 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9954 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9955 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9956 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9957 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9958 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9959 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9960 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9962 // Build the animation
9963 float durationSeconds(1.0f);
9964 Animation animation = Animation::New(durationSeconds);
9966 KeyFrames keyFrames = KeyFrames::New();
9967 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9968 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9969 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9971 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
9973 // Start the animation
9976 bool signalReceived(false);
9977 AnimationFinishCheck finishCheck(signalReceived);
9978 animation.FinishedSignal().Connect(&application, finishCheck);
9979 application.SendNotification();
9980 application.Render(0);
9981 application.SendNotification();
9982 finishCheck.CheckSignalNotReceived();
9983 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9984 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9985 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9986 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9988 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9989 application.SendNotification();
9990 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9991 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9992 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9993 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9995 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9996 application.SendNotification();
9997 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9998 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9999 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10000 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10002 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10003 application.SendNotification();
10004 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10005 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10006 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10007 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10009 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10010 application.SendNotification();
10011 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10012 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10013 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10014 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10016 // We did expect the animation to finish
10018 finishCheck.CheckSignalReceived();
10022 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
10024 TestApplication application;
10026 float startValue(1.0f);
10027 Actor actor = Actor::New();
10028 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10029 application.GetScene().Add(actor);
10031 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10032 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10033 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10034 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10035 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10036 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10037 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10038 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10039 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10041 // Build the animation
10042 float durationSeconds(1.0f);
10043 float delay = 0.5f;
10044 Animation animation = Animation::New(durationSeconds);
10046 KeyFrames keyFrames = KeyFrames::New();
10047 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10048 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10049 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10051 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay));
10053 // Start the animation
10056 bool signalReceived(false);
10057 AnimationFinishCheck finishCheck(signalReceived);
10058 animation.FinishedSignal().Connect(&application, finishCheck);
10059 application.SendNotification();
10061 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10062 application.SendNotification();
10063 finishCheck.CheckSignalNotReceived();
10064 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10065 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10066 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10067 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10069 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10070 application.SendNotification();
10071 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10072 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10073 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10074 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10076 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10077 application.SendNotification();
10078 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10079 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10080 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10081 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10083 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10084 application.SendNotification();
10085 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10086 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10087 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10088 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10090 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10091 application.SendNotification();
10092 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10093 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10094 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10095 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10097 // We did expect the animation to finish
10099 finishCheck.CheckSignalReceived();
10103 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
10105 TestApplication application;
10107 float startValue(1.0f);
10108 Actor actor = Actor::New();
10109 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10110 application.GetScene().Add(actor);
10112 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10113 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10114 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10115 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10116 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10117 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10118 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10119 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10120 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10122 // Build the animation
10123 float durationSeconds(1.0f);
10124 float delay = 0.5f;
10125 Animation animation = Animation::New(durationSeconds);
10127 KeyFrames keyFrames = KeyFrames::New();
10128 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10129 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10130 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10132 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10134 // Start the animation
10137 bool signalReceived(false);
10138 AnimationFinishCheck finishCheck(signalReceived);
10139 animation.FinishedSignal().Connect(&application, finishCheck);
10140 application.SendNotification();
10142 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10143 application.SendNotification();
10144 finishCheck.CheckSignalNotReceived();
10145 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10146 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10147 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10148 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10150 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10151 application.SendNotification();
10152 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10153 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10154 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10155 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10157 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10158 application.SendNotification();
10159 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10160 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10161 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10162 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10164 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10165 application.SendNotification();
10166 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10167 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10168 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10169 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10171 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10172 application.SendNotification();
10173 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10174 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10175 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10176 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10178 // We did expect the animation to finish
10180 finishCheck.CheckSignalReceived();
10184 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10186 TestApplication application;
10188 float startValue(1.0f);
10189 float delay = 0.5f;
10190 Actor actor = Actor::New();
10191 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10192 application.GetScene().Add(actor);
10194 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10195 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10196 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10197 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10198 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10199 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10200 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10201 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10202 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10204 // Build the animation
10205 float durationSeconds(1.0f);
10206 Animation animation = Animation::New(durationSeconds);
10208 KeyFrames keyFrames = KeyFrames::New();
10209 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10210 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10211 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10213 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
10215 // Start the animation
10218 bool signalReceived(false);
10219 AnimationFinishCheck finishCheck(signalReceived);
10220 animation.FinishedSignal().Connect(&application, finishCheck);
10221 application.SendNotification();
10223 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10224 application.SendNotification();
10225 finishCheck.CheckSignalNotReceived();
10226 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10227 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10228 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10229 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10231 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10232 application.SendNotification();
10233 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10234 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10235 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10236 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10238 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10239 application.SendNotification();
10240 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10241 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10242 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10243 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10245 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10246 application.SendNotification();
10247 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10248 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10249 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10250 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10252 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10253 application.SendNotification();
10254 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10255 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10256 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10257 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10259 // We did expect the animation to finish
10261 finishCheck.CheckSignalReceived();
10265 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10267 TestApplication application;
10269 float startValue(1.0f);
10270 Actor actor = Actor::New();
10271 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10272 application.GetScene().Add(actor);
10274 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10275 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10276 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10277 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10278 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10279 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10280 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10281 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10282 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10284 // Build the animation
10285 float durationSeconds(1.0f);
10286 float delay = 0.5f;
10287 Animation animation = Animation::New(durationSeconds);
10289 KeyFrames keyFrames = KeyFrames::New();
10290 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10291 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10292 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10294 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10296 // Start the animation
10299 bool signalReceived(false);
10300 AnimationFinishCheck finishCheck(signalReceived);
10301 animation.FinishedSignal().Connect(&application, finishCheck);
10302 application.SendNotification();
10304 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10305 application.SendNotification();
10306 finishCheck.CheckSignalNotReceived();
10307 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10308 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10309 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10310 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10312 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10313 application.SendNotification();
10314 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10315 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10316 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10317 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10319 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10320 application.SendNotification();
10321 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10322 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10323 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10324 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10326 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10327 application.SendNotification();
10328 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10329 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10330 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10331 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10333 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10334 application.SendNotification();
10335 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10336 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10337 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10338 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10340 // We did expect the animation to finish
10342 finishCheck.CheckSignalReceived();
10346 int UtcDaliAnimationAnimateP(void)
10348 TestApplication application;
10350 Actor actor = Actor::New();
10351 application.GetScene().Add(actor);
10354 Vector3 position0(30.0, 80.0, 0.0);
10355 Vector3 position1(70.0, 120.0, 0.0);
10356 Vector3 position2(100.0, 100.0, 0.0);
10358 Dali::Path path = Dali::Path::New();
10359 path.AddPoint(position0);
10360 path.AddPoint(position1);
10361 path.AddPoint(position2);
10363 //Control points for first segment
10364 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10365 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10367 //Control points for second segment
10368 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10369 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10371 // Build the animation
10372 float durationSeconds(1.0f);
10373 Animation animation = Animation::New(durationSeconds);
10374 animation.Animate(actor, path, Vector3::XAXIS);
10376 // Start the animation
10379 bool signalReceived(false);
10380 AnimationFinishCheck finishCheck(signalReceived);
10381 animation.FinishedSignal().Connect(&application, finishCheck);
10382 application.SendNotification();
10383 application.Render(0);
10384 application.SendNotification();
10385 finishCheck.CheckSignalNotReceived();
10386 Vector3 position, tangent;
10387 Quaternion rotation;
10388 path.Sample(0.0f, position, tangent);
10389 rotation = Quaternion(Vector3::XAXIS, tangent);
10390 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10391 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10393 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10394 application.SendNotification();
10395 path.Sample(0.25f, position, tangent);
10396 rotation = Quaternion(Vector3::XAXIS, tangent);
10397 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10398 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10400 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10401 application.SendNotification();
10402 path.Sample(0.5f, position, tangent);
10403 rotation = Quaternion(Vector3::XAXIS, tangent);
10404 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10405 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10407 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10408 application.SendNotification();
10409 path.Sample(0.75f, position, tangent);
10410 rotation = Quaternion(Vector3::XAXIS, tangent);
10411 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10412 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10414 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10415 application.SendNotification();
10416 path.Sample(1.0f, position, tangent);
10417 rotation = Quaternion(Vector3::XAXIS, tangent);
10418 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10419 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10421 finishCheck.CheckSignalReceived();
10425 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10427 TestApplication application;
10429 Actor actor = Actor::New();
10430 application.GetScene().Add(actor);
10433 Vector3 position0(30.0, 80.0, 0.0);
10434 Vector3 position1(70.0, 120.0, 0.0);
10435 Vector3 position2(100.0, 100.0, 0.0);
10437 Dali::Path path = Dali::Path::New();
10438 path.AddPoint(position0);
10439 path.AddPoint(position1);
10440 path.AddPoint(position2);
10442 //Control points for first segment
10443 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10444 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10446 //Control points for second segment
10447 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10448 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10450 // Build the animation
10451 float durationSeconds(1.0f);
10452 Animation animation = Animation::New(durationSeconds);
10453 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10455 // Start the animation
10458 bool signalReceived(false);
10459 AnimationFinishCheck finishCheck(signalReceived);
10460 animation.FinishedSignal().Connect(&application, finishCheck);
10461 application.SendNotification();
10462 application.Render(0);
10463 application.SendNotification();
10464 finishCheck.CheckSignalNotReceived();
10465 Vector3 position, tangent;
10466 Quaternion rotation;
10467 path.Sample(0.0f, position, tangent);
10468 rotation = Quaternion(Vector3::XAXIS, tangent);
10469 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10470 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10472 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10473 application.SendNotification();
10474 path.Sample(0.25f, position, tangent);
10475 rotation = Quaternion(Vector3::XAXIS, tangent);
10476 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10477 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10479 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10480 application.SendNotification();
10481 path.Sample(0.5f, position, tangent);
10482 rotation = Quaternion(Vector3::XAXIS, tangent);
10483 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10484 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10486 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10487 application.SendNotification();
10488 path.Sample(0.75f, position, tangent);
10489 rotation = Quaternion(Vector3::XAXIS, tangent);
10490 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10491 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10493 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10494 application.SendNotification();
10495 path.Sample(1.0f, position, tangent);
10496 rotation = Quaternion(Vector3::XAXIS, tangent);
10497 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10498 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10500 finishCheck.CheckSignalReceived();
10504 int UtcDaliAnimationAnimateTimePeriodP(void)
10506 TestApplication application;
10508 Actor actor = Actor::New();
10509 application.GetScene().Add(actor);
10512 Vector3 position0(30.0, 80.0, 0.0);
10513 Vector3 position1(70.0, 120.0, 0.0);
10514 Vector3 position2(100.0, 100.0, 0.0);
10516 Dali::Path path = Dali::Path::New();
10517 path.AddPoint(position0);
10518 path.AddPoint(position1);
10519 path.AddPoint(position2);
10521 //Control points for first segment
10522 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10523 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10525 //Control points for second segment
10526 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10527 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10529 // Build the animation
10530 float durationSeconds(1.0f);
10531 Animation animation = Animation::New(durationSeconds);
10532 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10534 // Start the animation
10537 bool signalReceived(false);
10538 AnimationFinishCheck finishCheck(signalReceived);
10539 animation.FinishedSignal().Connect(&application, finishCheck);
10540 application.SendNotification();
10541 application.Render(0);
10542 application.SendNotification();
10543 finishCheck.CheckSignalNotReceived();
10544 Vector3 position, tangent;
10545 Quaternion rotation;
10546 path.Sample(0.0f, position, tangent);
10547 rotation = Quaternion(Vector3::XAXIS, tangent);
10548 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10549 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10551 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10552 application.SendNotification();
10553 path.Sample(0.25f, position, tangent);
10554 rotation = Quaternion(Vector3::XAXIS, tangent);
10555 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10556 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10558 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10559 application.SendNotification();
10560 path.Sample(0.5f, position, tangent);
10561 rotation = Quaternion(Vector3::XAXIS, tangent);
10562 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10563 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10565 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10566 application.SendNotification();
10567 path.Sample(0.75f, position, tangent);
10568 rotation = Quaternion(Vector3::XAXIS, tangent);
10569 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10570 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10572 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10573 application.SendNotification();
10574 path.Sample(1.0f, position, tangent);
10575 rotation = Quaternion(Vector3::XAXIS, tangent);
10576 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10577 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10579 finishCheck.CheckSignalReceived();
10583 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10585 TestApplication application;
10587 Actor actor = Actor::New();
10588 application.GetScene().Add(actor);
10591 Vector3 position0(30.0, 80.0, 0.0);
10592 Vector3 position1(70.0, 120.0, 0.0);
10593 Vector3 position2(100.0, 100.0, 0.0);
10595 Dali::Path path = Dali::Path::New();
10596 path.AddPoint(position0);
10597 path.AddPoint(position1);
10598 path.AddPoint(position2);
10600 //Control points for first segment
10601 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10602 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10604 //Control points for second segment
10605 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10606 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10608 // Build the animation
10609 float durationSeconds(1.0f);
10610 Animation animation = Animation::New(durationSeconds);
10611 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10613 // Start the animation
10616 bool signalReceived(false);
10617 AnimationFinishCheck finishCheck(signalReceived);
10618 animation.FinishedSignal().Connect(&application, finishCheck);
10619 application.SendNotification();
10620 application.Render(0);
10621 application.SendNotification();
10622 finishCheck.CheckSignalNotReceived();
10623 Vector3 position, tangent;
10624 Quaternion rotation;
10625 path.Sample(0.0f, position, tangent);
10626 rotation = Quaternion(Vector3::XAXIS, tangent);
10627 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10628 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10630 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10631 application.SendNotification();
10632 path.Sample(0.25f, position, tangent);
10633 rotation = Quaternion(Vector3::XAXIS, tangent);
10634 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10635 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10637 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10638 application.SendNotification();
10639 path.Sample(0.5f, position, tangent);
10640 rotation = Quaternion(Vector3::XAXIS, tangent);
10641 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10642 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10644 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10645 application.SendNotification();
10646 path.Sample(0.75f, position, tangent);
10647 rotation = Quaternion(Vector3::XAXIS, tangent);
10648 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10649 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10651 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10652 application.SendNotification();
10653 path.Sample(1.0f, position, tangent);
10654 rotation = Quaternion(Vector3::XAXIS, tangent);
10655 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10656 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10658 finishCheck.CheckSignalReceived();
10662 int UtcDaliAnimationShowP(void)
10664 TestApplication application;
10666 Actor actor = Actor::New();
10667 actor.SetProperty(Actor::Property::VISIBLE, false);
10668 application.SendNotification();
10669 application.Render(0);
10670 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10671 application.GetScene().Add(actor);
10673 // Start the animation
10674 float durationSeconds(10.0f);
10675 Animation animation = Animation::New(durationSeconds);
10676 animation.Show(actor, durationSeconds * 0.5f);
10679 bool signalReceived(false);
10680 AnimationFinishCheck finishCheck(signalReceived);
10681 animation.FinishedSignal().Connect(&application, finishCheck);
10683 application.SendNotification();
10684 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10686 // We didn't expect the animation to finish yet
10687 application.SendNotification();
10688 finishCheck.CheckSignalNotReceived();
10689 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10691 application.SendNotification();
10692 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
10694 // We didn't expect the animation to finish yet
10695 application.SendNotification();
10696 finishCheck.CheckSignalNotReceived();
10697 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10699 application.SendNotification();
10700 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10702 // We did expect the animation to finish
10703 application.SendNotification();
10704 finishCheck.CheckSignalReceived();
10705 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10709 int UtcDaliAnimationHideP(void)
10711 TestApplication application;
10713 Actor actor = Actor::New();
10714 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10715 application.GetScene().Add(actor);
10717 // Start the animation
10718 float durationSeconds(10.0f);
10719 Animation animation = Animation::New(durationSeconds);
10720 animation.Hide(actor, durationSeconds * 0.5f);
10723 bool signalReceived(false);
10724 AnimationFinishCheck finishCheck(signalReceived);
10725 animation.FinishedSignal().Connect(&application, finishCheck);
10727 application.SendNotification();
10728 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10730 // We didn't expect the animation to finish yet
10731 application.SendNotification();
10732 finishCheck.CheckSignalNotReceived();
10733 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10735 application.SendNotification();
10736 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
10738 // We didn't expect the animation to finish yet
10739 application.SendNotification();
10740 finishCheck.CheckSignalNotReceived();
10741 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10743 application.SendNotification();
10744 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10746 // We did expect the animation to finish
10747 application.SendNotification();
10748 finishCheck.CheckSignalReceived();
10749 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10753 int UtcDaliAnimationShowHideAtEndP(void)
10755 // Test that show/hide delay can be the same as animation duration
10756 // i.e. to show/hide at the end of the animation
10758 TestApplication application;
10760 Actor actor = Actor::New();
10761 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10762 application.GetScene().Add(actor);
10764 // Start Hide animation
10765 float durationSeconds(10.0f);
10766 Animation animation = Animation::New(durationSeconds);
10767 animation.Hide(actor, durationSeconds /*Hide at end*/);
10770 bool signalReceived(false);
10771 AnimationFinishCheck finishCheck(signalReceived);
10772 animation.FinishedSignal().Connect(&application, finishCheck);
10774 application.SendNotification();
10775 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10777 // We did expect the animation to finish
10778 application.SendNotification();
10779 finishCheck.CheckSignalReceived();
10780 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10782 // Start Show animation
10783 animation = Animation::New(durationSeconds);
10784 animation.Show(actor, durationSeconds /*Show at end*/);
10785 animation.FinishedSignal().Connect(&application, finishCheck);
10788 application.SendNotification();
10789 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10791 // We did expect the animation to finish
10792 application.SendNotification();
10793 finishCheck.CheckSignalReceived();
10794 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10798 int UtcDaliKeyFramesCreateDestroyP(void)
10800 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10802 KeyFrames* keyFrames = new KeyFrames;
10804 DALI_TEST_CHECK(true);
10808 int UtcDaliKeyFramesDownCastP(void)
10810 TestApplication application;
10811 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10813 KeyFrames keyFrames = KeyFrames::New();
10814 BaseHandle object(keyFrames);
10816 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10817 DALI_TEST_CHECK(keyFrames2);
10819 KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
10820 DALI_TEST_CHECK(keyFrames3);
10822 BaseHandle unInitializedObject;
10823 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10824 DALI_TEST_CHECK(!keyFrames4);
10826 KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
10827 DALI_TEST_CHECK(!keyFrames5);
10831 int UtcDaliAnimationCreateDestroyP(void)
10833 TestApplication application;
10834 Animation* animation = new Animation;
10835 DALI_TEST_CHECK(animation);
10840 struct UpdateManagerTestConstraint
10842 UpdateManagerTestConstraint(TestApplication& application)
10843 : mApplication(application)
10847 void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
10849 mApplication.SendNotification(); // Process events
10852 TestApplication& mApplication;
10855 int UtcDaliAnimationUpdateManagerP(void)
10857 TestApplication application;
10859 Actor actor = Actor::New();
10860 application.GetScene().Add(actor);
10862 // Build the animation
10863 Animation animation = Animation::New(0.0f);
10865 bool signalReceived = false;
10866 AnimationFinishCheck finishCheck(signalReceived);
10867 animation.FinishedSignal().Connect(&application, finishCheck);
10869 Vector3 startValue(1.0f, 1.0f, 1.0f);
10870 Property::Index index = actor.RegisterProperty("testProperty", startValue);
10871 Constraint constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
10872 constraint.Apply();
10874 // Apply animation to actor
10875 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
10876 animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
10880 application.SendNotification();
10881 application.UpdateOnly(16);
10883 finishCheck.CheckSignalNotReceived();
10885 application.SendNotification(); // Process events
10887 finishCheck.CheckSignalReceived();
10892 int UtcDaliAnimationSignalOrderP(void)
10894 TestApplication application;
10896 Actor actor = Actor::New();
10897 application.GetScene().Add(actor);
10899 // Build the animations
10900 Animation animation1 = Animation::New(0.0f); // finishes first frame
10901 Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
10903 bool signal1Received = false;
10904 animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
10906 bool signal2Received = false;
10907 animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
10909 // Apply animations to actor
10910 animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
10912 animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
10915 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10916 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10918 application.SendNotification();
10919 application.UpdateOnly(10); // 10ms progress
10921 // no notifications yet
10922 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10923 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10925 application.SendNotification();
10928 DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
10929 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10930 signal1Received = false;
10932 // 1st animation is complete now, do another update with no ProcessEvents in between
10933 application.UpdateOnly(20); // 20ms progress
10936 application.SendNotification();
10938 // 2nd should complete now
10939 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10940 DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
10945 int UtcDaliAnimationExtendDurationP(void)
10947 TestApplication application;
10949 Actor actor = Actor::New();
10951 // Register a float property
10952 float startValue(10.0f);
10953 Property::Index index = actor.RegisterProperty("testProperty", startValue);
10954 application.GetScene().Add(actor);
10955 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
10956 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
10958 // Build the animation
10959 float initialDurationSeconds(1.0f);
10960 float animatorDelay = 5.0f;
10961 float animatorDurationSeconds(5.0f);
10962 float extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
10963 Animation animation = Animation::New(initialDurationSeconds);
10964 float targetValue(30.0f);
10965 float relativeValue(targetValue - startValue);
10967 animation.AnimateTo(Property(actor, index),
10969 TimePeriod(animatorDelay, animatorDurationSeconds));
10971 // The duration should have been extended
10972 DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
10974 // Start the animation
10977 bool signalReceived(false);
10978 AnimationFinishCheck finishCheck(signalReceived);
10979 animation.FinishedSignal().Connect(&application, finishCheck);
10981 application.SendNotification();
10982 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
10984 // We didn't expect the animation to finish yet, but cached value should be the final one
10985 application.SendNotification();
10986 finishCheck.CheckSignalNotReceived();
10987 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
10988 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
10990 application.SendNotification();
10991 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
10993 // We didn't expect the animation to finish yet
10994 application.SendNotification();
10995 finishCheck.CheckSignalNotReceived();
10996 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
10998 application.SendNotification();
10999 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11001 // We did expect the animation to finish
11002 application.SendNotification();
11003 finishCheck.CheckSignalReceived();
11004 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
11005 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11009 int UtcDaliAnimationCustomIntProperty(void)
11011 TestApplication application;
11013 Actor actor = Actor::New();
11014 application.GetScene().Add(actor);
11015 int startValue(0u);
11017 Property::Index index = actor.RegisterProperty("anIndex", startValue);
11018 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
11019 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11021 // Build the animation
11022 float durationSeconds(1.0f);
11023 Animation animation = Animation::New(durationSeconds);
11024 animation.AnimateTo(Property(actor, index), 20);
11026 // Start the animation
11029 // Target value should be retrievable straight away
11030 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11032 bool signalReceived(false);
11033 AnimationFinishCheck finishCheck(signalReceived);
11034 animation.FinishedSignal().Connect(&application, finishCheck);
11036 application.SendNotification();
11037 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
11039 // We didn't expect the animation to finish yet
11040 application.SendNotification();
11041 finishCheck.CheckSignalNotReceived();
11042 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
11044 application.SendNotification();
11045 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11047 // We did expect the animation to finish
11048 application.SendNotification();
11049 finishCheck.CheckSignalReceived();
11050 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
11051 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11055 int UtcDaliAnimationDuration(void)
11057 TestApplication application;
11059 Actor actor = Actor::New();
11060 application.GetScene().Add(actor);
11062 Animation animation = Animation::New(0.0f);
11063 DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
11065 // The animation duration should automatically increase depending on the animator time period
11067 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
11068 DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
11070 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
11071 DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
11076 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
11078 TestApplication application;
11080 Actor actor = Actor::New();
11082 // Register an integer property
11084 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11085 application.GetScene().Add(actor);
11086 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11088 DALI_TEST_ASSERTION(
11090 // Build the animation
11091 Animation animation = Animation::New(2.0f);
11092 std::string relativeValue = "relative string";
11093 animation.AnimateBy(Property(actor, index), relativeValue);
11094 tet_result(TET_FAIL);
11096 "Target value is not animatable");
11101 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
11103 TestApplication application;
11105 Actor actor = Actor::New();
11107 // Register an integer property
11109 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11110 application.GetScene().Add(actor);
11111 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11113 DALI_TEST_ASSERTION(
11115 // Build the animation
11116 Animation animation = Animation::New(2.0f);
11117 std::string relativeValue = "relative string";
11118 animation.AnimateTo(Property(actor, index), relativeValue);
11120 "Target value is not animatable");
11125 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
11127 TestApplication application;
11129 Actor actor = Actor::New();
11131 // Register an integer property
11133 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11134 application.GetScene().Add(actor);
11135 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11137 DALI_TEST_ASSERTION(
11139 // Build the animation
11140 KeyFrames keyFrames = KeyFrames::New();
11141 keyFrames.Add(0.0f, std::string("relative string1"));
11142 keyFrames.Add(1.0f, std::string("relative string2"));
11143 // no need to really create the animation as keyframes do the check
11145 "Property type is not animatable");
11150 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
11152 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
11154 TestApplication application;
11156 tet_infoline("Set initial position and set up animation to re-position actor");
11158 Actor actor = Actor::New();
11159 application.GetScene().Add(actor);
11160 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11161 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11163 // Build the animation
11164 Animation animation = Animation::New(2.0f);
11166 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11167 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11168 DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11170 tet_infoline("Set target position in animation without intiating play");
11172 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11173 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11175 application.SendNotification();
11176 application.Render();
11178 tet_infoline("Ensure position of actor is still at intial value");
11180 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11181 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11182 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11184 tet_infoline("Play animation and ensure actor position is now target");
11187 application.SendNotification();
11188 application.Render(1000u);
11190 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11192 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11193 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11194 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11196 tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11198 application.Render(2000u);
11200 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11202 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11203 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11204 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11209 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11211 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11213 TestApplication application;
11215 std::vector<Vector3> targetPositions;
11217 targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
11218 targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11219 targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
11221 tet_infoline("Set initial position and set up animation to re-position actor");
11223 Actor actor = Actor::New();
11224 application.GetScene().Add(actor);
11225 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11226 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11228 // Build the animation
11229 Animation animation = Animation::New(2.0f);
11231 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11232 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11233 DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11235 tet_infoline("Set target position in animation without intiating play");
11237 for(unsigned int i = 0; i < targetPositions.size(); i++)
11239 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11242 application.SendNotification();
11243 application.Render();
11245 tet_infoline("Ensure position of actor is still at intial value");
11247 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11248 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11249 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11251 tet_infoline("Play animation and ensure actor position is now target");
11254 application.SendNotification();
11255 application.Render(1000u);
11257 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11259 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11260 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11261 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11263 tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11265 application.Render(2000u);
11267 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11269 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11270 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11271 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11276 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11278 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even with mulitple animators of different Property Indexes");
11280 TestApplication application;
11282 std::vector<Vector3> targetSizes;
11283 std::vector<Vector3> targetPositions;
11285 targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11286 targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
11288 targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11290 tet_infoline("Set initial position and set up animation to re-position actor");
11292 Actor actor = Actor::New();
11293 application.GetScene().Add(actor);
11294 Vector3 initialSize(10.0f, 10.0f, 10.0f);
11295 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11297 actor.SetProperty(Actor::Property::SIZE, initialSize);
11298 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11300 // Build the animation
11301 Animation animation = Animation::New(2.0f);
11303 tet_infoline("Set target size in animation without intiating play");
11304 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11305 tet_infoline("Set target position in animation without intiating play");
11306 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11307 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11309 application.SendNotification();
11310 application.Render();
11312 tet_infoline("Ensure position of actor is still at intial size and position");
11314 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11315 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11316 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11318 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
11319 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
11320 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
11322 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11325 application.SendNotification();
11326 application.Render(2000u);
11328 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11330 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11331 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11332 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11334 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
11335 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
11336 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
11341 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11343 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11345 TestApplication application;
11347 std::vector<Vector3> targetSizes;
11348 std::vector<float> targetColors;
11350 targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11351 targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
11353 targetColors.push_back(1.0f);
11355 tet_infoline("Set initial position and set up animation to re-position actor");
11357 Actor actor = Actor::New();
11358 application.GetScene().Add(actor);
11359 Vector3 initialSize(10.0f, 5.0f, 10.0f);
11361 actor.SetProperty(Actor::Property::SIZE, initialSize);
11363 // Build the animation
11364 Animation animation = Animation::New(2.0f);
11366 tet_infoline("Set target size in animation without initiating play");
11367 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11368 tet_infoline("Set target position in animation without intiating play");
11369 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11370 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11372 application.SendNotification();
11373 application.Render();
11375 tet_infoline("Ensure position of actor is still at initial size and position");
11377 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11378 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11379 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11381 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11384 application.SendNotification();
11385 application.Render(2000u);
11387 tet_infoline("Ensure position and size of actor is at target value when animation playing");
11389 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11390 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11391 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11393 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
11398 int UtcDaliAnimationTimePeriodOrder(void)
11400 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
11402 TestApplication application;
11404 Actor actor = Actor::New();
11405 application.GetScene().Add(actor);
11407 application.SendNotification();
11408 application.Render();
11410 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11411 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11412 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11413 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11414 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11416 //////////////////////////////////////////////////////////////////////////////////
11418 tet_infoline("With two AnimateTo calls");
11420 Animation animation = Animation::New(0.0f);
11421 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11422 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11425 tet_infoline("The target position should change instantly");
11426 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11427 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11429 application.SendNotification();
11430 application.Render(5000); // After the animation is complete
11432 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11433 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11434 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11436 //////////////////////////////////////////////////////////////////////////////////
11438 tet_infoline("Same animation again but in a different order - should yield the same result");
11440 actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11441 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11442 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11444 application.SendNotification();
11445 application.Render();
11447 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11448 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11449 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11451 animation = Animation::New(0.0f);
11452 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11453 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11456 tet_infoline("The target position should change instantly");
11457 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11458 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11460 application.SendNotification();
11461 application.Render(5000); // After the animation is complete
11463 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11464 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11465 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11470 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11472 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls");
11474 TestApplication application;
11476 Actor actor = Actor::New();
11477 application.GetScene().Add(actor);
11479 application.SendNotification();
11480 application.Render();
11482 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11483 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11484 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11485 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11486 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11488 //////////////////////////////////////////////////////////////////////////////////
11492 Animation animation = Animation::New(0.0f);
11493 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11494 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11495 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11496 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11497 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11498 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11501 tet_infoline("The target position should change instantly");
11502 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11503 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11505 application.SendNotification();
11506 application.Render(14000); // After the animation is complete
11508 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11509 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11510 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11512 //////////////////////////////////////////////////////////////////////////////////
11514 tet_infoline("Same animation again but in a different order - should end up at the same point");
11516 actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11518 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11519 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11521 application.SendNotification();
11522 application.Render();
11524 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11525 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11526 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11528 animation = Animation::New(0.0f);
11529 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11530 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11531 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11532 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11533 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11534 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11537 tet_infoline("The target position should change instantly");
11538 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11539 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11541 application.SendNotification();
11542 application.Render(14000); // After the animation is complete
11544 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11545 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11546 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11551 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11553 TestApplication application;
11556 Actor actor = Actor::New();
11557 const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11558 application.GetScene().Add(actor);
11560 application.Render();
11561 application.SendNotification();
11563 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11565 // Build the animation
11566 float durationSeconds(1.0f);
11567 Animation animation = Animation::New(durationSeconds);
11569 KeyFrames keyFrames = KeyFrames::New();
11570 keyFrames.Add(0.0f, 10);
11571 keyFrames.Add(0.2f, 20);
11572 keyFrames.Add(0.4f, 30);
11573 keyFrames.Add(0.6f, 40);
11574 keyFrames.Add(0.8f, 50);
11575 keyFrames.Add(1.0f, 60);
11577 animation.AnimateBetween(Property(actor, index), keyFrames);
11579 // Start the animation
11582 // Target value should change to the last key-frame's value straight away
11583 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
11588 int UtcDaliAnimationAnimateBetweenVector2P(void)
11590 TestApplication application;
11592 Vector2 startValue(10.0f, 20.0f);
11593 Actor actor = Actor::New();
11594 const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11595 application.GetScene().Add(actor);
11597 application.Render();
11598 application.SendNotification();
11600 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
11602 // Build the animation
11603 float durationSeconds(1.0f);
11604 Animation animation = Animation::New(durationSeconds);
11606 KeyFrames keyFrames = KeyFrames::New();
11607 keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
11608 keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
11609 keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
11610 keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
11611 keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
11612 keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
11614 animation.AnimateBetween(Property(actor, index), keyFrames);
11616 // Start the animation
11619 // Target value should change to the last key-frame's value straight away
11620 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
11625 int UtcDaliAnimationProgressCallbackP(void)
11627 TestApplication application;
11629 Actor actor = Actor::New();
11630 application.GetScene().Add(actor);
11632 // Build the animation
11633 Animation animation = Animation::New(0.0f);
11636 float durationSeconds(1.0f);
11637 animation.SetDuration(durationSeconds);
11639 bool finishedSignalReceived(false);
11640 bool progressSignalReceived(false);
11642 AnimationFinishCheck finishCheck(finishedSignalReceived);
11643 animation.FinishedSignal().Connect(&application, finishCheck);
11645 AnimationProgressCheck progressCheck(progressSignalReceived);
11646 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
11647 application.SendNotification();
11649 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11650 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11652 tet_infoline("Animation Progress notification set to 30%");
11653 DevelAnimation::SetProgressNotification(animation, 0.3f);
11655 application.SendNotification();
11656 application.Render();
11658 DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
11660 progressCheck.CheckSignalNotReceived();
11662 // Start the animation from 10% progress
11663 animation.SetCurrentProgress(0.1f);
11666 tet_infoline("Animation Playing from 10%");
11668 application.SendNotification();
11669 application.Render(0); // start animation
11670 application.Render(durationSeconds * 100.0f); // 20% progress
11672 tet_infoline("Animation at 20%");
11674 progressCheck.CheckSignalNotReceived();
11676 application.SendNotification();
11677 application.Render(durationSeconds * 200.0f); // 40% progress
11678 application.SendNotification();
11679 tet_infoline("Animation at 40%");
11680 DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
11682 progressCheck.CheckSignalReceived();
11684 tet_infoline("Progress check reset");
11685 progressCheck.Reset();
11687 application.Render(durationSeconds * 100.0f); // 50% progress
11688 tet_infoline("Animation at 50%");
11689 application.SendNotification();
11691 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
11693 progressCheck.CheckSignalNotReceived();
11695 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
11696 application.SendNotification();
11698 tet_infoline("Animation at 60%");
11700 finishCheck.CheckSignalNotReceived();
11702 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
11703 application.SendNotification();
11704 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
11705 tet_infoline("Animation at 80%");
11707 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
11708 // We did expect the animation to finish
11709 application.SendNotification();
11710 finishCheck.CheckSignalReceived();
11711 tet_infoline("Animation finished");
11712 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11717 int UtcDaliAnimationPlayAfterP(void)
11719 TestApplication application;
11721 tet_printf("Testing that playing after 2 seconds\n");
11724 Actor actor = Actor::New();
11725 application.GetScene().Add(actor);
11727 // Build the animation
11728 float durationSeconds(1.0f);
11729 Animation animation = Animation::New(durationSeconds);
11731 bool signalReceived(false);
11732 AnimationFinishCheck finishCheck(signalReceived);
11733 animation.FinishedSignal().Connect(&application, finishCheck);
11734 application.SendNotification();
11736 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11737 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11739 // Play animation after the initial delay time
11740 animation.PlayAfter(0.2f);
11741 application.SendNotification();
11742 application.Render(0); // start animation
11744 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11745 application.SendNotification();
11746 finishCheck.CheckSignalNotReceived();
11747 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11749 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11751 // We didn't expect the animation to finish yet
11752 application.SendNotification();
11753 finishCheck.CheckSignalNotReceived();
11754 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11756 application.SendNotification();
11757 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11759 application.SendNotification();
11760 finishCheck.CheckSignalNotReceived();
11761 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11763 application.SendNotification();
11764 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11766 // We did expect the animation to finish
11767 application.SendNotification();
11768 finishCheck.CheckSignalReceived();
11769 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11771 // Check that nothing has changed after a couple of buffer swaps
11772 application.Render(0);
11773 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11776 tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11779 Actor actor = Actor::New();
11780 application.GetScene().Add(actor);
11782 // Build the animation
11783 float durationSeconds(1.0f);
11784 Animation animation = Animation::New(durationSeconds);
11785 animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0
11787 bool signalReceived(false);
11788 AnimationFinishCheck finishCheck(signalReceived);
11789 animation.FinishedSignal().Connect(&application, finishCheck);
11790 application.SendNotification();
11792 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11793 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11795 // Play animation after the initial delay time
11796 animation.PlayAfter(0.2f);
11797 application.SendNotification();
11798 application.Render(0); // start animation
11800 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11801 application.SendNotification();
11802 finishCheck.CheckSignalNotReceived();
11803 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11805 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11807 // We didn't expect the animation to finish yet
11808 application.SendNotification();
11809 finishCheck.CheckSignalNotReceived();
11810 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11812 application.SendNotification();
11813 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11815 application.SendNotification();
11816 finishCheck.CheckSignalNotReceived();
11817 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11819 application.SendNotification();
11820 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11822 // We did expect the animation to finish
11823 application.SendNotification();
11824 finishCheck.CheckSignalReceived();
11825 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
11827 // Check that nothing has changed after a couple of buffer swaps
11828 application.Render(0);
11829 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11835 int UtcDaliAnimationPlayAfterP2(void)
11837 TestApplication application;
11839 tet_printf("Testing that playing after 2 seconds before looping\n");
11842 Actor actor = Actor::New();
11843 application.GetScene().Add(actor);
11845 // Build the animation
11846 float durationSeconds(1.0f);
11847 Animation animation = Animation::New(durationSeconds);
11848 animation.SetLooping(true);
11850 bool signalReceived(false);
11851 AnimationFinishCheck finishCheck(signalReceived);
11852 animation.FinishedSignal().Connect(&application, finishCheck);
11853 application.SendNotification();
11855 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11856 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11858 // Play animation after the initial delay time
11859 animation.PlayAfter(0.2f);
11860 application.SendNotification();
11861 application.Render(0); // start animation
11863 for(int iterations = 0; iterations < 3; ++iterations)
11865 // The initial delay time of PlayAfter() applies only once in looping mode.
11866 if(iterations == 0)
11868 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11869 application.SendNotification();
11870 finishCheck.CheckSignalNotReceived();
11871 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11874 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11876 // We didn't expect the animation to finish yet
11877 application.SendNotification();
11878 finishCheck.CheckSignalNotReceived();
11879 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11881 application.SendNotification();
11882 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11884 application.SendNotification();
11885 finishCheck.CheckSignalNotReceived();
11886 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11888 application.SendNotification();
11889 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
11891 // We did expect the animation to finish
11892 application.SendNotification();
11893 finishCheck.CheckSignalNotReceived();
11894 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11897 animation.SetLooping(false);
11898 application.SendNotification();
11899 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11901 application.SendNotification();
11902 finishCheck.CheckSignalReceived();
11903 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11906 tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11909 Actor actor = Actor::New();
11910 application.GetScene().Add(actor);
11912 // Build the animation
11913 float durationSeconds(1.0f);
11914 Animation animation = Animation::New(durationSeconds);
11915 animation.SetLooping(true);
11916 animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0
11918 bool signalReceived(false);
11919 AnimationFinishCheck finishCheck(signalReceived);
11920 animation.FinishedSignal().Connect(&application, finishCheck);
11921 application.SendNotification();
11923 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11924 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11926 // Play animation after the initial delay time
11927 animation.PlayAfter(0.2f);
11928 application.SendNotification();
11929 application.Render(0); // start animation
11931 for(int iterations = 0; iterations < 3; ++iterations)
11933 // The initial delay time of PlayAfter() applies only once in looping mode.
11934 if(iterations == 0)
11936 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11937 application.SendNotification();
11938 finishCheck.CheckSignalNotReceived();
11939 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11942 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11944 // We didn't expect the animation to finish yet
11945 application.SendNotification();
11946 finishCheck.CheckSignalNotReceived();
11947 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11949 application.SendNotification();
11950 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11952 application.SendNotification();
11953 finishCheck.CheckSignalNotReceived();
11954 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11956 application.SendNotification();
11957 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
11959 // We did expect the animation to finish
11960 application.SendNotification();
11961 finishCheck.CheckSignalNotReceived();
11962 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
11965 animation.SetLooping(false);
11966 application.SendNotification();
11967 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11969 application.SendNotification();
11970 finishCheck.CheckSignalReceived();
11971 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11977 int UtcDaliAnimationPlayAfterP3(void)
11979 TestApplication application;
11981 tet_printf("Testing that PlayAfter with the negative delay seconds\n");
11983 Actor actor = Actor::New();
11984 application.GetScene().Add(actor);
11986 // Build the animation
11987 float durationSeconds(1.0f);
11988 Animation animation = Animation::New(durationSeconds);
11990 bool signalReceived(false);
11991 AnimationFinishCheck finishCheck(signalReceived);
11992 animation.FinishedSignal().Connect(&application, finishCheck);
11993 application.SendNotification();
11995 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11996 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11998 // When the delay time is negative value, it would treat as play immediately.
11999 animation.PlayAfter(-2.0f);
12000 application.SendNotification();
12001 application.Render(0); // start animation
12003 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12005 // We didn't expect the animation to finish yet
12006 application.SendNotification();
12007 finishCheck.CheckSignalNotReceived();
12008 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12010 application.SendNotification();
12011 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12013 application.SendNotification();
12014 finishCheck.CheckSignalNotReceived();
12015 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12017 application.SendNotification();
12018 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
12020 // We did expect the animation to finish
12021 application.SendNotification();
12022 finishCheck.CheckSignalReceived();
12023 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12025 // Check that nothing has changed after a couple of buffer swaps
12026 application.Render(0);
12027 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12031 int UtcDaliAnimationPlayAfterP4(void)
12033 TestApplication application;
12035 tet_printf("Testing that PlayAfter with progress value\n");
12037 Actor actor = Actor::New();
12038 application.GetScene().Add(actor);
12040 // Build the animation
12041 float durationSeconds(1.0f);
12042 Animation animation = Animation::New(durationSeconds);
12044 bool signalReceived(false);
12045 AnimationFinishCheck finishCheck(signalReceived);
12046 animation.FinishedSignal().Connect(&application, finishCheck);
12047 application.SendNotification();
12049 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12050 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12052 // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
12053 animation.PlayAfter(durationSeconds * 0.3f);
12054 application.SendNotification();
12055 application.Render(0); // start animation
12057 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
12059 // We didn't expect the animation to finish yet
12060 application.SendNotification();
12061 finishCheck.CheckSignalNotReceived();
12062 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
12064 application.SendNotification();
12065 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
12067 application.SendNotification();
12068 finishCheck.CheckSignalNotReceived();
12069 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12071 application.SendNotification();
12072 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
12074 application.SendNotification();
12075 finishCheck.CheckSignalNotReceived();
12076 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12078 application.SendNotification();
12079 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
12081 application.SendNotification();
12082 finishCheck.CheckSignalNotReceived();
12083 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
12085 application.SendNotification();
12086 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
12088 application.SendNotification();
12089 finishCheck.CheckSignalNotReceived();
12090 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
12092 application.SendNotification();
12093 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
12095 // We did expect the animation to finish
12096 application.SendNotification();
12097 finishCheck.CheckSignalReceived();
12098 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12100 // Check that nothing has changed after a couple of buffer swaps
12101 application.Render(0);
12102 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12106 int UtcDaliAnimationSetLoopingModeP(void)
12108 // Test Loop forever and Loop mode being set
12109 TestApplication application;
12110 Integration::Scene stage(application.GetScene());
12112 // Default: LoopingMode::RESTART
12114 Actor actor = Actor::New();
12117 float durationSeconds(1.0f);
12118 Animation animation = Animation::New(durationSeconds);
12119 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12121 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
12122 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12124 // Start the animation
12126 application.SendNotification();
12127 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
12131 application.SendNotification();
12132 application.Render();
12133 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12136 // LoopingMode::AUTO_REVERSE
12138 Actor actor = Actor::New();
12141 float durationSeconds(1.0f);
12142 Animation animation = Animation::New(durationSeconds);
12143 animation.SetLooping(true);
12145 bool signalReceived(false);
12146 AnimationFinishCheck finishCheck(signalReceived);
12147 animation.FinishedSignal().Connect(&application, finishCheck);
12148 application.SendNotification();
12150 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12151 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12153 animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
12154 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12156 // Start the animation
12158 application.SendNotification();
12159 application.Render(0);
12161 for(int iterations = 0; iterations < 3; ++iterations)
12163 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12164 application.SendNotification();
12165 finishCheck.CheckSignalNotReceived();
12167 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12168 // and arrives at the beginning.
12169 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12171 application.SendNotification();
12172 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12174 // We did expect the animation to finish
12175 application.SendNotification();
12176 finishCheck.CheckSignalNotReceived();
12177 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12180 animation.SetLooping(false);
12181 application.SendNotification();
12182 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12184 application.SendNotification();
12185 finishCheck.CheckSignalReceived();
12187 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12190 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12192 Actor actor = Actor::New();
12195 float durationSeconds(1.0f);
12196 Animation animation = Animation::New(durationSeconds);
12197 animation.SetLooping(true);
12199 bool signalReceived(false);
12200 AnimationFinishCheck finishCheck(signalReceived);
12201 animation.FinishedSignal().Connect(&application, finishCheck);
12202 application.SendNotification();
12204 // Specify a negative multiplier to play the animation in reverse
12205 animation.SetSpeedFactor(-1.0f);
12207 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12208 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12210 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12211 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12213 // Start the animation
12215 application.SendNotification();
12216 application.Render(0);
12218 for(int iterations = 0; iterations < 3; ++iterations)
12220 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12221 application.SendNotification();
12222 finishCheck.CheckSignalNotReceived();
12224 // Setting a negative speed factor is to play the animation in reverse.
12225 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12226 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12227 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12229 application.SendNotification();
12230 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12232 // We did expect the animation to finish
12233 application.SendNotification();
12234 finishCheck.CheckSignalNotReceived();
12235 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12238 animation.SetLooping(false);
12239 application.SendNotification();
12240 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12242 application.SendNotification();
12243 finishCheck.CheckSignalReceived();
12245 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12251 int UtcDaliAnimationSetLoopingModeP2(void)
12253 // Test Loop Count and Loop mode being set
12254 TestApplication application;
12255 Integration::Scene stage(application.GetScene());
12257 // LoopingMode::AUTO_REVERSE
12259 Actor actor = Actor::New();
12262 float durationSeconds(1.0f);
12263 Animation animation = Animation::New(durationSeconds);
12264 animation.SetLoopCount(3);
12265 DALI_TEST_CHECK(animation.IsLooping());
12267 bool signalReceived(false);
12268 AnimationFinishCheck finishCheck(signalReceived);
12269 animation.FinishedSignal().Connect(&application, finishCheck);
12270 application.SendNotification();
12272 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12273 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12275 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12276 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12278 // Start the animation
12281 application.Render(0);
12282 application.SendNotification();
12283 application.Render(0);
12284 application.SendNotification();
12285 application.Render(0);
12286 application.SendNotification();
12287 application.Render(0);
12288 application.SendNotification();
12291 float intervalSeconds = 3.0f;
12293 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12294 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12295 // and arrives at the beginning.
12296 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12298 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12300 application.Render(0);
12301 application.SendNotification();
12302 application.Render(0);
12303 application.SendNotification();
12304 application.Render(0);
12305 application.SendNotification();
12306 application.Render(0);
12307 application.SendNotification();
12308 finishCheck.CheckSignalNotReceived();
12310 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12312 application.SendNotification();
12313 finishCheck.CheckSignalReceived();
12314 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12316 finishCheck.Reset();
12319 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12321 Actor actor = Actor::New();
12324 float durationSeconds(1.0f);
12325 Animation animation = Animation::New(durationSeconds);
12326 animation.SetLoopCount(3);
12327 DALI_TEST_CHECK(animation.IsLooping());
12329 bool signalReceived(false);
12330 AnimationFinishCheck finishCheck(signalReceived);
12331 animation.FinishedSignal().Connect(&application, finishCheck);
12332 application.SendNotification();
12334 // Specify a negative multiplier to play the animation in reverse
12335 animation.SetSpeedFactor(-1.0f);
12337 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12338 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12340 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12341 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12343 // Start the animation
12346 application.Render(0);
12347 application.SendNotification();
12348 application.Render(0);
12349 application.SendNotification();
12350 application.Render(0);
12351 application.SendNotification();
12352 application.Render(0);
12353 application.SendNotification();
12356 float intervalSeconds = 3.0f;
12358 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12359 // Setting a negative speed factor is to play the animation in reverse.
12360 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12361 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12362 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12364 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12366 application.Render(0);
12367 application.SendNotification();
12368 application.Render(0);
12369 application.SendNotification();
12370 application.Render(0);
12371 application.SendNotification();
12372 application.Render(0);
12373 application.SendNotification();
12374 finishCheck.CheckSignalNotReceived();
12376 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12378 application.SendNotification();
12379 finishCheck.CheckSignalReceived();
12380 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12382 finishCheck.Reset();
12388 int UtcDaliAnimationSetLoopingModeP3(void)
12390 // Test Loop Count is 1 (== default) and Loop mode being set
12391 TestApplication application;
12392 Integration::Scene stage(application.GetScene());
12394 // LoopingMode::AUTO_REVERSE
12396 Actor actor = Actor::New();
12399 float durationSeconds(1.0f);
12400 Animation animation = Animation::New(durationSeconds);
12401 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12403 bool signalReceived(false);
12404 AnimationFinishCheck finishCheck(signalReceived);
12405 animation.FinishedSignal().Connect(&application, finishCheck);
12406 application.SendNotification();
12408 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12409 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12411 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12412 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12414 // Start the animation
12416 application.Render(0);
12417 application.SendNotification();
12419 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12420 application.SendNotification();
12421 finishCheck.CheckSignalNotReceived();
12423 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12424 // and arrives at the beginning.
12425 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12427 application.SendNotification();
12428 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12430 application.SendNotification();
12431 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12433 application.SendNotification();
12434 application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12436 application.SendNotification();
12437 application.Render(0);
12438 application.SendNotification();
12439 finishCheck.CheckSignalReceived();
12441 // After all animation finished, arrives at the beginning.
12442 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12444 finishCheck.Reset();
12447 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12449 Actor actor = Actor::New();
12452 float durationSeconds(1.0f);
12453 Animation animation = Animation::New(durationSeconds);
12454 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12456 bool signalReceived(false);
12457 AnimationFinishCheck finishCheck(signalReceived);
12458 animation.FinishedSignal().Connect(&application, finishCheck);
12459 application.SendNotification();
12461 // Specify a negative multiplier to play the animation in reverse
12462 animation.SetSpeedFactor(-1.0f);
12464 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12465 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12467 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12468 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12470 // Start the animation
12472 application.Render(0);
12473 application.SendNotification();
12475 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12476 application.SendNotification();
12477 finishCheck.CheckSignalNotReceived();
12479 // Setting a negative speed factor is to play the animation in reverse.
12480 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12481 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12482 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12484 application.SendNotification();
12485 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12487 application.SendNotification();
12488 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12490 application.SendNotification();
12491 application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12493 application.SendNotification();
12494 application.Render(0);
12495 application.SendNotification();
12496 finishCheck.CheckSignalReceived();
12498 // After all animation finished, arrives at the target.
12499 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12501 finishCheck.Reset();
12507 int UtcDaliAnimationGetLoopingModeP(void)
12509 TestApplication application;
12511 Animation animation = Animation::New(1.0f);
12514 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12516 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12517 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12522 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12524 TestApplication application;
12526 tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
12528 Actor actor = Actor::New();
12529 application.GetScene().Add(actor);
12531 // Build the animation
12532 Animation animation = Animation::New(0.0f);
12535 float durationSeconds(1.0f);
12536 animation.SetDuration(durationSeconds);
12538 bool finishedSignalReceived(false);
12539 bool progressSignalReceived(false);
12541 AnimationFinishCheck finishCheck(finishedSignalReceived);
12542 animation.FinishedSignal().Connect(&application, finishCheck);
12544 AnimationProgressCheck progressCheck(progressSignalReceived);
12545 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12546 application.SendNotification();
12548 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12549 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12551 progressCheck.CheckSignalNotReceived();
12555 application.SendNotification();
12556 application.Render(0); // start animation
12557 application.Render(durationSeconds * 100.0f); // 10% progress
12558 application.SendNotification();
12560 tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
12561 progressCheck.CheckSignalNotReceived();
12563 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
12565 application.SendNotification();
12566 finishCheck.CheckSignalReceived();
12567 tet_infoline("Animation finished");
12568 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12573 int UtcDaliAnimationMultipleProgressSignalsP(void)
12575 tet_infoline("Multiple animations with different progress markers");
12577 TestApplication application;
12579 Actor actor = Actor::New();
12580 application.GetScene().Add(actor);
12582 // Build the animation
12583 Animation animationAlpha = Animation::New(0.0f);
12584 Animation animationBeta = Animation::New(0.0f);
12587 float durationSeconds(1.0f);
12588 animationAlpha.SetDuration(durationSeconds);
12589 animationBeta.SetDuration(durationSeconds);
12591 bool progressSignalReceivedAlpha(false);
12592 bool progressSignalReceivedBeta(false);
12594 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12595 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12597 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12598 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12599 application.SendNotification();
12601 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12602 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12603 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12605 tet_infoline("AnimationAlpha Progress notification set to 30%");
12606 DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12608 tet_infoline("AnimationBeta Progress notification set to 50%");
12609 DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
12611 application.SendNotification();
12612 application.Render();
12614 progressCheckAlpha.CheckSignalNotReceived();
12615 progressCheckBeta.CheckSignalNotReceived();
12617 // Start the animations from 10% progress
12618 animationAlpha.SetCurrentProgress(0.1f);
12619 animationBeta.SetCurrentProgress(0.1f);
12620 animationAlpha.Play();
12621 animationBeta.Play();
12623 tet_infoline("Animation Playing from 10%");
12625 application.SendNotification();
12626 application.Render(0); // start animation
12627 application.Render(durationSeconds * 100.0f); // 20% progress
12629 tet_infoline("Animation at 20% - No signals to be received");
12631 progressCheckAlpha.CheckSignalNotReceived();
12632 progressCheckBeta.CheckSignalNotReceived();
12634 application.SendNotification();
12635 application.Render(durationSeconds * 200.0f); // 40% progress
12636 application.SendNotification();
12637 tet_infoline("Animation at 40% - Alpha signal should be received");
12638 DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12640 progressCheckAlpha.CheckSignalReceived();
12641 progressCheckBeta.CheckSignalNotReceived();
12643 tet_infoline("Progress check reset");
12644 progressCheckAlpha.Reset();
12645 progressCheckBeta.Reset();
12647 application.Render(durationSeconds * 100.0f); // 50% progress
12648 tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
12649 application.SendNotification();
12651 DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12653 progressCheckAlpha.CheckSignalNotReceived();
12654 progressCheckBeta.CheckSignalReceived();
12655 tet_infoline("Progress check reset");
12656 progressCheckAlpha.Reset();
12657 progressCheckBeta.Reset();
12659 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
12660 application.SendNotification();
12662 tet_infoline("Animation at 60%");
12664 progressCheckAlpha.CheckSignalNotReceived();
12665 progressCheckBeta.CheckSignalNotReceived();
12667 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12668 application.SendNotification();
12669 tet_infoline("Animation at 80%");
12671 progressCheckAlpha.CheckSignalNotReceived();
12672 progressCheckBeta.CheckSignalNotReceived();
12674 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12675 // We did expect the animation to finish
12676 tet_infoline("Animation finished");
12681 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12683 tet_infoline("Multiple animations with different progress markers and big step time");
12685 TestApplication application;
12687 Actor actor = Actor::New();
12688 application.GetScene().Add(actor);
12690 // Build the animation
12691 Animation animationAlpha = Animation::New(0.0f);
12692 Animation animationBeta = Animation::New(0.0f);
12695 const float durationSeconds(1.0f);
12696 animationAlpha.SetDuration(durationSeconds);
12697 animationBeta.SetDuration(durationSeconds);
12699 bool progressSignalReceivedAlpha(false);
12700 bool progressSignalReceivedBeta(false);
12702 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12703 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12705 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12706 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12707 application.SendNotification();
12709 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12710 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12711 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12713 tet_infoline("AnimationAlpha Progress notification set to 1%");
12714 DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
12716 tet_infoline("AnimationBeta Progress notification set to 99%");
12717 DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
12719 application.SendNotification();
12720 application.Render();
12722 progressCheckAlpha.CheckSignalNotReceived();
12723 progressCheckBeta.CheckSignalNotReceived();
12725 // Start the animations unlimited looping
12726 animationAlpha.SetLooping(true);
12727 animationBeta.SetLooping(true);
12728 animationAlpha.Play();
12729 animationBeta.Play();
12731 application.SendNotification();
12732 application.Render(0); // start animation
12733 application.Render(durationSeconds * 20.0f); // 2% progress
12734 application.SendNotification();
12735 DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12737 tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
12739 progressCheckAlpha.CheckSignalReceived();
12740 progressCheckBeta.CheckSignalNotReceived();
12742 tet_infoline("Progress check reset");
12743 progressCheckAlpha.Reset();
12744 progressCheckBeta.Reset();
12746 application.SendNotification();
12747 application.Render(durationSeconds * 960.0f); // 98% progress
12748 application.SendNotification();
12749 tet_infoline("Animation at 98% - No signal received");
12750 DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12752 progressCheckAlpha.CheckSignalNotReceived();
12753 progressCheckBeta.CheckSignalNotReceived();
12755 application.SendNotification();
12756 application.Render(durationSeconds * 40.0f); // 2% progress
12757 application.SendNotification();
12758 tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
12759 application.SendNotification();
12761 DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12763 progressCheckAlpha.CheckSignalReceived();
12764 progressCheckBeta.CheckSignalReceived();
12766 tet_infoline("Progress check reset");
12767 progressCheckAlpha.Reset();
12768 progressCheckBeta.Reset();
12770 application.SendNotification();
12771 application.Render(durationSeconds * 980.0f); // 100% progress
12772 application.SendNotification();
12773 tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
12774 application.SendNotification();
12776 progressCheckAlpha.CheckSignalNotReceived();
12777 progressCheckBeta.CheckSignalReceived();
12779 tet_infoline("Progress check reset");
12780 progressCheckAlpha.Reset();
12781 progressCheckBeta.Reset();
12783 animationAlpha.SetLooping(false);
12784 animationBeta.SetLooping(false);
12786 application.SendNotification();
12787 application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
12788 application.SendNotification();
12790 // We did expect the animation to finish
12791 tet_infoline("Animation finished");
12796 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12798 tet_infoline("Multiple animations with different progress markers");
12800 TestApplication application;
12802 Actor actor = Actor::New();
12803 application.GetScene().Add(actor);
12805 // Build the animation
12806 Animation animationAlpha = Animation::New(0.0f);
12807 Animation animationBeta = Animation::New(0.0f);
12810 float durationSeconds(1.0f);
12811 float delaySeconds(0.5f);
12812 animationAlpha.SetDuration(durationSeconds);
12813 animationBeta.SetDuration(durationSeconds);
12815 bool progressSignalReceivedAlpha(false);
12816 bool progressSignalReceivedBeta(false);
12818 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12819 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12821 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12822 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12823 application.SendNotification();
12825 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12826 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12827 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12829 tet_infoline("AnimationAlpha Progress notification set to 30%");
12830 DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12832 tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
12833 DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
12835 application.SendNotification();
12836 application.Render();
12838 progressCheckAlpha.CheckSignalNotReceived();
12839 progressCheckBeta.CheckSignalNotReceived();
12841 // Start the animations from 10% progress
12842 animationAlpha.PlayAfter(delaySeconds);
12843 animationBeta.PlayAfter(delaySeconds);
12845 application.SendNotification();
12846 application.Render(0); // start animation
12847 application.Render(delaySeconds * 500.0f); // 50% wait progress
12849 tet_infoline("Delay at 50% - No signals to be received");
12851 progressCheckAlpha.CheckSignalNotReceived();
12852 progressCheckBeta.CheckSignalNotReceived();
12854 application.SendNotification();
12855 application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
12856 application.SendNotification();
12857 tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
12858 DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12860 progressCheckBeta.CheckSignalReceived();
12861 progressCheckAlpha.CheckSignalNotReceived();
12863 tet_infoline("Progress check reset");
12864 progressCheckAlpha.Reset();
12865 progressCheckBeta.Reset();
12867 application.Render(durationSeconds * 200.0f); // 25% progress
12868 tet_infoline("Animation at 25% - No signals to be received");
12869 application.SendNotification();
12871 progressCheckAlpha.CheckSignalNotReceived();
12872 progressCheckBeta.CheckSignalNotReceived();
12874 application.Render(durationSeconds * 200.0f); // 45% progress
12875 tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
12876 application.SendNotification();
12878 DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12880 progressCheckAlpha.CheckSignalReceived();
12881 progressCheckBeta.CheckSignalNotReceived();
12883 tet_infoline("Progress check reset");
12884 progressCheckAlpha.Reset();
12885 progressCheckBeta.Reset();
12887 application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
12888 application.SendNotification();
12890 tet_infoline("Animation at 60%");
12892 progressCheckAlpha.CheckSignalNotReceived();
12893 progressCheckBeta.CheckSignalNotReceived();
12895 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12896 application.SendNotification();
12897 tet_infoline("Animation at 80%");
12899 progressCheckAlpha.CheckSignalNotReceived();
12900 progressCheckBeta.CheckSignalNotReceived();
12902 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12903 // We did expect the animation to finish
12904 tet_infoline("Animation finished");
12909 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12911 TestApplication application;
12913 Actor actor = Actor::New();
12914 application.GetScene().Add(actor);
12916 // Build the animation
12917 Animation animation = Animation::New(0.0f);
12920 const float durationSeconds(1.0f);
12921 animation.SetDuration(durationSeconds);
12923 // Set Looping Count
12924 const int loopCount(4);
12925 animation.SetLoopCount(loopCount);
12927 bool finishedSignalReceived(false);
12928 bool progressSignalReceived(false);
12930 AnimationFinishCheck finishCheck(finishedSignalReceived);
12931 animation.FinishedSignal().Connect(&application, finishCheck);
12933 AnimationProgressCheck progressCheck(progressSignalReceived);
12934 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12935 application.SendNotification();
12937 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12938 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12940 tet_infoline("Animation Progress notification set to 50% with looping count 4");
12941 DevelAnimation::SetProgressNotification(animation, 0.5f);
12943 application.SendNotification();
12944 application.Render();
12946 progressCheck.CheckSignalNotReceived();
12950 for(int count = 0; count < loopCount; count++)
12952 application.SendNotification();
12953 application.Render(0); // start animation
12954 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
12955 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
12957 tet_infoline("Animation at 25%");
12959 progressCheck.CheckSignalNotReceived();
12961 application.SendNotification();
12962 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
12963 application.SendNotification();
12964 tet_infoline("Animation at 50%");
12965 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
12967 progressCheck.CheckSignalReceived();
12969 tet_infoline("Progress check reset");
12970 progressCheck.Reset();
12972 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
12973 tet_infoline("Animation at 75%");
12974 application.SendNotification();
12976 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
12978 progressCheck.CheckSignalNotReceived();
12980 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
12981 tet_infoline("Animation at 100%");
12982 application.SendNotification();
12984 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12985 application.SendNotification();
12987 application.Render(10u);
12988 application.SendNotification();
12989 application.Render(0u);
12990 application.SendNotification();
12992 finishCheck.CheckSignalReceived();
12997 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
12999 TestApplication application;
13001 Actor actor = Actor::New();
13002 application.GetScene().Add(actor);
13004 // Build the animation
13005 Animation animation = Animation::New(0.0f);
13008 const float durationSeconds(1.0f);
13009 animation.SetDuration(durationSeconds);
13011 // Set Looping Unlmited
13012 animation.SetLooping(true);
13014 bool finishedSignalReceived(false);
13015 bool progressSignalReceived(false);
13017 AnimationFinishCheck finishCheck(finishedSignalReceived);
13018 animation.FinishedSignal().Connect(&application, finishCheck);
13020 AnimationProgressCheck progressCheck(progressSignalReceived);
13021 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13022 application.SendNotification();
13024 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13025 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13027 tet_infoline("Animation Progress notification set to 50% with unlimited looping");
13028 DevelAnimation::SetProgressNotification(animation, 0.5f);
13030 application.SendNotification();
13031 application.Render();
13033 progressCheck.CheckSignalNotReceived();
13037 for(int count = 0; count < 4; count++)
13039 application.SendNotification();
13040 application.Render(0); // start animation
13041 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13042 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13044 tet_infoline("Animation at 25%");
13046 progressCheck.CheckSignalNotReceived();
13048 application.SendNotification();
13049 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13050 application.SendNotification();
13051 tet_infoline("Animation at 50%");
13052 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13054 progressCheck.CheckSignalReceived();
13056 tet_infoline("Progress check reset");
13057 progressCheck.Reset();
13059 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13060 tet_infoline("Animation at 75%");
13061 application.SendNotification();
13063 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13065 progressCheck.CheckSignalNotReceived();
13067 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13068 tet_infoline("Animation at 100%");
13069 application.SendNotification();
13071 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13072 finishCheck.CheckSignalNotReceived();
13073 application.SendNotification();
13075 finishCheck.CheckSignalNotReceived();
13077 animation.SetLooping(false);
13078 application.Render(0u);
13079 application.SendNotification();
13080 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
13081 application.SendNotification();
13082 application.Render(0u);
13083 application.SendNotification();
13085 finishCheck.CheckSignalReceived();
13090 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
13092 TestApplication application;
13094 Actor actor = Actor::New();
13095 application.GetScene().Add(actor);
13097 // Build the animation
13098 Animation animation = Animation::New(0.0f);
13101 const float durationSeconds(1.0f);
13102 animation.SetDuration(durationSeconds);
13104 //Set speed negative
13105 animation.SetSpeedFactor(-1.0f);
13107 // Set Looping Unlmited
13108 animation.SetLooping(true);
13110 bool finishedSignalReceived(false);
13111 bool progressSignalReceived(false);
13113 AnimationFinishCheck finishCheck(finishedSignalReceived);
13114 animation.FinishedSignal().Connect(&application, finishCheck);
13116 AnimationProgressCheck progressCheck(progressSignalReceived);
13117 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13118 application.SendNotification();
13120 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13121 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13123 tet_infoline("Animation Progress notification set to 50%");
13124 DevelAnimation::SetProgressNotification(animation, 0.5f);
13126 application.SendNotification();
13127 application.Render();
13129 progressCheck.CheckSignalNotReceived();
13133 for(int count = 0; count < 4; count++)
13135 application.SendNotification();
13136 application.Render(0); // start animation
13137 progressCheck.CheckSignalNotReceived();
13139 application.SendNotification();
13140 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13141 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13143 tet_infoline("Animation at 25%");
13145 progressCheck.CheckSignalNotReceived();
13147 application.SendNotification();
13148 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13149 application.SendNotification();
13150 tet_infoline("Animation at 50%");
13151 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13153 progressCheck.CheckSignalReceived();
13155 tet_infoline("Progress check reset");
13156 progressCheck.Reset();
13158 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13159 tet_infoline("Animation at 75%");
13160 application.SendNotification();
13162 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13164 progressCheck.CheckSignalNotReceived();
13166 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13167 tet_infoline("Animation at 100%");
13168 application.SendNotification();
13170 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13171 finishCheck.CheckSignalNotReceived();
13172 application.SendNotification();
13174 finishCheck.CheckSignalNotReceived();
13177 animation.SetLooping(false);
13178 animation.SetLoopCount(4);
13180 application.Render(0u);
13181 application.SendNotification();
13183 for(int count = 0; count < 4; count++)
13185 application.SendNotification();
13186 application.Render(0); // start animation
13187 progressCheck.CheckSignalNotReceived();
13189 application.SendNotification();
13190 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13191 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13193 tet_infoline("Animation at 25%");
13195 progressCheck.CheckSignalNotReceived();
13197 application.SendNotification();
13198 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13199 application.SendNotification();
13200 tet_infoline("Animation at 50%");
13201 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13203 progressCheck.CheckSignalReceived();
13205 tet_infoline("Progress check reset");
13206 progressCheck.Reset();
13208 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13209 tet_infoline("Animation at 75%");
13210 application.SendNotification();
13212 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13214 progressCheck.CheckSignalNotReceived();
13216 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13217 tet_infoline("Animation at 100%");
13218 application.SendNotification();
13220 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13221 application.SendNotification();
13223 application.Render(10u);
13224 application.SendNotification();
13225 application.Render(0u);
13226 application.SendNotification();
13228 finishCheck.CheckSignalReceived();
13233 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13235 TestApplication application;
13237 Actor actor = Actor::New();
13238 application.GetScene().Add(actor);
13240 // Build the animation
13241 Animation animation = Animation::New(0.0f);
13244 const float durationSeconds(1.0f);
13245 animation.SetDuration(durationSeconds);
13247 bool finishedSignalReceived(false);
13248 bool progressSignalReceived(false);
13250 AnimationFinishCheck finishCheck(finishedSignalReceived);
13251 animation.FinishedSignal().Connect(&application, finishCheck);
13253 AnimationProgressCheck progressCheck(progressSignalReceived);
13254 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13255 application.SendNotification();
13257 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13258 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13260 tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
13261 animation.SetPlayRange(Vector2(0.1f, 0.9f));
13263 tet_infoline("Animation Progress notification set to >90% that never can notificated");
13264 DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
13266 application.SendNotification();
13267 application.Render();
13269 progressCheck.CheckSignalNotReceived();
13273 application.SendNotification();
13274 application.Render(0); // start animation
13275 application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
13276 DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
13278 tet_infoline("Animation at 35%");
13280 progressCheck.CheckSignalNotReceived();
13282 application.SendNotification();
13283 application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
13284 application.SendNotification();
13285 DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
13287 tet_infoline("Animation at 60%");
13289 progressCheck.CheckSignalNotReceived();
13291 application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
13292 tet_infoline("Animation at 85%");
13293 application.SendNotification();
13294 DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
13296 progressCheck.CheckSignalNotReceived();
13298 application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
13299 tet_infoline("Animation over 90%");
13300 application.SendNotification();
13302 // progress never signaled because playrange is 90%
13303 progressCheck.CheckSignalNotReceived();
13308 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13310 TestApplication application;
13312 Actor actor = Actor::New();
13313 application.GetScene().Add(actor);
13315 // Build the animation
13316 Animation animation = Animation::New(0.0f);
13319 float durationSeconds(5.0f);
13320 animation.SetDuration(durationSeconds);
13322 bool finishedSignalReceived(false);
13323 bool progressSignalReceived(false);
13325 AnimationFinishCheck finishCheck(finishedSignalReceived);
13326 animation.FinishedSignal().Connect(&application, finishCheck);
13328 AnimationProgressCheck progressCheck(progressSignalReceived);
13329 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13330 application.SendNotification();
13332 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13333 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13335 tet_infoline("Animation Progress notification set to 50%");
13336 DevelAnimation::SetProgressNotification(animation, 0.5f);
13338 application.SendNotification();
13339 application.Render();
13341 progressCheck.CheckSignalNotReceived();
13345 application.SendNotification();
13346 application.Render(0); // start animation
13347 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13348 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13350 tet_infoline("Animation at 25%");
13352 progressCheck.CheckSignalNotReceived();
13354 application.SendNotification();
13355 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13356 application.SendNotification();
13357 tet_infoline("Animation at 50%");
13358 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13360 progressCheck.CheckSignalReceived();
13362 tet_infoline("Progress check reset");
13363 progressCheck.Reset();
13365 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13366 tet_infoline("Animation at 75%");
13367 application.SendNotification();
13369 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13371 progressCheck.CheckSignalNotReceived();
13376 int UtcDaliAnimationAnimateByInvalidParameters(void)
13378 TestApplication application;
13380 Actor actor = Actor::New();
13381 application.GetScene().Add(actor);
13383 // Create the animation
13384 Animation animation = Animation::New(1.0f);
13386 DALI_TEST_ASSERTION(
13388 // non animateable property (STRING)
13389 animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
13391 "Property type is not animatable");
13393 DALI_TEST_ASSERTION(
13395 // non animateable property (MATRIX)
13396 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
13397 animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
13399 "Property type is not animatable");
13402 DALI_TEST_ASSERTION(
13404 // non animateable target (NONE)
13405 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
13407 "Target value is not animatable");
13409 DALI_TEST_ASSERTION(
13411 // non animateable target (STRING)
13412 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
13414 "Target value is not animatable");
13416 DALI_TEST_ASSERTION(
13418 // not mathing properties (VECTOR3, FLOAT)
13419 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
13421 "Property and target types don't match");
13423 DALI_TEST_ASSERTION(
13425 // not mathing properties (VECTOR3.A, VECTOR2)
13426 animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
13428 "Property and target types don't match");
13430 DALI_TEST_ASSERTION(
13432 // negative duration
13433 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13435 "Duration must be >=0");
13440 int UtcDaliAnimationAnimateToInvalidParameters(void)
13442 TestApplication application;
13444 Actor actor = Actor::New();
13445 application.GetScene().Add(actor);
13447 // Create the animation
13448 Animation animation = Animation::New(1.0f);
13451 DALI_TEST_ASSERTION(
13453 // non animateable property (MAP)
13454 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
13455 animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
13457 "Property type is not animatable");
13459 DALI_TEST_ASSERTION(
13461 // non animateable target (NONE)
13462 animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
13464 "Property type is not animatable");
13466 DALI_TEST_ASSERTION(
13468 // non animateable target (ARRAY)
13469 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
13471 "Target value is not animatable");
13473 DALI_TEST_ASSERTION(
13475 // non animateable target (RECTANGLE)
13476 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
13478 "Target value is not animatable");
13480 DALI_TEST_ASSERTION(
13482 // not mathing properties (FLOAT, INT)
13483 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
13485 "Property and target types don't match");
13487 DALI_TEST_ASSERTION(
13489 // not mathing properties (VECTOR3, VECTOR2)
13490 animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
13492 "Property and target types don't match");
13494 DALI_TEST_ASSERTION(
13496 // negative duration
13497 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13499 "Duration must be >=0");
13504 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13506 TestApplication application;
13508 Actor actor = Actor::New();
13509 application.GetScene().Add(actor);
13511 // Create the animation
13512 Animation animation = Animation::New(1.0f);
13515 DALI_TEST_ASSERTION(
13517 // non animateable property (ARRAY)
13518 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
13519 KeyFrames keyframes = KeyFrames::New();
13520 keyframes.Add(0.5f, Property::Value(Property::ARRAY));
13521 animation.AnimateBetween(Property(actor, index), keyframes);
13523 "Property type is not animatable");
13525 DALI_TEST_ASSERTION(
13527 // non animateable target (NONE)
13528 KeyFrames keyframes = KeyFrames::New();
13529 keyframes.Add(0.5f, Property::Value());
13530 animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
13532 "Property type is not animatable");
13534 DALI_TEST_ASSERTION(
13536 // non animateable target (EXTENTS)
13537 KeyFrames keyframes = KeyFrames::New();
13538 keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
13539 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13541 "Property type is not animatable");
13543 DALI_TEST_ASSERTION(
13545 // non animateable target (RECTANGLE)
13546 KeyFrames keyframes = KeyFrames::New();
13547 keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
13548 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13550 "Property type is not animatable");
13552 DALI_TEST_ASSERTION(
13554 // not mathing properties (VECTOR2, VECTOR4)
13555 KeyFrames keyframes = KeyFrames::New();
13556 keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
13557 animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
13559 "Property and target types don't match");
13561 DALI_TEST_ASSERTION(
13563 // negative duration
13564 KeyFrames keyframes = KeyFrames::New();
13565 keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
13566 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
13568 "Duration must be >=0");
13573 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13581 void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
13583 tet_printf("Testing %s\n", testName);
13585 // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13586 // This test checks that that is being done
13588 const float durationSeconds(1.0f);
13589 unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13590 const Vector3 originalPosition(Vector3::ZERO);
13591 const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13592 const Vector3 halfWayToTarget(targetPosition * 0.5f);
13594 struct ExpectedValue
13596 Animation::EndAction endAction;
13597 Vector3 expectedGetPropertyValue;
13600 ExpectedValue expectedValueTable[] =
13602 {Animation::BAKE, halfWayToTarget}, // When baking, the current value is the final value.
13603 {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
13604 {Animation::DISCARD, originalPosition}, // When discarding, we should jump back to the original value when clearing or stopping.
13606 const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
13608 for(auto i = 0u; i < expectedValueTableCount; ++i)
13610 TestApplication application;
13612 Actor actor = Actor::New();
13613 application.GetScene().Add(actor);
13615 // Build the animation
13616 Animation animation = Animation::New(durationSeconds);
13617 animation.SetEndAction(expectedValueTable[i].endAction);
13618 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13620 // Start the animation
13623 application.SendNotification();
13624 application.Render(halfAnimationDuration);
13626 // Stop or Clear the animation early, both have the same effect
13627 if(functionToTest == TestFunction::STOP)
13636 // The event side property should be set the expected value immediately, the update side property will still only be halfway as we haven't run an update yet
13637 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13638 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13640 // After one frame, both values should match regardless of the End Action
13641 application.SendNotification();
13642 application.Render();
13644 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13645 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13648 } // unnamed namespace
13650 int UtcDaliAnimationStopPropertyValue(void)
13652 CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
13656 int UtcDaliAnimationClearPropertyValue(void)
13658 CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
13662 int UtcDaliAnimationPausePropertyValue(void)
13664 const float durationSeconds(1.0f);
13665 unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13666 const Vector3 originalPosition(Vector3::ZERO);
13667 const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13668 const Vector3 halfWayToTarget(targetPosition * 0.5f);
13670 Animation::EndAction endActions[] =
13673 Animation::BAKE_FINAL,
13674 Animation::DISCARD,
13676 const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
13678 // For all end actions, when pausing, we stay at the current value
13679 for(auto i = 0u; i < endActionCount; ++i)
13681 TestApplication application;
13683 Actor actor = Actor::New();
13684 application.GetScene().Add(actor);
13686 // Build the animation
13687 Animation animation = Animation::New(durationSeconds);
13688 animation.SetEndAction(endActions[i]);
13689 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13691 // Start the animation
13694 application.SendNotification();
13695 application.Render(halfAnimationDuration);
13697 // Puase the animation early
13700 // The event side property should be set the current value immediately, the update side property will still only be halfway
13701 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13702 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13704 // After one frame, both values should match regardless of the End Action
13705 application.SendNotification();
13706 application.Render();
13708 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13709 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13715 int UtcDaliAnimationPlayFromWithLoopCount(void)
13717 TestApplication application;
13719 auto actor = Actor::New();
13720 application.GetScene().Add(actor);
13722 auto animation = Animation::New(1.0f);
13723 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
13724 animation.SetLoopCount(2);
13727 application.SendNotification();
13728 application.Render(1001);
13730 // One loop completed
13732 application.Render(2005);
13733 application.SendNotification();
13735 // 2 loops should have completed
13736 DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
13738 // Another render needs to occur after all the loops end
13739 application.SendNotification();
13740 application.Render(1000);
13742 // Stop the animation and use PlayFrom, previously we got an Assert here
13744 animation.PlayFrom(0.5f);
13746 application.SendNotification();
13747 application.Render(1000);
13749 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
13754 int UtcDaliAnimationCombineToAndByWithStop(void)
13756 tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
13758 TestApplication application;
13760 auto actor = Actor::New();
13761 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13762 application.GetScene().Add(actor);
13764 auto animation = Animation::New(1.0f);
13765 const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13766 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13767 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
13770 application.SendNotification();
13771 application.Render(500);
13773 application.SendNotification();
13774 application.Render(500);
13776 application.SendNotification();
13777 application.Render(500);
13779 // Stop and clear the animation using the current values
13783 // Check the y position, it should be the same as before
13784 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
13789 int UtcDaliAnimationCountAndGetAnimationAt(void)
13791 tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
13793 TestApplication application;
13795 auto actor = Actor::New();
13796 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13797 application.GetScene().Add(actor);
13799 auto animation = Animation::New(1.0f);
13800 const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13801 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13804 application.SendNotification();
13805 application.Render(500);
13807 uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
13808 DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
13810 DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
13812 Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
13813 DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
13815 DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
13816 DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
13817 DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
13818 DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
13819 DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
13821 // Stop and clear the animation using the current values
13828 int UtcDaliAnimationSetLoopingNegative(void)
13830 TestApplication application;
13831 Dali::Animation instance;
13835 instance.SetLooping(arg1);
13836 DALI_TEST_CHECK(false); // Should not get here
13840 DALI_TEST_CHECK(true); // We expect an assert
13845 int UtcDaliAnimationSetDurationNegative(void)
13847 TestApplication application;
13848 Dali::Animation instance;
13852 instance.SetDuration(arg1);
13853 DALI_TEST_CHECK(false); // Should not get here
13857 DALI_TEST_CHECK(true); // We expect an assert
13862 int UtcDaliAnimationGetLoopCountNegative(void)
13864 TestApplication application;
13865 Dali::Animation instance;
13868 instance.GetLoopCount();
13869 DALI_TEST_CHECK(false); // Should not get here
13873 DALI_TEST_CHECK(true); // We expect an assert
13878 int UtcDaliAnimationSetEndActionNegative(void)
13880 TestApplication application;
13881 Dali::Animation instance;
13884 Dali::Animation::EndAction arg1(Animation::BAKE);
13885 instance.SetEndAction(arg1);
13886 DALI_TEST_CHECK(false); // Should not get here
13890 DALI_TEST_CHECK(true); // We expect an assert
13895 int UtcDaliAnimationSetLoopCountNegative(void)
13897 TestApplication application;
13898 Dali::Animation instance;
13902 instance.SetLoopCount(arg1);
13903 DALI_TEST_CHECK(false); // Should not get here
13907 DALI_TEST_CHECK(true); // We expect an assert
13912 int UtcDaliAnimationSetPlayRangeNegative(void)
13914 TestApplication application;
13915 Dali::Animation instance;
13918 Dali::Vector2 arg1;
13919 instance.SetPlayRange(arg1);
13920 DALI_TEST_CHECK(false); // Should not get here
13924 DALI_TEST_CHECK(true); // We expect an assert
13929 int UtcDaliAnimationAnimateBetweenNegative01(void)
13931 TestApplication application;
13932 Dali::Animation instance;
13936 Dali::Property arg1(actor, Actor::Property::POSITION);
13937 Dali::KeyFrames arg2;
13938 instance.AnimateBetween(arg1, arg2);
13939 DALI_TEST_CHECK(false); // Should not get here
13943 DALI_TEST_CHECK(true); // We expect an assert
13948 int UtcDaliAnimationAnimateBetweenNegative02(void)
13950 TestApplication application;
13951 Dali::Animation instance;
13955 Dali::Property arg1(actor, Actor::Property::POSITION);
13956 Dali::KeyFrames arg2;
13957 Dali::Animation::Interpolation arg3(Animation::LINEAR);
13958 instance.AnimateBetween(arg1, arg2, arg3);
13959 DALI_TEST_CHECK(false); // Should not get here
13963 DALI_TEST_CHECK(true); // We expect an assert
13968 int UtcDaliAnimationAnimateBetweenNegative03(void)
13970 TestApplication application;
13971 Dali::Animation instance;
13975 Dali::Property arg1(actor, Actor::Property::POSITION);
13976 Dali::KeyFrames arg2;
13977 Dali::TimePeriod arg3(1.0f);
13978 instance.AnimateBetween(arg1, arg2, arg3);
13979 DALI_TEST_CHECK(false); // Should not get here
13983 DALI_TEST_CHECK(true); // We expect an assert
13988 int UtcDaliAnimationAnimateBetweenNegative04(void)
13990 TestApplication application;
13991 Dali::Animation instance;
13995 Dali::Property arg1(actor, Actor::Property::POSITION);
13996 Dali::KeyFrames arg2;
13997 Dali::TimePeriod arg3(1.0f);
13998 Dali::Animation::Interpolation arg4(Animation::LINEAR);
13999 instance.AnimateBetween(arg1, arg2, arg3, arg4);
14000 DALI_TEST_CHECK(false); // Should not get here
14004 DALI_TEST_CHECK(true); // We expect an assert
14009 int UtcDaliAnimationAnimateBetweenNegative05(void)
14011 TestApplication application;
14012 Dali::Animation instance;
14016 Dali::Property arg1(actor, Actor::Property::POSITION);
14017 Dali::KeyFrames arg2;
14018 Dali::AlphaFunction arg3;
14019 instance.AnimateBetween(arg1, arg2, arg3);
14020 DALI_TEST_CHECK(false); // Should not get here
14024 DALI_TEST_CHECK(true); // We expect an assert
14029 int UtcDaliAnimationAnimateBetweenNegative06(void)
14031 TestApplication application;
14032 Dali::Animation instance;
14036 Dali::Property arg1(actor, Actor::Property::POSITION);
14037 Dali::KeyFrames arg2;
14038 Dali::AlphaFunction arg3;
14039 Dali::Animation::Interpolation arg4(Animation::LINEAR);
14040 instance.AnimateBetween(arg1, arg2, arg3, arg4);
14041 DALI_TEST_CHECK(false); // Should not get here
14045 DALI_TEST_CHECK(true); // We expect an assert
14050 int UtcDaliAnimationAnimateBetweenNegative07(void)
14052 TestApplication application;
14053 Dali::Animation instance;
14057 Dali::Property arg1(actor, Actor::Property::POSITION);
14058 Dali::KeyFrames arg2;
14059 Dali::AlphaFunction arg3;
14060 Dali::TimePeriod arg4(1.0f);
14061 instance.AnimateBetween(arg1, arg2, arg3, arg4);
14062 DALI_TEST_CHECK(false); // Should not get here
14066 DALI_TEST_CHECK(true); // We expect an assert
14071 int UtcDaliAnimationAnimateBetweenNegative08(void)
14073 TestApplication application;
14074 Dali::Animation instance;
14078 Dali::Property arg1(actor, Actor::Property::POSITION);
14079 Dali::KeyFrames arg2;
14080 Dali::AlphaFunction arg3;
14081 Dali::TimePeriod arg4(1.0f);
14082 Dali::Animation::Interpolation arg5(Animation::LINEAR);
14083 instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
14084 DALI_TEST_CHECK(false); // Should not get here
14088 DALI_TEST_CHECK(true); // We expect an assert
14093 int UtcDaliAnimationFinishedSignalNegative(void)
14095 TestApplication application;
14096 Dali::Animation instance;
14099 instance.FinishedSignal();
14100 DALI_TEST_CHECK(false); // Should not get here
14104 DALI_TEST_CHECK(true); // We expect an assert
14109 int UtcDaliAnimationGetCurrentLoopNegative(void)
14111 TestApplication application;
14112 Dali::Animation instance;
14115 instance.GetCurrentLoop();
14116 DALI_TEST_CHECK(false); // Should not get here
14120 DALI_TEST_CHECK(true); // We expect an assert
14125 int UtcDaliAnimationSetLoopingModeNegative(void)
14127 TestApplication application;
14128 Dali::Animation instance;
14131 Dali::Animation::LoopingMode arg1(Animation::RESTART);
14132 instance.SetLoopingMode(arg1);
14133 DALI_TEST_CHECK(false); // Should not get here
14137 DALI_TEST_CHECK(true); // We expect an assert
14142 int UtcDaliAnimationSetSpeedFactorNegative(void)
14144 TestApplication application;
14145 Dali::Animation instance;
14149 instance.SetSpeedFactor(arg1);
14150 DALI_TEST_CHECK(false); // Should not get here
14154 DALI_TEST_CHECK(true); // We expect an assert
14159 int UtcDaliAnimationGetCurrentProgressNegative(void)
14161 TestApplication application;
14162 Dali::Animation instance;
14165 instance.GetCurrentProgress();
14166 DALI_TEST_CHECK(false); // Should not get here
14170 DALI_TEST_CHECK(true); // We expect an assert
14175 int UtcDaliAnimationSetCurrentProgressNegative(void)
14177 TestApplication application;
14178 Dali::Animation instance;
14182 instance.SetCurrentProgress(arg1);
14183 DALI_TEST_CHECK(false); // Should not get here
14187 DALI_TEST_CHECK(true); // We expect an assert
14192 int UtcDaliAnimationSetDisconnectActionNegative(void)
14194 TestApplication application;
14195 Dali::Animation instance;
14198 Dali::Animation::EndAction arg1(Animation::BAKE);
14199 instance.SetDisconnectAction(arg1);
14200 DALI_TEST_CHECK(false); // Should not get here
14204 DALI_TEST_CHECK(true); // We expect an assert
14209 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14211 TestApplication application;
14212 Dali::Animation instance;
14215 Dali::AlphaFunction arg1;
14216 instance.SetDefaultAlphaFunction(arg1);
14217 DALI_TEST_CHECK(false); // Should not get here
14221 DALI_TEST_CHECK(true); // We expect an assert
14226 int UtcDaliAnimationHideNegative(void)
14228 TestApplication application;
14229 Dali::Animation instance;
14234 instance.Hide(arg1, arg2);
14235 DALI_TEST_CHECK(false); // Should not get here
14239 DALI_TEST_CHECK(true); // We expect an assert
14244 int UtcDaliAnimationPlayNegative(void)
14246 TestApplication application;
14247 Dali::Animation instance;
14251 DALI_TEST_CHECK(false); // Should not get here
14255 DALI_TEST_CHECK(true); // We expect an assert
14260 int UtcDaliAnimationShowNegative(void)
14262 TestApplication application;
14263 Dali::Animation instance;
14268 instance.Show(arg1, arg2);
14269 DALI_TEST_CHECK(false); // Should not get here
14273 DALI_TEST_CHECK(true); // We expect an assert
14278 int UtcDaliAnimationStopNegative(void)
14280 TestApplication application;
14281 Dali::Animation instance;
14285 DALI_TEST_CHECK(false); // Should not get here
14289 DALI_TEST_CHECK(true); // We expect an assert
14294 int UtcDaliAnimationClearNegative(void)
14296 TestApplication application;
14297 Dali::Animation instance;
14301 DALI_TEST_CHECK(false); // Should not get here
14305 DALI_TEST_CHECK(true); // We expect an assert
14310 int UtcDaliAnimationPauseNegative(void)
14312 TestApplication application;
14313 Dali::Animation instance;
14317 DALI_TEST_CHECK(false); // Should not get here
14321 DALI_TEST_CHECK(true); // We expect an assert
14326 int UtcDaliAnimationAnimateNegative01(void)
14328 TestApplication application;
14329 Dali::Animation instance;
14334 Dali::Vector3 arg3;
14335 instance.Animate(arg1, arg2, arg3);
14336 DALI_TEST_CHECK(false); // Should not get here
14340 DALI_TEST_CHECK(true); // We expect an assert
14345 int UtcDaliAnimationAnimateNegative02(void)
14347 TestApplication application;
14348 Dali::Animation instance;
14353 Dali::Vector3 arg3;
14354 Dali::TimePeriod arg4(1.0f);
14355 instance.Animate(arg1, arg2, arg3, arg4);
14356 DALI_TEST_CHECK(false); // Should not get here
14360 DALI_TEST_CHECK(true); // We expect an assert
14365 int UtcDaliAnimationAnimateNegative03(void)
14367 TestApplication application;
14368 Dali::Animation instance;
14373 Dali::Vector3 arg3;
14374 Dali::AlphaFunction arg4;
14375 instance.Animate(arg1, arg2, arg3, arg4);
14376 DALI_TEST_CHECK(false); // Should not get here
14380 DALI_TEST_CHECK(true); // We expect an assert
14385 int UtcDaliAnimationAnimateNegative04(void)
14387 TestApplication application;
14388 Dali::Animation instance;
14393 Dali::Vector3 arg3;
14394 Dali::AlphaFunction arg4;
14395 Dali::TimePeriod arg5(1.0f);
14396 instance.Animate(arg1, arg2, arg3, arg4, arg5);
14397 DALI_TEST_CHECK(false); // Should not get here
14401 DALI_TEST_CHECK(true); // We expect an assert
14406 int UtcDaliAnimationPlayFromNegative(void)
14408 TestApplication application;
14409 Dali::Animation instance;
14413 instance.PlayFrom(arg1);
14414 DALI_TEST_CHECK(false); // Should not get here
14418 DALI_TEST_CHECK(true); // We expect an assert
14423 int UtcDaliAnimationAnimateByNegative01(void)
14425 TestApplication application;
14426 Dali::Animation instance;
14430 Dali::Property arg1(actor, Actor::Property::POSITION);
14431 Dali::Property::Value arg2;
14432 instance.AnimateBy(arg1, arg2);
14433 DALI_TEST_CHECK(false); // Should not get here
14437 DALI_TEST_CHECK(true); // We expect an assert
14442 int UtcDaliAnimationAnimateByNegative02(void)
14444 TestApplication application;
14445 Dali::Animation instance;
14449 Dali::Property arg1(actor, Actor::Property::POSITION);
14450 Dali::Property::Value arg2;
14451 Dali::TimePeriod arg3(1.0f);
14452 instance.AnimateBy(arg1, arg2, arg3);
14453 DALI_TEST_CHECK(false); // Should not get here
14457 DALI_TEST_CHECK(true); // We expect an assert
14462 int UtcDaliAnimationAnimateByNegative03(void)
14464 TestApplication application;
14465 Dali::Animation instance;
14469 Dali::Property arg1(actor, Actor::Property::POSITION);
14470 Dali::Property::Value arg2;
14471 Dali::AlphaFunction arg3;
14472 instance.AnimateBy(arg1, arg2, arg3);
14473 DALI_TEST_CHECK(false); // Should not get here
14477 DALI_TEST_CHECK(true); // We expect an assert
14482 int UtcDaliAnimationAnimateByNegative04(void)
14484 TestApplication application;
14485 Dali::Animation instance;
14489 Dali::Property arg1(actor, Actor::Property::POSITION);
14490 Dali::Property::Value arg2;
14491 Dali::AlphaFunction arg3;
14492 Dali::TimePeriod arg4(1.0f);
14493 instance.AnimateBy(arg1, arg2, arg3, arg4);
14494 DALI_TEST_CHECK(false); // Should not get here
14498 DALI_TEST_CHECK(true); // We expect an assert
14503 int UtcDaliAnimationAnimateToNegative01(void)
14505 TestApplication application;
14507 Dali::Animation instance;
14510 Dali::Property arg1(actor, Actor::Property::POSITION);
14511 Dali::Property::Value arg2;
14512 instance.AnimateTo(arg1, arg2);
14513 DALI_TEST_CHECK(false); // Should not get here
14517 DALI_TEST_CHECK(true); // We expect an assert
14522 int UtcDaliAnimationAnimateToNegative02(void)
14524 TestApplication application;
14525 Dali::Animation instance;
14529 Dali::Property arg1(actor, Actor::Property::POSITION);
14530 Dali::Property::Value arg2;
14531 Dali::TimePeriod arg3(1.0f);
14532 instance.AnimateTo(arg1, arg2, arg3);
14533 DALI_TEST_CHECK(false); // Should not get here
14537 DALI_TEST_CHECK(true); // We expect an assert
14542 int UtcDaliAnimationAnimateToNegative03(void)
14544 TestApplication application;
14545 Dali::Animation instance;
14549 Dali::Property arg1(actor, Actor::Property::POSITION);
14550 Dali::Property::Value arg2;
14551 Dali::AlphaFunction arg3;
14552 instance.AnimateTo(arg1, arg2, arg3);
14553 DALI_TEST_CHECK(false); // Should not get here
14557 DALI_TEST_CHECK(true); // We expect an assert
14562 int UtcDaliAnimationAnimateToNegative04(void)
14564 TestApplication application;
14565 Dali::Animation instance;
14569 Dali::Property arg1(actor, Actor::Property::POSITION);
14570 Dali::Property::Value arg2;
14571 Dali::AlphaFunction arg3;
14572 Dali::TimePeriod arg4(1.0f);
14573 instance.AnimateTo(arg1, arg2, arg3, arg4);
14574 DALI_TEST_CHECK(false); // Should not get here
14578 DALI_TEST_CHECK(true); // We expect an assert
14583 int UtcDaliAnimationPlayAfterNegative(void)
14585 TestApplication application;
14586 Dali::Animation instance;
14590 instance.PlayAfter(arg1);
14591 DALI_TEST_CHECK(false); // Should not get here
14595 DALI_TEST_CHECK(true); // We expect an assert
14600 int UtcDaliAnimationGetDurationNegative(void)
14602 TestApplication application;
14603 Dali::Animation instance;
14606 instance.GetDuration();
14607 DALI_TEST_CHECK(false); // Should not get here
14611 DALI_TEST_CHECK(true); // We expect an assert
14616 int UtcDaliAnimationGetEndActionNegative(void)
14618 TestApplication application;
14619 Dali::Animation instance;
14622 instance.GetEndAction();
14623 DALI_TEST_CHECK(false); // Should not get here
14627 DALI_TEST_CHECK(true); // We expect an assert
14632 int UtcDaliAnimationGetPlayRangeNegative(void)
14634 TestApplication application;
14635 Dali::Animation instance;
14638 instance.GetPlayRange();
14639 DALI_TEST_CHECK(false); // Should not get here
14643 DALI_TEST_CHECK(true); // We expect an assert
14648 int UtcDaliAnimationGetLoopingModeNegative(void)
14650 TestApplication application;
14651 Dali::Animation instance;
14654 instance.GetLoopingMode();
14655 DALI_TEST_CHECK(false); // Should not get here
14659 DALI_TEST_CHECK(true); // We expect an assert
14664 int UtcDaliAnimationGetSpeedFactorNegative(void)
14666 TestApplication application;
14667 Dali::Animation instance;
14670 instance.GetSpeedFactor();
14671 DALI_TEST_CHECK(false); // Should not get here
14675 DALI_TEST_CHECK(true); // We expect an assert
14680 int UtcDaliAnimationGetDisconnectActionNegative(void)
14682 TestApplication application;
14683 Dali::Animation instance;
14686 instance.GetDisconnectAction();
14687 DALI_TEST_CHECK(false); // Should not get here
14691 DALI_TEST_CHECK(true); // We expect an assert
14696 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
14698 TestApplication application;
14699 Dali::Animation instance;
14702 instance.GetDefaultAlphaFunction();
14703 DALI_TEST_CHECK(false); // Should not get here
14707 DALI_TEST_CHECK(true); // We expect an assert
14712 int UtcDaliAnimationGetStateNegative(void)
14714 TestApplication application;
14715 Dali::Animation instance;
14718 instance.GetState();
14719 DALI_TEST_CHECK(false); // Should not get here
14723 DALI_TEST_CHECK(true); // We expect an assert
14728 int UtcDaliAnimationIsLoopingNegative(void)
14730 TestApplication application;
14731 Dali::Animation instance;
14734 instance.IsLooping();
14735 DALI_TEST_CHECK(false); // Should not get here
14739 DALI_TEST_CHECK(true); // We expect an assert
14744 int UtcDaliKeyFramesAddNegative01(void)
14746 TestApplication application;
14747 Dali::KeyFrames instance;
14751 Dali::Property::Value arg2;
14752 instance.Add(arg1, arg2);
14753 DALI_TEST_CHECK(false); // Should not get here
14757 DALI_TEST_CHECK(true); // We expect an assert
14762 int UtcDaliKeyFramesAddNegative02(void)
14764 TestApplication application;
14765 Dali::KeyFrames instance;
14769 Dali::Property::Value arg2;
14770 Dali::AlphaFunction arg3;
14771 instance.Add(arg1, arg2, arg3);
14772 DALI_TEST_CHECK(false); // Should not get here
14776 DALI_TEST_CHECK(true); // We expect an assert
14781 int UtcDaliKeyFramesGetTypeNegative(void)
14783 TestApplication application;
14784 Dali::KeyFrames instance;
14787 instance.GetType();
14788 DALI_TEST_CHECK(false); // Should not get here
14792 DALI_TEST_CHECK(true); // We expect an assert