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 UtcDaliAnimationPlayOffSceneDiscardP(void)
2221 // Test that an animation can be played, when the actor is off-stage.
2222 // When the actor is added to the stage, it should appear at the current position
2223 // i.e. where it would have been anyway, if on-stage from the beginning.
2225 TestApplication application;
2227 Actor actor = Actor::New();
2228 Vector3 basePosition(Vector3::ZERO);
2229 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2230 // Not added to the stage yet!
2232 // Build the animation
2233 float durationSeconds(1.0f);
2234 Animation animation = Animation::New(durationSeconds);
2235 animation.SetDisconnectAction(Animation::DISCARD);
2236 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2237 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2239 // Start the animation
2242 bool signalReceived(false);
2243 AnimationFinishCheck finishCheck(signalReceived);
2244 animation.FinishedSignal().Connect(&application, finishCheck);
2246 application.SendNotification();
2247 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2249 // We didn't expect the animation to finish yet
2250 application.SendNotification();
2251 finishCheck.CheckSignalNotReceived();
2252 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION);
2255 application.GetScene().Add(actor);
2257 application.SendNotification();
2258 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2260 // We didn't expect the animation to finish yet
2261 application.SendNotification();
2262 finishCheck.CheckSignalNotReceived();
2263 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2265 // Remove from the stage
2266 application.GetScene().Remove(actor);
2268 application.SendNotification();
2269 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2271 // We didn't expect the animation to finish yet
2272 application.SendNotification();
2273 finishCheck.CheckSignalNotReceived();
2274 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*back to start position as disconnect behaviour is discard*/, TEST_LOCATION);
2275 // Check that nothing has changed after a couple of buffer swaps
2276 application.Render(0);
2277 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2278 application.Render(0);
2279 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2280 application.Render(0);
2281 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2284 application.GetScene().Add(actor);
2286 application.SendNotification();
2287 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2289 // We didn't expect the animation to finish yet
2290 application.SendNotification();
2291 finishCheck.CheckSignalNotReceived();
2292 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(80, 80, 80), TEST_LOCATION);
2294 application.SendNotification();
2295 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2297 // We did expect the animation to finish
2298 application.SendNotification();
2299 finishCheck.CheckSignalReceived();
2300 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2302 // Check that nothing has changed after a couple of buffer swaps
2303 application.Render(0);
2304 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2306 application.Render(0);
2307 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2311 int UtcDaliAnimationPlayOffSceneBakeFinalP(void)
2313 // Test that an animation can be played, when the actor is off-stage.
2314 // When the actor is added to the stage, it should appear at the current position
2315 // i.e. where it would have been anyway, if on-stage from the beginning.
2317 TestApplication application;
2319 Actor actor = Actor::New();
2320 Vector3 basePosition(Vector3::ZERO);
2321 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2322 // Not added to the stage!
2324 // Build the animation
2325 float durationSeconds(1.0f);
2326 Animation animation = Animation::New(durationSeconds);
2327 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2328 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2330 // Start the animation
2333 bool signalReceived(false);
2334 AnimationFinishCheck finishCheck(signalReceived);
2335 animation.FinishedSignal().Connect(&application, finishCheck);
2337 application.SendNotification();
2338 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2340 // We didn't expect the animation to finish yet
2341 application.SendNotification();
2342 finishCheck.CheckSignalNotReceived();
2343 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION);
2346 application.GetScene().Add(actor);
2348 application.SendNotification();
2349 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2351 // We didn't expect the animation to finish yet
2352 application.SendNotification();
2353 finishCheck.CheckSignalNotReceived();
2354 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2356 // Remove from the stage
2357 application.GetScene().Remove(actor);
2359 application.SendNotification();
2360 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2362 // We didn't expect the animation to finish yet
2363 application.SendNotification();
2364 finishCheck.CheckSignalNotReceived();
2365 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final*/, 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), targetPosition /*bake final removed the */, 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 UtcDaliAnimationPlayOffSceneBakeP(void)
2397 // Test that an animation can 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 animation.SetDisconnectAction(Animation::BAKE);
2412 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2413 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2415 // Start the animation
2418 bool signalReceived(false);
2419 AnimationFinishCheck finishCheck(signalReceived);
2420 animation.FinishedSignal().Connect(&application, finishCheck);
2422 application.SendNotification();
2423 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2425 // We didn't expect the animation to finish yet
2426 application.SendNotification();
2427 finishCheck.CheckSignalNotReceived();
2428 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION);
2431 application.GetScene().Add(actor);
2433 application.SendNotification();
2434 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2436 // We didn't expect the animation to finish yet
2437 application.SendNotification();
2438 finishCheck.CheckSignalNotReceived();
2439 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2441 // Remove from the stage
2442 application.GetScene().Remove(actor); // baked here
2444 application.SendNotification();
2445 // this render is a no-op in this case as animator is disabled while off stage
2446 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2447 // We didn't expect the animation to finish yet
2448 application.SendNotification();
2449 finishCheck.CheckSignalNotReceived();
2450 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*baked value*/, TEST_LOCATION);
2452 // Add back to the stage
2453 application.GetScene().Add(actor);
2455 application.SendNotification();
2456 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2457 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION);
2458 application.Render(static_cast<unsigned int>(0.0f));
2459 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2460 application.Render(static_cast<unsigned int>(0.0f));
2461 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2463 // Remove from the stage
2464 application.GetScene().Remove(actor); // baked here
2466 application.SendNotification();
2467 // this render is a no-op in this case as animator is disabled while off stage
2468 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2469 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2470 application.Render(static_cast<unsigned int>(0.0f));
2471 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2472 application.Render(static_cast<unsigned int>(0.0f));
2473 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2475 // Add back to the stage
2476 application.GetScene().Add(actor);
2478 // We didn't expect the animation to finish yet
2479 application.SendNotification();
2480 finishCheck.CheckSignalNotReceived();
2481 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88), TEST_LOCATION);
2483 application.SendNotification();
2484 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2486 // We did expect the animation to finish
2487 application.SendNotification();
2488 finishCheck.CheckSignalReceived();
2489 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2491 // Check that nothing has changed after a couple of buffer swaps
2492 application.Render(0);
2493 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2495 application.Render(0);
2496 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2500 int UtcDaliAnimationPlayDiscardHandleP(void)
2502 TestApplication application;
2504 Actor actor = Actor::New();
2505 application.GetScene().Add(actor);
2507 // Build the animation
2508 float durationSeconds(1.0f);
2509 Animation animation = Animation::New(durationSeconds);
2510 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2511 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2513 bool signalReceived(false);
2514 AnimationFinishCheck finishCheck(signalReceived);
2515 animation.FinishedSignal().Connect(&application, finishCheck);
2517 // Start the animation
2520 // This is a test of the "Fire and Forget" behaviour
2521 // Discard the animation handle!
2523 DALI_TEST_CHECK(!animation);
2525 application.SendNotification();
2526 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2528 // We didn't expect the animation to finish yet
2529 application.SendNotification();
2530 finishCheck.CheckSignalNotReceived();
2531 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2533 application.SendNotification();
2534 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2536 // We didn't expect the animation to finish yet
2537 application.SendNotification();
2538 finishCheck.CheckSignalNotReceived();
2539 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2541 application.SendNotification();
2542 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2544 // We didn't expect the animation to finish yet
2545 application.SendNotification();
2546 finishCheck.CheckSignalNotReceived();
2547 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2549 application.SendNotification();
2550 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2552 // We didn't expect the animation to finish yet
2553 application.SendNotification();
2554 finishCheck.CheckSignalNotReceived();
2555 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2557 application.SendNotification();
2558 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2560 // We did expect the animation to finish
2561 application.SendNotification();
2562 finishCheck.CheckSignalReceived();
2563 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2565 // Check that nothing has changed after a couple of buffer swaps
2566 application.Render(0);
2567 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2568 application.Render(0);
2569 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2573 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2575 TestApplication application;
2577 Actor actor = Actor::New();
2578 application.GetScene().Add(actor);
2580 // Build the animation
2581 float durationSeconds(1.0f);
2582 Animation animation = Animation::New(durationSeconds);
2583 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2584 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2586 // Start the animation
2589 bool signalReceived(false);
2590 AnimationFinishCheck finishCheck(signalReceived);
2591 animation.FinishedSignal().Connect(&application, finishCheck);
2593 application.SendNotification();
2594 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2596 // We didn't expect the animation to finish yet
2597 application.SendNotification();
2598 finishCheck.CheckSignalNotReceived();
2599 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2601 // This is a test of the "Fire and Forget" behaviour
2602 // Stop the animation, and Discard the animation handle!
2605 DALI_TEST_CHECK(!animation);
2607 application.SendNotification();
2608 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2610 // We expect the animation to finish at 20% progress
2611 application.SendNotification();
2612 finishCheck.CheckSignalReceived();
2613 finishCheck.Reset();
2614 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2616 application.SendNotification();
2617 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2619 // Check that nothing has changed
2620 application.SendNotification();
2621 finishCheck.CheckSignalNotReceived();
2622 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2624 application.SendNotification();
2625 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2627 // Check that nothing has changed
2628 application.SendNotification();
2629 finishCheck.CheckSignalNotReceived();
2630 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2632 application.SendNotification();
2633 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2635 // Check that nothing has changed
2636 application.SendNotification();
2637 finishCheck.CheckSignalNotReceived();
2638 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2642 int UtcDaliAnimationPlayRangeP(void)
2644 TestApplication application;
2646 Actor actor = Actor::New();
2647 application.GetScene().Add(actor);
2649 // Build the animation
2650 float durationSeconds(1.0f);
2651 Animation animation = Animation::New(durationSeconds);
2652 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2653 KeyFrames keyframes = KeyFrames::New();
2654 keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
2655 keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
2657 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
2659 // Set range between 0.4 and 0.8
2660 animation.SetPlayRange(Vector2(0.4f, 0.8f));
2663 bool signalReceived(false);
2664 AnimationFinishCheck finishCheck(signalReceived);
2665 animation.FinishedSignal().Connect(&application, finishCheck);
2667 //Test that setting progress outside the range doesn't work
2668 animation.SetCurrentProgress(0.9f);
2669 application.SendNotification();
2670 application.Render(0);
2671 DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2672 animation.SetCurrentProgress(0.2f);
2673 application.SendNotification();
2674 application.Render(0);
2675 DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2677 application.SendNotification();
2678 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2680 // We didn't expect the animation to finish yet
2681 application.SendNotification();
2682 finishCheck.CheckSignalNotReceived();
2683 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2685 animation.Play(); // Test that calling play has no effect, when animation is already playing
2686 application.SendNotification();
2687 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /* 80% progress */);
2689 // We did expect the animation to finish
2690 application.SendNotification();
2691 finishCheck.CheckSignalReceived();
2692 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2694 // Check that nothing has changed after a couple of buffer swaps
2695 application.Render(0);
2696 DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2697 application.Render(0);
2698 DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2700 //Loop inside the range
2701 finishCheck.Reset();
2702 animation.SetLooping(true);
2704 application.SendNotification();
2705 float intervalSeconds = 0.1f;
2706 float progress = 0.4f;
2707 for(int iterations = 0; iterations < 10; ++iterations)
2709 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2711 progress += intervalSeconds;
2714 progress = progress - 0.4f;
2717 DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2720 // We didn't expect the animation to finish yet
2721 application.SendNotification();
2722 finishCheck.CheckSignalNotReceived();
2724 //Test change range on the fly
2725 animation.SetPlayRange(Vector2(0.2f, 0.9f));
2726 application.SendNotification();
2728 for(int iterations = 0; iterations < 10; ++iterations)
2730 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2732 progress += intervalSeconds;
2735 progress = progress - 0.7f;
2738 DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2744 int UtcDaliAnimationPlayFromP(void)
2746 TestApplication application;
2748 Actor actor = Actor::New();
2749 application.GetScene().Add(actor);
2751 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2753 // Build the animation
2754 float durationSeconds(1.0f);
2755 Animation animation = Animation::New(durationSeconds);
2756 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2757 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2759 // Start the animation from 40% progress
2760 animation.PlayFrom(0.4f);
2762 // Target value should be updated straight away
2763 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2765 bool signalReceived(false);
2766 AnimationFinishCheck finishCheck(signalReceived);
2767 animation.FinishedSignal().Connect(&application, finishCheck);
2769 application.SendNotification();
2770 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2772 // We didn't expect the animation to finish yet
2773 application.SendNotification();
2774 finishCheck.CheckSignalNotReceived();
2775 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2777 animation.Play(); // Test that calling play has no effect, when animation is already playing
2778 application.SendNotification();
2779 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2781 // We didn't expect the animation to finish yet
2782 application.SendNotification();
2783 finishCheck.CheckSignalNotReceived();
2784 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2786 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2787 // We did expect the animation to finish
2788 application.SendNotification();
2789 finishCheck.CheckSignalReceived();
2790 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2792 // Check that nothing has changed after a couple of buffer swaps
2793 application.Render(0);
2794 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2795 application.Render(0);
2796 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2800 int UtcDaliAnimationPlayFromN(void)
2802 TestApplication application;
2804 Actor actor = Actor::New();
2805 application.GetScene().Add(actor);
2807 // Build the animation
2808 float durationSeconds(1.0f);
2809 Animation animation = Animation::New(durationSeconds);
2810 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2811 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2813 //PlayFrom with an argument outside the range [0..1] will be ignored
2814 animation.PlayFrom(-1.0f);
2815 application.SendNotification();
2816 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2818 animation.PlayFrom(100.0f);
2819 application.SendNotification();
2820 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2824 int UtcDaliAnimationPauseP(void)
2826 TestApplication application;
2828 Actor actor = Actor::New();
2829 application.GetScene().Add(actor);
2831 // Build the animation
2832 float durationSeconds(1.0f);
2833 Animation animation = Animation::New(durationSeconds);
2834 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2835 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2837 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2839 // Start the animation
2842 bool signalReceived(false);
2843 AnimationFinishCheck finishCheck(signalReceived);
2844 animation.FinishedSignal().Connect(&application, finishCheck);
2846 application.SendNotification();
2847 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
2849 // We didn't expect the animation to finish yet
2850 application.SendNotification();
2851 finishCheck.CheckSignalNotReceived();
2852 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
2854 // Pause the animation
2856 application.SendNotification();
2859 for(int i = 0; i < 5; ++i)
2861 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
2863 // We didn't expect the animation to finish yet
2864 application.SendNotification();
2865 finishCheck.CheckSignalNotReceived();
2866 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
2871 application.SendNotification();
2872 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2874 // We didn't expect the animation to finish yet
2875 application.SendNotification();
2876 finishCheck.CheckSignalNotReceived();
2878 application.SendNotification();
2879 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
2881 // We did expect the animation to finish
2882 application.SendNotification();
2883 finishCheck.CheckSignalReceived();
2884 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2886 // Check that nothing has changed after a couple of buffer swaps
2887 application.Render(0);
2888 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2889 application.Render(0);
2890 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2894 int UtcDaliAnimationGetStateP(void)
2896 TestApplication application;
2898 Actor actor = Actor::New();
2899 application.GetScene().Add(actor);
2901 // Build the animation
2902 float durationSeconds(1.0f);
2903 Animation animation = Animation::New(durationSeconds);
2904 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2905 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2906 DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2908 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2910 // Start the animation
2913 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2915 bool signalReceived(false);
2916 AnimationFinishCheck finishCheck(signalReceived);
2917 animation.FinishedSignal().Connect(&application, finishCheck);
2919 application.SendNotification();
2920 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
2922 // We didn't expect the animation to finish yet
2923 application.SendNotification();
2924 finishCheck.CheckSignalNotReceived();
2925 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2926 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
2928 // Pause the animation
2930 DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
2931 application.SendNotification();
2932 application.Render(0.f);
2935 for(int i = 0; i < 5; ++i)
2937 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
2939 // We didn't expect the animation to finish yet
2940 application.SendNotification();
2941 finishCheck.CheckSignalNotReceived();
2942 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
2943 DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
2947 finishCheck.Reset();
2949 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2950 application.SendNotification();
2951 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2952 // We didn't expect the animation to finish yet
2953 application.SendNotification();
2954 finishCheck.CheckSignalNotReceived();
2955 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2957 application.SendNotification();
2958 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
2960 // We did expect the animation to finish
2961 application.SendNotification();
2962 finishCheck.CheckSignalReceived();
2963 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2964 DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2966 // Check that nothing has changed after a couple of buffer swaps
2967 application.Render(0);
2968 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2969 application.Render(0);
2970 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2971 DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2974 finishCheck.Reset();
2976 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2977 application.SendNotification();
2978 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2979 application.SendNotification();
2980 finishCheck.CheckSignalNotReceived();
2981 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
2986 int UtcDaliAnimationStopP(void)
2988 TestApplication application;
2990 Actor actor = Actor::New();
2991 application.GetScene().Add(actor);
2993 // Build the animation
2994 float durationSeconds(1.0f);
2995 Animation animation = Animation::New(durationSeconds);
2996 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2997 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2999 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3001 // Start the animation
3004 bool signalReceived(false);
3005 AnimationFinishCheck finishCheck(signalReceived);
3006 animation.FinishedSignal().Connect(&application, finishCheck);
3008 application.SendNotification();
3009 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3011 // We didn't expect the animation to finish yet
3012 application.SendNotification();
3013 finishCheck.CheckSignalNotReceived();
3014 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3016 // Stop the animation
3018 application.SendNotification();
3021 for(int i = 0; i < 5; ++i)
3023 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3025 // We did expect the animation to finish
3026 application.SendNotification();
3027 finishCheck.CheckSignalReceived();
3028 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when stopped */, TEST_LOCATION);
3033 int UtcDaliAnimationStopSetPositionP(void)
3035 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
3036 // i.e. to check that the animation does not interfere with the position set.
3038 TestApplication application;
3040 Actor actor = Actor::New();
3041 application.GetScene().Add(actor);
3043 // Build the animation
3044 float durationSeconds(1.0f);
3045 Animation animation = Animation::New(durationSeconds);
3046 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3047 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3049 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3051 // Start the animation
3054 bool signalReceived(false);
3055 AnimationFinishCheck finishCheck(signalReceived);
3056 animation.FinishedSignal().Connect(&application, finishCheck);
3058 application.SendNotification();
3059 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3061 // We didn't expect the animation to finish yet
3062 application.SendNotification();
3063 finishCheck.CheckSignalNotReceived();
3064 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3066 // Stop the animation
3068 Vector3 positionSet(2.0f, 3.0f, 4.0f);
3069 actor.SetProperty(Actor::Property::POSITION, positionSet);
3070 application.SendNotification();
3073 for(int i = 0; i < 5; ++i)
3075 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3077 // We did expect the animation to finish
3078 application.SendNotification();
3079 finishCheck.CheckSignalReceived();
3080 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), positionSet /*Animation should not interfere with this*/, TEST_LOCATION);
3085 int UtcDaliAnimationClearP(void)
3087 TestApplication application;
3089 Actor actor = Actor::New();
3090 application.GetScene().Add(actor);
3092 // Build the animation
3093 float durationSeconds(1.0f);
3094 Animation animation = Animation::New(durationSeconds);
3095 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3096 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3098 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3100 // Start the animation
3103 bool signalReceived(false);
3104 AnimationFinishCheck finishCheck(signalReceived);
3105 animation.FinishedSignal().Connect(&application, finishCheck);
3107 application.SendNotification();
3108 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3110 // We didn't expect the animation to finish yet
3111 application.SendNotification();
3112 finishCheck.CheckSignalNotReceived();
3113 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3115 // Clear the animation
3117 application.SendNotification();
3119 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3121 // We don't expect the animation to finish now
3122 application.SendNotification();
3123 finishCheck.CheckSignalNotReceived();
3124 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
3126 // Restart as a scale animation; this should not move the actor's position
3127 finishCheck.Reset();
3128 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
3129 Vector3 targetScale(3.0f, 3.0f, 3.0f);
3130 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
3133 application.SendNotification();
3134 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3136 // We didn't expect the animation to finish yet
3137 application.SendNotification();
3138 finishCheck.CheckSignalNotReceived();
3139 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3140 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
3142 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3144 // We did expect the animation to finish
3145 application.SendNotification();
3146 finishCheck.CheckSignalReceived();
3147 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3148 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
3152 int UtcDaliAnimationFinishedSignalP(void)
3154 TestApplication application;
3156 // Start the empty animation
3157 float durationSeconds(1.0f);
3158 Animation animation = Animation::New(durationSeconds);
3161 bool signalReceived(false);
3162 AnimationFinishCheck finishCheck(signalReceived);
3163 animation.FinishedSignal().Connect(&application, finishCheck);
3165 application.SendNotification();
3166 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
3168 // We did expect the animation to finish
3169 application.SendNotification();
3170 finishCheck.CheckSignalReceived();
3174 int UtcDaliAnimationAnimateByBooleanP(void)
3176 TestApplication application;
3178 Actor actor = Actor::New();
3180 // Register a boolean property
3181 bool startValue(false);
3182 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3183 application.GetScene().Add(actor);
3184 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3185 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3187 // Build the animation
3188 float durationSeconds(2.0f);
3189 Animation animation = Animation::New(durationSeconds);
3190 const bool relativeValue(true);
3191 const bool finalValue(false || relativeValue);
3192 animation.AnimateBy(Property(actor, index), relativeValue);
3194 // Start the animation
3197 // Target value should be retrievable straight away
3198 DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
3200 bool signalReceived(false);
3201 AnimationFinishCheck finishCheck(signalReceived);
3202 animation.FinishedSignal().Connect(&application, finishCheck);
3204 application.SendNotification();
3205 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3207 // We didn't expect the animation to finish yet
3208 application.SendNotification();
3209 finishCheck.CheckSignalNotReceived();
3210 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3212 application.SendNotification();
3213 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3215 // We did expect the animation to finish
3216 application.SendNotification();
3217 finishCheck.CheckSignalReceived();
3218 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3220 // Check that nothing has changed after a couple of buffer swaps
3221 application.Render(0);
3222 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3223 application.Render(0);
3224 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3226 // Repeat with relative value "false" - this should be an NOOP
3227 animation = Animation::New(durationSeconds);
3228 bool noOpValue(false);
3229 animation.AnimateBy(Property(actor, index), noOpValue);
3231 // Start the animation
3234 finishCheck.Reset();
3235 animation.FinishedSignal().Connect(&application, finishCheck);
3237 application.SendNotification();
3238 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3240 // We didn't expect the animation to finish yet
3241 application.SendNotification();
3242 finishCheck.CheckSignalNotReceived();
3243 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3245 application.SendNotification();
3246 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3248 // We did expect the animation to finish
3249 application.SendNotification();
3250 finishCheck.CheckSignalReceived();
3251 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3253 // Check that nothing has changed after a couple of buffer swaps
3254 application.Render(0);
3255 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3256 application.Render(0);
3257 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3261 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3263 TestApplication application;
3265 Actor actor = Actor::New();
3267 // Register a boolean property
3268 bool startValue(false);
3269 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3270 application.GetScene().Add(actor);
3271 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3272 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3274 // Build the animation
3275 float durationSeconds(2.0f);
3276 Animation animation = Animation::New(durationSeconds);
3277 bool relativeValue(true);
3278 bool finalValue(false || relativeValue);
3279 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3281 // Start the animation
3284 bool signalReceived(false);
3285 AnimationFinishCheck finishCheck(signalReceived);
3286 animation.FinishedSignal().Connect(&application, finishCheck);
3288 application.SendNotification();
3289 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3291 // We didn't expect the animation to finish yet
3292 application.SendNotification();
3293 finishCheck.CheckSignalNotReceived();
3294 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3296 application.SendNotification();
3297 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3299 // We did expect the animation to finish
3300 application.SendNotification();
3301 finishCheck.CheckSignalReceived();
3302 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3304 // Check that nothing has changed after a couple of buffer swaps
3305 application.Render(0);
3306 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3307 application.Render(0);
3308 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3310 // Repeat with relative value "false" - this should be an NOOP
3311 animation = Animation::New(durationSeconds);
3312 bool noOpValue(false);
3313 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3315 // Start the animation
3318 finishCheck.Reset();
3319 animation.FinishedSignal().Connect(&application, finishCheck);
3321 application.SendNotification();
3322 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3324 // We didn't expect the animation to finish yet
3325 application.SendNotification();
3326 finishCheck.CheckSignalNotReceived();
3327 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3329 application.SendNotification();
3330 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3332 // We did expect the animation to finish
3333 application.SendNotification();
3334 finishCheck.CheckSignalReceived();
3335 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3339 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3341 TestApplication application;
3343 Actor actor = Actor::New();
3345 // Register a boolean property
3346 bool startValue(false);
3347 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3348 application.GetScene().Add(actor);
3349 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3350 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3352 // Build the animation
3353 float durationSeconds(2.0f);
3354 Animation animation = Animation::New(durationSeconds);
3355 bool relativeValue(true);
3356 bool finalValue(false || relativeValue);
3357 float animatorDurationSeconds(durationSeconds * 0.5f);
3358 animation.AnimateBy(Property(actor, index),
3360 TimePeriod(animatorDurationSeconds));
3362 // Start the animation
3365 bool signalReceived(false);
3366 AnimationFinishCheck finishCheck(signalReceived);
3367 animation.FinishedSignal().Connect(&application, finishCheck);
3369 application.SendNotification();
3370 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3372 // We didn't expect the animation to finish yet
3373 application.SendNotification();
3374 finishCheck.CheckSignalNotReceived();
3375 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3377 application.SendNotification();
3378 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3380 // We didn't expect the animation to finish yet...
3381 application.SendNotification();
3382 finishCheck.CheckSignalNotReceived();
3384 // ...however we should have reached the final value
3385 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3387 application.SendNotification();
3388 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3390 // We did expect the animation to finish
3391 application.SendNotification();
3392 finishCheck.CheckSignalReceived();
3393 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3395 // Check that nothing has changed after a couple of buffer swaps
3396 application.Render(0);
3397 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3398 application.Render(0);
3399 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3403 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3405 TestApplication application;
3407 Actor actor = Actor::New();
3409 // Register a boolean property
3410 bool startValue(false);
3411 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3412 application.GetScene().Add(actor);
3413 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3414 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3416 // Build the animation
3417 float durationSeconds(2.0f);
3418 Animation animation = Animation::New(durationSeconds);
3419 bool relativeValue(true);
3420 bool finalValue(false || relativeValue);
3421 float animatorDurationSeconds(durationSeconds * 0.5f);
3422 animation.AnimateBy(Property(actor, index),
3424 AlphaFunction::EASE_IN_OUT,
3425 TimePeriod(animatorDurationSeconds));
3427 // Start the animation
3430 bool signalReceived(false);
3431 AnimationFinishCheck finishCheck(signalReceived);
3432 animation.FinishedSignal().Connect(&application, finishCheck);
3434 application.SendNotification();
3435 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3437 // We didn't expect the animation to finish yet
3438 application.SendNotification();
3439 finishCheck.CheckSignalNotReceived();
3440 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3442 application.SendNotification();
3443 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3445 // We didn't expect the animation to finish yet...
3446 application.SendNotification();
3447 finishCheck.CheckSignalNotReceived();
3449 // ...however we should have reached the final value
3450 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3452 application.SendNotification();
3453 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3455 // We did expect the animation to finish
3456 application.SendNotification();
3457 finishCheck.CheckSignalReceived();
3458 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3460 // Check that nothing has changed after a couple of buffer swaps
3461 application.Render(0);
3462 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3463 application.Render(0);
3464 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3468 int UtcDaliAnimationAnimateByFloatP(void)
3470 TestApplication application;
3472 Actor actor = Actor::New();
3474 // Register a float property
3475 float startValue(10.0f);
3476 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3477 application.GetScene().Add(actor);
3478 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3479 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3481 // Build the animation
3482 float durationSeconds(2.0f);
3483 Animation animation = Animation::New(durationSeconds);
3484 float targetValue(50.0f);
3485 float relativeValue(targetValue - startValue);
3486 animation.AnimateBy(Property(actor, index), relativeValue);
3488 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3490 // Start the animation
3493 // Target value should be retrievable straight away
3494 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
3496 bool signalReceived(false);
3497 AnimationFinishCheck finishCheck(signalReceived);
3498 animation.FinishedSignal().Connect(&application, finishCheck);
3500 application.SendNotification();
3501 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3503 // We didn't expect the animation to finish yet
3504 application.SendNotification();
3505 finishCheck.CheckSignalNotReceived();
3506 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
3508 application.SendNotification();
3509 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3511 // We did expect the animation to finish
3512 application.SendNotification();
3513 finishCheck.CheckSignalReceived();
3514 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3516 // Check that nothing has changed after a couple of buffer swaps
3517 application.Render(0);
3518 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3519 application.Render(0);
3520 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3524 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3526 TestApplication application;
3528 Actor actor = Actor::New();
3530 // Register a float property
3531 float startValue(10.0f);
3532 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3533 application.GetScene().Add(actor);
3534 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3535 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3537 // Build the animation
3538 float durationSeconds(1.0f);
3539 Animation animation = Animation::New(durationSeconds);
3540 float targetValue(90.0f);
3541 float relativeValue(targetValue - startValue);
3542 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3544 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3546 // Start the animation
3549 bool signalReceived(false);
3550 AnimationFinishCheck finishCheck(signalReceived);
3551 animation.FinishedSignal().Connect(&application, finishCheck);
3553 application.SendNotification();
3554 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3556 // We didn't expect the animation to finish yet
3557 application.SendNotification();
3558 finishCheck.CheckSignalNotReceived();
3560 // The position should have moved more, than with a linear alpha function
3561 float current(actor.GetCurrentProperty<float>(index));
3562 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3564 application.SendNotification();
3565 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3567 // We did expect the animation to finish
3568 application.SendNotification();
3569 finishCheck.CheckSignalReceived();
3570 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3572 // Check that nothing has changed after a couple of buffer swaps
3573 application.Render(0);
3574 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3575 application.Render(0);
3576 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3580 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3582 TestApplication application;
3584 Actor actor = Actor::New();
3586 // Register a float property
3587 float startValue(10.0f);
3588 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3589 application.GetScene().Add(actor);
3590 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3591 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3593 // Build the animation
3594 float durationSeconds(1.0f);
3595 Animation animation = Animation::New(durationSeconds);
3596 float targetValue(30.0f);
3597 float relativeValue(targetValue - startValue);
3599 animation.AnimateBy(Property(actor, index),
3601 TimePeriod(delay, durationSeconds - delay));
3603 // Start the animation
3606 bool signalReceived(false);
3607 AnimationFinishCheck finishCheck(signalReceived);
3608 animation.FinishedSignal().Connect(&application, finishCheck);
3610 application.SendNotification();
3611 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3613 // We didn't expect the animation to finish yet
3614 application.SendNotification();
3615 finishCheck.CheckSignalNotReceived();
3616 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3618 application.SendNotification();
3619 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3621 // We didn't expect the animation to finish yet
3622 application.SendNotification();
3623 finishCheck.CheckSignalNotReceived();
3624 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3626 application.SendNotification();
3627 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3629 // We did expect the animation to finish
3630 application.SendNotification();
3631 finishCheck.CheckSignalReceived();
3632 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3634 // Check that nothing has changed after a couple of buffer swaps
3635 application.Render(0);
3636 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3637 application.Render(0);
3638 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3642 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3644 TestApplication application;
3646 Actor actor = Actor::New();
3648 // Register a float property
3649 float startValue(10.0f);
3650 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3651 application.GetScene().Add(actor);
3652 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3653 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3655 // Build the animation
3656 float durationSeconds(1.0f);
3657 Animation animation = Animation::New(durationSeconds);
3658 float targetValue(30.0f);
3659 float relativeValue(targetValue - startValue);
3661 animation.AnimateBy(Property(actor, index),
3663 AlphaFunction::LINEAR,
3664 TimePeriod(delay, durationSeconds - delay));
3666 // Start the animation
3669 bool signalReceived(false);
3670 AnimationFinishCheck finishCheck(signalReceived);
3671 animation.FinishedSignal().Connect(&application, finishCheck);
3673 application.SendNotification();
3674 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3676 // We didn't expect the animation to finish yet
3677 application.SendNotification();
3678 finishCheck.CheckSignalNotReceived();
3679 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3681 application.SendNotification();
3682 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3684 // We didn't expect the animation to finish yet
3685 application.SendNotification();
3686 finishCheck.CheckSignalNotReceived();
3687 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3689 application.SendNotification();
3690 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3692 // We did expect the animation to finish
3693 application.SendNotification();
3694 finishCheck.CheckSignalReceived();
3695 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3697 // Check that nothing has changed after a couple of buffer swaps
3698 application.Render(0);
3699 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3700 application.Render(0);
3701 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3705 int UtcDaliAnimationAnimateByIntegerP(void)
3707 TestApplication application;
3709 Actor actor = Actor::New();
3711 // Register an integer property
3713 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3714 application.GetScene().Add(actor);
3715 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3716 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3718 // Build the animation
3719 float durationSeconds(2.0f);
3720 Animation animation = Animation::New(durationSeconds);
3721 int targetValue(50);
3722 int relativeValue(targetValue - startValue);
3723 animation.AnimateBy(Property(actor, index), relativeValue);
3725 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3727 // Start the animation
3730 // Target value should be retrievable straight away
3731 DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
3733 bool signalReceived(false);
3734 AnimationFinishCheck finishCheck(signalReceived);
3735 animation.FinishedSignal().Connect(&application, finishCheck);
3737 application.SendNotification();
3738 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3740 // We didn't expect the animation to finish yet
3741 application.SendNotification();
3742 finishCheck.CheckSignalNotReceived();
3743 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
3745 application.SendNotification();
3746 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3748 // We did expect the animation to finish
3749 application.SendNotification();
3750 finishCheck.CheckSignalReceived();
3751 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3753 // Check that nothing has changed after a couple of buffer swaps
3754 application.Render(0);
3755 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3756 application.Render(0);
3757 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3761 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3763 TestApplication application;
3765 Actor actor = Actor::New();
3767 // Register an integer property
3769 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3770 application.GetScene().Add(actor);
3771 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3772 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3774 // Build the animation
3775 float durationSeconds(1.0f);
3776 Animation animation = Animation::New(durationSeconds);
3777 int targetValue(90);
3778 int relativeValue(targetValue - startValue);
3779 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3781 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3783 // Start the animation
3786 bool signalReceived(false);
3787 AnimationFinishCheck finishCheck(signalReceived);
3788 animation.FinishedSignal().Connect(&application, finishCheck);
3790 application.SendNotification();
3791 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3793 // We didn't expect the animation to finish yet
3794 application.SendNotification();
3795 finishCheck.CheckSignalNotReceived();
3797 // The position should have moved more, than with a linear alpha function
3798 int current(actor.GetCurrentProperty<int>(index));
3799 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3801 application.SendNotification();
3802 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3804 // We did expect the animation to finish
3805 application.SendNotification();
3806 finishCheck.CheckSignalReceived();
3807 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3809 // Check that nothing has changed after a couple of buffer swaps
3810 application.Render(0);
3811 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3812 application.Render(0);
3813 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3817 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3819 TestApplication application;
3821 Actor actor = Actor::New();
3823 // Register an integer property
3825 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3826 application.GetScene().Add(actor);
3827 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3828 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3830 // Build the animation
3831 float durationSeconds(1.0f);
3832 Animation animation = Animation::New(durationSeconds);
3833 int targetValue(30);
3834 int relativeValue(targetValue - startValue);
3836 animation.AnimateBy(Property(actor, index),
3838 TimePeriod(delay, durationSeconds - delay));
3840 // Start the animation
3843 bool signalReceived(false);
3844 AnimationFinishCheck finishCheck(signalReceived);
3845 animation.FinishedSignal().Connect(&application, finishCheck);
3847 application.SendNotification();
3848 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3850 // We didn't expect the animation to finish yet
3851 application.SendNotification();
3852 finishCheck.CheckSignalNotReceived();
3853 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3855 application.SendNotification();
3856 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3858 // We didn't expect the animation to finish yet
3859 application.SendNotification();
3860 finishCheck.CheckSignalNotReceived();
3861 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
3863 application.SendNotification();
3864 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3866 // We did expect the animation to finish
3867 application.SendNotification();
3868 finishCheck.CheckSignalReceived();
3869 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3871 // Check that nothing has changed after a couple of buffer swaps
3872 application.Render(0);
3873 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3874 application.Render(0);
3875 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3879 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3881 TestApplication application;
3883 Actor actor = Actor::New();
3885 // Register an integer property
3887 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3888 application.GetScene().Add(actor);
3889 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3890 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3892 // Build the animation
3893 float durationSeconds(1.0f);
3894 Animation animation = Animation::New(durationSeconds);
3895 int targetValue(30);
3896 int relativeValue(targetValue - startValue);
3898 animation.AnimateBy(Property(actor, index),
3900 AlphaFunction::LINEAR,
3901 TimePeriod(delay, durationSeconds - delay));
3903 // Start the animation
3906 bool signalReceived(false);
3907 AnimationFinishCheck finishCheck(signalReceived);
3908 animation.FinishedSignal().Connect(&application, finishCheck);
3910 application.SendNotification();
3911 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3913 // We didn't expect the animation to finish yet
3914 application.SendNotification();
3915 finishCheck.CheckSignalNotReceived();
3916 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3918 application.SendNotification();
3919 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3921 // We didn't expect the animation to finish yet
3922 application.SendNotification();
3923 finishCheck.CheckSignalNotReceived();
3924 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
3926 application.SendNotification();
3927 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3929 // We did expect the animation to finish
3930 application.SendNotification();
3931 finishCheck.CheckSignalReceived();
3932 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3934 // Check that nothing has changed after a couple of buffer swaps
3935 application.Render(0);
3936 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3937 application.Render(0);
3938 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3942 int UtcDaliAnimationAnimateByQuaternionP(void)
3944 TestApplication application;
3946 Actor actor = Actor::New();
3948 // Register a quaternion property
3949 const Quaternion startValue(Degree(90), Vector3::XAXIS);
3950 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3951 application.GetScene().Add(actor);
3952 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
3953 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
3955 // Build the animation
3956 float durationSeconds(2.0f);
3957 Animation animation = Animation::New(durationSeconds);
3958 const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
3959 const Quaternion finalValue(startValue * relativeValue);
3960 animation.AnimateBy(Property(actor, index), relativeValue);
3962 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
3963 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
3965 // Start the animation
3968 // Target value should be retrievable straight away
3969 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
3971 application.SendNotification();
3972 application.Render(2000); // animation complete
3974 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
3975 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
3980 int UtcDaliAnimationAnimateByVector2P(void)
3982 TestApplication application;
3984 Actor actor = Actor::New();
3986 // Register a Vector2 property
3987 Vector2 startValue(10.0f, 10.0f);
3988 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3989 application.GetScene().Add(actor);
3990 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
3991 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
3993 // Build the animation
3994 float durationSeconds(2.0f);
3995 Animation animation = Animation::New(durationSeconds);
3996 Vector2 targetValue(60.0f, 60.0f);
3997 Vector2 relativeValue(targetValue - startValue);
3998 animation.AnimateBy(Property(actor, index), relativeValue);
4000 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4002 // Start the animation
4005 // Target value should be retrievable straight away
4006 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
4008 bool signalReceived(false);
4009 AnimationFinishCheck finishCheck(signalReceived);
4010 animation.FinishedSignal().Connect(&application, finishCheck);
4012 application.SendNotification();
4013 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4015 // We didn't expect the animation to finish yet
4016 application.SendNotification();
4017 finishCheck.CheckSignalNotReceived();
4018 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
4020 application.SendNotification();
4021 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4023 // We did expect the animation to finish
4024 application.SendNotification();
4025 finishCheck.CheckSignalReceived();
4026 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4028 // Check that nothing has changed after a couple of buffer swaps
4029 application.Render(0);
4030 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4031 application.Render(0);
4032 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4036 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
4038 TestApplication application;
4040 Actor actor = Actor::New();
4042 // Register a Vector2 property
4043 Vector2 startValue(100.0f, 100.0f);
4044 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4045 application.GetScene().Add(actor);
4046 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4047 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4049 // Build the animation
4050 float durationSeconds(1.0f);
4051 Animation animation = Animation::New(durationSeconds);
4052 Vector2 targetValue(20.0f, 20.0f);
4053 Vector2 relativeValue(targetValue - startValue);
4054 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4056 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4058 // Start the animation
4061 bool signalReceived(false);
4062 AnimationFinishCheck finishCheck(signalReceived);
4063 animation.FinishedSignal().Connect(&application, finishCheck);
4065 application.SendNotification();
4066 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4068 // We didn't expect the animation to finish yet
4069 application.SendNotification();
4070 finishCheck.CheckSignalNotReceived();
4072 // The position should have moved more, than with a linear alpha function
4073 Vector2 current(actor.GetCurrentProperty<Vector2>(index));
4074 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4075 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4077 application.SendNotification();
4078 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4080 // We did expect the animation to finish
4081 application.SendNotification();
4082 finishCheck.CheckSignalReceived();
4083 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4085 // Check that nothing has changed after a couple of buffer swaps
4086 application.Render(0);
4087 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4088 application.Render(0);
4089 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4093 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4095 TestApplication application;
4097 Actor actor = Actor::New();
4099 // Register a Vector2 property
4100 Vector2 startValue(10.0f, 10.0f);
4101 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4102 application.GetScene().Add(actor);
4103 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4104 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4106 // Build the animation
4107 float durationSeconds(1.0f);
4108 Animation animation = Animation::New(durationSeconds);
4109 Vector2 targetValue(30.0f, 30.0f);
4110 Vector2 relativeValue(targetValue - startValue);
4112 animation.AnimateBy(Property(actor, index),
4114 TimePeriod(delay, durationSeconds - delay));
4116 // Start the animation
4119 bool signalReceived(false);
4120 AnimationFinishCheck finishCheck(signalReceived);
4121 animation.FinishedSignal().Connect(&application, finishCheck);
4123 application.SendNotification();
4124 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4126 // We didn't expect the animation to finish yet
4127 application.SendNotification();
4128 finishCheck.CheckSignalNotReceived();
4129 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4131 application.SendNotification();
4132 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4134 // We didn't expect the animation to finish yet
4135 application.SendNotification();
4136 finishCheck.CheckSignalNotReceived();
4137 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4139 application.SendNotification();
4140 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4142 // We did expect the animation to finish
4143 application.SendNotification();
4144 finishCheck.CheckSignalReceived();
4145 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4147 // Check that nothing has changed after a couple of buffer swaps
4148 application.Render(0);
4149 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4150 application.Render(0);
4151 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4155 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4157 TestApplication application;
4159 Actor actor = Actor::New();
4161 // Register a Vector2 property
4162 Vector2 startValue(5.0f, 5.0f);
4163 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4164 application.GetScene().Add(actor);
4165 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4166 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4168 // Build the animation
4169 float durationSeconds(1.0f);
4170 Animation animation = Animation::New(durationSeconds);
4171 Vector2 targetValue(10.0f, 10.0f);
4172 Vector2 relativeValue(targetValue - startValue);
4174 animation.AnimateBy(Property(actor, index),
4176 AlphaFunction::LINEAR,
4177 TimePeriod(delay, durationSeconds - delay));
4179 // Start the animation
4182 bool signalReceived(false);
4183 AnimationFinishCheck finishCheck(signalReceived);
4184 animation.FinishedSignal().Connect(&application, finishCheck);
4186 application.SendNotification();
4187 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4189 // We didn't expect the animation to finish yet
4190 application.SendNotification();
4191 finishCheck.CheckSignalNotReceived();
4192 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4194 application.SendNotification();
4195 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4197 // We didn't expect the animation to finish yet
4198 application.SendNotification();
4199 finishCheck.CheckSignalNotReceived();
4200 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4202 application.SendNotification();
4203 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4205 // We did expect the animation to finish
4206 application.SendNotification();
4207 finishCheck.CheckSignalReceived();
4208 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4210 // Check that nothing has changed after a couple of buffer swaps
4211 application.Render(0);
4212 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4213 application.Render(0);
4214 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4218 int UtcDaliAnimationAnimateByVector3P(void)
4220 TestApplication application;
4222 Actor actor = Actor::New();
4224 // Register a Vector3 property
4225 Vector3 startValue(10.0f, 10.0f, 10.0f);
4226 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4227 application.GetScene().Add(actor);
4228 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4229 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4231 // Build the animation
4232 float durationSeconds(2.0f);
4233 Animation animation = Animation::New(durationSeconds);
4234 Vector3 targetValue(60.0f, 60.0f, 60.0f);
4235 Vector3 relativeValue(targetValue - startValue);
4236 animation.AnimateBy(Property(actor, index), relativeValue);
4238 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4240 // Start the animation
4243 // Target value should be retrievable straight away
4244 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
4246 bool signalReceived(false);
4247 AnimationFinishCheck finishCheck(signalReceived);
4248 animation.FinishedSignal().Connect(&application, finishCheck);
4250 application.SendNotification();
4251 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4253 // We didn't expect the animation to finish yet
4254 application.SendNotification();
4255 finishCheck.CheckSignalNotReceived();
4256 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
4258 application.SendNotification();
4259 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4261 // We did expect the animation to finish
4262 application.SendNotification();
4263 finishCheck.CheckSignalReceived();
4264 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4266 // Check that nothing has changed after a couple of buffer swaps
4267 application.Render(0);
4268 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4269 application.Render(0);
4270 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4274 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4276 TestApplication application;
4278 Actor actor = Actor::New();
4280 // Register a Vector3 property
4281 Vector3 startValue(100.0f, 100.0f, 100.0f);
4282 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4283 application.GetScene().Add(actor);
4284 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4285 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4287 // Build the animation
4288 float durationSeconds(1.0f);
4289 Animation animation = Animation::New(durationSeconds);
4290 Vector3 targetValue(20.0f, 20.0f, 20.0f);
4291 Vector3 relativeValue(targetValue - startValue);
4292 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4294 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4296 // Start the animation
4299 bool signalReceived(false);
4300 AnimationFinishCheck finishCheck(signalReceived);
4301 animation.FinishedSignal().Connect(&application, finishCheck);
4303 application.SendNotification();
4304 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4306 // We didn't expect the animation to finish yet
4307 application.SendNotification();
4308 finishCheck.CheckSignalNotReceived();
4310 // The position should have moved more, than with a linear alpha function
4311 Vector3 current(actor.GetCurrentProperty<Vector3>(index));
4312 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4313 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4314 DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4316 application.SendNotification();
4317 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4319 // We did expect the animation to finish
4320 application.SendNotification();
4321 finishCheck.CheckSignalReceived();
4322 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4324 // Check that nothing has changed after a couple of buffer swaps
4325 application.Render(0);
4326 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4327 application.Render(0);
4328 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4332 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4334 TestApplication application;
4336 Actor actor = Actor::New();
4338 // Register a Vector3 property
4339 Vector3 startValue(10.0f, 10.0f, 10.0f);
4340 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4341 application.GetScene().Add(actor);
4342 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4343 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4345 // Build the animation
4346 float durationSeconds(1.0f);
4347 Animation animation = Animation::New(durationSeconds);
4348 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4349 Vector3 relativeValue(targetValue - startValue);
4351 animation.AnimateBy(Property(actor, index),
4353 TimePeriod(delay, durationSeconds - delay));
4355 // Start the animation
4358 bool signalReceived(false);
4359 AnimationFinishCheck finishCheck(signalReceived);
4360 animation.FinishedSignal().Connect(&application, finishCheck);
4362 application.SendNotification();
4363 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4365 // We didn't expect the animation to finish yet
4366 application.SendNotification();
4367 finishCheck.CheckSignalNotReceived();
4368 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4370 application.SendNotification();
4371 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4373 // We didn't expect the animation to finish yet
4374 application.SendNotification();
4375 finishCheck.CheckSignalNotReceived();
4376 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4378 application.SendNotification();
4379 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4381 // We did expect the animation to finish
4382 application.SendNotification();
4383 finishCheck.CheckSignalReceived();
4384 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4386 // Check that nothing has changed after a couple of buffer swaps
4387 application.Render(0);
4388 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4389 application.Render(0);
4390 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4394 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4396 TestApplication application;
4398 Actor actor = Actor::New();
4400 // Register a Vector3 property
4401 Vector3 startValue(5.0f, 5.0f, 5.0f);
4402 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4403 application.GetScene().Add(actor);
4404 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4405 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4407 // Build the animation
4408 float durationSeconds(1.0f);
4409 Animation animation = Animation::New(durationSeconds);
4410 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4411 Vector3 relativeValue(targetValue - startValue);
4413 animation.AnimateBy(Property(actor, index),
4415 AlphaFunction::LINEAR,
4416 TimePeriod(delay, durationSeconds - delay));
4418 // Start the animation
4421 bool signalReceived(false);
4422 AnimationFinishCheck finishCheck(signalReceived);
4423 animation.FinishedSignal().Connect(&application, finishCheck);
4425 application.SendNotification();
4426 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4428 // We didn't expect the animation to finish yet
4429 application.SendNotification();
4430 finishCheck.CheckSignalNotReceived();
4431 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4433 application.SendNotification();
4434 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4436 // We didn't expect the animation to finish yet
4437 application.SendNotification();
4438 finishCheck.CheckSignalNotReceived();
4439 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4441 application.SendNotification();
4442 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4444 // We did expect the animation to finish
4445 application.SendNotification();
4446 finishCheck.CheckSignalReceived();
4447 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4449 // Check that nothing has changed after a couple of buffer swaps
4450 application.Render(0);
4451 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4452 application.Render(0);
4453 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4457 int UtcDaliAnimationAnimateByVector4P(void)
4459 TestApplication application;
4461 Actor actor = Actor::New();
4463 // Register a Vector4 property
4464 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4465 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4466 application.GetScene().Add(actor);
4467 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4468 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4470 // Build the animation
4471 float durationSeconds(2.0f);
4472 Animation animation = Animation::New(durationSeconds);
4473 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4474 Vector4 relativeValue(targetValue - startValue);
4475 animation.AnimateBy(Property(actor, index), relativeValue);
4477 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4479 // Start the animation
4482 // Target value should be retrievable straight away
4483 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
4485 bool signalReceived(false);
4486 AnimationFinishCheck finishCheck(signalReceived);
4487 animation.FinishedSignal().Connect(&application, finishCheck);
4489 application.SendNotification();
4490 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4492 // We didn't expect the animation to finish yet
4493 application.SendNotification();
4494 finishCheck.CheckSignalNotReceived();
4495 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
4497 application.SendNotification();
4498 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4500 // We did expect the animation to finish
4501 application.SendNotification();
4502 finishCheck.CheckSignalReceived();
4503 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4505 // Check that nothing has changed after a couple of buffer swaps
4506 application.Render(0);
4507 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4508 application.Render(0);
4509 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4513 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4515 TestApplication application;
4517 Actor actor = Actor::New();
4519 // Register a Vector4 property
4520 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4521 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4522 application.GetScene().Add(actor);
4523 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4524 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4526 // Build the animation
4527 float durationSeconds(1.0f);
4528 Animation animation = Animation::New(durationSeconds);
4529 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4530 Vector4 relativeValue(targetValue - startValue);
4531 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4533 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4535 // Start the animation
4538 bool signalReceived(false);
4539 AnimationFinishCheck finishCheck(signalReceived);
4540 animation.FinishedSignal().Connect(&application, finishCheck);
4542 application.SendNotification();
4543 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4545 // We didn't expect the animation to finish yet
4546 application.SendNotification();
4547 finishCheck.CheckSignalNotReceived();
4549 // The position should have moved more, than with a linear alpha function
4550 Vector4 current(actor.GetCurrentProperty<Vector4>(index));
4551 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4552 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4553 DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4554 DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
4556 application.SendNotification();
4557 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4559 // We did expect the animation to finish
4560 application.SendNotification();
4561 finishCheck.CheckSignalReceived();
4562 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4564 // Check that nothing has changed after a couple of buffer swaps
4565 application.Render(0);
4566 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4567 application.Render(0);
4568 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4572 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4574 TestApplication application;
4576 Actor actor = Actor::New();
4578 // Register a Vector4 property
4579 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4580 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4581 application.GetScene().Add(actor);
4582 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4583 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4585 // Build the animation
4586 float durationSeconds(1.0f);
4587 Animation animation = Animation::New(durationSeconds);
4588 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4589 Vector4 relativeValue(targetValue - startValue);
4591 animation.AnimateBy(Property(actor, index),
4593 TimePeriod(delay, durationSeconds - delay));
4595 // Start the animation
4598 bool signalReceived(false);
4599 AnimationFinishCheck finishCheck(signalReceived);
4600 animation.FinishedSignal().Connect(&application, finishCheck);
4602 application.SendNotification();
4603 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4605 // We didn't expect the animation to finish yet
4606 application.SendNotification();
4607 finishCheck.CheckSignalNotReceived();
4608 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4610 application.SendNotification();
4611 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4613 // We didn't expect the animation to finish yet
4614 application.SendNotification();
4615 finishCheck.CheckSignalNotReceived();
4616 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4618 application.SendNotification();
4619 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4621 // We did expect the animation to finish
4622 application.SendNotification();
4623 finishCheck.CheckSignalReceived();
4624 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4626 // Check that nothing has changed after a couple of buffer swaps
4627 application.Render(0);
4628 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4629 application.Render(0);
4630 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4634 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4636 TestApplication application;
4638 Actor actor = Actor::New();
4640 // Register a Vector4 property
4641 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4642 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4643 application.GetScene().Add(actor);
4644 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4645 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4647 // Build the animation
4648 float durationSeconds(1.0f);
4649 Animation animation = Animation::New(durationSeconds);
4650 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4651 Vector4 relativeValue(targetValue - startValue);
4653 animation.AnimateBy(Property(actor, index),
4655 AlphaFunction::LINEAR,
4656 TimePeriod(delay, durationSeconds - delay));
4658 // Start the animation
4661 bool signalReceived(false);
4662 AnimationFinishCheck finishCheck(signalReceived);
4663 animation.FinishedSignal().Connect(&application, finishCheck);
4665 application.SendNotification();
4666 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4668 // We didn't expect the animation to finish yet
4669 application.SendNotification();
4670 finishCheck.CheckSignalNotReceived();
4671 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4673 application.SendNotification();
4674 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4676 // We didn't expect the animation to finish yet
4677 application.SendNotification();
4678 finishCheck.CheckSignalNotReceived();
4679 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4681 application.SendNotification();
4682 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4684 // We did expect the animation to finish
4685 application.SendNotification();
4686 finishCheck.CheckSignalReceived();
4687 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4689 // Check that nothing has changed after a couple of buffer swaps
4690 application.Render(0);
4691 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4692 application.Render(0);
4693 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4697 int UtcDaliAnimationAnimateByActorPositionP(void)
4699 TestApplication application;
4701 Actor actor = Actor::New();
4702 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4703 actor.SetProperty(Actor::Property::POSITION, startPosition);
4704 application.GetScene().Add(actor);
4705 application.SendNotification();
4706 application.Render(0);
4707 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4709 // Build the animation
4710 float durationSeconds(1.0f);
4711 Animation animation = Animation::New(durationSeconds);
4712 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4713 Vector3 relativePosition(targetPosition - startPosition);
4714 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4716 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4718 // Start the animation
4721 // Target value should be retrievable straight away
4722 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4724 bool signalReceived(false);
4725 AnimationFinishCheck finishCheck(signalReceived);
4726 animation.FinishedSignal().Connect(&application, finishCheck);
4728 application.SendNotification();
4729 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4731 // We didn't expect the animation to finish yet
4732 application.SendNotification();
4733 finishCheck.CheckSignalNotReceived();
4734 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
4736 application.SendNotification();
4737 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4739 // We did expect the animation to finish
4740 application.SendNotification();
4741 finishCheck.CheckSignalReceived();
4742 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4744 // Check that nothing has changed after a couple of buffer swaps
4745 application.Render(0);
4746 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4747 application.Render(0);
4748 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4752 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4754 TestApplication application;
4756 Actor actor = Actor::New();
4757 application.GetScene().Add(actor);
4758 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4760 // Build the animation
4761 float durationSeconds(1.0f);
4762 Animation animation = Animation::New(durationSeconds);
4763 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4764 Vector3 relativePosition(targetPosition - Vector3::ZERO);
4765 animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
4766 animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
4767 animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
4769 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4770 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4772 // Start the animation
4775 // Target value should be retrievable straight away
4776 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4777 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
4778 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
4779 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
4781 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
4783 application.SendNotification();
4784 application.Render(1000); // 1 second progress
4786 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4791 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4793 TestApplication application;
4795 Actor actor = Actor::New();
4796 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4797 actor.SetProperty(Actor::Property::POSITION, startPosition);
4798 application.GetScene().Add(actor);
4799 application.SendNotification();
4800 application.Render(0);
4801 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4803 // Build the animation
4804 float durationSeconds(1.0f);
4805 Animation animation = Animation::New(durationSeconds);
4806 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4807 Vector3 relativePosition(targetPosition - startPosition);
4808 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4810 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4812 // Start the animation
4815 bool signalReceived(false);
4816 AnimationFinishCheck finishCheck(signalReceived);
4817 animation.FinishedSignal().Connect(&application, finishCheck);
4819 application.SendNotification();
4820 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4822 // We didn't expect the animation to finish yet
4823 application.SendNotification();
4824 finishCheck.CheckSignalNotReceived();
4826 // The position should have moved more, than with a linear alpha function
4827 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
4828 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
4829 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
4830 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
4832 application.SendNotification();
4833 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4835 // We did expect the animation to finish
4836 application.SendNotification();
4837 finishCheck.CheckSignalReceived();
4838 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4840 // Check that nothing has changed after a couple of buffer swaps
4841 application.Render(0);
4842 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4843 application.Render(0);
4844 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4848 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4850 TestApplication application;
4852 Actor actor = Actor::New();
4853 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4854 actor.SetProperty(Actor::Property::POSITION, startPosition);
4855 application.GetScene().Add(actor);
4856 application.SendNotification();
4857 application.Render(0);
4858 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4860 // Build the animation
4861 float durationSeconds(1.0f);
4862 Animation animation = Animation::New(durationSeconds);
4863 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4864 Vector3 relativePosition(targetPosition - startPosition);
4866 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4868 TimePeriod(delay, durationSeconds - delay));
4870 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4872 // Start the animation
4875 bool signalReceived(false);
4876 AnimationFinishCheck finishCheck(signalReceived);
4877 animation.FinishedSignal().Connect(&application, finishCheck);
4879 application.SendNotification();
4880 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4882 // We didn't expect the animation to finish yet
4883 application.SendNotification();
4884 finishCheck.CheckSignalNotReceived();
4885 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4887 application.SendNotification();
4888 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
4890 // We did expect the animation to finish
4891 application.SendNotification();
4892 finishCheck.CheckSignalReceived();
4893 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4895 // Check that nothing has changed after a couple of buffer swaps
4896 application.Render(0);
4897 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4898 application.Render(0);
4899 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4903 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4905 TestApplication application;
4907 Actor actor = Actor::New();
4908 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4909 actor.SetProperty(Actor::Property::POSITION, startPosition);
4910 application.GetScene().Add(actor);
4911 application.SendNotification();
4912 application.Render(0);
4913 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4915 // Build the animation
4916 float durationSeconds(1.0f);
4917 Animation animation = Animation::New(durationSeconds);
4918 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4919 Vector3 relativePosition(targetPosition - startPosition);
4921 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4923 AlphaFunction::LINEAR,
4924 TimePeriod(delay, durationSeconds - delay));
4926 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4928 // Start the animation
4931 bool signalReceived(false);
4932 AnimationFinishCheck finishCheck(signalReceived);
4933 animation.FinishedSignal().Connect(&application, finishCheck);
4935 application.SendNotification();
4936 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4938 // We didn't expect the animation to finish yet
4939 application.SendNotification();
4940 finishCheck.CheckSignalNotReceived();
4941 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4943 application.SendNotification();
4944 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
4946 // We did expect the animation to finish
4947 application.SendNotification();
4948 finishCheck.CheckSignalReceived();
4949 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4951 // Check that nothing has changed after a couple of buffer swaps
4952 application.Render(0);
4953 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4954 application.Render(0);
4955 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4959 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4961 TestApplication application;
4963 Actor actor = Actor::New();
4964 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
4965 application.GetScene().Add(actor);
4966 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
4968 // Build the animation
4969 float durationSeconds(1.0f);
4970 Animation animation = Animation::New(durationSeconds);
4971 Degree relativeRotationDegrees(360.0f);
4972 Radian relativeRotationRadians(relativeRotationDegrees);
4973 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
4975 // Start the animation
4978 // Target value should be retrievable straight away
4979 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
4981 bool signalReceived(false);
4982 AnimationFinishCheck finishCheck(signalReceived);
4983 animation.FinishedSignal().Connect(&application, finishCheck);
4985 application.SendNotification();
4986 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
4988 // We didn't expect the animation to finish yet
4989 application.SendNotification();
4990 finishCheck.CheckSignalNotReceived();
4991 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
4993 application.SendNotification();
4994 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
4996 // We didn't expect the animation to finish yet
4997 application.SendNotification();
4998 finishCheck.CheckSignalNotReceived();
4999 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5001 application.SendNotification();
5002 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5004 // We didn't expect the animation to finish yet
5005 application.SendNotification();
5006 finishCheck.CheckSignalNotReceived();
5007 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5009 application.SendNotification();
5010 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5012 // We did expect the animation to finish
5013 application.SendNotification();
5014 finishCheck.CheckSignalReceived();
5015 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5019 int UtcDaliAnimationAnimateByActorOrientationP2(void)
5021 TestApplication application;
5023 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
5025 Actor actor = Actor::New();
5026 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5027 application.GetScene().Add(actor);
5028 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5030 // Build the animation
5031 float durationSeconds(1.0f);
5032 Animation animation = Animation::New(durationSeconds);
5033 Degree relativeRotationDegrees(710.0f);
5034 Radian relativeRotationRadians(relativeRotationDegrees);
5036 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
5038 // Start the animation
5041 bool signalReceived(false);
5042 AnimationFinishCheck finishCheck(signalReceived);
5043 animation.FinishedSignal().Connect(&application, finishCheck);
5045 application.SendNotification();
5046 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5048 // We didn't expect the animation to finish yet
5049 application.SendNotification();
5050 finishCheck.CheckSignalNotReceived();
5051 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5053 application.SendNotification();
5054 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5056 // We didn't expect the animation to finish yet
5057 application.SendNotification();
5058 finishCheck.CheckSignalNotReceived();
5059 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5061 application.SendNotification();
5062 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5064 // We didn't expect the animation to finish yet
5065 application.SendNotification();
5066 finishCheck.CheckSignalNotReceived();
5067 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5069 application.SendNotification();
5070 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5072 // We did expect the animation to finish
5073 application.SendNotification();
5074 finishCheck.CheckSignalReceived();
5075 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5079 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5081 TestApplication application;
5083 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5085 Actor actor = Actor::New();
5086 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5087 application.GetScene().Add(actor);
5088 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5090 // Build the animation
5091 float durationSeconds(1.0f);
5092 Animation animation = Animation::New(durationSeconds);
5093 Degree relativeRotationDegrees(730.0f);
5094 Radian relativeRotationRadians(relativeRotationDegrees);
5096 Radian actualRotationRadians(Degree(10.0f));
5098 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
5100 // Start the animation
5103 bool signalReceived(false);
5104 AnimationFinishCheck finishCheck(signalReceived);
5105 animation.FinishedSignal().Connect(&application, finishCheck);
5107 application.SendNotification();
5108 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5110 // We didn't expect the animation to finish yet
5111 application.SendNotification();
5112 finishCheck.CheckSignalNotReceived();
5113 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5115 application.SendNotification();
5116 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5118 // We didn't expect the animation to finish yet
5119 application.SendNotification();
5120 finishCheck.CheckSignalNotReceived();
5121 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5123 application.SendNotification();
5124 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5126 // We didn't expect the animation to finish yet
5127 application.SendNotification();
5128 finishCheck.CheckSignalNotReceived();
5129 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5131 application.SendNotification();
5132 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5134 // We did expect the animation to finish
5135 application.SendNotification();
5136 finishCheck.CheckSignalReceived();
5137 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5138 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5142 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5144 TestApplication application;
5146 Actor actor = Actor::New();
5147 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5148 application.GetScene().Add(actor);
5149 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5151 // Build the animation
5152 float durationSeconds(1.0f);
5153 Animation animation = Animation::New(durationSeconds);
5154 Degree relativeRotationDegrees(360.0f);
5155 Radian relativeRotationRadians(relativeRotationDegrees);
5156 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
5158 // Start the animation
5161 bool signalReceived(false);
5162 AnimationFinishCheck finishCheck(signalReceived);
5163 animation.FinishedSignal().Connect(&application, finishCheck);
5165 application.SendNotification();
5166 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5168 // We didn't expect the animation to finish yet
5169 application.SendNotification();
5170 finishCheck.CheckSignalNotReceived();
5171 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5173 application.SendNotification();
5174 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5176 // We didn't expect the animation to finish yet
5177 application.SendNotification();
5178 finishCheck.CheckSignalNotReceived();
5179 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5181 application.SendNotification();
5182 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5184 // We didn't expect the animation to finish yet
5185 application.SendNotification();
5186 finishCheck.CheckSignalNotReceived();
5187 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5189 application.SendNotification();
5190 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5192 // We did expect the animation to finish
5193 application.SendNotification();
5194 finishCheck.CheckSignalReceived();
5195 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5199 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5201 TestApplication application;
5203 Actor actor = Actor::New();
5204 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5205 application.GetScene().Add(actor);
5206 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5208 // Build the animation
5209 float durationSeconds(1.0f);
5210 Animation animation = Animation::New(durationSeconds);
5211 Degree relativeRotationDegrees(360.0f);
5212 Radian relativeRotationRadians(relativeRotationDegrees);
5214 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
5216 // Start the animation
5219 bool signalReceived(false);
5220 AnimationFinishCheck finishCheck(signalReceived);
5221 animation.FinishedSignal().Connect(&application, finishCheck);
5223 application.SendNotification();
5224 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5226 // We didn't expect the animation to finish yet
5227 application.SendNotification();
5228 finishCheck.CheckSignalNotReceived();
5229 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5230 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5232 application.SendNotification();
5233 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5235 // We didn't expect the animation to finish yet
5236 application.SendNotification();
5237 finishCheck.CheckSignalNotReceived();
5238 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5239 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5241 application.SendNotification();
5242 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5244 // We didn't expect the animation to finish yet
5245 application.SendNotification();
5246 finishCheck.CheckSignalNotReceived();
5247 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5248 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5250 application.SendNotification();
5251 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5253 // We did expect the animation to finish
5254 application.SendNotification();
5255 finishCheck.CheckSignalReceived();
5256 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5260 int UtcDaliAnimationAnimateByActorScaleP(void)
5262 TestApplication application;
5264 Actor actor = Actor::New();
5265 application.GetScene().Add(actor);
5266 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5268 // Build the animation
5269 float durationSeconds(1.0f);
5270 Animation animation = Animation::New(durationSeconds);
5271 Vector3 targetScale(2.0f, 2.0f, 2.0f);
5272 Vector3 relativeScale(targetScale - Vector3::ONE);
5273 animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
5275 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
5277 // Start the animation
5280 // Target value should be retrievable straight away
5281 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5283 bool signalReceived(false);
5284 AnimationFinishCheck finishCheck(signalReceived);
5285 animation.FinishedSignal().Connect(&application, finishCheck);
5287 application.SendNotification();
5288 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5290 // We didn't expect the animation to finish yet
5291 application.SendNotification();
5292 finishCheck.CheckSignalNotReceived();
5293 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
5295 application.SendNotification();
5296 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5298 // We did expect the animation to finish
5299 application.SendNotification();
5300 finishCheck.CheckSignalReceived();
5301 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5304 finishCheck.Reset();
5305 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5306 application.SendNotification();
5307 application.Render(0);
5308 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5310 // Repeat with a different (ease-in) alpha function
5311 animation = Animation::New(durationSeconds);
5312 animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
5313 animation.FinishedSignal().Connect(&application, finishCheck);
5316 application.SendNotification();
5317 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5319 // We didn't expect the animation to finish yet
5320 application.SendNotification();
5321 finishCheck.CheckSignalNotReceived();
5323 // The scale should have grown less, than with a linear alpha function
5324 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
5325 DALI_TEST_CHECK(current.x > 1.0f);
5326 DALI_TEST_CHECK(current.y > 1.0f);
5327 DALI_TEST_CHECK(current.z > 1.0f);
5328 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
5329 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
5330 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
5332 application.SendNotification();
5333 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5335 // We did expect the animation to finish
5336 application.SendNotification();
5337 finishCheck.CheckSignalReceived();
5338 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5341 finishCheck.Reset();
5342 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5343 application.SendNotification();
5344 application.Render(0);
5345 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5347 // Repeat with a delay
5349 animation = Animation::New(durationSeconds);
5350 animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5351 animation.FinishedSignal().Connect(&application, finishCheck);
5354 application.SendNotification();
5355 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5357 // We didn't expect the animation to finish yet
5358 application.SendNotification();
5359 finishCheck.CheckSignalNotReceived();
5360 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5362 application.SendNotification();
5363 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5365 // We did expect the animation to finish
5366 application.SendNotification();
5367 finishCheck.CheckSignalReceived();
5368 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5372 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5374 TestApplication application;
5376 Actor actor = Actor::New();
5377 application.GetScene().Add(actor);
5378 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5380 // Build the animation
5381 float durationSeconds(1.0f);
5382 Animation animation = Animation::New(durationSeconds);
5383 Vector3 targetScale(2.0f, 3.0f, 4.0f);
5384 Vector3 relativeScale(targetScale - Vector3::ONE);
5385 animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
5386 animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
5387 animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
5389 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5390 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5392 // Start the animation
5395 // Target value should be retrievable straight away
5396 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5397 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
5398 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
5399 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
5401 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
5403 application.SendNotification();
5404 application.Render(1000); // 1 second progress
5406 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5411 int UtcDaliAnimationAnimateByActorColorP(void)
5413 TestApplication application;
5415 Actor actor = Actor::New();
5416 application.GetScene().Add(actor);
5417 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5419 // Build the animation
5420 float durationSeconds(1.0f);
5421 Animation animation = Animation::New(durationSeconds);
5422 Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5423 Vector4 relativeColor(targetColor - Color::WHITE);
5424 animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
5426 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5427 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5429 // Start the animation
5432 // Target value should be retrievable straight away
5433 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5434 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5435 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5436 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5437 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5439 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5441 application.SendNotification();
5442 application.Render(1000); // 1 second progress
5444 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5449 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5451 TestApplication application;
5453 Actor actor = Actor::New();
5454 application.GetScene().Add(actor);
5455 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5457 // Build the animation
5458 float durationSeconds(1.0f);
5459 Animation animation = Animation::New(durationSeconds);
5460 Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5461 Vector4 relativeColor(targetColor - Color::WHITE);
5462 animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
5463 animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
5464 animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
5465 animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
5467 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5468 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5470 // Start the animation
5473 // Target value should be retrievable straight away
5474 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5475 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5476 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5477 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5478 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5480 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5482 application.SendNotification();
5483 application.Render(1000); // 1 second progress
5485 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5490 int UtcDaliAnimationAnimateByActorSizeP(void)
5492 TestApplication application;
5494 Actor actor = Actor::New();
5495 application.GetScene().Add(actor);
5496 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5498 // Build the animation
5499 float durationSeconds(1.0f);
5500 Animation animation = Animation::New(durationSeconds);
5501 Vector3 targetSize(100.0f, 200.0f, 300.0f);
5502 Vector3 relativeSize(targetSize - Vector3::ZERO);
5503 animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
5505 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5506 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5508 // Start the animation
5511 // Target value should be retrievable straight away
5512 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5513 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5514 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5515 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5517 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5519 application.SendNotification();
5520 application.Render(1000); // 1 second progress
5522 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5527 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5529 TestApplication application;
5531 Actor actor = Actor::New();
5532 application.GetScene().Add(actor);
5533 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5535 // Build the animation
5536 float durationSeconds(1.0f);
5537 Animation animation = Animation::New(durationSeconds);
5538 Vector3 targetSize(100.0f, 200.0f, 300.0f);
5539 Vector3 relativeSize(targetSize - Vector3::ZERO);
5540 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
5541 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
5542 animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
5544 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5545 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5547 // Start the animation
5550 // Target value should be retrievable straight away
5551 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5552 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5553 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5554 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5556 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5558 application.SendNotification();
5559 application.Render(1000); // 1 second progress
5561 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5566 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5568 TestApplication application;
5570 Actor actor = Actor::New();
5571 application.GetScene().Add(actor);
5572 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5574 actor.SetProperty(Actor::Property::VISIBLE, false);
5576 application.SendNotification();
5577 application.Render();
5579 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5581 // Build the animation
5582 float durationSeconds(1.0f);
5583 Animation animation = Animation::New(durationSeconds);
5584 bool targetVisibility(true);
5585 bool relativeVisibility(targetVisibility);
5586 animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
5588 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5590 // Start the animation
5593 // Target value should be retrievable straight away
5594 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
5595 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
5597 application.SendNotification();
5598 application.Render(1000); // 1 second progress
5600 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5605 int UtcDaliAnimationAnimateToBooleanP(void)
5607 TestApplication application;
5609 Actor actor = Actor::New();
5611 // Register a boolean property
5612 const bool startValue(false);
5613 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5614 application.GetScene().Add(actor);
5615 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5616 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5618 // Build the animation
5619 float durationSeconds(2.0f);
5620 Animation animation = Animation::New(durationSeconds);
5621 const bool targetValue(!startValue);
5622 animation.AnimateTo(Property(actor, index), targetValue);
5624 // Start the animation
5627 bool signalReceived(false);
5628 AnimationFinishCheck finishCheck(signalReceived);
5629 animation.FinishedSignal().Connect(&application, finishCheck);
5631 application.SendNotification();
5632 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5634 // We didn't expect the animation to finish yet
5635 application.SendNotification();
5636 finishCheck.CheckSignalNotReceived();
5637 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5639 application.SendNotification();
5640 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5642 // We did expect the animation to finish
5643 application.SendNotification();
5644 finishCheck.CheckSignalReceived();
5645 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5647 // Check that nothing has changed after a couple of buffer swaps
5648 application.Render(0);
5649 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5650 application.Render(0);
5651 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5653 // Repeat with target value "false"
5654 animation = Animation::New(durationSeconds);
5655 const bool finalValue(!targetValue);
5656 animation.AnimateTo(Property(actor, index), finalValue);
5658 // Start the animation
5661 finishCheck.Reset();
5662 animation.FinishedSignal().Connect(&application, finishCheck);
5664 application.SendNotification();
5665 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5667 // We didn't expect the animation to finish yet
5668 application.SendNotification();
5669 finishCheck.CheckSignalNotReceived();
5670 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5672 application.SendNotification();
5673 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5675 // We did expect the animation to finish
5676 application.SendNotification();
5677 finishCheck.CheckSignalReceived();
5678 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5680 // Check that nothing has changed after a couple of buffer swaps
5681 application.Render(0);
5682 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5683 application.Render(0);
5684 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5688 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5690 TestApplication application;
5692 Actor actor = Actor::New();
5694 // Register a boolean property
5695 const bool startValue(false);
5696 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5697 application.GetScene().Add(actor);
5698 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5699 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5701 // Build the animation
5702 float durationSeconds(2.0f);
5703 Animation animation = Animation::New(durationSeconds);
5704 const bool targetValue(!startValue);
5705 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5707 // Start the animation
5710 bool signalReceived(false);
5711 AnimationFinishCheck finishCheck(signalReceived);
5712 animation.FinishedSignal().Connect(&application, finishCheck);
5714 application.SendNotification();
5715 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5717 // We didn't expect the animation to finish yet
5718 application.SendNotification();
5719 finishCheck.CheckSignalNotReceived();
5720 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5722 application.SendNotification();
5723 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5725 // We did expect the animation to finish
5726 application.SendNotification();
5727 finishCheck.CheckSignalReceived();
5728 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5730 // Check that nothing has changed after a couple of buffer swaps
5731 application.Render(0);
5732 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5733 application.Render(0);
5734 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5736 // Repeat with target value "false"
5737 animation = Animation::New(durationSeconds);
5738 const bool finalValue(!targetValue);
5739 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5741 // Start the animation
5744 finishCheck.Reset();
5745 animation.FinishedSignal().Connect(&application, finishCheck);
5747 application.SendNotification();
5748 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5750 // We didn't expect the animation to finish yet
5751 application.SendNotification();
5752 finishCheck.CheckSignalNotReceived();
5753 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5755 application.SendNotification();
5756 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5758 // We did expect the animation to finish
5759 application.SendNotification();
5760 finishCheck.CheckSignalReceived();
5761 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5763 // Check that nothing has changed after a couple of buffer swaps
5764 application.Render(0);
5765 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5766 application.Render(0);
5767 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5771 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5773 TestApplication application;
5775 Actor actor = Actor::New();
5777 // Register a boolean property
5778 bool startValue(false);
5779 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5780 application.GetScene().Add(actor);
5781 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5782 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5784 // Build the animation
5785 float durationSeconds(2.0f);
5786 Animation animation = Animation::New(durationSeconds);
5787 bool finalValue(!startValue);
5788 float animatorDurationSeconds(durationSeconds * 0.5f);
5789 animation.AnimateTo(Property(actor, index),
5791 TimePeriod(animatorDurationSeconds));
5793 // Start the animation
5796 bool signalReceived(false);
5797 AnimationFinishCheck finishCheck(signalReceived);
5798 animation.FinishedSignal().Connect(&application, finishCheck);
5800 application.SendNotification();
5801 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5803 // We didn't expect the animation to finish yet
5804 application.SendNotification();
5805 finishCheck.CheckSignalNotReceived();
5806 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5808 application.SendNotification();
5809 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5811 // We didn't expect the animation to finish yet...
5812 application.SendNotification();
5813 finishCheck.CheckSignalNotReceived();
5815 // ...however we should have reached the final value
5816 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5818 application.SendNotification();
5819 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5821 // We did expect the animation to finish
5822 application.SendNotification();
5823 finishCheck.CheckSignalReceived();
5824 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5826 // Check that nothing has changed after a couple of buffer swaps
5827 application.Render(0);
5828 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5829 application.Render(0);
5830 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5834 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5836 TestApplication application;
5838 Actor actor = Actor::New();
5840 // Register a boolean property
5841 bool startValue(false);
5842 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5843 application.GetScene().Add(actor);
5844 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5845 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5847 // Build the animation
5848 float durationSeconds(2.0f);
5849 Animation animation = Animation::New(durationSeconds);
5850 bool finalValue(!startValue);
5851 float animatorDurationSeconds(durationSeconds * 0.5f);
5852 animation.AnimateTo(Property(actor, index),
5854 AlphaFunction::LINEAR,
5855 TimePeriod(animatorDurationSeconds));
5857 // Start the animation
5860 bool signalReceived(false);
5861 AnimationFinishCheck finishCheck(signalReceived);
5862 animation.FinishedSignal().Connect(&application, finishCheck);
5864 application.SendNotification();
5865 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5867 // We didn't expect the animation to finish yet
5868 application.SendNotification();
5869 finishCheck.CheckSignalNotReceived();
5870 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5872 application.SendNotification();
5873 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5875 // We didn't expect the animation to finish yet...
5876 application.SendNotification();
5877 finishCheck.CheckSignalNotReceived();
5879 // ...however we should have reached the final value
5880 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5882 application.SendNotification();
5883 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5885 // We did expect the animation to finish
5886 application.SendNotification();
5887 finishCheck.CheckSignalReceived();
5888 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5890 // Check that nothing has changed after a couple of buffer swaps
5891 application.Render(0);
5892 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5893 application.Render(0);
5894 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5898 int UtcDaliAnimationAnimateToFloatP(void)
5900 TestApplication application;
5902 Actor actor = Actor::New();
5904 // Register a float property
5905 float startValue(10.0f);
5906 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5907 application.GetScene().Add(actor);
5908 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
5909 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
5911 // Build the animation
5912 float durationSeconds(2.0f);
5913 Animation animation = Animation::New(durationSeconds);
5914 float targetValue(50.0f);
5915 float relativeValue(targetValue - startValue);
5916 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5918 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
5920 // Start the animation
5923 bool signalReceived(false);
5924 AnimationFinishCheck finishCheck(signalReceived);
5925 animation.FinishedSignal().Connect(&application, finishCheck);
5927 application.SendNotification();
5928 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5930 // We didn't expect the animation to finish yet
5931 application.SendNotification();
5932 finishCheck.CheckSignalNotReceived();
5933 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
5935 application.SendNotification();
5936 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5938 // We did expect the animation to finish
5939 application.SendNotification();
5940 finishCheck.CheckSignalReceived();
5941 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
5945 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5947 TestApplication application;
5949 Actor actor = Actor::New();
5951 // Register a float property
5952 float startValue(10.0f);
5953 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5954 application.GetScene().Add(actor);
5955 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
5956 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
5958 // Build the animation
5959 float durationSeconds(1.0f);
5960 Animation animation = Animation::New(durationSeconds);
5961 float targetValue(90.0f);
5962 float relativeValue(targetValue - startValue);
5963 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5965 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
5967 // Start the animation
5970 bool signalReceived(false);
5971 AnimationFinishCheck finishCheck(signalReceived);
5972 animation.FinishedSignal().Connect(&application, finishCheck);
5974 application.SendNotification();
5975 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5977 // We didn't expect the animation to finish yet
5978 application.SendNotification();
5979 finishCheck.CheckSignalNotReceived();
5981 // The position should have moved more, than with a linear alpha function
5982 float current(actor.GetCurrentProperty<float>(index));
5983 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
5985 application.SendNotification();
5986 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5988 // We did expect the animation to finish
5989 application.SendNotification();
5990 finishCheck.CheckSignalReceived();
5991 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
5995 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5997 TestApplication application;
5999 Actor actor = Actor::New();
6001 // Register a float property
6002 float startValue(10.0f);
6003 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6004 application.GetScene().Add(actor);
6005 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6006 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6008 // Build the animation
6009 float durationSeconds(1.0f);
6010 Animation animation = Animation::New(durationSeconds);
6011 float targetValue(30.0f);
6012 float relativeValue(targetValue - startValue);
6014 animation.AnimateTo(Property(actor, index),
6016 TimePeriod(delay, durationSeconds - delay));
6018 // Start the animation
6021 bool signalReceived(false);
6022 AnimationFinishCheck finishCheck(signalReceived);
6023 animation.FinishedSignal().Connect(&application, finishCheck);
6025 application.SendNotification();
6026 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6028 // We didn't expect the animation to finish yet
6029 application.SendNotification();
6030 finishCheck.CheckSignalNotReceived();
6031 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6033 application.SendNotification();
6034 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6036 // We didn't expect the animation to finish yet
6037 application.SendNotification();
6038 finishCheck.CheckSignalNotReceived();
6039 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6041 application.SendNotification();
6042 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6044 // We did expect the animation to finish
6045 application.SendNotification();
6046 finishCheck.CheckSignalReceived();
6047 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6051 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
6053 TestApplication application;
6055 Actor actor = Actor::New();
6057 // Register a float property
6058 float startValue(10.0f);
6059 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6060 application.GetScene().Add(actor);
6061 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6062 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6064 // Build the animation
6065 float durationSeconds(1.0f);
6066 Animation animation = Animation::New(durationSeconds);
6067 float targetValue(30.0f);
6068 float relativeValue(targetValue - startValue);
6070 animation.AnimateTo(Property(actor, index),
6072 AlphaFunction::LINEAR,
6073 TimePeriod(delay, durationSeconds - delay));
6075 // Start the animation
6078 bool signalReceived(false);
6079 AnimationFinishCheck finishCheck(signalReceived);
6080 animation.FinishedSignal().Connect(&application, finishCheck);
6082 application.SendNotification();
6083 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6085 // We didn't expect the animation to finish yet
6086 application.SendNotification();
6087 finishCheck.CheckSignalNotReceived();
6088 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6090 application.SendNotification();
6091 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6093 // We didn't expect the animation to finish yet
6094 application.SendNotification();
6095 finishCheck.CheckSignalNotReceived();
6096 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6098 application.SendNotification();
6099 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6101 // We did expect the animation to finish
6102 application.SendNotification();
6103 finishCheck.CheckSignalReceived();
6104 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6108 int UtcDaliAnimationAnimateToIntegerP(void)
6110 TestApplication application;
6112 Actor actor = Actor::New();
6114 // Register an integer property
6116 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6117 application.GetScene().Add(actor);
6118 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6119 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6121 // Build the animation
6122 float durationSeconds(2.0f);
6123 Animation animation = Animation::New(durationSeconds);
6124 int targetValue(50);
6125 int relativeValue(targetValue - startValue);
6126 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6128 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6130 // Start the animation
6133 bool signalReceived(false);
6134 AnimationFinishCheck finishCheck(signalReceived);
6135 animation.FinishedSignal().Connect(&application, finishCheck);
6137 application.SendNotification();
6138 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6140 // We didn't expect the animation to finish yet
6141 application.SendNotification();
6142 finishCheck.CheckSignalNotReceived();
6143 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
6145 application.SendNotification();
6146 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6148 // We did expect the animation to finish
6149 application.SendNotification();
6150 finishCheck.CheckSignalReceived();
6151 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6155 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6157 TestApplication application;
6159 Actor actor = Actor::New();
6161 // Register an integer property
6163 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6164 application.GetScene().Add(actor);
6165 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6166 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6168 // Build the animation
6169 float durationSeconds(1.0f);
6170 Animation animation = Animation::New(durationSeconds);
6171 int targetValue(90);
6172 int relativeValue(targetValue - startValue);
6173 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6175 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6177 // Start the animation
6180 bool signalReceived(false);
6181 AnimationFinishCheck finishCheck(signalReceived);
6182 animation.FinishedSignal().Connect(&application, finishCheck);
6184 application.SendNotification();
6185 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6187 // We didn't expect the animation to finish yet
6188 application.SendNotification();
6189 finishCheck.CheckSignalNotReceived();
6191 // The position should have moved more, than with a linear alpha function
6192 int current(actor.GetCurrentProperty<int>(index));
6193 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6195 application.SendNotification();
6196 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6198 // We did expect the animation to finish
6199 application.SendNotification();
6200 finishCheck.CheckSignalReceived();
6201 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6205 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6207 TestApplication application;
6209 Actor actor = Actor::New();
6211 // Register an integer property
6213 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6214 application.GetScene().Add(actor);
6215 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6216 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6218 // Build the animation
6219 float durationSeconds(1.0f);
6220 Animation animation = Animation::New(durationSeconds);
6221 int targetValue(30);
6222 int relativeValue(targetValue - startValue);
6224 animation.AnimateTo(Property(actor, index),
6226 TimePeriod(delay, durationSeconds - delay));
6228 // Start the animation
6231 bool signalReceived(false);
6232 AnimationFinishCheck finishCheck(signalReceived);
6233 animation.FinishedSignal().Connect(&application, finishCheck);
6235 application.SendNotification();
6236 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6238 // We didn't expect the animation to finish yet
6239 application.SendNotification();
6240 finishCheck.CheckSignalNotReceived();
6241 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6243 application.SendNotification();
6244 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6246 // We didn't expect the animation to finish yet
6247 application.SendNotification();
6248 finishCheck.CheckSignalNotReceived();
6249 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6251 application.SendNotification();
6252 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6254 // We did expect the animation to finish
6255 application.SendNotification();
6256 finishCheck.CheckSignalReceived();
6257 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6261 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6263 TestApplication application;
6265 Actor actor = Actor::New();
6267 // Register an integer property
6269 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6270 application.GetScene().Add(actor);
6271 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6272 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6274 // Build the animation
6275 float durationSeconds(1.0f);
6276 Animation animation = Animation::New(durationSeconds);
6277 int targetValue(30);
6278 int relativeValue(targetValue - startValue);
6280 animation.AnimateTo(Property(actor, index),
6282 AlphaFunction::LINEAR,
6283 TimePeriod(delay, durationSeconds - delay));
6285 // Start the animation
6288 bool signalReceived(false);
6289 AnimationFinishCheck finishCheck(signalReceived);
6290 animation.FinishedSignal().Connect(&application, finishCheck);
6292 application.SendNotification();
6293 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6295 // We didn't expect the animation to finish yet
6296 application.SendNotification();
6297 finishCheck.CheckSignalNotReceived();
6298 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6300 application.SendNotification();
6301 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6303 // We didn't expect the animation to finish yet
6304 application.SendNotification();
6305 finishCheck.CheckSignalNotReceived();
6306 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6308 application.SendNotification();
6309 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6311 // We did expect the animation to finish
6312 application.SendNotification();
6313 finishCheck.CheckSignalReceived();
6314 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6318 int UtcDaliAnimationAnimateToVector2P(void)
6320 TestApplication application;
6322 Actor actor = Actor::New();
6324 // Register a Vector2 property
6325 Vector2 startValue(-50.0f, -50.0f);
6326 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6327 application.GetScene().Add(actor);
6328 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6329 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6331 // Build the animation
6332 float durationSeconds(2.0f);
6333 Animation animation = Animation::New(durationSeconds);
6334 Vector2 targetValue(50.0f, 50.0f);
6335 Vector2 relativeValue(targetValue - startValue);
6336 animation.AnimateTo(Property(actor, index), targetValue);
6338 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6340 // Start the animation
6343 bool signalReceived(false);
6344 AnimationFinishCheck finishCheck(signalReceived);
6345 animation.FinishedSignal().Connect(&application, finishCheck);
6347 application.SendNotification();
6348 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6350 // We didn't expect the animation to finish yet
6351 application.SendNotification();
6352 finishCheck.CheckSignalNotReceived();
6353 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
6355 application.SendNotification();
6356 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6358 // We did expect the animation to finish
6359 application.SendNotification();
6360 finishCheck.CheckSignalReceived();
6361 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6365 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6367 TestApplication application;
6369 Actor actor = Actor::New();
6371 // Register a Vector2 property
6372 Vector2 startValue(1000.0f, 1000.0f);
6373 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6374 application.GetScene().Add(actor);
6375 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6376 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6378 // Build the animation
6379 float durationSeconds(1.0f);
6380 Animation animation = Animation::New(durationSeconds);
6381 Vector2 targetValue(9000.0f, 9000.0f);
6382 Vector2 relativeValue(targetValue - startValue);
6383 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6385 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6387 // Start the animation
6390 bool signalReceived(false);
6391 AnimationFinishCheck finishCheck(signalReceived);
6392 animation.FinishedSignal().Connect(&application, finishCheck);
6394 application.SendNotification();
6395 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6397 // We didn't expect the animation to finish yet
6398 application.SendNotification();
6399 finishCheck.CheckSignalNotReceived();
6401 // The position should have moved more, than with a linear alpha function
6402 Vector2 current(actor.GetCurrentProperty<Vector2>(index));
6403 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6404 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6406 application.SendNotification();
6407 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6409 // We did expect the animation to finish
6410 application.SendNotification();
6411 finishCheck.CheckSignalReceived();
6412 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6416 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6418 TestApplication application;
6420 Actor actor = Actor::New();
6422 // Register a Vector2 property
6423 Vector2 startValue(10.0f, 10.0f);
6424 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6425 application.GetScene().Add(actor);
6426 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6427 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6429 // Build the animation
6430 float durationSeconds(1.0f);
6431 Animation animation = Animation::New(durationSeconds);
6432 Vector2 targetValue(-10.0f, 20.0f);
6433 Vector2 relativeValue(targetValue - startValue);
6435 animation.AnimateTo(Property(actor, index),
6437 TimePeriod(delay, durationSeconds - delay));
6439 // Start the animation
6442 bool signalReceived(false);
6443 AnimationFinishCheck finishCheck(signalReceived);
6444 animation.FinishedSignal().Connect(&application, finishCheck);
6446 application.SendNotification();
6447 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6449 // We didn't expect the animation to finish yet
6450 application.SendNotification();
6451 finishCheck.CheckSignalNotReceived();
6452 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6454 application.SendNotification();
6455 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6457 // We didn't expect the animation to finish yet
6458 application.SendNotification();
6459 finishCheck.CheckSignalNotReceived();
6460 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6462 application.SendNotification();
6463 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6465 // We did expect the animation to finish
6466 application.SendNotification();
6467 finishCheck.CheckSignalReceived();
6468 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6472 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6474 TestApplication application;
6476 Actor actor = Actor::New();
6478 // Register a Vector2 property
6479 Vector2 startValue(10.0f, 10.0f);
6480 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6481 application.GetScene().Add(actor);
6482 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6483 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6485 // Build the animation
6486 float durationSeconds(1.0f);
6487 Animation animation = Animation::New(durationSeconds);
6488 Vector2 targetValue(30.0f, 30.0f);
6489 Vector2 relativeValue(targetValue - startValue);
6491 animation.AnimateTo(Property(actor, index),
6493 AlphaFunction::LINEAR,
6494 TimePeriod(delay, durationSeconds - delay));
6496 // Start the animation
6499 bool signalReceived(false);
6500 AnimationFinishCheck finishCheck(signalReceived);
6501 animation.FinishedSignal().Connect(&application, finishCheck);
6503 application.SendNotification();
6504 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6506 // We didn't expect the animation to finish yet, but cached value should be the final one
6507 application.SendNotification();
6508 finishCheck.CheckSignalNotReceived();
6509 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6510 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6512 application.SendNotification();
6513 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6515 // We didn't expect the animation to finish yet
6516 application.SendNotification();
6517 finishCheck.CheckSignalNotReceived();
6518 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6520 application.SendNotification();
6521 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6523 // We did expect the animation to finish
6524 application.SendNotification();
6525 finishCheck.CheckSignalReceived();
6526 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6527 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6531 int UtcDaliAnimationAnimateToVector3P(void)
6533 TestApplication application;
6535 Actor actor = Actor::New();
6537 // Register a Vector3 property
6538 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6539 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6540 application.GetScene().Add(actor);
6541 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6542 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6544 // Build the animation
6545 float durationSeconds(2.0f);
6546 Animation animation = Animation::New(durationSeconds);
6547 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6548 Vector3 relativeValue(targetValue - startValue);
6549 animation.AnimateTo(Property(actor, index), targetValue);
6551 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6553 // Start the animation
6556 bool signalReceived(false);
6557 AnimationFinishCheck finishCheck(signalReceived);
6558 animation.FinishedSignal().Connect(&application, finishCheck);
6560 application.SendNotification();
6561 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6563 // We didn't expect the animation to finish yet
6564 application.SendNotification();
6565 finishCheck.CheckSignalNotReceived();
6566 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
6568 application.SendNotification();
6569 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6571 // We did expect the animation to finish
6572 application.SendNotification();
6573 finishCheck.CheckSignalReceived();
6574 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6578 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6580 TestApplication application;
6582 Actor actor = Actor::New();
6584 // Register a Vector3 property
6585 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6586 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6587 application.GetScene().Add(actor);
6588 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6589 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6591 // Build the animation
6592 float durationSeconds(1.0f);
6593 Animation animation = Animation::New(durationSeconds);
6594 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6595 Vector3 relativeValue(targetValue - startValue);
6596 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6598 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6600 // Start the animation
6603 bool signalReceived(false);
6604 AnimationFinishCheck finishCheck(signalReceived);
6605 animation.FinishedSignal().Connect(&application, finishCheck);
6607 application.SendNotification();
6608 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6610 // We didn't expect the animation to finish yet
6611 application.SendNotification();
6612 finishCheck.CheckSignalNotReceived();
6614 // The position should have moved more, than with a linear alpha function
6615 Vector3 current(actor.GetCurrentProperty<Vector3>(index));
6616 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6617 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6618 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6620 application.SendNotification();
6621 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6623 // We did expect the animation to finish
6624 application.SendNotification();
6625 finishCheck.CheckSignalReceived();
6626 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6630 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6632 TestApplication application;
6634 Actor actor = Actor::New();
6636 // Register a Vector3 property
6637 Vector3 startValue(10.0f, 10.0f, 10.0f);
6638 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6639 application.GetScene().Add(actor);
6640 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6641 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6643 // Build the animation
6644 float durationSeconds(1.0f);
6645 Animation animation = Animation::New(durationSeconds);
6646 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6647 Vector3 relativeValue(targetValue - startValue);
6649 animation.AnimateTo(Property(actor, index),
6651 TimePeriod(delay, durationSeconds - delay));
6653 // Start the animation
6656 bool signalReceived(false);
6657 AnimationFinishCheck finishCheck(signalReceived);
6658 animation.FinishedSignal().Connect(&application, finishCheck);
6660 application.SendNotification();
6661 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6663 // We didn't expect the animation to finish yet
6664 application.SendNotification();
6665 finishCheck.CheckSignalNotReceived();
6666 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6668 application.SendNotification();
6669 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6671 // We didn't expect the animation to finish yet
6672 application.SendNotification();
6673 finishCheck.CheckSignalNotReceived();
6674 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6676 application.SendNotification();
6677 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6679 // We did expect the animation to finish
6680 application.SendNotification();
6681 finishCheck.CheckSignalReceived();
6682 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6686 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6688 TestApplication application;
6690 Actor actor = Actor::New();
6692 // Register a Vector3 property
6693 Vector3 startValue(10.0f, 10.0f, 10.0f);
6694 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6695 application.GetScene().Add(actor);
6696 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6697 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6699 // Build the animation
6700 float durationSeconds(1.0f);
6701 Animation animation = Animation::New(durationSeconds);
6702 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6703 Vector3 relativeValue(targetValue - startValue);
6705 animation.AnimateTo(Property(actor, "testProperty"),
6707 AlphaFunction::LINEAR,
6708 TimePeriod(delay, durationSeconds - delay));
6710 // Start the animation
6713 bool signalReceived(false);
6714 AnimationFinishCheck finishCheck(signalReceived);
6715 animation.FinishedSignal().Connect(&application, finishCheck);
6717 application.SendNotification();
6718 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6720 // We didn't expect the animation to finish yet
6721 application.SendNotification();
6722 finishCheck.CheckSignalNotReceived();
6723 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6725 application.SendNotification();
6726 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6728 // We didn't expect the animation to finish yet
6729 application.SendNotification();
6730 finishCheck.CheckSignalNotReceived();
6731 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6733 application.SendNotification();
6734 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6736 // We did expect the animation to finish
6737 application.SendNotification();
6738 finishCheck.CheckSignalReceived();
6739 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6743 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6745 TestApplication application;
6747 Actor actor = Actor::New();
6749 // Register a Vector3 property
6750 Vector3 startValue(10.0f, 10.0f, 10.0f);
6751 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6752 application.GetScene().Add(actor);
6753 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6754 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6756 // Build the animation
6757 float durationSeconds(1.0f);
6758 Animation animation = Animation::New(durationSeconds);
6759 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6760 Vector3 relativeValue(targetValue - startValue);
6762 animation.AnimateTo(Property(actor, "testProperty", 0),
6764 AlphaFunction::LINEAR,
6765 TimePeriod(delay, durationSeconds - delay));
6766 animation.AnimateTo(Property(actor, index, 1),
6768 AlphaFunction::LINEAR,
6769 TimePeriod(delay, durationSeconds - delay));
6771 // Start the animation
6774 bool signalReceived(false);
6775 AnimationFinishCheck finishCheck(signalReceived);
6776 animation.FinishedSignal().Connect(&application, finishCheck);
6778 application.SendNotification();
6779 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6781 // We didn't expect the animation to finish yet
6782 application.SendNotification();
6783 finishCheck.CheckSignalNotReceived();
6784 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6786 application.SendNotification();
6787 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6789 // We didn't expect the animation to finish yet
6790 application.SendNotification();
6791 finishCheck.CheckSignalNotReceived();
6792 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6794 application.SendNotification();
6795 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6797 // We did expect the animation to finish
6798 application.SendNotification();
6799 finishCheck.CheckSignalReceived();
6800 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6804 int UtcDaliAnimationAnimateToVector4P(void)
6806 TestApplication application;
6808 Actor actor = Actor::New();
6810 // Register a Vector4 property
6811 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6812 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6813 application.GetScene().Add(actor);
6814 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6815 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6817 // Build the animation
6818 float durationSeconds(2.0f);
6819 Animation animation = Animation::New(durationSeconds);
6820 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6821 Vector4 relativeValue(targetValue - startValue);
6822 animation.AnimateTo(Property(actor, index), targetValue);
6824 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6826 // Start the animation
6829 bool signalReceived(false);
6830 AnimationFinishCheck finishCheck(signalReceived);
6831 animation.FinishedSignal().Connect(&application, finishCheck);
6833 application.SendNotification();
6834 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6836 // We didn't expect the animation to finish yet
6837 application.SendNotification();
6838 finishCheck.CheckSignalNotReceived();
6839 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
6841 application.SendNotification();
6842 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6844 // We did expect the animation to finish
6845 application.SendNotification();
6846 finishCheck.CheckSignalReceived();
6847 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6851 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6853 TestApplication application;
6855 Actor actor = Actor::New();
6857 // Register a Vector4 property
6858 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6859 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6860 application.GetScene().Add(actor);
6861 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6862 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6864 // Build the animation
6865 float durationSeconds(1.0f);
6866 Animation animation = Animation::New(durationSeconds);
6867 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6868 Vector4 relativeValue(targetValue - startValue);
6869 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6871 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6873 // Start the animation
6876 bool signalReceived(false);
6877 AnimationFinishCheck finishCheck(signalReceived);
6878 animation.FinishedSignal().Connect(&application, finishCheck);
6880 application.SendNotification();
6881 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6883 // We didn't expect the animation to finish yet
6884 application.SendNotification();
6885 finishCheck.CheckSignalNotReceived();
6887 // The position should have moved more, than with a linear alpha function
6888 Vector4 current(actor.GetCurrentProperty<Vector4>(index));
6889 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6890 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6891 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6892 DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
6894 application.SendNotification();
6895 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6897 // We did expect the animation to finish
6898 application.SendNotification();
6899 finishCheck.CheckSignalReceived();
6900 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6904 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6906 TestApplication application;
6908 Actor actor = Actor::New();
6910 // Register a Vector4 property
6911 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6912 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6913 application.GetScene().Add(actor);
6914 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6915 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
6917 // Build the animation
6918 float durationSeconds(1.0f);
6919 Animation animation = Animation::New(durationSeconds);
6920 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6921 Vector4 relativeValue(targetValue - startValue);
6923 animation.AnimateTo(Property(actor, index),
6925 TimePeriod(delay, durationSeconds - delay));
6927 // Start the animation
6930 bool signalReceived(false);
6931 AnimationFinishCheck finishCheck(signalReceived);
6932 animation.FinishedSignal().Connect(&application, finishCheck);
6934 application.SendNotification();
6935 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6937 // We didn't expect the animation to finish yet
6938 application.SendNotification();
6939 finishCheck.CheckSignalNotReceived();
6940 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
6942 application.SendNotification();
6943 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6945 // We didn't expect the animation to finish yet
6946 application.SendNotification();
6947 finishCheck.CheckSignalNotReceived();
6948 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
6950 application.SendNotification();
6951 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6953 // We did expect the animation to finish
6954 application.SendNotification();
6955 finishCheck.CheckSignalReceived();
6956 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
6960 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6962 TestApplication application;
6964 Actor actor = Actor::New();
6966 // Register a Vector4 property
6967 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6968 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6969 application.GetScene().Add(actor);
6970 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6971 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6973 // Build the animation
6974 float durationSeconds(1.0f);
6975 Animation animation = Animation::New(durationSeconds);
6976 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6977 Vector4 relativeValue(targetValue - startValue);
6979 animation.AnimateTo(Property(actor, index),
6981 AlphaFunction::LINEAR,
6982 TimePeriod(delay, durationSeconds - delay));
6984 // Start the animation
6987 bool signalReceived(false);
6988 AnimationFinishCheck finishCheck(signalReceived);
6989 animation.FinishedSignal().Connect(&application, finishCheck);
6991 application.SendNotification();
6992 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6994 // We didn't expect the animation to finish yet
6995 application.SendNotification();
6996 finishCheck.CheckSignalNotReceived();
6997 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6999 application.SendNotification();
7000 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7002 // We didn't expect the animation to finish yet
7003 application.SendNotification();
7004 finishCheck.CheckSignalNotReceived();
7005 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7007 application.SendNotification();
7008 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7010 // We did expect the animation to finish
7011 application.SendNotification();
7012 finishCheck.CheckSignalReceived();
7013 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7017 int UtcDaliAnimationAnimateToActorParentOriginP(void)
7019 TestApplication application;
7021 Actor actor = Actor::New();
7022 application.GetScene().Add(actor);
7023 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
7025 // Build the animation
7026 float durationSeconds(1.0f);
7027 Animation animation = Animation::New(durationSeconds);
7028 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
7030 DALI_TEST_ASSERTION(
7032 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
7034 "Property is not animatable");
7039 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
7041 TestApplication application;
7043 Actor actor = Actor::New();
7044 application.GetScene().Add(actor);
7045 float startValue(0.0f);
7046 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
7047 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
7049 // Build the animation
7050 float durationSeconds(1.0f);
7051 Animation animation = Animation::New(durationSeconds);
7052 float targetX(1.0f);
7054 DALI_TEST_ASSERTION(
7056 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
7058 "Property is not animatable");
7063 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7065 TestApplication application;
7067 Actor actor = Actor::New();
7068 application.GetScene().Add(actor);
7069 float startValue(0.0f);
7070 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
7071 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
7073 // Build the animation
7074 float durationSeconds(1.0f);
7075 Animation animation = Animation::New(durationSeconds);
7076 float targetY(1.0f);
7078 DALI_TEST_ASSERTION(
7080 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
7082 "Property is not animatable");
7087 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7089 TestApplication application;
7091 Actor actor = Actor::New();
7092 application.GetScene().Add(actor);
7093 float startValue(0.5f);
7094 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
7095 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
7097 // Build the animation
7098 float durationSeconds(1.0f);
7099 Animation animation = Animation::New(durationSeconds);
7100 float targetZ(1.0f);
7102 DALI_TEST_ASSERTION(
7104 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
7106 "Property is not animatable");
7111 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7113 TestApplication application;
7115 Actor actor = Actor::New();
7116 application.GetScene().Add(actor);
7117 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
7119 // Build the animation
7120 float durationSeconds(1.0f);
7121 Animation animation = Animation::New(durationSeconds);
7122 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
7124 DALI_TEST_ASSERTION(
7126 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7128 "Property is not animatable");
7133 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7135 TestApplication application;
7137 Actor actor = Actor::New();
7138 application.GetScene().Add(actor);
7139 float startValue(0.5f);
7140 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
7141 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
7143 // Build the animation
7144 float durationSeconds(1.0f);
7145 Animation animation = Animation::New(durationSeconds);
7146 float targetX(1.0f);
7148 DALI_TEST_ASSERTION(
7150 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
7152 "Property is not animatable");
7157 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7159 TestApplication application;
7161 Actor actor = Actor::New();
7162 application.GetScene().Add(actor);
7163 float startValue(0.5f);
7164 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
7165 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
7167 // Build the animation
7168 float durationSeconds(1.0f);
7169 Animation animation = Animation::New(durationSeconds);
7170 float targetY(0.0f);
7172 DALI_TEST_ASSERTION(
7174 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
7176 "Property is not animatable");
7181 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7183 TestApplication application;
7185 Actor actor = Actor::New();
7186 application.GetScene().Add(actor);
7187 float startValue(0.5f);
7188 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
7189 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
7191 // Build the animation
7192 float durationSeconds(1.0f);
7193 Animation animation = Animation::New(durationSeconds);
7194 float targetZ(100.0f);
7196 DALI_TEST_ASSERTION(
7198 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
7200 "Property is not animatable");
7205 int UtcDaliAnimationAnimateToActorSizeP(void)
7207 TestApplication application;
7209 Actor actor = Actor::New();
7210 application.GetScene().Add(actor);
7211 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7213 // Build the animation
7214 float durationSeconds(1.0f);
7215 Animation animation = Animation::New(durationSeconds);
7216 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7217 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7219 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7221 // Should return the initial properties before play
7222 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7223 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
7224 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
7225 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
7227 // Start the animation
7230 // Should return the target property after play
7231 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7232 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
7233 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
7234 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
7236 bool signalReceived(false);
7237 AnimationFinishCheck finishCheck(signalReceived);
7238 animation.FinishedSignal().Connect(&application, finishCheck);
7240 application.SendNotification();
7241 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7243 // We didn't expect the animation to finish yet
7244 application.SendNotification();
7245 finishCheck.CheckSignalNotReceived();
7246 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7248 application.SendNotification();
7249 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7251 // We did expect the animation to finish
7252 application.SendNotification();
7253 finishCheck.CheckSignalReceived();
7254 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7257 finishCheck.Reset();
7258 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7259 application.SendNotification();
7260 application.Render(0);
7261 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7263 // Repeat with a different (ease-in) alpha function
7264 animation = Animation::New(durationSeconds);
7265 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7266 animation.FinishedSignal().Connect(&application, finishCheck);
7269 application.SendNotification();
7270 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7272 // We didn't expect the animation to finish yet
7273 application.SendNotification();
7274 finishCheck.CheckSignalNotReceived();
7276 // The size should have travelled less, than with a linear alpha function
7277 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7278 DALI_TEST_CHECK(current.x > 0.0f);
7279 DALI_TEST_CHECK(current.y > 0.0f);
7280 DALI_TEST_CHECK(current.z > 0.0f);
7281 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7282 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7283 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
7285 application.SendNotification();
7286 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7288 // We did expect the animation to finish
7289 application.SendNotification();
7290 finishCheck.CheckSignalReceived();
7291 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7294 finishCheck.Reset();
7295 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7296 application.SendNotification();
7297 application.Render(0);
7298 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7300 // Repeat with a delay
7302 animation = Animation::New(durationSeconds);
7303 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7304 animation.FinishedSignal().Connect(&application, finishCheck);
7307 application.SendNotification();
7308 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7310 // We didn't expect the animation to finish yet
7311 application.SendNotification();
7312 finishCheck.CheckSignalNotReceived();
7313 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7315 application.SendNotification();
7316 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7318 // We did expect the animation to finish
7319 application.SendNotification();
7320 finishCheck.CheckSignalReceived();
7321 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7325 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7327 TestApplication application;
7329 Actor actor = Actor::New();
7330 application.GetScene().Add(actor);
7331 float startValue(0.0f);
7332 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
7333 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7335 // Build the animation
7336 float durationSeconds(1.0f);
7337 Animation animation = Animation::New(durationSeconds);
7338 float targetWidth(10.0f);
7339 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
7341 float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
7343 // Should return the initial properties before play
7344 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7345 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7347 // Start the animation
7350 // Should return the target property after play
7351 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
7352 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7354 bool signalReceived(false);
7355 AnimationFinishCheck finishCheck(signalReceived);
7356 animation.FinishedSignal().Connect(&application, finishCheck);
7358 application.SendNotification();
7359 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7361 // We didn't expect the animation to finish yet
7362 application.SendNotification();
7363 finishCheck.CheckSignalNotReceived();
7364 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
7366 application.SendNotification();
7367 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7369 // We did expect the animation to finish
7370 application.SendNotification();
7371 finishCheck.CheckSignalReceived();
7372 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
7373 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7377 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7379 TestApplication application;
7381 Actor actor = Actor::New();
7382 application.GetScene().Add(actor);
7383 float startValue(0.0f);
7384 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
7385 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7387 // Build the animation
7388 float durationSeconds(1.0f);
7389 Animation animation = Animation::New(durationSeconds);
7390 float targetHeight(-10.0f);
7391 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
7393 float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
7395 // Should return the initial properties before play
7396 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7397 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7399 // Start the animation
7402 // Should return the target property after play
7403 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
7404 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7406 bool signalReceived(false);
7407 AnimationFinishCheck finishCheck(signalReceived);
7408 animation.FinishedSignal().Connect(&application, finishCheck);
7410 application.SendNotification();
7411 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7413 // We didn't expect the animation to finish yet
7414 application.SendNotification();
7415 finishCheck.CheckSignalNotReceived();
7416 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
7418 application.SendNotification();
7419 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7421 // We did expect the animation to finish
7422 application.SendNotification();
7423 finishCheck.CheckSignalReceived();
7424 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
7425 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7429 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7431 TestApplication application;
7433 Actor actor = Actor::New();
7434 application.GetScene().Add(actor);
7435 float startValue(0.0f);
7436 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
7437 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7439 // Build the animation
7440 float durationSeconds(1.0f);
7441 Animation animation = Animation::New(durationSeconds);
7442 float targetDepth(-10.0f);
7443 animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
7445 float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
7447 // Should return the initial properties before play
7448 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7449 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7451 // Start the animation
7454 // Should return the target property after play
7455 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
7456 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7458 bool signalReceived(false);
7459 AnimationFinishCheck finishCheck(signalReceived);
7460 animation.FinishedSignal().Connect(&application, finishCheck);
7462 application.SendNotification();
7463 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7465 // We didn't expect the animation to finish yet
7466 application.SendNotification();
7467 finishCheck.CheckSignalNotReceived();
7468 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
7470 application.SendNotification();
7471 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7473 // We did expect the animation to finish
7474 application.SendNotification();
7475 finishCheck.CheckSignalReceived();
7476 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
7477 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7481 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7483 TestApplication application;
7485 Actor actor = Actor::New();
7486 application.GetScene().Add(actor);
7487 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7489 // Build the animation
7490 float durationSeconds(1.0f);
7491 Animation animation = Animation::New(durationSeconds);
7492 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7493 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7495 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7497 // Start the animation
7500 bool signalReceived(false);
7501 AnimationFinishCheck finishCheck(signalReceived);
7502 animation.FinishedSignal().Connect(&application, finishCheck);
7504 application.SendNotification();
7505 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7507 // We didn't expect the animation to finish yet
7508 application.SendNotification();
7509 finishCheck.CheckSignalNotReceived();
7510 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7512 application.SendNotification();
7513 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7515 // We did expect the animation to finish
7516 application.SendNotification();
7517 finishCheck.CheckSignalReceived();
7518 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7521 finishCheck.Reset();
7522 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7523 application.SendNotification();
7524 application.Render(0);
7525 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7527 // Repeat with a different (ease-in) alpha function
7528 animation = Animation::New(durationSeconds);
7529 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
7530 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
7531 animation.FinishedSignal().Connect(&application, finishCheck);
7534 application.SendNotification();
7535 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7537 // We didn't expect the animation to finish yet
7538 application.SendNotification();
7539 finishCheck.CheckSignalNotReceived();
7541 // The size should have travelled less, than with a linear alpha function
7542 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7543 DALI_TEST_CHECK(current.x > 0.0f);
7544 DALI_TEST_CHECK(current.y > 0.0f);
7545 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7546 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7548 application.SendNotification();
7549 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7551 // We did expect the animation to finish
7552 application.SendNotification();
7553 finishCheck.CheckSignalReceived();
7554 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7555 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7558 finishCheck.Reset();
7559 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7560 application.SendNotification();
7561 application.Render(0);
7562 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7564 // Repeat with a delay
7566 animation = Animation::New(durationSeconds);
7567 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7568 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7569 animation.FinishedSignal().Connect(&application, finishCheck);
7572 application.SendNotification();
7573 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7575 // We didn't expect the animation to finish yet
7576 application.SendNotification();
7577 finishCheck.CheckSignalNotReceived();
7578 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7580 application.SendNotification();
7581 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7583 // We did expect the animation to finish
7584 application.SendNotification();
7585 finishCheck.CheckSignalReceived();
7586 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7587 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7591 int UtcDaliAnimationAnimateToActorPositionP(void)
7593 TestApplication application;
7595 Actor actor = Actor::New();
7596 application.GetScene().Add(actor);
7597 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7599 // Build the animation
7600 float durationSeconds(1.0f);
7601 Animation animation = Animation::New(durationSeconds);
7602 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7603 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7605 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7607 // Should return the initial properties before play
7608 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7609 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
7610 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
7611 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
7613 // Start the animation
7616 // Should return the target property after play
7617 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7618 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
7619 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
7620 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
7622 bool signalReceived(false);
7623 AnimationFinishCheck finishCheck(signalReceived);
7624 animation.FinishedSignal().Connect(&application, finishCheck);
7626 application.SendNotification();
7627 application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7629 // We didn't expect the animation to finish yet
7630 application.SendNotification();
7631 finishCheck.CheckSignalNotReceived();
7632 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7634 application.SendNotification();
7635 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7637 // We did expect the animation to finish
7638 application.SendNotification();
7639 finishCheck.CheckSignalReceived();
7640 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7644 int UtcDaliAnimationAnimateToActorPositionXP(void)
7646 TestApplication application;
7648 Actor actor = Actor::New();
7649 application.GetScene().Add(actor);
7650 float startValue(0.0f);
7651 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
7652 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7653 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7654 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7656 // Build the animation
7657 float durationSeconds(1.0f);
7658 Animation animation = Animation::New(durationSeconds);
7659 float targetX(1.0f);
7660 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
7662 float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
7664 // Should return the initial properties before play
7665 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7666 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7668 // Start the animation
7671 // Should return the target property after play
7672 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
7673 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7675 bool signalReceived(false);
7676 AnimationFinishCheck finishCheck(signalReceived);
7677 animation.FinishedSignal().Connect(&application, finishCheck);
7679 application.SendNotification();
7680 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7682 // We didn't expect the animation to finish yet
7683 application.SendNotification();
7684 finishCheck.CheckSignalNotReceived();
7685 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
7687 application.SendNotification();
7688 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7690 // We did expect the animation to finish
7691 application.SendNotification();
7692 finishCheck.CheckSignalReceived();
7693 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
7694 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7695 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7696 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7700 int UtcDaliAnimationAnimateToActorPositionYP(void)
7702 TestApplication application;
7704 Actor actor = Actor::New();
7705 application.GetScene().Add(actor);
7706 float startValue(0.0f);
7707 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
7708 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7709 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7710 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7712 // Build the animation
7713 float durationSeconds(1.0f);
7714 Animation animation = Animation::New(durationSeconds);
7715 float targetY(10.0f);
7716 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
7718 float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
7720 // Should return the initial properties before play
7721 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7722 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7724 // Start the animation
7727 // Should return the target property after play
7728 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
7729 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7731 bool signalReceived(false);
7732 AnimationFinishCheck finishCheck(signalReceived);
7733 animation.FinishedSignal().Connect(&application, finishCheck);
7735 application.SendNotification();
7736 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7738 // We didn't expect the animation to finish yet
7739 application.SendNotification();
7740 finishCheck.CheckSignalNotReceived();
7741 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
7743 application.SendNotification();
7744 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7746 // We did expect the animation to finish
7747 application.SendNotification();
7748 finishCheck.CheckSignalReceived();
7749 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
7750 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7751 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7752 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7756 int UtcDaliAnimationAnimateToActorPositionZP(void)
7758 TestApplication application;
7760 Actor actor = Actor::New();
7761 application.GetScene().Add(actor);
7762 float startValue(0.0f);
7763 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
7764 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7765 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7766 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7768 // Build the animation
7769 float durationSeconds(1.0f);
7770 Animation animation = Animation::New(durationSeconds);
7771 float targetZ(-5.0f);
7772 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
7774 float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
7776 // Should return the initial properties before play
7777 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7778 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7780 // Start the animation
7783 // Should return the target property after play
7784 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
7785 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7787 bool signalReceived(false);
7788 AnimationFinishCheck finishCheck(signalReceived);
7789 animation.FinishedSignal().Connect(&application, finishCheck);
7791 application.SendNotification();
7792 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7794 // We didn't expect the animation to finish yet
7795 application.SendNotification();
7796 finishCheck.CheckSignalNotReceived();
7797 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
7799 application.SendNotification();
7800 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7802 // We did expect the animation to finish
7803 application.SendNotification();
7804 finishCheck.CheckSignalReceived();
7805 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
7806 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7807 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7808 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7812 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7814 TestApplication application;
7816 Actor actor = Actor::New();
7817 application.GetScene().Add(actor);
7818 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7820 // Build the animation
7821 float durationSeconds(1.0f);
7822 Animation animation = Animation::New(durationSeconds);
7823 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7824 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7826 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7828 // Start the animation
7831 bool signalReceived(false);
7832 AnimationFinishCheck finishCheck(signalReceived);
7833 animation.FinishedSignal().Connect(&application, finishCheck);
7835 application.SendNotification();
7836 application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7838 // We didn't expect the animation to finish yet
7839 application.SendNotification();
7840 finishCheck.CheckSignalNotReceived();
7842 // The position should have moved less, than with a linear alpha function
7843 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
7844 DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
7845 DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
7846 DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
7847 DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
7848 DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
7849 DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
7851 application.SendNotification();
7852 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7854 // We did expect the animation to finish
7855 application.SendNotification();
7856 finishCheck.CheckSignalReceived();
7857 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7861 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7863 TestApplication application;
7865 Actor actor = Actor::New();
7866 application.GetScene().Add(actor);
7867 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7869 // Build the animation
7870 float durationSeconds(1.0f);
7871 Animation animation = Animation::New(durationSeconds);
7872 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7874 animation.AnimateTo(Property(actor, Actor::Property::POSITION),
7876 TimePeriod(delay, durationSeconds - delay));
7878 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7880 // Start the animation
7883 bool signalReceived(false);
7884 AnimationFinishCheck finishCheck(signalReceived);
7885 animation.FinishedSignal().Connect(&application, finishCheck);
7887 application.SendNotification();
7888 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7890 // We didn't expect the animation to finish yet
7891 application.SendNotification();
7892 finishCheck.CheckSignalNotReceived();
7893 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7895 application.SendNotification();
7896 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
7898 // We didn't expect the animation to finish yet
7899 application.SendNotification();
7900 finishCheck.CheckSignalNotReceived();
7901 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7903 application.SendNotification();
7904 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
7906 // We did expect the animation to finish
7907 application.SendNotification();
7908 finishCheck.CheckSignalReceived();
7909 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7913 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7915 TestApplication application;
7917 Actor actor = Actor::New();
7918 application.GetScene().Add(actor);
7919 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7921 // Build the animation
7922 float durationSeconds(1.0f);
7923 Animation animation = Animation::New(durationSeconds);
7924 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7926 animation.AnimateTo(Property(actor, Actor::Property::POSITION),
7928 AlphaFunction::LINEAR,
7929 TimePeriod(delay, durationSeconds - delay));
7931 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7933 // Start the animation
7936 bool signalReceived(false);
7937 AnimationFinishCheck finishCheck(signalReceived);
7938 animation.FinishedSignal().Connect(&application, finishCheck);
7940 application.SendNotification();
7941 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7943 // We didn't expect the animation to finish yet
7944 application.SendNotification();
7945 finishCheck.CheckSignalNotReceived();
7946 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7948 application.SendNotification();
7949 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
7951 // We didn't expect the animation to finish yet
7952 application.SendNotification();
7953 finishCheck.CheckSignalNotReceived();
7954 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7956 application.SendNotification();
7957 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
7959 // We did expect the animation to finish
7960 application.SendNotification();
7961 finishCheck.CheckSignalReceived();
7962 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7966 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7968 TestApplication application;
7970 Actor actor = Actor::New();
7971 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
7972 application.GetScene().Add(actor);
7973 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
7975 // Build the animation
7976 float durationSeconds(1.0f);
7977 Animation animation = Animation::New(durationSeconds);
7978 Degree targetRotationDegrees(90.0f);
7979 Radian targetRotationRadians(targetRotationDegrees);
7980 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
7982 // Start the animation
7985 // Target value should be retrievable straight away
7986 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
7988 bool signalReceived(false);
7989 AnimationFinishCheck finishCheck(signalReceived);
7990 animation.FinishedSignal().Connect(&application, finishCheck);
7992 application.SendNotification();
7993 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
7995 // We didn't expect the animation to finish yet
7996 application.SendNotification();
7997 finishCheck.CheckSignalNotReceived();
7998 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8000 application.SendNotification();
8001 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8003 // We didn't expect the animation to finish yet
8004 application.SendNotification();
8005 finishCheck.CheckSignalNotReceived();
8006 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8008 application.SendNotification();
8009 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8011 // We didn't expect the animation to finish yet
8012 application.SendNotification();
8013 finishCheck.CheckSignalNotReceived();
8014 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8016 application.SendNotification();
8017 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8019 // We did expect the animation to finish
8020 application.SendNotification();
8021 finishCheck.CheckSignalReceived();
8022 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8026 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
8028 TestApplication application;
8030 Actor actor = Actor::New();
8031 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8032 application.GetScene().Add(actor);
8033 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8035 // Build the animation
8036 float durationSeconds(1.0f);
8037 Animation animation = Animation::New(durationSeconds);
8038 Degree targetRotationDegrees(90.0f);
8039 Radian targetRotationRadians(targetRotationDegrees);
8040 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8041 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
8043 // Start the animation
8046 bool signalReceived(false);
8047 AnimationFinishCheck finishCheck(signalReceived);
8048 animation.FinishedSignal().Connect(&application, finishCheck);
8050 application.SendNotification();
8051 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8053 // We didn't expect the animation to finish yet
8054 application.SendNotification();
8055 finishCheck.CheckSignalNotReceived();
8056 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8058 application.SendNotification();
8059 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8061 // We didn't expect the animation to finish yet
8062 application.SendNotification();
8063 finishCheck.CheckSignalNotReceived();
8064 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8066 application.SendNotification();
8067 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8069 // We didn't expect the animation to finish yet
8070 application.SendNotification();
8071 finishCheck.CheckSignalNotReceived();
8072 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8074 application.SendNotification();
8075 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8077 // We did expect the animation to finish
8078 application.SendNotification();
8079 finishCheck.CheckSignalReceived();
8080 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8084 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8086 TestApplication application;
8088 Actor actor = Actor::New();
8089 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8090 application.GetScene().Add(actor);
8091 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8093 // Build the animation
8094 float durationSeconds(1.0f);
8095 Animation animation = Animation::New(durationSeconds);
8096 Degree targetRotationDegrees(90.0f);
8097 Radian targetRotationRadians(targetRotationDegrees);
8098 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8100 // Start the animation
8103 bool signalReceived(false);
8104 AnimationFinishCheck finishCheck(signalReceived);
8105 animation.FinishedSignal().Connect(&application, finishCheck);
8107 application.SendNotification();
8108 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8110 // We didn't expect the animation to finish yet
8111 application.SendNotification();
8112 finishCheck.CheckSignalNotReceived();
8113 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8115 application.SendNotification();
8116 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8118 // We didn't expect the animation to finish yet
8119 application.SendNotification();
8120 finishCheck.CheckSignalNotReceived();
8121 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8123 application.SendNotification();
8124 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8126 // We didn't expect the animation to finish yet
8127 application.SendNotification();
8128 finishCheck.CheckSignalNotReceived();
8129 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8131 application.SendNotification();
8132 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8134 // We did expect the animation to finish
8135 application.SendNotification();
8136 finishCheck.CheckSignalReceived();
8137 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8141 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8143 TestApplication application;
8145 Actor actor = Actor::New();
8146 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8147 application.GetScene().Add(actor);
8148 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8150 // Build the animation
8151 float durationSeconds(1.0f);
8152 Animation animation = Animation::New(durationSeconds);
8153 Degree targetRotationDegrees(90.0f);
8154 Radian targetRotationRadians(targetRotationDegrees);
8156 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8158 // Start the animation
8161 bool signalReceived(false);
8162 AnimationFinishCheck finishCheck(signalReceived);
8163 animation.FinishedSignal().Connect(&application, finishCheck);
8165 application.SendNotification();
8166 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8168 // We didn't expect the animation to finish yet
8169 application.SendNotification();
8170 finishCheck.CheckSignalNotReceived();
8171 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8172 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8174 application.SendNotification();
8175 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8177 // We didn't expect the animation to finish yet
8178 application.SendNotification();
8179 finishCheck.CheckSignalNotReceived();
8180 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8181 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8183 application.SendNotification();
8184 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8186 // We didn't expect the animation to finish yet
8187 application.SendNotification();
8188 finishCheck.CheckSignalNotReceived();
8189 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8190 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8192 application.SendNotification();
8193 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8195 // We did expect the animation to finish
8196 application.SendNotification();
8197 finishCheck.CheckSignalReceived();
8198 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8202 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8204 TestApplication application;
8206 Actor actor = Actor::New();
8207 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8208 application.GetScene().Add(actor);
8209 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8211 // Build the animation
8212 float durationSeconds(1.0f);
8213 Animation animation = Animation::New(durationSeconds);
8214 Degree targetRotationDegrees(90.0f);
8215 Radian targetRotationRadians(targetRotationDegrees);
8217 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8219 // Start the animation
8222 bool signalReceived(false);
8223 AnimationFinishCheck finishCheck(signalReceived);
8224 animation.FinishedSignal().Connect(&application, finishCheck);
8226 application.SendNotification();
8227 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8229 // We didn't expect the animation to finish yet
8230 application.SendNotification();
8231 finishCheck.CheckSignalNotReceived();
8232 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8233 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8235 application.SendNotification();
8236 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8238 // We didn't expect the animation to finish yet
8239 application.SendNotification();
8240 finishCheck.CheckSignalNotReceived();
8241 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8242 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8244 application.SendNotification();
8245 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8247 // We didn't expect the animation to finish yet
8248 application.SendNotification();
8249 finishCheck.CheckSignalNotReceived();
8250 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8251 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8253 application.SendNotification();
8254 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8256 // We did expect the animation to finish
8257 application.SendNotification();
8258 finishCheck.CheckSignalReceived();
8259 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8263 int UtcDaliAnimationAnimateToActorScaleP(void)
8265 TestApplication application;
8267 Actor actor = Actor::New();
8268 application.GetScene().Add(actor);
8269 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8271 // Build the animation
8272 float durationSeconds(1.0f);
8273 Animation animation = Animation::New(durationSeconds);
8274 Vector3 targetScale(2.0f, 2.0f, 2.0f);
8275 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
8277 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
8279 // Start the animation
8282 // Target value should be retrievable straight away
8283 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8284 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
8285 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
8286 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
8288 bool signalReceived(false);
8289 AnimationFinishCheck finishCheck(signalReceived);
8290 animation.FinishedSignal().Connect(&application, finishCheck);
8292 application.SendNotification();
8293 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8295 // We didn't expect the animation to finish yet
8296 application.SendNotification();
8297 finishCheck.CheckSignalNotReceived();
8298 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
8300 application.SendNotification();
8301 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8303 // We did expect the animation to finish
8304 application.SendNotification();
8305 finishCheck.CheckSignalReceived();
8306 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8309 finishCheck.Reset();
8310 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8311 application.SendNotification();
8312 application.Render(0);
8313 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8315 // Repeat with a different (ease-in) alpha function
8316 animation = Animation::New(durationSeconds);
8317 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8318 animation.FinishedSignal().Connect(&application, finishCheck);
8321 application.SendNotification();
8322 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8324 // We didn't expect the animation to finish yet
8325 application.SendNotification();
8326 finishCheck.CheckSignalNotReceived();
8328 // The scale should have grown less, than with a linear alpha function
8329 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
8330 DALI_TEST_CHECK(current.x > 1.0f);
8331 DALI_TEST_CHECK(current.y > 1.0f);
8332 DALI_TEST_CHECK(current.z > 1.0f);
8333 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
8334 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
8335 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
8337 application.SendNotification();
8338 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8340 // We did expect the animation to finish
8341 application.SendNotification();
8342 finishCheck.CheckSignalReceived();
8343 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8346 finishCheck.Reset();
8347 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8348 application.SendNotification();
8349 application.Render(0);
8350 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8352 // Repeat with a delay
8354 animation = Animation::New(durationSeconds);
8355 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8356 animation.FinishedSignal().Connect(&application, finishCheck);
8359 application.SendNotification();
8360 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8362 // We didn't expect the animation to finish yet
8363 application.SendNotification();
8364 finishCheck.CheckSignalNotReceived();
8365 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8367 application.SendNotification();
8368 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8370 // We did expect the animation to finish
8371 application.SendNotification();
8372 finishCheck.CheckSignalReceived();
8373 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8377 int UtcDaliAnimationAnimateToActorScaleXP(void)
8379 TestApplication application;
8381 Actor actor = Actor::New();
8382 application.GetScene().Add(actor);
8383 float startValue(1.0f);
8384 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
8385 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8386 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8387 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8388 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8389 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8390 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8392 // Build the animation
8393 float durationSeconds(1.0f);
8394 Animation animation = Animation::New(durationSeconds);
8395 float targetX(10.0f);
8396 animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
8398 float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
8400 // Start the animation
8403 // Target value should be retrievable straight away
8404 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
8405 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8407 bool signalReceived(false);
8408 AnimationFinishCheck finishCheck(signalReceived);
8409 animation.FinishedSignal().Connect(&application, finishCheck);
8411 application.SendNotification();
8412 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8414 // We didn't expect the animation to finish yet
8415 application.SendNotification();
8416 finishCheck.CheckSignalNotReceived();
8417 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
8418 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
8419 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8420 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8422 application.SendNotification();
8423 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8425 // We did expect the animation to finish
8426 application.SendNotification();
8427 finishCheck.CheckSignalReceived();
8428 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
8429 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8430 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8431 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8435 int UtcDaliAnimationAnimateToActorScaleYP(void)
8437 TestApplication application;
8439 Actor actor = Actor::New();
8440 application.GetScene().Add(actor);
8441 float startValue(1.0f);
8442 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
8443 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8444 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8445 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8446 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8447 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8448 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8450 // Build the animation
8451 float durationSeconds(1.0f);
8452 Animation animation = Animation::New(durationSeconds);
8453 float targetY(1000.0f);
8454 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
8456 float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
8458 // Start the animation
8461 // Target value should be retrievable straight away
8462 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
8463 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8465 bool signalReceived(false);
8466 AnimationFinishCheck finishCheck(signalReceived);
8467 animation.FinishedSignal().Connect(&application, finishCheck);
8469 application.SendNotification();
8470 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8472 // We didn't expect the animation to finish yet
8473 application.SendNotification();
8474 finishCheck.CheckSignalNotReceived();
8475 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, 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), fiftyPercentProgress, TEST_LOCATION);
8478 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8480 application.SendNotification();
8481 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8483 // We did expect the animation to finish
8484 application.SendNotification();
8485 finishCheck.CheckSignalReceived();
8486 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
8487 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8488 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8489 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8493 int UtcDaliAnimationAnimateToActorScaleZP(void)
8495 TestApplication application;
8497 Actor actor = Actor::New();
8498 application.GetScene().Add(actor);
8499 float startValue(1.0f);
8500 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
8501 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8502 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8503 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8504 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8505 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8506 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8508 // Build the animation
8509 float durationSeconds(1.0f);
8510 Animation animation = Animation::New(durationSeconds);
8511 float targetZ(-1000.0f);
8512 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
8514 float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8516 // Start the animation
8519 // Target value should be retrievable straight away
8520 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
8521 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8523 bool signalReceived(false);
8524 AnimationFinishCheck finishCheck(signalReceived);
8525 animation.FinishedSignal().Connect(&application, finishCheck);
8527 application.SendNotification();
8528 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8530 // We didn't expect the animation to finish yet
8531 application.SendNotification();
8532 finishCheck.CheckSignalNotReceived();
8533 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, 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), fiftyPercentProgress, TEST_LOCATION);
8538 application.SendNotification();
8539 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8541 // We did expect the animation to finish
8542 application.SendNotification();
8543 finishCheck.CheckSignalReceived();
8544 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
8545 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8546 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8547 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8551 int UtcDaliAnimationAnimateToActorColorP(void)
8553 TestApplication application;
8555 Actor actor = Actor::New();
8556 application.GetScene().Add(actor);
8557 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8559 // Build the animation
8560 float durationSeconds(1.0f);
8561 Animation animation = Animation::New(durationSeconds);
8562 Vector4 targetColor(Color::RED);
8563 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
8565 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8566 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8568 // Start the animation
8571 // Target value should be retrievable straight away
8572 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8573 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
8574 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
8575 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
8576 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
8577 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
8579 bool signalReceived(false);
8580 AnimationFinishCheck finishCheck(signalReceived);
8581 animation.FinishedSignal().Connect(&application, finishCheck);
8583 application.SendNotification();
8584 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8586 // We didn't expect the animation to finish yet
8587 application.SendNotification();
8588 finishCheck.CheckSignalNotReceived();
8589 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
8591 application.SendNotification();
8592 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8594 // We did expect the animation to finish
8595 application.SendNotification();
8596 finishCheck.CheckSignalReceived();
8597 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8600 finishCheck.Reset();
8601 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8602 application.SendNotification();
8603 application.Render(0);
8604 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8606 // Repeat with a different (ease-in) alpha function
8607 animation = Animation::New(durationSeconds);
8608 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8609 animation.FinishedSignal().Connect(&application, finishCheck);
8612 application.SendNotification();
8613 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8615 // We didn't expect the animation to finish yet
8616 application.SendNotification();
8617 finishCheck.CheckSignalNotReceived();
8619 // The color should have changed less, than with a linear alpha function
8620 Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
8621 DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
8622 DALI_TEST_CHECK(current.y < 1.0f);
8623 DALI_TEST_CHECK(current.y > tenPercentProgress.y);
8624 DALI_TEST_CHECK(current.z < 1.0f);
8625 DALI_TEST_CHECK(current.z > tenPercentProgress.z);
8626 DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
8628 application.SendNotification();
8629 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8631 // We did expect the animation to finish
8632 application.SendNotification();
8633 finishCheck.CheckSignalReceived();
8634 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8637 finishCheck.Reset();
8638 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8639 application.SendNotification();
8640 application.Render(0);
8641 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8643 // Repeat with a shorter animator duration
8644 float animatorDuration = 0.5f;
8645 animation = Animation::New(durationSeconds);
8646 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8647 animation.FinishedSignal().Connect(&application, finishCheck);
8650 application.SendNotification();
8651 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
8653 // We didn't expect the animation to finish yet
8654 application.SendNotification();
8655 finishCheck.CheckSignalNotReceived();
8656 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
8658 application.SendNotification();
8659 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
8661 // We didn't expect the animation to finish yet
8662 application.SendNotification();
8663 finishCheck.CheckSignalNotReceived();
8664 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8666 application.SendNotification();
8667 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8669 // We did expect the animation to finish
8670 application.SendNotification();
8671 finishCheck.CheckSignalReceived();
8672 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8676 int UtcDaliAnimationAnimateToActorColorRedP(void)
8678 TestApplication application;
8680 Actor actor = Actor::New();
8681 application.GetScene().Add(actor);
8682 float startValue(1.0f);
8683 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
8684 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8685 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8686 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8687 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8688 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8689 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8690 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8691 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8693 // Build the animation
8694 float durationSeconds(1.0f);
8695 Animation animation = Animation::New(durationSeconds);
8696 float targetRed(0.5f);
8697 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
8699 float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
8701 // Start the animation
8704 // Target value should be retrievable straight away
8705 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
8706 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8708 bool signalReceived(false);
8709 AnimationFinishCheck finishCheck(signalReceived);
8710 animation.FinishedSignal().Connect(&application, finishCheck);
8712 application.SendNotification();
8713 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8715 // We didn't expect the animation to finish yet
8716 application.SendNotification();
8717 finishCheck.CheckSignalNotReceived();
8718 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
8719 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
8720 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8721 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8722 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8724 application.SendNotification();
8725 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8727 // We did expect the animation to finish
8728 application.SendNotification();
8729 finishCheck.CheckSignalReceived();
8730 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
8731 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8732 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8733 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8734 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8738 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8740 TestApplication application;
8742 Actor actor = Actor::New();
8743 application.GetScene().Add(actor);
8744 float startValue(1.0f);
8745 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
8746 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8747 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8748 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8749 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8750 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8751 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8752 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8753 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8755 // Build the animation
8756 float durationSeconds(1.0f);
8757 Animation animation = Animation::New(durationSeconds);
8758 float targetGreen(0.5f);
8759 animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
8761 float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
8763 // Start the animation
8766 // Target value should be retrievable straight away
8767 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
8768 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8770 bool signalReceived(false);
8771 AnimationFinishCheck finishCheck(signalReceived);
8772 animation.FinishedSignal().Connect(&application, finishCheck);
8774 application.SendNotification();
8775 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8777 // We didn't expect the animation to finish yet
8778 application.SendNotification();
8779 finishCheck.CheckSignalNotReceived();
8780 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
8781 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8782 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
8783 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8784 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8786 application.SendNotification();
8787 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8789 // We did expect the animation to finish
8790 application.SendNotification();
8791 finishCheck.CheckSignalReceived();
8792 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
8793 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8794 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8795 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8796 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8800 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8802 TestApplication application;
8804 Actor actor = Actor::New();
8805 application.GetScene().Add(actor);
8806 float startValue(1.0f);
8807 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
8808 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8809 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8810 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8811 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8812 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8813 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8814 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8815 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8817 // Build the animation
8818 float durationSeconds(1.0f);
8819 Animation animation = Animation::New(durationSeconds);
8820 float targetBlue(0.5f);
8821 animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
8823 float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
8825 // Start the animation
8828 // Target value should be retrievable straight away
8829 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
8830 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8832 bool signalReceived(false);
8833 AnimationFinishCheck finishCheck(signalReceived);
8834 animation.FinishedSignal().Connect(&application, finishCheck);
8836 application.SendNotification();
8837 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8839 // We didn't expect the animation to finish yet
8840 application.SendNotification();
8841 finishCheck.CheckSignalNotReceived();
8842 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
8843 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8844 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8845 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
8846 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8848 application.SendNotification();
8849 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8851 // We did expect the animation to finish
8852 application.SendNotification();
8853 finishCheck.CheckSignalReceived();
8854 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
8855 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8856 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8857 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8858 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8862 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8864 TestApplication application;
8866 Actor actor = Actor::New();
8867 application.GetScene().Add(actor);
8868 float startValue(1.0f);
8869 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
8870 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8871 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8872 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8873 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8874 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8875 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8876 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8877 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8879 // Build the animation
8880 float durationSeconds(1.0f);
8881 Animation animation = Animation::New(durationSeconds);
8882 float targetAlpha(0.5f);
8883 animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
8885 float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
8887 // Start the animation
8890 // Target value should be retrievable straight away
8891 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
8892 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
8893 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
8895 bool signalReceived(false);
8896 AnimationFinishCheck finishCheck(signalReceived);
8897 animation.FinishedSignal().Connect(&application, finishCheck);
8899 application.SendNotification();
8900 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8902 // We didn't expect the animation to finish yet
8903 application.SendNotification();
8904 finishCheck.CheckSignalNotReceived();
8905 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
8906 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8907 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8908 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8909 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
8911 application.SendNotification();
8912 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8914 // We did expect the animation to finish
8915 application.SendNotification();
8916 finishCheck.CheckSignalReceived();
8917 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
8918 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8919 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8920 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8921 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
8925 int UtcDaliAnimationKeyFrames01P(void)
8927 TestApplication application;
8929 KeyFrames keyFrames = KeyFrames::New();
8930 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8932 keyFrames.Add(0.0f, 0.1f);
8934 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8936 KeyFrames keyFrames2(keyFrames);
8937 DALI_TEST_CHECK(keyFrames2);
8938 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8940 KeyFrames keyFrames3 = KeyFrames::New();
8941 keyFrames3.Add(0.6f, true);
8942 DALI_TEST_CHECK(keyFrames3);
8943 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8945 keyFrames3 = keyFrames;
8946 DALI_TEST_CHECK(keyFrames3);
8947 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8952 int UtcDaliAnimationKeyFrames02N(void)
8954 TestApplication application;
8956 KeyFrames keyFrames = KeyFrames::New();
8957 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8959 keyFrames.Add(0.0f, 0.1f);
8960 keyFrames.Add(0.2f, 0.5f);
8961 keyFrames.Add(0.4f, 0.0f);
8962 keyFrames.Add(0.6f, 1.0f);
8963 keyFrames.Add(0.8f, 0.7f);
8964 keyFrames.Add(1.0f, 0.9f);
8966 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8968 DALI_TEST_ASSERTION(
8970 keyFrames.Add(1.9f, false);
8972 "mType == value.GetType()");
8977 int UtcDaliAnimationKeyFrames03N(void)
8979 TestApplication application;
8981 KeyFrames keyFrames = KeyFrames::New();
8982 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8984 keyFrames.Add(0.0f, true);
8985 keyFrames.Add(0.2f, false);
8986 keyFrames.Add(0.4f, false);
8987 keyFrames.Add(0.6f, true);
8988 keyFrames.Add(0.8f, true);
8989 keyFrames.Add(1.0f, false);
8991 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8993 DALI_TEST_ASSERTION(
8995 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8997 "mType == value.GetType()");
9002 int UtcDaliAnimationKeyFrames04N(void)
9004 TestApplication application;
9006 KeyFrames keyFrames = KeyFrames::New();
9007 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9009 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
9010 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
9011 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
9012 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
9013 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
9014 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
9016 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
9018 DALI_TEST_ASSERTION(
9020 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9022 "mType == value.GetType()");
9027 int UtcDaliAnimationKeyFrames05N(void)
9029 TestApplication application;
9031 KeyFrames keyFrames = KeyFrames::New();
9032 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9034 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
9035 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
9036 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
9037 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
9038 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
9039 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
9041 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
9043 DALI_TEST_ASSERTION(
9045 keyFrames.Add(0.7f, 1.0f);
9047 "mType == value.GetType()");
9052 int UtcDaliAnimationKeyFrames06N(void)
9054 TestApplication application;
9056 KeyFrames keyFrames = KeyFrames::New();
9057 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9059 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
9060 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9061 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
9062 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
9063 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
9064 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
9066 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
9068 DALI_TEST_ASSERTION(
9070 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9072 "mType == value.GetType()");
9077 int UtcDaliAnimationKeyFrames07N(void)
9079 TestApplication application;
9081 KeyFrames keyFrames = KeyFrames::New();
9082 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9084 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9085 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9086 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9087 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9088 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9089 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9091 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9093 DALI_TEST_ASSERTION(
9095 keyFrames.Add(0.7f, 1.1f);
9097 "mType == value.GetType()");
9102 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9104 TestApplication application;
9106 float startValue(1.0f);
9107 Actor actor = Actor::New();
9108 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9109 application.GetScene().Add(actor);
9111 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9112 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9113 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9114 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9115 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9116 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9117 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9118 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9119 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9121 // Build the animation
9122 float durationSeconds(1.0f);
9123 Animation animation = Animation::New(durationSeconds);
9125 KeyFrames keyFrames = KeyFrames::New();
9126 keyFrames.Add(0.0f, 0.1f);
9127 keyFrames.Add(0.2f, 0.5f);
9128 keyFrames.Add(0.4f, 0.0f);
9129 keyFrames.Add(0.6f, 1.0f);
9130 keyFrames.Add(0.8f, 0.7f);
9131 keyFrames.Add(1.0f, 0.9f);
9133 animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
9135 // Start the animation
9138 // Final key frame value should be retrievable straight away
9139 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
9141 bool signalReceived(false);
9142 AnimationFinishCheck finishCheck(signalReceived);
9143 animation.FinishedSignal().Connect(&application, finishCheck);
9144 application.SendNotification();
9145 application.Render(0);
9146 application.SendNotification();
9147 finishCheck.CheckSignalNotReceived();
9148 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9150 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9151 application.SendNotification();
9152 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9153 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9154 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9155 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION);
9156 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
9158 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9159 application.SendNotification();
9160 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9161 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9162 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9163 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION);
9164 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
9166 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9167 application.SendNotification();
9168 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9169 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9170 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9171 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9172 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9174 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9175 application.SendNotification();
9176 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9177 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9178 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9179 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9180 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9182 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9183 application.SendNotification();
9184 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9185 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9186 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9187 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
9188 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
9190 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9191 application.SendNotification();
9192 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9193 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9194 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9195 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9196 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9198 // We did expect the animation to finish
9200 finishCheck.CheckSignalReceived();
9204 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9206 TestApplication application;
9208 float startValue(1.0f);
9209 Actor actor = Actor::New();
9210 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9211 application.GetScene().Add(actor);
9213 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9214 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9215 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9216 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9217 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9218 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9219 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9220 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9221 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9223 // Build the animation
9224 float durationSeconds(1.0f);
9225 Animation animation = Animation::New(durationSeconds);
9227 KeyFrames keyFrames = KeyFrames::New();
9228 keyFrames.Add(0.0f, 0.1f);
9229 keyFrames.Add(0.2f, 0.5f);
9230 keyFrames.Add(0.4f, 0.0f);
9231 keyFrames.Add(0.6f, 1.0f);
9232 keyFrames.Add(0.8f, 0.7f);
9233 keyFrames.Add(1.0f, 0.9f);
9235 animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
9237 // Start the animation
9240 bool signalReceived(false);
9241 AnimationFinishCheck finishCheck(signalReceived);
9242 animation.FinishedSignal().Connect(&application, finishCheck);
9243 application.SendNotification();
9244 application.Render(0);
9245 application.SendNotification();
9246 finishCheck.CheckSignalNotReceived();
9247 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9249 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9250 application.SendNotification();
9251 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9252 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9253 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9254 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
9255 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
9257 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9258 application.SendNotification();
9259 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9260 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9261 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9262 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
9263 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
9265 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9266 application.SendNotification();
9267 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9268 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9269 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9270 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9271 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9273 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9274 application.SendNotification();
9275 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9276 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9277 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9278 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9279 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9281 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9282 application.SendNotification();
9283 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9284 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9285 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9286 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION);
9287 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
9289 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9290 application.SendNotification();
9291 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9292 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9293 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9294 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9295 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9297 // We did expect the animation to finish
9299 finishCheck.CheckSignalReceived();
9303 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9305 TestApplication application;
9307 float startValue(1.0f);
9308 Actor actor = Actor::New();
9309 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9310 application.GetScene().Add(actor);
9312 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9313 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9314 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9315 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9316 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9317 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9318 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9319 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9320 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9322 // Build the animation
9323 float durationSeconds(1.0f);
9324 Animation animation = Animation::New(durationSeconds);
9326 KeyFrames keyFrames = KeyFrames::New();
9327 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9328 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9329 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9331 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
9333 // Start the animation
9336 bool signalReceived(false);
9337 AnimationFinishCheck finishCheck(signalReceived);
9338 animation.FinishedSignal().Connect(&application, finishCheck);
9339 application.SendNotification();
9340 application.Render(0);
9341 application.SendNotification();
9342 finishCheck.CheckSignalNotReceived();
9343 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9344 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9345 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9346 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9348 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9349 application.SendNotification();
9350 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9351 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9352 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9353 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9355 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9356 application.SendNotification();
9357 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9358 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9359 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9360 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9362 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9363 application.SendNotification();
9364 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9365 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9366 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9367 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9369 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9370 application.SendNotification();
9371 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9372 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9373 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9374 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9376 // We did expect the animation to finish
9378 finishCheck.CheckSignalReceived();
9382 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9384 TestApplication application;
9386 float startValue(1.0f);
9387 Actor actor = Actor::New();
9388 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9389 application.GetScene().Add(actor);
9391 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9392 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9393 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9394 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9395 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9396 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9397 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9398 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9399 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9401 // Build the animation
9402 float durationSeconds(1.0f);
9403 Animation animation = Animation::New(durationSeconds);
9405 KeyFrames keyFrames = KeyFrames::New();
9406 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9407 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9408 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9410 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
9412 // Start the animation
9415 bool signalReceived(false);
9416 AnimationFinishCheck finishCheck(signalReceived);
9417 animation.FinishedSignal().Connect(&application, finishCheck);
9418 application.SendNotification();
9419 application.Render(0);
9420 application.SendNotification();
9421 finishCheck.CheckSignalNotReceived();
9422 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9423 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9424 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9425 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9427 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9428 application.SendNotification();
9429 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9430 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9431 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9432 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9434 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9435 application.SendNotification();
9436 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9437 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9438 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9439 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9441 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9442 application.SendNotification();
9443 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9444 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9445 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9446 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9448 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9449 application.SendNotification();
9450 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9451 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9452 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9453 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9455 // We did expect the animation to finish
9457 finishCheck.CheckSignalReceived();
9461 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9463 TestApplication application;
9465 Actor actor = Actor::New();
9466 AngleAxis aa(Degree(90), Vector3::XAXIS);
9467 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9468 application.GetScene().Add(actor);
9470 application.SendNotification();
9471 application.Render(0);
9473 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9475 // Build the animation
9476 float durationSeconds(1.0f);
9477 Animation animation = Animation::New(durationSeconds);
9479 KeyFrames keyFrames = KeyFrames::New();
9480 keyFrames.Add(0.0f, false);
9481 keyFrames.Add(0.2f, true);
9482 keyFrames.Add(0.4f, true);
9483 keyFrames.Add(0.8f, false);
9484 keyFrames.Add(1.0f, true);
9486 animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
9488 // Start the animation
9491 // Final key frame value should be retrievable straight away
9492 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9494 bool signalReceived(false);
9495 AnimationFinishCheck finishCheck(signalReceived);
9496 animation.FinishedSignal().Connect(&application, finishCheck);
9497 application.SendNotification();
9498 application.SendNotification();
9499 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9500 application.SendNotification();
9501 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9502 application.SendNotification();
9504 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9505 finishCheck.CheckSignalReceived();
9509 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9511 TestApplication application;
9513 Actor actor = Actor::New();
9514 AngleAxis aa(Degree(90), Vector3::XAXIS);
9515 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9516 application.GetScene().Add(actor);
9518 application.SendNotification();
9519 application.Render(0);
9521 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9523 // Build the animation
9524 float durationSeconds(1.0f);
9525 Animation animation = Animation::New(durationSeconds);
9527 KeyFrames keyFrames = KeyFrames::New();
9528 keyFrames.Add(0.0f, false);
9529 keyFrames.Add(0.2f, true);
9530 keyFrames.Add(0.4f, true);
9531 keyFrames.Add(0.8f, false);
9532 keyFrames.Add(1.0f, true);
9534 //Cubic interpolation for boolean values should be ignored
9535 animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
9537 // Start the animation
9540 bool signalReceived(false);
9541 AnimationFinishCheck finishCheck(signalReceived);
9542 animation.FinishedSignal().Connect(&application, finishCheck);
9543 application.SendNotification();
9544 application.SendNotification();
9545 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9546 application.SendNotification();
9547 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9548 application.SendNotification();
9550 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9551 finishCheck.CheckSignalReceived();
9555 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9557 TestApplication application;
9559 Actor actor = Actor::New();
9560 AngleAxis aa(Degree(90), Vector3::XAXIS);
9561 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9562 application.GetScene().Add(actor);
9564 application.SendNotification();
9565 application.Render(0);
9566 Quaternion start(Radian(aa.angle), aa.axis);
9567 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9569 // Build the animation
9570 float durationSeconds(1.0f);
9571 Animation animation = Animation::New(durationSeconds);
9573 KeyFrames keyFrames = KeyFrames::New();
9574 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9576 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9578 // Start the animation
9581 // Final key frame value should be retrievable straight away
9582 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
9584 bool signalReceived(false);
9585 AnimationFinishCheck finishCheck(signalReceived);
9586 animation.FinishedSignal().Connect(&application, finishCheck);
9587 application.SendNotification();
9588 application.SendNotification();
9589 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9590 application.SendNotification();
9591 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9592 application.SendNotification();
9594 Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9596 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9597 finishCheck.CheckSignalReceived();
9601 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9603 TestApplication application;
9605 Actor actor = Actor::New();
9606 AngleAxis aa(Degree(90), Vector3::XAXIS);
9607 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9608 application.SendNotification();
9609 application.Render(0);
9610 application.GetScene().Add(actor);
9612 Quaternion start(Radian(aa.angle), aa.axis);
9613 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9615 // Build the animation
9616 float durationSeconds(1.0f);
9617 Animation animation = Animation::New(durationSeconds);
9619 KeyFrames keyFrames = KeyFrames::New();
9620 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9621 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9622 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9624 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9626 // Start the animation
9629 bool signalReceived(false);
9630 AnimationFinishCheck finishCheck(signalReceived);
9631 animation.FinishedSignal().Connect(&application, finishCheck);
9632 application.SendNotification();
9633 application.Render(0);
9634 application.SendNotification();
9635 finishCheck.CheckSignalNotReceived();
9637 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9638 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9640 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9641 application.SendNotification();
9642 check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9643 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9645 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9646 application.SendNotification();
9647 check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9648 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9650 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9651 application.SendNotification();
9652 check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9653 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9655 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9656 application.SendNotification();
9657 check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9658 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9660 // We did expect the animation to finish
9662 finishCheck.CheckSignalReceived();
9666 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9668 TestApplication application;
9670 Actor actor = Actor::New();
9671 AngleAxis aa(Degree(90), Vector3::XAXIS);
9672 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9673 application.GetScene().Add(actor);
9675 application.SendNotification();
9676 application.Render(0);
9677 Quaternion start(Radian(aa.angle), aa.axis);
9678 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9680 // Build the animation
9681 float durationSeconds(1.0f);
9682 Animation animation = Animation::New(durationSeconds);
9684 KeyFrames keyFrames = KeyFrames::New();
9685 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9687 //Cubic interpolation should be ignored for quaternions
9688 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9690 // Start the animation
9693 bool signalReceived(false);
9694 AnimationFinishCheck finishCheck(signalReceived);
9695 animation.FinishedSignal().Connect(&application, finishCheck);
9696 application.SendNotification();
9697 application.SendNotification();
9698 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9699 application.SendNotification();
9700 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9701 application.SendNotification();
9703 Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9705 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9706 finishCheck.CheckSignalReceived();
9710 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9712 TestApplication application;
9714 Actor actor = Actor::New();
9715 AngleAxis aa(Degree(90), Vector3::XAXIS);
9716 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9717 application.SendNotification();
9718 application.Render(0);
9719 application.GetScene().Add(actor);
9721 Quaternion start(Radian(aa.angle), aa.axis);
9722 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9724 // Build the animation
9725 float durationSeconds(1.0f);
9726 Animation animation = Animation::New(durationSeconds);
9728 KeyFrames keyFrames = KeyFrames::New();
9729 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9730 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9731 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9733 //Cubic interpolation should be ignored for quaternions
9734 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9736 // Start the animation
9739 bool signalReceived(false);
9740 AnimationFinishCheck finishCheck(signalReceived);
9741 animation.FinishedSignal().Connect(&application, finishCheck);
9742 application.SendNotification();
9743 application.Render(0);
9744 application.SendNotification();
9745 finishCheck.CheckSignalNotReceived();
9747 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9748 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9750 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9751 application.SendNotification();
9752 check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9753 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9755 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9756 application.SendNotification();
9757 check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9758 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9760 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9761 application.SendNotification();
9762 check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9763 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9765 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9766 application.SendNotification();
9767 check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9768 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9770 // We did expect the animation to finish
9772 finishCheck.CheckSignalReceived();
9776 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9778 TestApplication application;
9780 float startValue(1.0f);
9781 Actor actor = Actor::New();
9782 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9783 application.GetScene().Add(actor);
9785 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9786 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9787 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9788 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9789 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9790 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9791 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9792 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9793 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9795 // Build the animation
9796 float durationSeconds(1.0f);
9797 Animation animation = Animation::New(durationSeconds);
9799 KeyFrames keyFrames = KeyFrames::New();
9800 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9801 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9802 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9804 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
9806 // Start the animation
9809 bool signalReceived(false);
9810 AnimationFinishCheck finishCheck(signalReceived);
9811 animation.FinishedSignal().Connect(&application, finishCheck);
9812 application.SendNotification();
9813 application.Render(0);
9814 application.SendNotification();
9815 finishCheck.CheckSignalNotReceived();
9816 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9817 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9818 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9819 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9821 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9822 application.SendNotification();
9823 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9824 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9825 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9826 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9828 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9829 application.SendNotification();
9830 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9831 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9832 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9833 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9835 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9836 application.SendNotification();
9837 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9838 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9839 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9840 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9842 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9843 application.SendNotification();
9844 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9845 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9846 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9847 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9849 // We did expect the animation to finish
9851 finishCheck.CheckSignalReceived();
9855 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9857 TestApplication application;
9859 float startValue(1.0f);
9860 Actor actor = Actor::New();
9861 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9862 application.GetScene().Add(actor);
9864 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9865 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9866 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9867 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9868 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9869 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9870 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9871 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9872 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9874 // Build the animation
9875 float durationSeconds(1.0f);
9876 Animation animation = Animation::New(durationSeconds);
9878 KeyFrames keyFrames = KeyFrames::New();
9879 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9880 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9881 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9883 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
9885 // Start the animation
9888 bool signalReceived(false);
9889 AnimationFinishCheck finishCheck(signalReceived);
9890 animation.FinishedSignal().Connect(&application, finishCheck);
9891 application.SendNotification();
9892 application.Render(0);
9893 application.SendNotification();
9894 finishCheck.CheckSignalNotReceived();
9895 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9896 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9897 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9898 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9900 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9901 application.SendNotification();
9902 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9903 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9904 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9905 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9907 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9908 application.SendNotification();
9909 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9910 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9911 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9912 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9914 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9915 application.SendNotification();
9916 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9917 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9918 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9919 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9921 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9922 application.SendNotification();
9923 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9924 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9925 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9926 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9928 // We did expect the animation to finish
9930 finishCheck.CheckSignalReceived();
9934 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9936 TestApplication application;
9938 float startValue(1.0f);
9939 Actor actor = Actor::New();
9940 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9941 application.GetScene().Add(actor);
9943 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9944 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9945 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9946 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9947 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9948 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9949 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9950 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9951 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9953 // Build the animation
9954 float durationSeconds(1.0f);
9956 Animation animation = Animation::New(durationSeconds);
9958 KeyFrames keyFrames = KeyFrames::New();
9959 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9960 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9961 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9963 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay));
9965 // Start the animation
9968 bool signalReceived(false);
9969 AnimationFinishCheck finishCheck(signalReceived);
9970 animation.FinishedSignal().Connect(&application, finishCheck);
9971 application.SendNotification();
9973 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
9974 application.SendNotification();
9975 finishCheck.CheckSignalNotReceived();
9976 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9977 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9978 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9979 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9981 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
9982 application.SendNotification();
9983 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9984 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9985 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9986 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9988 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
9989 application.SendNotification();
9990 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9991 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9992 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9993 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9995 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
9996 application.SendNotification();
9997 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9998 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9999 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10000 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10002 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10003 application.SendNotification();
10004 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10005 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10006 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10007 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10009 // We did expect the animation to finish
10011 finishCheck.CheckSignalReceived();
10015 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
10017 TestApplication application;
10019 float startValue(1.0f);
10020 Actor actor = Actor::New();
10021 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10022 application.GetScene().Add(actor);
10024 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10025 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10026 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10027 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10028 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10029 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10030 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10031 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10032 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10034 // Build the animation
10035 float durationSeconds(1.0f);
10036 float delay = 0.5f;
10037 Animation animation = Animation::New(durationSeconds);
10039 KeyFrames keyFrames = KeyFrames::New();
10040 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10041 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10042 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10044 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10046 // Start the animation
10049 bool signalReceived(false);
10050 AnimationFinishCheck finishCheck(signalReceived);
10051 animation.FinishedSignal().Connect(&application, finishCheck);
10052 application.SendNotification();
10054 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10055 application.SendNotification();
10056 finishCheck.CheckSignalNotReceived();
10057 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10058 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10059 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10060 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10062 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10063 application.SendNotification();
10064 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10065 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10066 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10067 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10069 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10070 application.SendNotification();
10071 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10072 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10073 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10074 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10076 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10077 application.SendNotification();
10078 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10079 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10080 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10081 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10083 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10084 application.SendNotification();
10085 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10086 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10087 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10088 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10090 // We did expect the animation to finish
10092 finishCheck.CheckSignalReceived();
10096 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10098 TestApplication application;
10100 float startValue(1.0f);
10101 float delay = 0.5f;
10102 Actor actor = Actor::New();
10103 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10104 application.GetScene().Add(actor);
10106 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10107 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10108 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10109 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10110 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10111 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10112 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10113 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10114 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10116 // Build the animation
10117 float durationSeconds(1.0f);
10118 Animation animation = Animation::New(durationSeconds);
10120 KeyFrames keyFrames = KeyFrames::New();
10121 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10122 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10123 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10125 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
10127 // Start the animation
10130 bool signalReceived(false);
10131 AnimationFinishCheck finishCheck(signalReceived);
10132 animation.FinishedSignal().Connect(&application, finishCheck);
10133 application.SendNotification();
10135 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10136 application.SendNotification();
10137 finishCheck.CheckSignalNotReceived();
10138 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10139 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10140 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10141 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10143 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10144 application.SendNotification();
10145 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10146 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10147 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10148 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10150 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10151 application.SendNotification();
10152 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10153 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10154 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10155 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10157 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10158 application.SendNotification();
10159 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10160 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10161 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10162 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10164 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10165 application.SendNotification();
10166 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10167 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10168 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10169 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10171 // We did expect the animation to finish
10173 finishCheck.CheckSignalReceived();
10177 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10179 TestApplication application;
10181 float startValue(1.0f);
10182 Actor actor = Actor::New();
10183 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10184 application.GetScene().Add(actor);
10186 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10187 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10188 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10189 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10190 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10191 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10192 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10193 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10194 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10196 // Build the animation
10197 float durationSeconds(1.0f);
10198 float delay = 0.5f;
10199 Animation animation = Animation::New(durationSeconds);
10201 KeyFrames keyFrames = KeyFrames::New();
10202 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10203 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10204 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10206 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10208 // Start the animation
10211 bool signalReceived(false);
10212 AnimationFinishCheck finishCheck(signalReceived);
10213 animation.FinishedSignal().Connect(&application, finishCheck);
10214 application.SendNotification();
10216 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10217 application.SendNotification();
10218 finishCheck.CheckSignalNotReceived();
10219 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10220 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10221 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10222 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10224 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10225 application.SendNotification();
10226 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10227 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10228 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10229 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10231 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10232 application.SendNotification();
10233 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10234 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10235 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10236 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10238 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10239 application.SendNotification();
10240 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10241 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10242 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10243 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10245 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10246 application.SendNotification();
10247 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10248 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10249 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10250 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10252 // We did expect the animation to finish
10254 finishCheck.CheckSignalReceived();
10258 int UtcDaliAnimationAnimateP(void)
10260 TestApplication application;
10262 Actor actor = Actor::New();
10263 application.GetScene().Add(actor);
10266 Vector3 position0(30.0, 80.0, 0.0);
10267 Vector3 position1(70.0, 120.0, 0.0);
10268 Vector3 position2(100.0, 100.0, 0.0);
10270 Dali::Path path = Dali::Path::New();
10271 path.AddPoint(position0);
10272 path.AddPoint(position1);
10273 path.AddPoint(position2);
10275 //Control points for first segment
10276 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10277 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10279 //Control points for second segment
10280 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10281 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10283 // Build the animation
10284 float durationSeconds(1.0f);
10285 Animation animation = Animation::New(durationSeconds);
10286 animation.Animate(actor, path, Vector3::XAXIS);
10288 // Start the animation
10291 bool signalReceived(false);
10292 AnimationFinishCheck finishCheck(signalReceived);
10293 animation.FinishedSignal().Connect(&application, finishCheck);
10294 application.SendNotification();
10295 application.Render(0);
10296 application.SendNotification();
10297 finishCheck.CheckSignalNotReceived();
10298 Vector3 position, tangent;
10299 Quaternion rotation;
10300 path.Sample(0.0f, position, tangent);
10301 rotation = Quaternion(Vector3::XAXIS, tangent);
10302 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10303 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10305 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10306 application.SendNotification();
10307 path.Sample(0.25f, position, tangent);
10308 rotation = Quaternion(Vector3::XAXIS, tangent);
10309 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10310 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10312 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10313 application.SendNotification();
10314 path.Sample(0.5f, position, tangent);
10315 rotation = Quaternion(Vector3::XAXIS, tangent);
10316 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10317 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10319 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10320 application.SendNotification();
10321 path.Sample(0.75f, position, tangent);
10322 rotation = Quaternion(Vector3::XAXIS, tangent);
10323 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10324 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10326 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10327 application.SendNotification();
10328 path.Sample(1.0f, position, tangent);
10329 rotation = Quaternion(Vector3::XAXIS, tangent);
10330 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10331 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10333 finishCheck.CheckSignalReceived();
10337 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10339 TestApplication application;
10341 Actor actor = Actor::New();
10342 application.GetScene().Add(actor);
10345 Vector3 position0(30.0, 80.0, 0.0);
10346 Vector3 position1(70.0, 120.0, 0.0);
10347 Vector3 position2(100.0, 100.0, 0.0);
10349 Dali::Path path = Dali::Path::New();
10350 path.AddPoint(position0);
10351 path.AddPoint(position1);
10352 path.AddPoint(position2);
10354 //Control points for first segment
10355 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10356 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10358 //Control points for second segment
10359 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10360 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10362 // Build the animation
10363 float durationSeconds(1.0f);
10364 Animation animation = Animation::New(durationSeconds);
10365 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10367 // Start the animation
10370 bool signalReceived(false);
10371 AnimationFinishCheck finishCheck(signalReceived);
10372 animation.FinishedSignal().Connect(&application, finishCheck);
10373 application.SendNotification();
10374 application.Render(0);
10375 application.SendNotification();
10376 finishCheck.CheckSignalNotReceived();
10377 Vector3 position, tangent;
10378 Quaternion rotation;
10379 path.Sample(0.0f, position, tangent);
10380 rotation = Quaternion(Vector3::XAXIS, tangent);
10381 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10382 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10384 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10385 application.SendNotification();
10386 path.Sample(0.25f, position, tangent);
10387 rotation = Quaternion(Vector3::XAXIS, tangent);
10388 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10389 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10391 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10392 application.SendNotification();
10393 path.Sample(0.5f, position, tangent);
10394 rotation = Quaternion(Vector3::XAXIS, tangent);
10395 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10396 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10398 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10399 application.SendNotification();
10400 path.Sample(0.75f, position, tangent);
10401 rotation = Quaternion(Vector3::XAXIS, tangent);
10402 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10403 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10405 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10406 application.SendNotification();
10407 path.Sample(1.0f, position, tangent);
10408 rotation = Quaternion(Vector3::XAXIS, tangent);
10409 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10410 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10412 finishCheck.CheckSignalReceived();
10416 int UtcDaliAnimationAnimateTimePeriodP(void)
10418 TestApplication application;
10420 Actor actor = Actor::New();
10421 application.GetScene().Add(actor);
10424 Vector3 position0(30.0, 80.0, 0.0);
10425 Vector3 position1(70.0, 120.0, 0.0);
10426 Vector3 position2(100.0, 100.0, 0.0);
10428 Dali::Path path = Dali::Path::New();
10429 path.AddPoint(position0);
10430 path.AddPoint(position1);
10431 path.AddPoint(position2);
10433 //Control points for first segment
10434 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10435 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10437 //Control points for second segment
10438 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10439 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10441 // Build the animation
10442 float durationSeconds(1.0f);
10443 Animation animation = Animation::New(durationSeconds);
10444 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10446 // Start the animation
10449 bool signalReceived(false);
10450 AnimationFinishCheck finishCheck(signalReceived);
10451 animation.FinishedSignal().Connect(&application, finishCheck);
10452 application.SendNotification();
10453 application.Render(0);
10454 application.SendNotification();
10455 finishCheck.CheckSignalNotReceived();
10456 Vector3 position, tangent;
10457 Quaternion rotation;
10458 path.Sample(0.0f, position, tangent);
10459 rotation = Quaternion(Vector3::XAXIS, tangent);
10460 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10461 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10463 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10464 application.SendNotification();
10465 path.Sample(0.25f, position, tangent);
10466 rotation = Quaternion(Vector3::XAXIS, tangent);
10467 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10468 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10470 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10471 application.SendNotification();
10472 path.Sample(0.5f, position, tangent);
10473 rotation = Quaternion(Vector3::XAXIS, tangent);
10474 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10475 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10477 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10478 application.SendNotification();
10479 path.Sample(0.75f, position, tangent);
10480 rotation = Quaternion(Vector3::XAXIS, tangent);
10481 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10482 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10484 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10485 application.SendNotification();
10486 path.Sample(1.0f, position, tangent);
10487 rotation = Quaternion(Vector3::XAXIS, tangent);
10488 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10489 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10491 finishCheck.CheckSignalReceived();
10495 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10497 TestApplication application;
10499 Actor actor = Actor::New();
10500 application.GetScene().Add(actor);
10503 Vector3 position0(30.0, 80.0, 0.0);
10504 Vector3 position1(70.0, 120.0, 0.0);
10505 Vector3 position2(100.0, 100.0, 0.0);
10507 Dali::Path path = Dali::Path::New();
10508 path.AddPoint(position0);
10509 path.AddPoint(position1);
10510 path.AddPoint(position2);
10512 //Control points for first segment
10513 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10514 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10516 //Control points for second segment
10517 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10518 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10520 // Build the animation
10521 float durationSeconds(1.0f);
10522 Animation animation = Animation::New(durationSeconds);
10523 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10525 // Start the animation
10528 bool signalReceived(false);
10529 AnimationFinishCheck finishCheck(signalReceived);
10530 animation.FinishedSignal().Connect(&application, finishCheck);
10531 application.SendNotification();
10532 application.Render(0);
10533 application.SendNotification();
10534 finishCheck.CheckSignalNotReceived();
10535 Vector3 position, tangent;
10536 Quaternion rotation;
10537 path.Sample(0.0f, position, tangent);
10538 rotation = Quaternion(Vector3::XAXIS, tangent);
10539 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10540 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10542 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10543 application.SendNotification();
10544 path.Sample(0.25f, position, tangent);
10545 rotation = Quaternion(Vector3::XAXIS, tangent);
10546 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10547 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10549 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10550 application.SendNotification();
10551 path.Sample(0.5f, position, tangent);
10552 rotation = Quaternion(Vector3::XAXIS, tangent);
10553 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10554 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10556 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10557 application.SendNotification();
10558 path.Sample(0.75f, position, tangent);
10559 rotation = Quaternion(Vector3::XAXIS, tangent);
10560 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10561 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10563 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10564 application.SendNotification();
10565 path.Sample(1.0f, position, tangent);
10566 rotation = Quaternion(Vector3::XAXIS, tangent);
10567 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10568 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10570 finishCheck.CheckSignalReceived();
10574 int UtcDaliAnimationShowP(void)
10576 TestApplication application;
10578 Actor actor = Actor::New();
10579 actor.SetProperty(Actor::Property::VISIBLE, false);
10580 application.SendNotification();
10581 application.Render(0);
10582 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10583 application.GetScene().Add(actor);
10585 // Start the animation
10586 float durationSeconds(10.0f);
10587 Animation animation = Animation::New(durationSeconds);
10588 animation.Show(actor, durationSeconds * 0.5f);
10591 bool signalReceived(false);
10592 AnimationFinishCheck finishCheck(signalReceived);
10593 animation.FinishedSignal().Connect(&application, finishCheck);
10595 application.SendNotification();
10596 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10598 // We didn't expect the animation to finish yet
10599 application.SendNotification();
10600 finishCheck.CheckSignalNotReceived();
10601 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10603 application.SendNotification();
10604 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
10606 // We didn't expect the animation to finish yet
10607 application.SendNotification();
10608 finishCheck.CheckSignalNotReceived();
10609 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10611 application.SendNotification();
10612 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10614 // We did expect the animation to finish
10615 application.SendNotification();
10616 finishCheck.CheckSignalReceived();
10617 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10621 int UtcDaliAnimationHideP(void)
10623 TestApplication application;
10625 Actor actor = Actor::New();
10626 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10627 application.GetScene().Add(actor);
10629 // Start the animation
10630 float durationSeconds(10.0f);
10631 Animation animation = Animation::New(durationSeconds);
10632 animation.Hide(actor, durationSeconds * 0.5f);
10635 bool signalReceived(false);
10636 AnimationFinishCheck finishCheck(signalReceived);
10637 animation.FinishedSignal().Connect(&application, finishCheck);
10639 application.SendNotification();
10640 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10642 // We didn't expect the animation to finish yet
10643 application.SendNotification();
10644 finishCheck.CheckSignalNotReceived();
10645 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10647 application.SendNotification();
10648 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
10650 // We didn't expect the animation to finish yet
10651 application.SendNotification();
10652 finishCheck.CheckSignalNotReceived();
10653 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10655 application.SendNotification();
10656 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10658 // We did expect the animation to finish
10659 application.SendNotification();
10660 finishCheck.CheckSignalReceived();
10661 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10665 int UtcDaliAnimationShowHideAtEndP(void)
10667 // Test that show/hide delay can be the same as animation duration
10668 // i.e. to show/hide at the end of the animation
10670 TestApplication application;
10672 Actor actor = Actor::New();
10673 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10674 application.GetScene().Add(actor);
10676 // Start Hide animation
10677 float durationSeconds(10.0f);
10678 Animation animation = Animation::New(durationSeconds);
10679 animation.Hide(actor, durationSeconds /*Hide at end*/);
10682 bool signalReceived(false);
10683 AnimationFinishCheck finishCheck(signalReceived);
10684 animation.FinishedSignal().Connect(&application, finishCheck);
10686 application.SendNotification();
10687 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10689 // We did expect the animation to finish
10690 application.SendNotification();
10691 finishCheck.CheckSignalReceived();
10692 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10694 // Start Show animation
10695 animation = Animation::New(durationSeconds);
10696 animation.Show(actor, durationSeconds /*Show at end*/);
10697 animation.FinishedSignal().Connect(&application, finishCheck);
10700 application.SendNotification();
10701 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10703 // We did expect the animation to finish
10704 application.SendNotification();
10705 finishCheck.CheckSignalReceived();
10706 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10710 int UtcDaliKeyFramesCreateDestroyP(void)
10712 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10714 KeyFrames* keyFrames = new KeyFrames;
10716 DALI_TEST_CHECK(true);
10720 int UtcDaliKeyFramesDownCastP(void)
10722 TestApplication application;
10723 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10725 KeyFrames keyFrames = KeyFrames::New();
10726 BaseHandle object(keyFrames);
10728 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10729 DALI_TEST_CHECK(keyFrames2);
10731 KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
10732 DALI_TEST_CHECK(keyFrames3);
10734 BaseHandle unInitializedObject;
10735 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10736 DALI_TEST_CHECK(!keyFrames4);
10738 KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
10739 DALI_TEST_CHECK(!keyFrames5);
10743 int UtcDaliAnimationCreateDestroyP(void)
10745 TestApplication application;
10746 Animation* animation = new Animation;
10747 DALI_TEST_CHECK(animation);
10752 struct UpdateManagerTestConstraint
10754 UpdateManagerTestConstraint(TestApplication& application)
10755 : mApplication(application)
10759 void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
10761 mApplication.SendNotification(); // Process events
10764 TestApplication& mApplication;
10767 int UtcDaliAnimationUpdateManagerP(void)
10769 TestApplication application;
10771 Actor actor = Actor::New();
10772 application.GetScene().Add(actor);
10774 // Build the animation
10775 Animation animation = Animation::New(0.0f);
10777 bool signalReceived = false;
10778 AnimationFinishCheck finishCheck(signalReceived);
10779 animation.FinishedSignal().Connect(&application, finishCheck);
10781 Vector3 startValue(1.0f, 1.0f, 1.0f);
10782 Property::Index index = actor.RegisterProperty("testProperty", startValue);
10783 Constraint constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
10784 constraint.Apply();
10786 // Apply animation to actor
10787 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
10788 animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
10792 application.SendNotification();
10793 application.UpdateOnly(16);
10795 finishCheck.CheckSignalNotReceived();
10797 application.SendNotification(); // Process events
10799 finishCheck.CheckSignalReceived();
10804 int UtcDaliAnimationSignalOrderP(void)
10806 TestApplication application;
10808 Actor actor = Actor::New();
10809 application.GetScene().Add(actor);
10811 // Build the animations
10812 Animation animation1 = Animation::New(0.0f); // finishes first frame
10813 Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
10815 bool signal1Received = false;
10816 animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
10818 bool signal2Received = false;
10819 animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
10821 // Apply animations to actor
10822 animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
10824 animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
10827 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10828 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10830 application.SendNotification();
10831 application.UpdateOnly(10); // 10ms progress
10833 // no notifications yet
10834 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10835 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10837 application.SendNotification();
10840 DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
10841 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10842 signal1Received = false;
10844 // 1st animation is complete now, do another update with no ProcessEvents in between
10845 application.UpdateOnly(20); // 20ms progress
10848 application.SendNotification();
10850 // 2nd should complete now
10851 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10852 DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
10857 int UtcDaliAnimationExtendDurationP(void)
10859 TestApplication application;
10861 Actor actor = Actor::New();
10863 // Register a float property
10864 float startValue(10.0f);
10865 Property::Index index = actor.RegisterProperty("testProperty", startValue);
10866 application.GetScene().Add(actor);
10867 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
10868 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
10870 // Build the animation
10871 float initialDurationSeconds(1.0f);
10872 float animatorDelay = 5.0f;
10873 float animatorDurationSeconds(5.0f);
10874 float extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
10875 Animation animation = Animation::New(initialDurationSeconds);
10876 float targetValue(30.0f);
10877 float relativeValue(targetValue - startValue);
10879 animation.AnimateTo(Property(actor, index),
10881 TimePeriod(animatorDelay, animatorDurationSeconds));
10883 // The duration should have been extended
10884 DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
10886 // Start the animation
10889 bool signalReceived(false);
10890 AnimationFinishCheck finishCheck(signalReceived);
10891 animation.FinishedSignal().Connect(&application, finishCheck);
10893 application.SendNotification();
10894 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
10896 // We didn't expect the animation to finish yet, but cached value should be the final one
10897 application.SendNotification();
10898 finishCheck.CheckSignalNotReceived();
10899 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
10900 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
10902 application.SendNotification();
10903 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
10905 // We didn't expect the animation to finish yet
10906 application.SendNotification();
10907 finishCheck.CheckSignalNotReceived();
10908 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
10910 application.SendNotification();
10911 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
10913 // We did expect the animation to finish
10914 application.SendNotification();
10915 finishCheck.CheckSignalReceived();
10916 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
10917 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
10921 int UtcDaliAnimationCustomIntProperty(void)
10923 TestApplication application;
10925 Actor actor = Actor::New();
10926 application.GetScene().Add(actor);
10927 int startValue(0u);
10929 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10930 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
10931 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
10933 // Build the animation
10934 float durationSeconds(1.0f);
10935 Animation animation = Animation::New(durationSeconds);
10936 animation.AnimateTo(Property(actor, index), 20);
10938 // Start the animation
10941 // Target value should be retrievable straight away
10942 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
10944 bool signalReceived(false);
10945 AnimationFinishCheck finishCheck(signalReceived);
10946 animation.FinishedSignal().Connect(&application, finishCheck);
10948 application.SendNotification();
10949 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
10951 // We didn't expect the animation to finish yet
10952 application.SendNotification();
10953 finishCheck.CheckSignalNotReceived();
10954 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
10956 application.SendNotification();
10957 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10959 // We did expect the animation to finish
10960 application.SendNotification();
10961 finishCheck.CheckSignalReceived();
10962 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
10963 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
10967 int UtcDaliAnimationDuration(void)
10969 TestApplication application;
10971 Actor actor = Actor::New();
10972 application.GetScene().Add(actor);
10974 Animation animation = Animation::New(0.0f);
10975 DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
10977 // The animation duration should automatically increase depending on the animator time period
10979 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
10980 DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
10982 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
10983 DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
10988 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10990 TestApplication application;
10992 Actor actor = Actor::New();
10994 // Register an integer property
10996 Property::Index index = actor.RegisterProperty("testProperty", startValue);
10997 application.GetScene().Add(actor);
10998 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11000 DALI_TEST_ASSERTION(
11002 // Build the animation
11003 Animation animation = Animation::New(2.0f);
11004 std::string relativeValue = "relative string";
11005 animation.AnimateBy(Property(actor, index), relativeValue);
11006 tet_result(TET_FAIL);
11008 "Target value is not animatable");
11013 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
11015 TestApplication application;
11017 Actor actor = Actor::New();
11019 // Register an integer property
11021 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11022 application.GetScene().Add(actor);
11023 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11025 DALI_TEST_ASSERTION(
11027 // Build the animation
11028 Animation animation = Animation::New(2.0f);
11029 std::string relativeValue = "relative string";
11030 animation.AnimateTo(Property(actor, index), relativeValue);
11032 "Target value is not animatable");
11037 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
11039 TestApplication application;
11041 Actor actor = Actor::New();
11043 // Register an integer property
11045 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11046 application.GetScene().Add(actor);
11047 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11049 DALI_TEST_ASSERTION(
11051 // Build the animation
11052 KeyFrames keyFrames = KeyFrames::New();
11053 keyFrames.Add(0.0f, std::string("relative string1"));
11054 keyFrames.Add(1.0f, std::string("relative string2"));
11055 // no need to really create the animation as keyframes do the check
11057 "Property type is not animatable");
11062 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
11064 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
11066 TestApplication application;
11068 tet_infoline("Set initial position and set up animation to re-position actor");
11070 Actor actor = Actor::New();
11071 application.GetScene().Add(actor);
11072 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11073 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11075 // Build the animation
11076 Animation animation = Animation::New(2.0f);
11078 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11079 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11080 DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11082 tet_infoline("Set target position in animation without intiating play");
11084 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11085 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11087 application.SendNotification();
11088 application.Render();
11090 tet_infoline("Ensure position of actor is still at intial value");
11092 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11093 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11094 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11096 tet_infoline("Play animation and ensure actor position is now target");
11099 application.SendNotification();
11100 application.Render(1000u);
11102 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11104 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11105 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11106 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11108 tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11110 application.Render(2000u);
11112 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11114 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11115 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11116 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11121 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11123 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11125 TestApplication application;
11127 std::vector<Vector3> targetPositions;
11129 targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
11130 targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11131 targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
11133 tet_infoline("Set initial position and set up animation to re-position actor");
11135 Actor actor = Actor::New();
11136 application.GetScene().Add(actor);
11137 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11138 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11140 // Build the animation
11141 Animation animation = Animation::New(2.0f);
11143 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11144 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11145 DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11147 tet_infoline("Set target position in animation without intiating play");
11149 for(unsigned int i = 0; i < targetPositions.size(); i++)
11151 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11154 application.SendNotification();
11155 application.Render();
11157 tet_infoline("Ensure position of actor is still at intial value");
11159 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11160 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11161 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11163 tet_infoline("Play animation and ensure actor position is now target");
11166 application.SendNotification();
11167 application.Render(1000u);
11169 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11171 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11172 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11173 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11175 tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11177 application.Render(2000u);
11179 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11181 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11182 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11183 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11188 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11190 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");
11192 TestApplication application;
11194 std::vector<Vector3> targetSizes;
11195 std::vector<Vector3> targetPositions;
11197 targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11198 targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
11200 targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11202 tet_infoline("Set initial position and set up animation to re-position actor");
11204 Actor actor = Actor::New();
11205 application.GetScene().Add(actor);
11206 Vector3 initialSize(10.0f, 10.0f, 10.0f);
11207 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11209 actor.SetProperty(Actor::Property::SIZE, initialSize);
11210 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11212 // Build the animation
11213 Animation animation = Animation::New(2.0f);
11215 tet_infoline("Set target size in animation without intiating play");
11216 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11217 tet_infoline("Set target position in animation without intiating play");
11218 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11219 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11221 application.SendNotification();
11222 application.Render();
11224 tet_infoline("Ensure position of actor is still at intial size and position");
11226 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11227 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11228 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11230 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
11231 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
11232 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
11234 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11237 application.SendNotification();
11238 application.Render(2000u);
11240 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11242 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11243 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11244 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11246 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
11247 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
11248 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
11253 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11255 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11257 TestApplication application;
11259 std::vector<Vector3> targetSizes;
11260 std::vector<float> targetColors;
11262 targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11263 targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
11265 targetColors.push_back(1.0f);
11267 tet_infoline("Set initial position and set up animation to re-position actor");
11269 Actor actor = Actor::New();
11270 application.GetScene().Add(actor);
11271 Vector3 initialSize(10.0f, 5.0f, 10.0f);
11273 actor.SetProperty(Actor::Property::SIZE, initialSize);
11275 // Build the animation
11276 Animation animation = Animation::New(2.0f);
11278 tet_infoline("Set target size in animation without initiating play");
11279 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11280 tet_infoline("Set target position in animation without intiating play");
11281 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11282 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11284 application.SendNotification();
11285 application.Render();
11287 tet_infoline("Ensure position of actor is still at initial size and position");
11289 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11290 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11291 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11293 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11296 application.SendNotification();
11297 application.Render(2000u);
11299 tet_infoline("Ensure position and size of actor is at target value when animation playing");
11301 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11302 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11303 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11305 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
11310 int UtcDaliAnimationTimePeriodOrder(void)
11312 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
11314 TestApplication application;
11316 Actor actor = Actor::New();
11317 application.GetScene().Add(actor);
11319 application.SendNotification();
11320 application.Render();
11322 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11323 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11324 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11325 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11326 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11328 //////////////////////////////////////////////////////////////////////////////////
11330 tet_infoline("With two AnimateTo calls");
11332 Animation animation = Animation::New(0.0f);
11333 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11334 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11337 tet_infoline("The target position should change instantly");
11338 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11339 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11341 application.SendNotification();
11342 application.Render(5000); // After the animation is complete
11344 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11345 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11346 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11348 //////////////////////////////////////////////////////////////////////////////////
11350 tet_infoline("Same animation again but in a different order - should yield the same result");
11352 actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11353 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11354 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11356 application.SendNotification();
11357 application.Render();
11359 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11360 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11361 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11363 animation = Animation::New(0.0f);
11364 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11365 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11368 tet_infoline("The target position should change instantly");
11369 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11370 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11372 application.SendNotification();
11373 application.Render(5000); // After the animation is complete
11375 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11376 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11377 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11382 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11384 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");
11386 TestApplication application;
11388 Actor actor = Actor::New();
11389 application.GetScene().Add(actor);
11391 application.SendNotification();
11392 application.Render();
11394 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11395 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11396 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11397 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11398 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11400 //////////////////////////////////////////////////////////////////////////////////
11404 Animation animation = Animation::New(0.0f);
11405 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11406 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11407 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11408 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11409 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11410 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11413 tet_infoline("The target position should change instantly");
11414 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11415 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11417 application.SendNotification();
11418 application.Render(14000); // After the animation is complete
11420 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11421 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11422 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11424 //////////////////////////////////////////////////////////////////////////////////
11426 tet_infoline("Same animation again but in a different order - should end up at the same point");
11428 actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11430 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11431 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11433 application.SendNotification();
11434 application.Render();
11436 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11437 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11438 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11440 animation = Animation::New(0.0f);
11441 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11442 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11443 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11444 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11445 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11446 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11449 tet_infoline("The target position should change instantly");
11450 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11451 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11453 application.SendNotification();
11454 application.Render(14000); // After the animation is complete
11456 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11457 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11458 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11463 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11465 TestApplication application;
11468 Actor actor = Actor::New();
11469 const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11470 application.GetScene().Add(actor);
11472 application.Render();
11473 application.SendNotification();
11475 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11477 // Build the animation
11478 float durationSeconds(1.0f);
11479 Animation animation = Animation::New(durationSeconds);
11481 KeyFrames keyFrames = KeyFrames::New();
11482 keyFrames.Add(0.0f, 10);
11483 keyFrames.Add(0.2f, 20);
11484 keyFrames.Add(0.4f, 30);
11485 keyFrames.Add(0.6f, 40);
11486 keyFrames.Add(0.8f, 50);
11487 keyFrames.Add(1.0f, 60);
11489 animation.AnimateBetween(Property(actor, index), keyFrames);
11491 // Start the animation
11494 // Target value should change to the last key-frame's value straight away
11495 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
11500 int UtcDaliAnimationAnimateBetweenVector2P(void)
11502 TestApplication application;
11504 Vector2 startValue(10.0f, 20.0f);
11505 Actor actor = Actor::New();
11506 const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11507 application.GetScene().Add(actor);
11509 application.Render();
11510 application.SendNotification();
11512 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
11514 // Build the animation
11515 float durationSeconds(1.0f);
11516 Animation animation = Animation::New(durationSeconds);
11518 KeyFrames keyFrames = KeyFrames::New();
11519 keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
11520 keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
11521 keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
11522 keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
11523 keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
11524 keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
11526 animation.AnimateBetween(Property(actor, index), keyFrames);
11528 // Start the animation
11531 // Target value should change to the last key-frame's value straight away
11532 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
11537 int UtcDaliAnimationProgressCallbackP(void)
11539 TestApplication application;
11541 Actor actor = Actor::New();
11542 application.GetScene().Add(actor);
11544 // Build the animation
11545 Animation animation = Animation::New(0.0f);
11548 float durationSeconds(1.0f);
11549 animation.SetDuration(durationSeconds);
11551 bool finishedSignalReceived(false);
11552 bool progressSignalReceived(false);
11554 AnimationFinishCheck finishCheck(finishedSignalReceived);
11555 animation.FinishedSignal().Connect(&application, finishCheck);
11557 AnimationProgressCheck progressCheck(progressSignalReceived);
11558 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
11559 application.SendNotification();
11561 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11562 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11564 tet_infoline("Animation Progress notification set to 30%");
11565 DevelAnimation::SetProgressNotification(animation, 0.3f);
11567 application.SendNotification();
11568 application.Render();
11570 DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
11572 progressCheck.CheckSignalNotReceived();
11574 // Start the animation from 10% progress
11575 animation.SetCurrentProgress(0.1f);
11578 tet_infoline("Animation Playing from 10%");
11580 application.SendNotification();
11581 application.Render(0); // start animation
11582 application.Render(durationSeconds * 100.0f); // 20% progress
11584 tet_infoline("Animation at 20%");
11586 progressCheck.CheckSignalNotReceived();
11588 application.SendNotification();
11589 application.Render(durationSeconds * 200.0f); // 40% progress
11590 application.SendNotification();
11591 tet_infoline("Animation at 40%");
11592 DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
11594 progressCheck.CheckSignalReceived();
11596 tet_infoline("Progress check reset");
11597 progressCheck.Reset();
11599 application.Render(durationSeconds * 100.0f); // 50% progress
11600 tet_infoline("Animation at 50%");
11601 application.SendNotification();
11603 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
11605 progressCheck.CheckSignalNotReceived();
11607 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
11608 application.SendNotification();
11610 tet_infoline("Animation at 60%");
11612 finishCheck.CheckSignalNotReceived();
11614 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
11615 application.SendNotification();
11616 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
11617 tet_infoline("Animation at 80%");
11619 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
11620 // We did expect the animation to finish
11621 application.SendNotification();
11622 finishCheck.CheckSignalReceived();
11623 tet_infoline("Animation finished");
11624 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11629 int UtcDaliAnimationPlayAfterP(void)
11631 TestApplication application;
11633 tet_printf("Testing that playing after 2 seconds\n");
11636 Actor actor = Actor::New();
11637 application.GetScene().Add(actor);
11639 // Build the animation
11640 float durationSeconds(1.0f);
11641 Animation animation = Animation::New(durationSeconds);
11643 bool signalReceived(false);
11644 AnimationFinishCheck finishCheck(signalReceived);
11645 animation.FinishedSignal().Connect(&application, finishCheck);
11646 application.SendNotification();
11648 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11649 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11651 // Play animation after the initial delay time
11652 animation.PlayAfter(0.2f);
11653 application.SendNotification();
11654 application.Render(0); // start animation
11656 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11657 application.SendNotification();
11658 finishCheck.CheckSignalNotReceived();
11659 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11661 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11663 // We didn't expect the animation to finish yet
11664 application.SendNotification();
11665 finishCheck.CheckSignalNotReceived();
11666 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11668 application.SendNotification();
11669 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11671 application.SendNotification();
11672 finishCheck.CheckSignalNotReceived();
11673 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11675 application.SendNotification();
11676 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11678 // We did expect the animation to finish
11679 application.SendNotification();
11680 finishCheck.CheckSignalReceived();
11681 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11683 // Check that nothing has changed after a couple of buffer swaps
11684 application.Render(0);
11685 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11688 tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11691 Actor actor = Actor::New();
11692 application.GetScene().Add(actor);
11694 // Build the animation
11695 float durationSeconds(1.0f);
11696 Animation animation = Animation::New(durationSeconds);
11697 animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0
11699 bool signalReceived(false);
11700 AnimationFinishCheck finishCheck(signalReceived);
11701 animation.FinishedSignal().Connect(&application, finishCheck);
11702 application.SendNotification();
11704 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11705 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11707 // Play animation after the initial delay time
11708 animation.PlayAfter(0.2f);
11709 application.SendNotification();
11710 application.Render(0); // start animation
11712 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11713 application.SendNotification();
11714 finishCheck.CheckSignalNotReceived();
11715 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11717 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11719 // We didn't expect the animation to finish yet
11720 application.SendNotification();
11721 finishCheck.CheckSignalNotReceived();
11722 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11724 application.SendNotification();
11725 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11727 application.SendNotification();
11728 finishCheck.CheckSignalNotReceived();
11729 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11731 application.SendNotification();
11732 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11734 // We did expect the animation to finish
11735 application.SendNotification();
11736 finishCheck.CheckSignalReceived();
11737 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
11739 // Check that nothing has changed after a couple of buffer swaps
11740 application.Render(0);
11741 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11747 int UtcDaliAnimationPlayAfterP2(void)
11749 TestApplication application;
11751 tet_printf("Testing that playing after 2 seconds before looping\n");
11754 Actor actor = Actor::New();
11755 application.GetScene().Add(actor);
11757 // Build the animation
11758 float durationSeconds(1.0f);
11759 Animation animation = Animation::New(durationSeconds);
11760 animation.SetLooping(true);
11762 bool signalReceived(false);
11763 AnimationFinishCheck finishCheck(signalReceived);
11764 animation.FinishedSignal().Connect(&application, finishCheck);
11765 application.SendNotification();
11767 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11768 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11770 // Play animation after the initial delay time
11771 animation.PlayAfter(0.2f);
11772 application.SendNotification();
11773 application.Render(0); // start animation
11775 for(int iterations = 0; iterations < 3; ++iterations)
11777 // The initial delay time of PlayAfter() applies only once in looping mode.
11778 if(iterations == 0)
11780 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11781 application.SendNotification();
11782 finishCheck.CheckSignalNotReceived();
11783 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11786 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11788 // We didn't expect the animation to finish yet
11789 application.SendNotification();
11790 finishCheck.CheckSignalNotReceived();
11791 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11793 application.SendNotification();
11794 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11796 application.SendNotification();
11797 finishCheck.CheckSignalNotReceived();
11798 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11800 application.SendNotification();
11801 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
11803 // We did expect the animation to finish
11804 application.SendNotification();
11805 finishCheck.CheckSignalNotReceived();
11806 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11809 animation.SetLooping(false);
11810 application.SendNotification();
11811 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11813 application.SendNotification();
11814 finishCheck.CheckSignalReceived();
11815 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11818 tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11821 Actor actor = Actor::New();
11822 application.GetScene().Add(actor);
11824 // Build the animation
11825 float durationSeconds(1.0f);
11826 Animation animation = Animation::New(durationSeconds);
11827 animation.SetLooping(true);
11828 animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0
11830 bool signalReceived(false);
11831 AnimationFinishCheck finishCheck(signalReceived);
11832 animation.FinishedSignal().Connect(&application, finishCheck);
11833 application.SendNotification();
11835 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11836 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11838 // Play animation after the initial delay time
11839 animation.PlayAfter(0.2f);
11840 application.SendNotification();
11841 application.Render(0); // start animation
11843 for(int iterations = 0; iterations < 3; ++iterations)
11845 // The initial delay time of PlayAfter() applies only once in looping mode.
11846 if(iterations == 0)
11848 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11849 application.SendNotification();
11850 finishCheck.CheckSignalNotReceived();
11851 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11854 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11856 // We didn't expect the animation to finish yet
11857 application.SendNotification();
11858 finishCheck.CheckSignalNotReceived();
11859 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11861 application.SendNotification();
11862 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11864 application.SendNotification();
11865 finishCheck.CheckSignalNotReceived();
11866 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11868 application.SendNotification();
11869 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
11871 // We did expect the animation to finish
11872 application.SendNotification();
11873 finishCheck.CheckSignalNotReceived();
11874 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
11877 animation.SetLooping(false);
11878 application.SendNotification();
11879 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11881 application.SendNotification();
11882 finishCheck.CheckSignalReceived();
11883 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11889 int UtcDaliAnimationPlayAfterP3(void)
11891 TestApplication application;
11893 tet_printf("Testing that PlayAfter with the negative delay seconds\n");
11895 Actor actor = Actor::New();
11896 application.GetScene().Add(actor);
11898 // Build the animation
11899 float durationSeconds(1.0f);
11900 Animation animation = Animation::New(durationSeconds);
11902 bool signalReceived(false);
11903 AnimationFinishCheck finishCheck(signalReceived);
11904 animation.FinishedSignal().Connect(&application, finishCheck);
11905 application.SendNotification();
11907 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11908 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11910 // When the delay time is negative value, it would treat as play immediately.
11911 animation.PlayAfter(-2.0f);
11912 application.SendNotification();
11913 application.Render(0); // start animation
11915 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11917 // We didn't expect the animation to finish yet
11918 application.SendNotification();
11919 finishCheck.CheckSignalNotReceived();
11920 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11922 application.SendNotification();
11923 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11925 application.SendNotification();
11926 finishCheck.CheckSignalNotReceived();
11927 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11929 application.SendNotification();
11930 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11932 // We did expect the animation to finish
11933 application.SendNotification();
11934 finishCheck.CheckSignalReceived();
11935 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11937 // Check that nothing has changed after a couple of buffer swaps
11938 application.Render(0);
11939 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11943 int UtcDaliAnimationPlayAfterP4(void)
11945 TestApplication application;
11947 tet_printf("Testing that PlayAfter with progress value\n");
11949 Actor actor = Actor::New();
11950 application.GetScene().Add(actor);
11952 // Build the animation
11953 float durationSeconds(1.0f);
11954 Animation animation = Animation::New(durationSeconds);
11956 bool signalReceived(false);
11957 AnimationFinishCheck finishCheck(signalReceived);
11958 animation.FinishedSignal().Connect(&application, finishCheck);
11959 application.SendNotification();
11961 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11962 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11964 // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
11965 animation.PlayAfter(durationSeconds * 0.3f);
11966 application.SendNotification();
11967 application.Render(0); // start animation
11969 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
11971 // We didn't expect the animation to finish yet
11972 application.SendNotification();
11973 finishCheck.CheckSignalNotReceived();
11974 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
11976 application.SendNotification();
11977 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
11979 application.SendNotification();
11980 finishCheck.CheckSignalNotReceived();
11981 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11983 application.SendNotification();
11984 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
11986 application.SendNotification();
11987 finishCheck.CheckSignalNotReceived();
11988 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11990 application.SendNotification();
11991 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
11993 application.SendNotification();
11994 finishCheck.CheckSignalNotReceived();
11995 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
11997 application.SendNotification();
11998 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
12000 application.SendNotification();
12001 finishCheck.CheckSignalNotReceived();
12002 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
12004 application.SendNotification();
12005 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
12007 // We did expect the animation to finish
12008 application.SendNotification();
12009 finishCheck.CheckSignalReceived();
12010 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12012 // Check that nothing has changed after a couple of buffer swaps
12013 application.Render(0);
12014 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12018 int UtcDaliAnimationSetLoopingModeP(void)
12020 // Test Loop forever and Loop mode being set
12021 TestApplication application;
12022 Integration::Scene stage(application.GetScene());
12024 // Default: LoopingMode::RESTART
12026 Actor actor = Actor::New();
12029 float durationSeconds(1.0f);
12030 Animation animation = Animation::New(durationSeconds);
12031 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12033 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
12034 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12036 // Start the animation
12038 application.SendNotification();
12039 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
12043 application.SendNotification();
12044 application.Render();
12045 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12048 // LoopingMode::AUTO_REVERSE
12050 Actor actor = Actor::New();
12053 float durationSeconds(1.0f);
12054 Animation animation = Animation::New(durationSeconds);
12055 animation.SetLooping(true);
12057 bool signalReceived(false);
12058 AnimationFinishCheck finishCheck(signalReceived);
12059 animation.FinishedSignal().Connect(&application, finishCheck);
12060 application.SendNotification();
12062 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12063 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12065 animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
12066 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12068 // Start the animation
12070 application.SendNotification();
12071 application.Render(0);
12073 for(int iterations = 0; iterations < 3; ++iterations)
12075 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12076 application.SendNotification();
12077 finishCheck.CheckSignalNotReceived();
12079 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12080 // and arrives at the beginning.
12081 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12083 application.SendNotification();
12084 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12086 // We did expect the animation to finish
12087 application.SendNotification();
12088 finishCheck.CheckSignalNotReceived();
12089 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12092 animation.SetLooping(false);
12093 application.SendNotification();
12094 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12096 application.SendNotification();
12097 finishCheck.CheckSignalReceived();
12099 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12102 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12104 Actor actor = Actor::New();
12107 float durationSeconds(1.0f);
12108 Animation animation = Animation::New(durationSeconds);
12109 animation.SetLooping(true);
12111 bool signalReceived(false);
12112 AnimationFinishCheck finishCheck(signalReceived);
12113 animation.FinishedSignal().Connect(&application, finishCheck);
12114 application.SendNotification();
12116 // Specify a negative multiplier to play the animation in reverse
12117 animation.SetSpeedFactor(-1.0f);
12119 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12120 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12122 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12123 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12125 // Start the animation
12127 application.SendNotification();
12128 application.Render(0);
12130 for(int iterations = 0; iterations < 3; ++iterations)
12132 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12133 application.SendNotification();
12134 finishCheck.CheckSignalNotReceived();
12136 // Setting a negative speed factor is to play the animation in reverse.
12137 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12138 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12139 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12141 application.SendNotification();
12142 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12144 // We did expect the animation to finish
12145 application.SendNotification();
12146 finishCheck.CheckSignalNotReceived();
12147 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12150 animation.SetLooping(false);
12151 application.SendNotification();
12152 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12154 application.SendNotification();
12155 finishCheck.CheckSignalReceived();
12157 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12163 int UtcDaliAnimationSetLoopingModeP2(void)
12165 // Test Loop Count and Loop mode being set
12166 TestApplication application;
12167 Integration::Scene stage(application.GetScene());
12169 // LoopingMode::AUTO_REVERSE
12171 Actor actor = Actor::New();
12174 float durationSeconds(1.0f);
12175 Animation animation = Animation::New(durationSeconds);
12176 animation.SetLoopCount(3);
12177 DALI_TEST_CHECK(animation.IsLooping());
12179 bool signalReceived(false);
12180 AnimationFinishCheck finishCheck(signalReceived);
12181 animation.FinishedSignal().Connect(&application, finishCheck);
12182 application.SendNotification();
12184 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12185 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12187 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12188 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12190 // Start the animation
12193 application.Render(0);
12194 application.SendNotification();
12195 application.Render(0);
12196 application.SendNotification();
12197 application.Render(0);
12198 application.SendNotification();
12199 application.Render(0);
12200 application.SendNotification();
12203 float intervalSeconds = 3.0f;
12205 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12206 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12207 // and arrives at the beginning.
12208 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12210 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12212 application.Render(0);
12213 application.SendNotification();
12214 application.Render(0);
12215 application.SendNotification();
12216 application.Render(0);
12217 application.SendNotification();
12218 application.Render(0);
12219 application.SendNotification();
12220 finishCheck.CheckSignalNotReceived();
12222 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12224 application.SendNotification();
12225 finishCheck.CheckSignalReceived();
12226 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12228 finishCheck.Reset();
12231 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12233 Actor actor = Actor::New();
12236 float durationSeconds(1.0f);
12237 Animation animation = Animation::New(durationSeconds);
12238 animation.SetLoopCount(3);
12239 DALI_TEST_CHECK(animation.IsLooping());
12241 bool signalReceived(false);
12242 AnimationFinishCheck finishCheck(signalReceived);
12243 animation.FinishedSignal().Connect(&application, finishCheck);
12244 application.SendNotification();
12246 // Specify a negative multiplier to play the animation in reverse
12247 animation.SetSpeedFactor(-1.0f);
12249 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12250 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12252 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12253 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12255 // Start the animation
12258 application.Render(0);
12259 application.SendNotification();
12260 application.Render(0);
12261 application.SendNotification();
12262 application.Render(0);
12263 application.SendNotification();
12264 application.Render(0);
12265 application.SendNotification();
12268 float intervalSeconds = 3.0f;
12270 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12271 // Setting a negative speed factor is to play the animation in reverse.
12272 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12273 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12274 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12276 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12278 application.Render(0);
12279 application.SendNotification();
12280 application.Render(0);
12281 application.SendNotification();
12282 application.Render(0);
12283 application.SendNotification();
12284 application.Render(0);
12285 application.SendNotification();
12286 finishCheck.CheckSignalNotReceived();
12288 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12290 application.SendNotification();
12291 finishCheck.CheckSignalReceived();
12292 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12294 finishCheck.Reset();
12300 int UtcDaliAnimationSetLoopingModeP3(void)
12302 // Test Loop Count is 1 (== default) and Loop mode being set
12303 TestApplication application;
12304 Integration::Scene stage(application.GetScene());
12306 // LoopingMode::AUTO_REVERSE
12308 Actor actor = Actor::New();
12311 float durationSeconds(1.0f);
12312 Animation animation = Animation::New(durationSeconds);
12313 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12315 bool signalReceived(false);
12316 AnimationFinishCheck finishCheck(signalReceived);
12317 animation.FinishedSignal().Connect(&application, finishCheck);
12318 application.SendNotification();
12320 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12321 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12323 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12324 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12326 // Start the animation
12328 application.Render(0);
12329 application.SendNotification();
12331 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12332 application.SendNotification();
12333 finishCheck.CheckSignalNotReceived();
12335 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12336 // and arrives at the beginning.
12337 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12339 application.SendNotification();
12340 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12342 application.SendNotification();
12343 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12345 application.SendNotification();
12346 application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12348 application.SendNotification();
12349 application.Render(0);
12350 application.SendNotification();
12351 finishCheck.CheckSignalReceived();
12353 // After all animation finished, arrives at the beginning.
12354 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12356 finishCheck.Reset();
12359 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12361 Actor actor = Actor::New();
12364 float durationSeconds(1.0f);
12365 Animation animation = Animation::New(durationSeconds);
12366 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12368 bool signalReceived(false);
12369 AnimationFinishCheck finishCheck(signalReceived);
12370 animation.FinishedSignal().Connect(&application, finishCheck);
12371 application.SendNotification();
12373 // Specify a negative multiplier to play the animation in reverse
12374 animation.SetSpeedFactor(-1.0f);
12376 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12377 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12379 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12380 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12382 // Start the animation
12384 application.Render(0);
12385 application.SendNotification();
12387 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12388 application.SendNotification();
12389 finishCheck.CheckSignalNotReceived();
12391 // Setting a negative speed factor is to play the animation in reverse.
12392 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12393 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12394 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12396 application.SendNotification();
12397 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12399 application.SendNotification();
12400 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12402 application.SendNotification();
12403 application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12405 application.SendNotification();
12406 application.Render(0);
12407 application.SendNotification();
12408 finishCheck.CheckSignalReceived();
12410 // After all animation finished, arrives at the target.
12411 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12413 finishCheck.Reset();
12419 int UtcDaliAnimationGetLoopingModeP(void)
12421 TestApplication application;
12423 Animation animation = Animation::New(1.0f);
12426 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12428 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12429 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12434 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12436 TestApplication application;
12438 tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
12440 Actor actor = Actor::New();
12441 application.GetScene().Add(actor);
12443 // Build the animation
12444 Animation animation = Animation::New(0.0f);
12447 float durationSeconds(1.0f);
12448 animation.SetDuration(durationSeconds);
12450 bool finishedSignalReceived(false);
12451 bool progressSignalReceived(false);
12453 AnimationFinishCheck finishCheck(finishedSignalReceived);
12454 animation.FinishedSignal().Connect(&application, finishCheck);
12456 AnimationProgressCheck progressCheck(progressSignalReceived);
12457 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12458 application.SendNotification();
12460 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12461 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12463 progressCheck.CheckSignalNotReceived();
12467 application.SendNotification();
12468 application.Render(0); // start animation
12469 application.Render(durationSeconds * 100.0f); // 10% progress
12470 application.SendNotification();
12472 tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
12473 progressCheck.CheckSignalNotReceived();
12475 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
12477 application.SendNotification();
12478 finishCheck.CheckSignalReceived();
12479 tet_infoline("Animation finished");
12480 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12485 int UtcDaliAnimationMultipleProgressSignalsP(void)
12487 tet_infoline("Multiple animations with different progress markers");
12489 TestApplication application;
12491 Actor actor = Actor::New();
12492 application.GetScene().Add(actor);
12494 // Build the animation
12495 Animation animationAlpha = Animation::New(0.0f);
12496 Animation animationBeta = Animation::New(0.0f);
12499 float durationSeconds(1.0f);
12500 animationAlpha.SetDuration(durationSeconds);
12501 animationBeta.SetDuration(durationSeconds);
12503 bool progressSignalReceivedAlpha(false);
12504 bool progressSignalReceivedBeta(false);
12506 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12507 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12509 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12510 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12511 application.SendNotification();
12513 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12514 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12515 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12517 tet_infoline("AnimationAlpha Progress notification set to 30%");
12518 DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12520 tet_infoline("AnimationBeta Progress notification set to 50%");
12521 DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
12523 application.SendNotification();
12524 application.Render();
12526 progressCheckAlpha.CheckSignalNotReceived();
12527 progressCheckBeta.CheckSignalNotReceived();
12529 // Start the animations from 10% progress
12530 animationAlpha.SetCurrentProgress(0.1f);
12531 animationBeta.SetCurrentProgress(0.1f);
12532 animationAlpha.Play();
12533 animationBeta.Play();
12535 tet_infoline("Animation Playing from 10%");
12537 application.SendNotification();
12538 application.Render(0); // start animation
12539 application.Render(durationSeconds * 100.0f); // 20% progress
12541 tet_infoline("Animation at 20% - No signals to be received");
12543 progressCheckAlpha.CheckSignalNotReceived();
12544 progressCheckBeta.CheckSignalNotReceived();
12546 application.SendNotification();
12547 application.Render(durationSeconds * 200.0f); // 40% progress
12548 application.SendNotification();
12549 tet_infoline("Animation at 40% - Alpha signal should be received");
12550 DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12552 progressCheckAlpha.CheckSignalReceived();
12553 progressCheckBeta.CheckSignalNotReceived();
12555 tet_infoline("Progress check reset");
12556 progressCheckAlpha.Reset();
12557 progressCheckBeta.Reset();
12559 application.Render(durationSeconds * 100.0f); // 50% progress
12560 tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
12561 application.SendNotification();
12563 DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12565 progressCheckAlpha.CheckSignalNotReceived();
12566 progressCheckBeta.CheckSignalReceived();
12567 tet_infoline("Progress check reset");
12568 progressCheckAlpha.Reset();
12569 progressCheckBeta.Reset();
12571 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
12572 application.SendNotification();
12574 tet_infoline("Animation at 60%");
12576 progressCheckAlpha.CheckSignalNotReceived();
12577 progressCheckBeta.CheckSignalNotReceived();
12579 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12580 application.SendNotification();
12581 tet_infoline("Animation at 80%");
12583 progressCheckAlpha.CheckSignalNotReceived();
12584 progressCheckBeta.CheckSignalNotReceived();
12586 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12587 // We did expect the animation to finish
12588 tet_infoline("Animation finished");
12593 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12595 tet_infoline("Multiple animations with different progress markers and big step time");
12597 TestApplication application;
12599 Actor actor = Actor::New();
12600 application.GetScene().Add(actor);
12602 // Build the animation
12603 Animation animationAlpha = Animation::New(0.0f);
12604 Animation animationBeta = Animation::New(0.0f);
12607 const float durationSeconds(1.0f);
12608 animationAlpha.SetDuration(durationSeconds);
12609 animationBeta.SetDuration(durationSeconds);
12611 bool progressSignalReceivedAlpha(false);
12612 bool progressSignalReceivedBeta(false);
12614 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12615 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12617 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12618 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12619 application.SendNotification();
12621 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12622 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12623 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12625 tet_infoline("AnimationAlpha Progress notification set to 1%");
12626 DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
12628 tet_infoline("AnimationBeta Progress notification set to 99%");
12629 DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
12631 application.SendNotification();
12632 application.Render();
12634 progressCheckAlpha.CheckSignalNotReceived();
12635 progressCheckBeta.CheckSignalNotReceived();
12637 // Start the animations unlimited looping
12638 animationAlpha.SetLooping(true);
12639 animationBeta.SetLooping(true);
12640 animationAlpha.Play();
12641 animationBeta.Play();
12643 application.SendNotification();
12644 application.Render(0); // start animation
12645 application.Render(durationSeconds * 20.0f); // 2% progress
12646 application.SendNotification();
12647 DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12649 tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
12651 progressCheckAlpha.CheckSignalReceived();
12652 progressCheckBeta.CheckSignalNotReceived();
12654 tet_infoline("Progress check reset");
12655 progressCheckAlpha.Reset();
12656 progressCheckBeta.Reset();
12658 application.SendNotification();
12659 application.Render(durationSeconds * 960.0f); // 98% progress
12660 application.SendNotification();
12661 tet_infoline("Animation at 98% - No signal received");
12662 DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12664 progressCheckAlpha.CheckSignalNotReceived();
12665 progressCheckBeta.CheckSignalNotReceived();
12667 application.SendNotification();
12668 application.Render(durationSeconds * 40.0f); // 2% progress
12669 application.SendNotification();
12670 tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
12671 application.SendNotification();
12673 DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12675 progressCheckAlpha.CheckSignalReceived();
12676 progressCheckBeta.CheckSignalReceived();
12678 tet_infoline("Progress check reset");
12679 progressCheckAlpha.Reset();
12680 progressCheckBeta.Reset();
12682 application.SendNotification();
12683 application.Render(durationSeconds * 980.0f); // 100% progress
12684 application.SendNotification();
12685 tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
12686 application.SendNotification();
12688 progressCheckAlpha.CheckSignalNotReceived();
12689 progressCheckBeta.CheckSignalReceived();
12691 tet_infoline("Progress check reset");
12692 progressCheckAlpha.Reset();
12693 progressCheckBeta.Reset();
12695 animationAlpha.SetLooping(false);
12696 animationBeta.SetLooping(false);
12698 application.SendNotification();
12699 application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
12700 application.SendNotification();
12702 // We did expect the animation to finish
12703 tet_infoline("Animation finished");
12708 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12710 tet_infoline("Multiple animations with different progress markers");
12712 TestApplication application;
12714 Actor actor = Actor::New();
12715 application.GetScene().Add(actor);
12717 // Build the animation
12718 Animation animationAlpha = Animation::New(0.0f);
12719 Animation animationBeta = Animation::New(0.0f);
12722 float durationSeconds(1.0f);
12723 float delaySeconds(0.5f);
12724 animationAlpha.SetDuration(durationSeconds);
12725 animationBeta.SetDuration(durationSeconds);
12727 bool progressSignalReceivedAlpha(false);
12728 bool progressSignalReceivedBeta(false);
12730 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12731 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12733 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12734 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12735 application.SendNotification();
12737 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12738 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12739 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12741 tet_infoline("AnimationAlpha Progress notification set to 30%");
12742 DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12744 tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
12745 DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
12747 application.SendNotification();
12748 application.Render();
12750 progressCheckAlpha.CheckSignalNotReceived();
12751 progressCheckBeta.CheckSignalNotReceived();
12753 // Start the animations from 10% progress
12754 animationAlpha.PlayAfter(delaySeconds);
12755 animationBeta.PlayAfter(delaySeconds);
12757 application.SendNotification();
12758 application.Render(0); // start animation
12759 application.Render(delaySeconds * 500.0f); // 50% wait progress
12761 tet_infoline("Delay at 50% - No signals to be received");
12763 progressCheckAlpha.CheckSignalNotReceived();
12764 progressCheckBeta.CheckSignalNotReceived();
12766 application.SendNotification();
12767 application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
12768 application.SendNotification();
12769 tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
12770 DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12772 progressCheckBeta.CheckSignalReceived();
12773 progressCheckAlpha.CheckSignalNotReceived();
12775 tet_infoline("Progress check reset");
12776 progressCheckAlpha.Reset();
12777 progressCheckBeta.Reset();
12779 application.Render(durationSeconds * 200.0f); // 25% progress
12780 tet_infoline("Animation at 25% - No signals to be received");
12781 application.SendNotification();
12783 progressCheckAlpha.CheckSignalNotReceived();
12784 progressCheckBeta.CheckSignalNotReceived();
12786 application.Render(durationSeconds * 200.0f); // 45% progress
12787 tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
12788 application.SendNotification();
12790 DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12792 progressCheckAlpha.CheckSignalReceived();
12793 progressCheckBeta.CheckSignalNotReceived();
12795 tet_infoline("Progress check reset");
12796 progressCheckAlpha.Reset();
12797 progressCheckBeta.Reset();
12799 application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
12800 application.SendNotification();
12802 tet_infoline("Animation at 60%");
12804 progressCheckAlpha.CheckSignalNotReceived();
12805 progressCheckBeta.CheckSignalNotReceived();
12807 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12808 application.SendNotification();
12809 tet_infoline("Animation at 80%");
12811 progressCheckAlpha.CheckSignalNotReceived();
12812 progressCheckBeta.CheckSignalNotReceived();
12814 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12815 // We did expect the animation to finish
12816 tet_infoline("Animation finished");
12821 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12823 TestApplication application;
12825 Actor actor = Actor::New();
12826 application.GetScene().Add(actor);
12828 // Build the animation
12829 Animation animation = Animation::New(0.0f);
12832 const float durationSeconds(1.0f);
12833 animation.SetDuration(durationSeconds);
12835 // Set Looping Count
12836 const int loopCount(4);
12837 animation.SetLoopCount(loopCount);
12839 bool finishedSignalReceived(false);
12840 bool progressSignalReceived(false);
12842 AnimationFinishCheck finishCheck(finishedSignalReceived);
12843 animation.FinishedSignal().Connect(&application, finishCheck);
12845 AnimationProgressCheck progressCheck(progressSignalReceived);
12846 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12847 application.SendNotification();
12849 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12850 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12852 tet_infoline("Animation Progress notification set to 50% with looping count 4");
12853 DevelAnimation::SetProgressNotification(animation, 0.5f);
12855 application.SendNotification();
12856 application.Render();
12858 progressCheck.CheckSignalNotReceived();
12862 for(int count = 0; count < loopCount; count++)
12864 application.SendNotification();
12865 application.Render(0); // start animation
12866 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
12867 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
12869 tet_infoline("Animation at 25%");
12871 progressCheck.CheckSignalNotReceived();
12873 application.SendNotification();
12874 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
12875 application.SendNotification();
12876 tet_infoline("Animation at 50%");
12877 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
12879 progressCheck.CheckSignalReceived();
12881 tet_infoline("Progress check reset");
12882 progressCheck.Reset();
12884 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
12885 tet_infoline("Animation at 75%");
12886 application.SendNotification();
12888 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
12890 progressCheck.CheckSignalNotReceived();
12892 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
12893 tet_infoline("Animation at 100%");
12894 application.SendNotification();
12896 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12897 application.SendNotification();
12899 application.Render(10u);
12900 application.SendNotification();
12901 application.Render(0u);
12902 application.SendNotification();
12904 finishCheck.CheckSignalReceived();
12909 int UtcDaliAnimationProgressCallbackWithLoopingP2(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 Unlmited
12924 animation.SetLooping(true);
12926 bool finishedSignalReceived(false);
12927 bool progressSignalReceived(false);
12929 AnimationFinishCheck finishCheck(finishedSignalReceived);
12930 animation.FinishedSignal().Connect(&application, finishCheck);
12932 AnimationProgressCheck progressCheck(progressSignalReceived);
12933 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12934 application.SendNotification();
12936 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12937 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12939 tet_infoline("Animation Progress notification set to 50% with unlimited looping");
12940 DevelAnimation::SetProgressNotification(animation, 0.5f);
12942 application.SendNotification();
12943 application.Render();
12945 progressCheck.CheckSignalNotReceived();
12949 for(int count = 0; count < 4; count++)
12951 application.SendNotification();
12952 application.Render(0); // start animation
12953 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
12954 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
12956 tet_infoline("Animation at 25%");
12958 progressCheck.CheckSignalNotReceived();
12960 application.SendNotification();
12961 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
12962 application.SendNotification();
12963 tet_infoline("Animation at 50%");
12964 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
12966 progressCheck.CheckSignalReceived();
12968 tet_infoline("Progress check reset");
12969 progressCheck.Reset();
12971 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
12972 tet_infoline("Animation at 75%");
12973 application.SendNotification();
12975 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
12977 progressCheck.CheckSignalNotReceived();
12979 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
12980 tet_infoline("Animation at 100%");
12981 application.SendNotification();
12983 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12984 finishCheck.CheckSignalNotReceived();
12985 application.SendNotification();
12987 finishCheck.CheckSignalNotReceived();
12989 animation.SetLooping(false);
12990 application.Render(0u);
12991 application.SendNotification();
12992 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
12993 application.SendNotification();
12994 application.Render(0u);
12995 application.SendNotification();
12997 finishCheck.CheckSignalReceived();
13002 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
13004 TestApplication application;
13006 Actor actor = Actor::New();
13007 application.GetScene().Add(actor);
13009 // Build the animation
13010 Animation animation = Animation::New(0.0f);
13013 const float durationSeconds(1.0f);
13014 animation.SetDuration(durationSeconds);
13016 //Set speed negative
13017 animation.SetSpeedFactor(-1.0f);
13019 // Set Looping Unlmited
13020 animation.SetLooping(true);
13022 bool finishedSignalReceived(false);
13023 bool progressSignalReceived(false);
13025 AnimationFinishCheck finishCheck(finishedSignalReceived);
13026 animation.FinishedSignal().Connect(&application, finishCheck);
13028 AnimationProgressCheck progressCheck(progressSignalReceived);
13029 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13030 application.SendNotification();
13032 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13033 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13035 tet_infoline("Animation Progress notification set to 50%");
13036 DevelAnimation::SetProgressNotification(animation, 0.5f);
13038 application.SendNotification();
13039 application.Render();
13041 progressCheck.CheckSignalNotReceived();
13045 for(int count = 0; count < 4; count++)
13047 application.SendNotification();
13048 application.Render(0); // start animation
13049 progressCheck.CheckSignalNotReceived();
13051 application.SendNotification();
13052 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13053 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13055 tet_infoline("Animation at 25%");
13057 progressCheck.CheckSignalNotReceived();
13059 application.SendNotification();
13060 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13061 application.SendNotification();
13062 tet_infoline("Animation at 50%");
13063 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13065 progressCheck.CheckSignalReceived();
13067 tet_infoline("Progress check reset");
13068 progressCheck.Reset();
13070 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13071 tet_infoline("Animation at 75%");
13072 application.SendNotification();
13074 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13076 progressCheck.CheckSignalNotReceived();
13078 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13079 tet_infoline("Animation at 100%");
13080 application.SendNotification();
13082 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13083 finishCheck.CheckSignalNotReceived();
13084 application.SendNotification();
13086 finishCheck.CheckSignalNotReceived();
13089 animation.SetLooping(false);
13090 animation.SetLoopCount(4);
13092 application.Render(0u);
13093 application.SendNotification();
13095 for(int count = 0; count < 4; count++)
13097 application.SendNotification();
13098 application.Render(0); // start animation
13099 progressCheck.CheckSignalNotReceived();
13101 application.SendNotification();
13102 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13103 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13105 tet_infoline("Animation at 25%");
13107 progressCheck.CheckSignalNotReceived();
13109 application.SendNotification();
13110 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13111 application.SendNotification();
13112 tet_infoline("Animation at 50%");
13113 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13115 progressCheck.CheckSignalReceived();
13117 tet_infoline("Progress check reset");
13118 progressCheck.Reset();
13120 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13121 tet_infoline("Animation at 75%");
13122 application.SendNotification();
13124 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13126 progressCheck.CheckSignalNotReceived();
13128 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13129 tet_infoline("Animation at 100%");
13130 application.SendNotification();
13132 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13133 application.SendNotification();
13135 application.Render(10u);
13136 application.SendNotification();
13137 application.Render(0u);
13138 application.SendNotification();
13140 finishCheck.CheckSignalReceived();
13145 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13147 TestApplication application;
13149 Actor actor = Actor::New();
13150 application.GetScene().Add(actor);
13152 // Build the animation
13153 Animation animation = Animation::New(0.0f);
13156 const float durationSeconds(1.0f);
13157 animation.SetDuration(durationSeconds);
13159 bool finishedSignalReceived(false);
13160 bool progressSignalReceived(false);
13162 AnimationFinishCheck finishCheck(finishedSignalReceived);
13163 animation.FinishedSignal().Connect(&application, finishCheck);
13165 AnimationProgressCheck progressCheck(progressSignalReceived);
13166 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13167 application.SendNotification();
13169 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13170 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13172 tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
13173 animation.SetPlayRange(Vector2(0.1f, 0.9f));
13175 tet_infoline("Animation Progress notification set to >90% that never can notificated");
13176 DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
13178 application.SendNotification();
13179 application.Render();
13181 progressCheck.CheckSignalNotReceived();
13185 application.SendNotification();
13186 application.Render(0); // start animation
13187 application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
13188 DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
13190 tet_infoline("Animation at 35%");
13192 progressCheck.CheckSignalNotReceived();
13194 application.SendNotification();
13195 application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
13196 application.SendNotification();
13197 DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
13199 tet_infoline("Animation at 60%");
13201 progressCheck.CheckSignalNotReceived();
13203 application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
13204 tet_infoline("Animation at 85%");
13205 application.SendNotification();
13206 DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
13208 progressCheck.CheckSignalNotReceived();
13210 application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
13211 tet_infoline("Animation over 90%");
13212 application.SendNotification();
13214 // progress never signaled because playrange is 90%
13215 progressCheck.CheckSignalNotReceived();
13220 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13222 TestApplication application;
13224 Actor actor = Actor::New();
13225 application.GetScene().Add(actor);
13227 // Build the animation
13228 Animation animation = Animation::New(0.0f);
13231 float durationSeconds(5.0f);
13232 animation.SetDuration(durationSeconds);
13234 bool finishedSignalReceived(false);
13235 bool progressSignalReceived(false);
13237 AnimationFinishCheck finishCheck(finishedSignalReceived);
13238 animation.FinishedSignal().Connect(&application, finishCheck);
13240 AnimationProgressCheck progressCheck(progressSignalReceived);
13241 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13242 application.SendNotification();
13244 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13245 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13247 tet_infoline("Animation Progress notification set to 50%");
13248 DevelAnimation::SetProgressNotification(animation, 0.5f);
13250 application.SendNotification();
13251 application.Render();
13253 progressCheck.CheckSignalNotReceived();
13257 application.SendNotification();
13258 application.Render(0); // start animation
13259 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13260 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13262 tet_infoline("Animation at 25%");
13264 progressCheck.CheckSignalNotReceived();
13266 application.SendNotification();
13267 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13268 application.SendNotification();
13269 tet_infoline("Animation at 50%");
13270 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13272 progressCheck.CheckSignalReceived();
13274 tet_infoline("Progress check reset");
13275 progressCheck.Reset();
13277 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13278 tet_infoline("Animation at 75%");
13279 application.SendNotification();
13281 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13283 progressCheck.CheckSignalNotReceived();
13288 int UtcDaliAnimationAnimateByInvalidParameters(void)
13290 TestApplication application;
13292 Actor actor = Actor::New();
13293 application.GetScene().Add(actor);
13295 // Create the animation
13296 Animation animation = Animation::New(1.0f);
13298 DALI_TEST_ASSERTION(
13300 // non animateable property (STRING)
13301 animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
13303 "Property type is not animatable");
13305 DALI_TEST_ASSERTION(
13307 // non animateable property (MATRIX)
13308 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
13309 animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
13311 "Property type is not animatable");
13314 DALI_TEST_ASSERTION(
13316 // non animateable target (NONE)
13317 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
13319 "Target value is not animatable");
13321 DALI_TEST_ASSERTION(
13323 // non animateable target (STRING)
13324 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
13326 "Target value is not animatable");
13328 DALI_TEST_ASSERTION(
13330 // not mathing properties (VECTOR3, FLOAT)
13331 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
13333 "Property and target types don't match");
13335 DALI_TEST_ASSERTION(
13337 // not mathing properties (VECTOR3.A, VECTOR2)
13338 animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
13340 "Property and target types don't match");
13342 DALI_TEST_ASSERTION(
13344 // negative duration
13345 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13347 "Duration must be >=0");
13352 int UtcDaliAnimationAnimateToInvalidParameters(void)
13354 TestApplication application;
13356 Actor actor = Actor::New();
13357 application.GetScene().Add(actor);
13359 // Create the animation
13360 Animation animation = Animation::New(1.0f);
13363 DALI_TEST_ASSERTION(
13365 // non animateable property (MAP)
13366 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
13367 animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
13369 "Property type is not animatable");
13371 DALI_TEST_ASSERTION(
13373 // non animateable target (NONE)
13374 animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
13376 "Property type is not animatable");
13378 DALI_TEST_ASSERTION(
13380 // non animateable target (ARRAY)
13381 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
13383 "Target value is not animatable");
13385 DALI_TEST_ASSERTION(
13387 // non animateable target (RECTANGLE)
13388 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
13390 "Target value is not animatable");
13392 DALI_TEST_ASSERTION(
13394 // not mathing properties (FLOAT, INT)
13395 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
13397 "Property and target types don't match");
13399 DALI_TEST_ASSERTION(
13401 // not mathing properties (VECTOR3, VECTOR2)
13402 animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
13404 "Property and target types don't match");
13406 DALI_TEST_ASSERTION(
13408 // negative duration
13409 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13411 "Duration must be >=0");
13416 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13418 TestApplication application;
13420 Actor actor = Actor::New();
13421 application.GetScene().Add(actor);
13423 // Create the animation
13424 Animation animation = Animation::New(1.0f);
13427 DALI_TEST_ASSERTION(
13429 // non animateable property (ARRAY)
13430 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
13431 KeyFrames keyframes = KeyFrames::New();
13432 keyframes.Add(0.5f, Property::Value(Property::ARRAY));
13433 animation.AnimateBetween(Property(actor, index), keyframes);
13435 "Property type is not animatable");
13437 DALI_TEST_ASSERTION(
13439 // non animateable target (NONE)
13440 KeyFrames keyframes = KeyFrames::New();
13441 keyframes.Add(0.5f, Property::Value());
13442 animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
13444 "Property type is not animatable");
13446 DALI_TEST_ASSERTION(
13448 // non animateable target (EXTENTS)
13449 KeyFrames keyframes = KeyFrames::New();
13450 keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
13451 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13453 "Property type is not animatable");
13455 DALI_TEST_ASSERTION(
13457 // non animateable target (RECTANGLE)
13458 KeyFrames keyframes = KeyFrames::New();
13459 keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
13460 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13462 "Property type is not animatable");
13464 DALI_TEST_ASSERTION(
13466 // not mathing properties (VECTOR2, VECTOR4)
13467 KeyFrames keyframes = KeyFrames::New();
13468 keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
13469 animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
13471 "Property and target types don't match");
13473 DALI_TEST_ASSERTION(
13475 // negative duration
13476 KeyFrames keyframes = KeyFrames::New();
13477 keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
13478 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
13480 "Duration must be >=0");
13485 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13493 void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
13495 tet_printf("Testing %s\n", testName);
13497 // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13498 // This test checks that that is being done
13500 const float durationSeconds(1.0f);
13501 unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13502 const Vector3 originalPosition(Vector3::ZERO);
13503 const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13504 const Vector3 halfWayToTarget(targetPosition * 0.5f);
13506 struct ExpectedValue
13508 Animation::EndAction endAction;
13509 Vector3 expectedGetPropertyValue;
13512 ExpectedValue expectedValueTable[] =
13514 {Animation::BAKE, halfWayToTarget}, // When baking, the current value is the final value.
13515 {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
13516 {Animation::DISCARD, originalPosition}, // When discarding, we should jump back to the original value when clearing or stopping.
13518 const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
13520 for(auto i = 0u; i < expectedValueTableCount; ++i)
13522 TestApplication application;
13524 Actor actor = Actor::New();
13525 application.GetScene().Add(actor);
13527 // Build the animation
13528 Animation animation = Animation::New(durationSeconds);
13529 animation.SetEndAction(expectedValueTable[i].endAction);
13530 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13532 // Start the animation
13535 application.SendNotification();
13536 application.Render(halfAnimationDuration);
13538 // Stop or Clear the animation early, both have the same effect
13539 if(functionToTest == TestFunction::STOP)
13548 // 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
13549 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13550 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13552 // After one frame, both values should match regardless of the End Action
13553 application.SendNotification();
13554 application.Render();
13556 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13557 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13560 } // unnamed namespace
13562 int UtcDaliAnimationStopPropertyValue(void)
13564 CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
13568 int UtcDaliAnimationClearPropertyValue(void)
13570 CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
13574 int UtcDaliAnimationPausePropertyValue(void)
13576 const float durationSeconds(1.0f);
13577 unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13578 const Vector3 originalPosition(Vector3::ZERO);
13579 const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13580 const Vector3 halfWayToTarget(targetPosition * 0.5f);
13582 Animation::EndAction endActions[] =
13585 Animation::BAKE_FINAL,
13586 Animation::DISCARD,
13588 const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
13590 // For all end actions, when pausing, we stay at the current value
13591 for(auto i = 0u; i < endActionCount; ++i)
13593 TestApplication application;
13595 Actor actor = Actor::New();
13596 application.GetScene().Add(actor);
13598 // Build the animation
13599 Animation animation = Animation::New(durationSeconds);
13600 animation.SetEndAction(endActions[i]);
13601 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13603 // Start the animation
13606 application.SendNotification();
13607 application.Render(halfAnimationDuration);
13609 // Puase the animation early
13612 // The event side property should be set the current value immediately, the update side property will still only be halfway
13613 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13614 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13616 // After one frame, both values should match regardless of the End Action
13617 application.SendNotification();
13618 application.Render();
13620 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13621 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13627 int UtcDaliAnimationPlayFromWithLoopCount(void)
13629 TestApplication application;
13631 auto actor = Actor::New();
13632 application.GetScene().Add(actor);
13634 auto animation = Animation::New(1.0f);
13635 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
13636 animation.SetLoopCount(2);
13639 application.SendNotification();
13640 application.Render(1001);
13642 // One loop completed
13644 application.Render(2005);
13645 application.SendNotification();
13647 // 2 loops should have completed
13648 DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
13650 // Another render needs to occur after all the loops end
13651 application.SendNotification();
13652 application.Render(1000);
13654 // Stop the animation and use PlayFrom, previously we got an Assert here
13656 animation.PlayFrom(0.5f);
13658 application.SendNotification();
13659 application.Render(1000);
13661 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
13666 int UtcDaliAnimationCombineToAndByWithStop(void)
13668 tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
13670 TestApplication application;
13672 auto actor = Actor::New();
13673 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13674 application.GetScene().Add(actor);
13676 auto animation = Animation::New(1.0f);
13677 const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13678 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13679 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
13682 application.SendNotification();
13683 application.Render(500);
13685 application.SendNotification();
13686 application.Render(500);
13688 application.SendNotification();
13689 application.Render(500);
13691 // Stop and clear the animation using the current values
13695 // Check the y position, it should be the same as before
13696 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
13701 int UtcDaliAnimationCountAndGetAnimationAt(void)
13703 tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
13705 TestApplication application;
13707 auto actor = Actor::New();
13708 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13709 application.GetScene().Add(actor);
13711 auto animation = Animation::New(1.0f);
13712 const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13713 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13716 application.SendNotification();
13717 application.Render(500);
13719 uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
13720 DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
13722 DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
13724 Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
13725 DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
13727 DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
13728 DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
13729 DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
13730 DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
13731 DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
13733 // Stop and clear the animation using the current values
13740 int UtcDaliAnimationSetLoopingNegative(void)
13742 TestApplication application;
13743 Dali::Animation instance;
13747 instance.SetLooping(arg1);
13748 DALI_TEST_CHECK(false); // Should not get here
13752 DALI_TEST_CHECK(true); // We expect an assert
13757 int UtcDaliAnimationSetDurationNegative(void)
13759 TestApplication application;
13760 Dali::Animation instance;
13764 instance.SetDuration(arg1);
13765 DALI_TEST_CHECK(false); // Should not get here
13769 DALI_TEST_CHECK(true); // We expect an assert
13774 int UtcDaliAnimationGetLoopCountNegative(void)
13776 TestApplication application;
13777 Dali::Animation instance;
13780 instance.GetLoopCount();
13781 DALI_TEST_CHECK(false); // Should not get here
13785 DALI_TEST_CHECK(true); // We expect an assert
13790 int UtcDaliAnimationSetEndActionNegative(void)
13792 TestApplication application;
13793 Dali::Animation instance;
13796 Dali::Animation::EndAction arg1(Animation::BAKE);
13797 instance.SetEndAction(arg1);
13798 DALI_TEST_CHECK(false); // Should not get here
13802 DALI_TEST_CHECK(true); // We expect an assert
13807 int UtcDaliAnimationSetLoopCountNegative(void)
13809 TestApplication application;
13810 Dali::Animation instance;
13814 instance.SetLoopCount(arg1);
13815 DALI_TEST_CHECK(false); // Should not get here
13819 DALI_TEST_CHECK(true); // We expect an assert
13824 int UtcDaliAnimationSetPlayRangeNegative(void)
13826 TestApplication application;
13827 Dali::Animation instance;
13830 Dali::Vector2 arg1;
13831 instance.SetPlayRange(arg1);
13832 DALI_TEST_CHECK(false); // Should not get here
13836 DALI_TEST_CHECK(true); // We expect an assert
13841 int UtcDaliAnimationAnimateBetweenNegative01(void)
13843 TestApplication application;
13844 Dali::Animation instance;
13848 Dali::Property arg1(actor, Actor::Property::POSITION);
13849 Dali::KeyFrames arg2;
13850 instance.AnimateBetween(arg1, arg2);
13851 DALI_TEST_CHECK(false); // Should not get here
13855 DALI_TEST_CHECK(true); // We expect an assert
13860 int UtcDaliAnimationAnimateBetweenNegative02(void)
13862 TestApplication application;
13863 Dali::Animation instance;
13867 Dali::Property arg1(actor, Actor::Property::POSITION);
13868 Dali::KeyFrames arg2;
13869 Dali::Animation::Interpolation arg3(Animation::LINEAR);
13870 instance.AnimateBetween(arg1, arg2, arg3);
13871 DALI_TEST_CHECK(false); // Should not get here
13875 DALI_TEST_CHECK(true); // We expect an assert
13880 int UtcDaliAnimationAnimateBetweenNegative03(void)
13882 TestApplication application;
13883 Dali::Animation instance;
13887 Dali::Property arg1(actor, Actor::Property::POSITION);
13888 Dali::KeyFrames arg2;
13889 Dali::TimePeriod arg3(1.0f);
13890 instance.AnimateBetween(arg1, arg2, arg3);
13891 DALI_TEST_CHECK(false); // Should not get here
13895 DALI_TEST_CHECK(true); // We expect an assert
13900 int UtcDaliAnimationAnimateBetweenNegative04(void)
13902 TestApplication application;
13903 Dali::Animation instance;
13907 Dali::Property arg1(actor, Actor::Property::POSITION);
13908 Dali::KeyFrames arg2;
13909 Dali::TimePeriod arg3(1.0f);
13910 Dali::Animation::Interpolation arg4(Animation::LINEAR);
13911 instance.AnimateBetween(arg1, arg2, arg3, arg4);
13912 DALI_TEST_CHECK(false); // Should not get here
13916 DALI_TEST_CHECK(true); // We expect an assert
13921 int UtcDaliAnimationAnimateBetweenNegative05(void)
13923 TestApplication application;
13924 Dali::Animation instance;
13928 Dali::Property arg1(actor, Actor::Property::POSITION);
13929 Dali::KeyFrames arg2;
13930 Dali::AlphaFunction arg3;
13931 instance.AnimateBetween(arg1, arg2, arg3);
13932 DALI_TEST_CHECK(false); // Should not get here
13936 DALI_TEST_CHECK(true); // We expect an assert
13941 int UtcDaliAnimationAnimateBetweenNegative06(void)
13943 TestApplication application;
13944 Dali::Animation instance;
13948 Dali::Property arg1(actor, Actor::Property::POSITION);
13949 Dali::KeyFrames arg2;
13950 Dali::AlphaFunction arg3;
13951 Dali::Animation::Interpolation arg4(Animation::LINEAR);
13952 instance.AnimateBetween(arg1, arg2, arg3, arg4);
13953 DALI_TEST_CHECK(false); // Should not get here
13957 DALI_TEST_CHECK(true); // We expect an assert
13962 int UtcDaliAnimationAnimateBetweenNegative07(void)
13964 TestApplication application;
13965 Dali::Animation instance;
13969 Dali::Property arg1(actor, Actor::Property::POSITION);
13970 Dali::KeyFrames arg2;
13971 Dali::AlphaFunction arg3;
13972 Dali::TimePeriod arg4(1.0f);
13973 instance.AnimateBetween(arg1, arg2, arg3, arg4);
13974 DALI_TEST_CHECK(false); // Should not get here
13978 DALI_TEST_CHECK(true); // We expect an assert
13983 int UtcDaliAnimationAnimateBetweenNegative08(void)
13985 TestApplication application;
13986 Dali::Animation instance;
13990 Dali::Property arg1(actor, Actor::Property::POSITION);
13991 Dali::KeyFrames arg2;
13992 Dali::AlphaFunction arg3;
13993 Dali::TimePeriod arg4(1.0f);
13994 Dali::Animation::Interpolation arg5(Animation::LINEAR);
13995 instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
13996 DALI_TEST_CHECK(false); // Should not get here
14000 DALI_TEST_CHECK(true); // We expect an assert
14005 int UtcDaliAnimationFinishedSignalNegative(void)
14007 TestApplication application;
14008 Dali::Animation instance;
14011 instance.FinishedSignal();
14012 DALI_TEST_CHECK(false); // Should not get here
14016 DALI_TEST_CHECK(true); // We expect an assert
14021 int UtcDaliAnimationGetCurrentLoopNegative(void)
14023 TestApplication application;
14024 Dali::Animation instance;
14027 instance.GetCurrentLoop();
14028 DALI_TEST_CHECK(false); // Should not get here
14032 DALI_TEST_CHECK(true); // We expect an assert
14037 int UtcDaliAnimationSetLoopingModeNegative(void)
14039 TestApplication application;
14040 Dali::Animation instance;
14043 Dali::Animation::LoopingMode arg1(Animation::RESTART);
14044 instance.SetLoopingMode(arg1);
14045 DALI_TEST_CHECK(false); // Should not get here
14049 DALI_TEST_CHECK(true); // We expect an assert
14054 int UtcDaliAnimationSetSpeedFactorNegative(void)
14056 TestApplication application;
14057 Dali::Animation instance;
14061 instance.SetSpeedFactor(arg1);
14062 DALI_TEST_CHECK(false); // Should not get here
14066 DALI_TEST_CHECK(true); // We expect an assert
14071 int UtcDaliAnimationGetCurrentProgressNegative(void)
14073 TestApplication application;
14074 Dali::Animation instance;
14077 instance.GetCurrentProgress();
14078 DALI_TEST_CHECK(false); // Should not get here
14082 DALI_TEST_CHECK(true); // We expect an assert
14087 int UtcDaliAnimationSetCurrentProgressNegative(void)
14089 TestApplication application;
14090 Dali::Animation instance;
14094 instance.SetCurrentProgress(arg1);
14095 DALI_TEST_CHECK(false); // Should not get here
14099 DALI_TEST_CHECK(true); // We expect an assert
14104 int UtcDaliAnimationSetDisconnectActionNegative(void)
14106 TestApplication application;
14107 Dali::Animation instance;
14110 Dali::Animation::EndAction arg1(Animation::BAKE);
14111 instance.SetDisconnectAction(arg1);
14112 DALI_TEST_CHECK(false); // Should not get here
14116 DALI_TEST_CHECK(true); // We expect an assert
14121 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14123 TestApplication application;
14124 Dali::Animation instance;
14127 Dali::AlphaFunction arg1;
14128 instance.SetDefaultAlphaFunction(arg1);
14129 DALI_TEST_CHECK(false); // Should not get here
14133 DALI_TEST_CHECK(true); // We expect an assert
14138 int UtcDaliAnimationHideNegative(void)
14140 TestApplication application;
14141 Dali::Animation instance;
14146 instance.Hide(arg1, arg2);
14147 DALI_TEST_CHECK(false); // Should not get here
14151 DALI_TEST_CHECK(true); // We expect an assert
14156 int UtcDaliAnimationPlayNegative(void)
14158 TestApplication application;
14159 Dali::Animation instance;
14163 DALI_TEST_CHECK(false); // Should not get here
14167 DALI_TEST_CHECK(true); // We expect an assert
14172 int UtcDaliAnimationShowNegative(void)
14174 TestApplication application;
14175 Dali::Animation instance;
14180 instance.Show(arg1, arg2);
14181 DALI_TEST_CHECK(false); // Should not get here
14185 DALI_TEST_CHECK(true); // We expect an assert
14190 int UtcDaliAnimationStopNegative(void)
14192 TestApplication application;
14193 Dali::Animation instance;
14197 DALI_TEST_CHECK(false); // Should not get here
14201 DALI_TEST_CHECK(true); // We expect an assert
14206 int UtcDaliAnimationClearNegative(void)
14208 TestApplication application;
14209 Dali::Animation instance;
14213 DALI_TEST_CHECK(false); // Should not get here
14217 DALI_TEST_CHECK(true); // We expect an assert
14222 int UtcDaliAnimationPauseNegative(void)
14224 TestApplication application;
14225 Dali::Animation instance;
14229 DALI_TEST_CHECK(false); // Should not get here
14233 DALI_TEST_CHECK(true); // We expect an assert
14238 int UtcDaliAnimationAnimateNegative01(void)
14240 TestApplication application;
14241 Dali::Animation instance;
14246 Dali::Vector3 arg3;
14247 instance.Animate(arg1, arg2, arg3);
14248 DALI_TEST_CHECK(false); // Should not get here
14252 DALI_TEST_CHECK(true); // We expect an assert
14257 int UtcDaliAnimationAnimateNegative02(void)
14259 TestApplication application;
14260 Dali::Animation instance;
14265 Dali::Vector3 arg3;
14266 Dali::TimePeriod arg4(1.0f);
14267 instance.Animate(arg1, arg2, arg3, arg4);
14268 DALI_TEST_CHECK(false); // Should not get here
14272 DALI_TEST_CHECK(true); // We expect an assert
14277 int UtcDaliAnimationAnimateNegative03(void)
14279 TestApplication application;
14280 Dali::Animation instance;
14285 Dali::Vector3 arg3;
14286 Dali::AlphaFunction arg4;
14287 instance.Animate(arg1, arg2, arg3, arg4);
14288 DALI_TEST_CHECK(false); // Should not get here
14292 DALI_TEST_CHECK(true); // We expect an assert
14297 int UtcDaliAnimationAnimateNegative04(void)
14299 TestApplication application;
14300 Dali::Animation instance;
14305 Dali::Vector3 arg3;
14306 Dali::AlphaFunction arg4;
14307 Dali::TimePeriod arg5(1.0f);
14308 instance.Animate(arg1, arg2, arg3, arg4, arg5);
14309 DALI_TEST_CHECK(false); // Should not get here
14313 DALI_TEST_CHECK(true); // We expect an assert
14318 int UtcDaliAnimationPlayFromNegative(void)
14320 TestApplication application;
14321 Dali::Animation instance;
14325 instance.PlayFrom(arg1);
14326 DALI_TEST_CHECK(false); // Should not get here
14330 DALI_TEST_CHECK(true); // We expect an assert
14335 int UtcDaliAnimationAnimateByNegative01(void)
14337 TestApplication application;
14338 Dali::Animation instance;
14342 Dali::Property arg1(actor, Actor::Property::POSITION);
14343 Dali::Property::Value arg2;
14344 instance.AnimateBy(arg1, arg2);
14345 DALI_TEST_CHECK(false); // Should not get here
14349 DALI_TEST_CHECK(true); // We expect an assert
14354 int UtcDaliAnimationAnimateByNegative02(void)
14356 TestApplication application;
14357 Dali::Animation instance;
14361 Dali::Property arg1(actor, Actor::Property::POSITION);
14362 Dali::Property::Value arg2;
14363 Dali::TimePeriod arg3(1.0f);
14364 instance.AnimateBy(arg1, arg2, arg3);
14365 DALI_TEST_CHECK(false); // Should not get here
14369 DALI_TEST_CHECK(true); // We expect an assert
14374 int UtcDaliAnimationAnimateByNegative03(void)
14376 TestApplication application;
14377 Dali::Animation instance;
14381 Dali::Property arg1(actor, Actor::Property::POSITION);
14382 Dali::Property::Value arg2;
14383 Dali::AlphaFunction arg3;
14384 instance.AnimateBy(arg1, arg2, arg3);
14385 DALI_TEST_CHECK(false); // Should not get here
14389 DALI_TEST_CHECK(true); // We expect an assert
14394 int UtcDaliAnimationAnimateByNegative04(void)
14396 TestApplication application;
14397 Dali::Animation instance;
14401 Dali::Property arg1(actor, Actor::Property::POSITION);
14402 Dali::Property::Value arg2;
14403 Dali::AlphaFunction arg3;
14404 Dali::TimePeriod arg4(1.0f);
14405 instance.AnimateBy(arg1, arg2, arg3, arg4);
14406 DALI_TEST_CHECK(false); // Should not get here
14410 DALI_TEST_CHECK(true); // We expect an assert
14415 int UtcDaliAnimationAnimateToNegative01(void)
14417 TestApplication application;
14419 Dali::Animation instance;
14422 Dali::Property arg1(actor, Actor::Property::POSITION);
14423 Dali::Property::Value arg2;
14424 instance.AnimateTo(arg1, arg2);
14425 DALI_TEST_CHECK(false); // Should not get here
14429 DALI_TEST_CHECK(true); // We expect an assert
14434 int UtcDaliAnimationAnimateToNegative02(void)
14436 TestApplication application;
14437 Dali::Animation instance;
14441 Dali::Property arg1(actor, Actor::Property::POSITION);
14442 Dali::Property::Value arg2;
14443 Dali::TimePeriod arg3(1.0f);
14444 instance.AnimateTo(arg1, arg2, arg3);
14445 DALI_TEST_CHECK(false); // Should not get here
14449 DALI_TEST_CHECK(true); // We expect an assert
14454 int UtcDaliAnimationAnimateToNegative03(void)
14456 TestApplication application;
14457 Dali::Animation instance;
14461 Dali::Property arg1(actor, Actor::Property::POSITION);
14462 Dali::Property::Value arg2;
14463 Dali::AlphaFunction arg3;
14464 instance.AnimateTo(arg1, arg2, arg3);
14465 DALI_TEST_CHECK(false); // Should not get here
14469 DALI_TEST_CHECK(true); // We expect an assert
14474 int UtcDaliAnimationAnimateToNegative04(void)
14476 TestApplication application;
14477 Dali::Animation instance;
14481 Dali::Property arg1(actor, Actor::Property::POSITION);
14482 Dali::Property::Value arg2;
14483 Dali::AlphaFunction arg3;
14484 Dali::TimePeriod arg4(1.0f);
14485 instance.AnimateTo(arg1, arg2, arg3, arg4);
14486 DALI_TEST_CHECK(false); // Should not get here
14490 DALI_TEST_CHECK(true); // We expect an assert
14495 int UtcDaliAnimationPlayAfterNegative(void)
14497 TestApplication application;
14498 Dali::Animation instance;
14502 instance.PlayAfter(arg1);
14503 DALI_TEST_CHECK(false); // Should not get here
14507 DALI_TEST_CHECK(true); // We expect an assert
14512 int UtcDaliAnimationGetDurationNegative(void)
14514 TestApplication application;
14515 Dali::Animation instance;
14518 instance.GetDuration();
14519 DALI_TEST_CHECK(false); // Should not get here
14523 DALI_TEST_CHECK(true); // We expect an assert
14528 int UtcDaliAnimationGetEndActionNegative(void)
14530 TestApplication application;
14531 Dali::Animation instance;
14534 instance.GetEndAction();
14535 DALI_TEST_CHECK(false); // Should not get here
14539 DALI_TEST_CHECK(true); // We expect an assert
14544 int UtcDaliAnimationGetPlayRangeNegative(void)
14546 TestApplication application;
14547 Dali::Animation instance;
14550 instance.GetPlayRange();
14551 DALI_TEST_CHECK(false); // Should not get here
14555 DALI_TEST_CHECK(true); // We expect an assert
14560 int UtcDaliAnimationGetLoopingModeNegative(void)
14562 TestApplication application;
14563 Dali::Animation instance;
14566 instance.GetLoopingMode();
14567 DALI_TEST_CHECK(false); // Should not get here
14571 DALI_TEST_CHECK(true); // We expect an assert
14576 int UtcDaliAnimationGetSpeedFactorNegative(void)
14578 TestApplication application;
14579 Dali::Animation instance;
14582 instance.GetSpeedFactor();
14583 DALI_TEST_CHECK(false); // Should not get here
14587 DALI_TEST_CHECK(true); // We expect an assert
14592 int UtcDaliAnimationGetDisconnectActionNegative(void)
14594 TestApplication application;
14595 Dali::Animation instance;
14598 instance.GetDisconnectAction();
14599 DALI_TEST_CHECK(false); // Should not get here
14603 DALI_TEST_CHECK(true); // We expect an assert
14608 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
14610 TestApplication application;
14611 Dali::Animation instance;
14614 instance.GetDefaultAlphaFunction();
14615 DALI_TEST_CHECK(false); // Should not get here
14619 DALI_TEST_CHECK(true); // We expect an assert
14624 int UtcDaliAnimationGetStateNegative(void)
14626 TestApplication application;
14627 Dali::Animation instance;
14630 instance.GetState();
14631 DALI_TEST_CHECK(false); // Should not get here
14635 DALI_TEST_CHECK(true); // We expect an assert
14640 int UtcDaliAnimationIsLoopingNegative(void)
14642 TestApplication application;
14643 Dali::Animation instance;
14646 instance.IsLooping();
14647 DALI_TEST_CHECK(false); // Should not get here
14651 DALI_TEST_CHECK(true); // We expect an assert
14656 int UtcDaliKeyFramesAddNegative01(void)
14658 TestApplication application;
14659 Dali::KeyFrames instance;
14663 Dali::Property::Value arg2;
14664 instance.Add(arg1, arg2);
14665 DALI_TEST_CHECK(false); // Should not get here
14669 DALI_TEST_CHECK(true); // We expect an assert
14674 int UtcDaliKeyFramesAddNegative02(void)
14676 TestApplication application;
14677 Dali::KeyFrames instance;
14681 Dali::Property::Value arg2;
14682 Dali::AlphaFunction arg3;
14683 instance.Add(arg1, arg2, arg3);
14684 DALI_TEST_CHECK(false); // Should not get here
14688 DALI_TEST_CHECK(true); // We expect an assert
14693 int UtcDaliKeyFramesGetTypeNegative(void)
14695 TestApplication application;
14696 Dali::KeyFrames instance;
14699 instance.GetType();
14700 DALI_TEST_CHECK(false); // Should not get here
14704 DALI_TEST_CHECK(true); // We expect an assert