2 * Copyright (c) 2021 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/devel-api/animation/key-frames-devel.h>
22 #include <dali/public-api/dali-core.h>
31 void utc_dali_animation_startuP(void)
33 test_return_value = TET_UNDEF;
36 void utc_dali_animation_cleanuP(void)
38 test_return_value = TET_PASS;
43 static const float ROTATION_EPSILON = 0.0001f;
44 static const float VECTOR4_EPSILON = 0.0001f;
45 static const float VECTOR3_EPSILON = 0.0001f;
47 // Functor to test whether a Finish signal is emitted
48 struct AnimationFinishCheck
50 AnimationFinishCheck(bool& signalReceived)
51 : mSignalReceived(signalReceived)
55 void operator()(Animation& animation)
57 mSignalReceived = true;
62 mSignalReceived = false;
65 void CheckSignalReceived()
69 tet_printf("Expected Finish signal was not received\n");
78 void CheckSignalNotReceived()
82 tet_printf("Unexpected Finish signal was received\n");
91 bool& mSignalReceived; // owned by individual tests
94 // Functor to test whether a Progress signal is emitted
95 struct AnimationProgressCheck
97 AnimationProgressCheck(bool& signalReceived, std::string name = " ")
98 : mSignalReceived(signalReceived),
103 void operator()(Animation& animation)
105 mSignalReceived = true;
110 mSignalReceived = false;
113 void CheckSignalReceived()
117 tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str());
118 tet_result(TET_FAIL);
122 tet_result(TET_PASS);
126 void CheckSignalNotReceived()
130 tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
131 tet_result(TET_FAIL);
135 tet_result(TET_PASS);
139 bool& mSignalReceived; // owned by individual tests
145 int UtcDaliAnimationConstructorP(void)
147 TestApplication application;
151 DALI_TEST_CHECK(!animation);
155 int UtcDaliAnimationNewP(void)
157 TestApplication application;
159 Animation animation = Animation::New(1.0f);
161 DALI_TEST_CHECK(animation);
165 int UtcDaliAnimationNewN(void)
167 TestApplication application;
169 Animation animation = Animation::New(-1.0f);
171 DALI_TEST_CHECK(animation);
172 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
176 int UtcDaliAnimationDownCastP(void)
178 TestApplication application;
180 tet_infoline("Testing Dali::Animation::DownCast()");
182 float durationSeconds(1.0f);
183 Animation animation = Animation::New(durationSeconds);
185 BaseHandle object(animation);
187 Animation animation2 = Animation::DownCast(object);
188 DALI_TEST_CHECK(animation2);
190 Animation animation3 = DownCast<Animation>(object);
191 DALI_TEST_CHECK(animation3);
195 int UtcDaliAnimationDownCastN(void)
197 TestApplication application;
199 BaseHandle unInitializedObject;
201 Animation animation1 = Animation::DownCast(unInitializedObject);
202 DALI_TEST_CHECK(!animation1);
204 Animation animation2 = DownCast<Animation>(unInitializedObject);
205 DALI_TEST_CHECK(!animation2);
209 int UtcDaliAnimationCopyConstructorP(void)
211 TestApplication application;
213 // Initialize an object, ref count == 1
214 Animation animation = Animation::New(1.0f);
216 Animation copy(animation);
217 DALI_TEST_CHECK(copy);
219 DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
223 int UtcDaliAnimationAssignmentOperatorP(void)
225 TestApplication application;
227 Animation animation = Animation::New(1.0f);
229 Animation copy = animation;
230 DALI_TEST_CHECK(copy);
232 DALI_TEST_CHECK(animation == copy);
234 DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
238 int UtcDaliAnimationMoveConstructor(void)
240 TestApplication application;
244 Animation animation = Animation::New(1.0f);
245 DALI_TEST_CHECK(animation);
246 DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
247 DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
249 Animation movedAnimation = std::move(animation);
250 DALI_TEST_CHECK(movedAnimation);
251 DALI_TEST_EQUALS(1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
252 DALI_TEST_EQUALS(1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION);
253 DALI_TEST_CHECK(!animation);
257 KeyFrames keyframes = KeyFrames::New();
258 DALI_TEST_CHECK(keyframes);
259 DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
260 DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
262 keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
263 keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
264 DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
266 KeyFrames movedKeyFrames = std::move(keyframes);
267 DALI_TEST_CHECK(movedKeyFrames);
268 DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
269 DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
270 DALI_TEST_CHECK(!keyframes);
275 int UtcDaliAnimationMoveAssignment(void)
277 TestApplication application;
281 Animation animation = Animation::New(1.0f);
282 DALI_TEST_CHECK(animation);
283 DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
284 DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
287 move = std::move(animation);
288 DALI_TEST_CHECK(move);
289 DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
290 DALI_TEST_EQUALS(1.0f, move.GetDuration(), 0.001f, TEST_LOCATION);
291 DALI_TEST_CHECK(!animation);
295 KeyFrames keyframes = KeyFrames::New();
296 DALI_TEST_CHECK(keyframes);
297 DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
298 DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
300 keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
301 keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
302 DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
304 KeyFrames movedKeyFrames;
305 movedKeyFrames = std::move(keyframes);
306 DALI_TEST_CHECK(movedKeyFrames);
307 DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
308 DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
309 DALI_TEST_CHECK(!keyframes);
314 int UtcDaliAnimationSetDurationP(void)
316 TestApplication application;
318 Actor actor = Actor::New();
319 application.GetScene().Add(actor);
321 // Build the animation
322 float durationSeconds(1.0f);
323 Animation animation = Animation::New(durationSeconds);
324 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
326 // Start the animation
327 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
328 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
331 bool signalReceived(false);
332 AnimationFinishCheck finishCheck(signalReceived);
333 animation.FinishedSignal().Connect(&application, finishCheck);
335 application.SendNotification();
336 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
338 // We didn't expect the animation to finish yet
339 application.SendNotification();
340 finishCheck.CheckSignalNotReceived();
342 application.Render(2u /*just beyond the animation duration*/);
344 // We did expect the animation to finish
345 application.SendNotification();
346 finishCheck.CheckSignalReceived();
347 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
349 // Restart the animation, with a different duration
351 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
352 durationSeconds = 3.5f;
353 animation.SetDuration(durationSeconds);
354 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
357 application.SendNotification();
358 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
360 // We didn't expect the animation to finish yet
361 application.SendNotification();
362 finishCheck.CheckSignalNotReceived();
364 application.Render(2u /*just beyond the animation duration*/);
366 // We did expect the animation to finish
367 application.SendNotification();
368 finishCheck.CheckSignalReceived();
369 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
371 // Check that nothing has changed after a couple of buffer swaps
372 application.Render(0);
373 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
374 application.Render(0);
375 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
379 int UtcDaliAnimationSetDurationN(void)
381 TestApplication application;
383 Animation animation = Animation::New(1.0f);
384 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
386 animation.SetDuration(-1.0f);
387 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
391 int UtcDaliAnimationGetDurationP(void)
393 TestApplication application;
395 Animation animation = Animation::New(1.0f);
396 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
398 animation.SetDuration(2.0f);
399 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
403 int UtcDaliAnimationSetLoopingP(void)
405 TestApplication application;
407 Actor actor = Actor::New();
408 application.GetScene().Add(actor);
410 // Build the animation
411 float durationSeconds(1.0f);
412 Animation animation = Animation::New(durationSeconds);
413 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
414 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
416 // Start the animation
417 animation.SetLooping(true);
418 DALI_TEST_CHECK(animation.IsLooping());
421 bool signalReceived(false);
422 AnimationFinishCheck finishCheck(signalReceived);
423 animation.FinishedSignal().Connect(&application, finishCheck);
425 application.SendNotification();
428 float intervalSeconds = 0.25f;
429 float progress = 0.0f;
430 for(int iterations = 0; iterations < 5;)
432 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
434 progress += intervalSeconds;
435 DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
439 progress = progress - 1.0f;
444 // We didn't expect the animation to finish yet
445 application.SendNotification();
446 finishCheck.CheckSignalNotReceived();
448 animation.SetLooping(false);
449 DALI_TEST_CHECK(!animation.IsLooping());
451 application.SendNotification();
452 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
454 // We did expect the animation to finish
455 application.SendNotification();
456 finishCheck.CheckSignalReceived();
457 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
459 // Check that nothing has changed after a couple of buffer swaps
460 application.Render(0);
461 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
462 application.Render(0);
463 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
467 int UtcDaliAnimationSetLoopCountP(void)
469 TestApplication application;
471 Actor actor = Actor::New();
472 application.GetScene().Add(actor);
474 // Build the animation
475 float durationSeconds(1.0f);
476 Animation animation = Animation::New(durationSeconds);
477 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
478 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
480 // Start the animation
481 animation.SetLoopCount(3);
482 DALI_TEST_CHECK(animation.IsLooping());
485 bool signalReceived(false);
486 AnimationFinishCheck finishCheck(signalReceived);
487 animation.FinishedSignal().Connect(&application, finishCheck);
489 application.Render(0);
490 application.SendNotification();
491 application.Render(0);
492 application.SendNotification();
493 application.Render(0);
494 application.SendNotification();
495 application.Render(0);
496 application.SendNotification();
499 float intervalSeconds = 3.0f;
501 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
502 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
504 application.Render(0);
505 application.SendNotification();
506 application.Render(0);
507 application.SendNotification();
508 application.Render(0);
509 application.SendNotification();
510 application.Render(0);
511 application.SendNotification();
512 finishCheck.CheckSignalNotReceived();
514 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
516 application.SendNotification();
517 finishCheck.CheckSignalReceived();
518 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
522 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
523 application.SendNotification();
524 finishCheck.CheckSignalNotReceived();
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.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
530 application.SendNotification();
531 finishCheck.CheckSignalNotReceived();
536 int UtcDaliAnimationSetLoopCountP2(void)
538 TestApplication application;
541 // switching between forever and loop count
544 Actor actor = Actor::New();
545 application.GetScene().Add(actor);
547 // Build the animation
548 float durationSeconds(1.0f);
549 Animation animation = Animation::New(durationSeconds);
550 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
551 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
552 animation.SetEndAction(Animation::DISCARD);
554 // Start the animation
555 animation.SetLoopCount(3);
556 DALI_TEST_CHECK(animation.IsLooping());
559 bool signalReceived(false);
560 AnimationFinishCheck finishCheck(signalReceived);
561 animation.FinishedSignal().Connect(&application, finishCheck);
563 float intervalSeconds = 3.0f;
565 application.SendNotification();
566 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
567 application.SendNotification();
568 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
569 application.SendNotification();
570 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
571 application.SendNotification();
573 application.SendNotification();
574 finishCheck.CheckSignalReceived();
579 animation.SetLooping(true);
580 DALI_TEST_CHECK(animation.IsLooping());
582 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
583 application.SendNotification();
584 finishCheck.CheckSignalNotReceived();
586 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
587 application.SendNotification();
588 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
589 application.SendNotification();
590 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
591 application.SendNotification();
592 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
593 application.SendNotification();
594 application.SendNotification();
595 finishCheck.CheckSignalNotReceived();
600 animation.SetLoopCount(3);
601 DALI_TEST_CHECK(animation.IsLooping());
604 application.SendNotification();
605 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
606 application.SendNotification();
607 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
608 application.SendNotification();
609 finishCheck.CheckSignalNotReceived();
611 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
612 application.SendNotification();
613 finishCheck.CheckSignalReceived();
618 animation.SetLooping(true);
619 DALI_TEST_CHECK(animation.IsLooping());
621 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
622 application.SendNotification();
623 finishCheck.CheckSignalNotReceived();
625 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
626 application.SendNotification();
627 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
628 application.SendNotification();
629 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
630 application.SendNotification();
631 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
632 application.SendNotification();
633 finishCheck.CheckSignalNotReceived();
638 animation.SetLoopCount(3);
639 DALI_TEST_CHECK(animation.IsLooping());
641 application.SendNotification();
642 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
643 application.SendNotification();
644 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
645 application.SendNotification();
646 finishCheck.CheckSignalNotReceived();
648 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
649 application.SendNotification();
650 finishCheck.CheckSignalNotReceived(); // we never hit play
657 int UtcDaliAnimationSetLoopCountP3(void)
659 TestApplication application;
662 // switching between forever and loop count
664 Actor actor = Actor::New();
665 application.GetScene().Add(actor);
667 // Build the animation
668 float durationSeconds(1.0f);
669 Animation animation = Animation::New(durationSeconds);
670 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
671 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
672 animation.SetEndAction(Animation::DISCARD);
674 float intervalSeconds = 3.0f;
676 bool signalReceived(false);
677 AnimationFinishCheck finishCheck(signalReceived);
678 animation.FinishedSignal().Connect(&application, finishCheck);
681 animation.SetLooping(true);
682 DALI_TEST_CHECK(animation.IsLooping());
684 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
685 application.SendNotification();
686 finishCheck.CheckSignalNotReceived();
688 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
689 application.SendNotification();
690 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
691 application.SendNotification();
692 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
693 application.SendNotification();
694 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
695 application.SendNotification();
696 finishCheck.CheckSignalNotReceived();
701 animation.SetLoopCount(3);
702 DALI_TEST_CHECK(animation.IsLooping());
704 application.SendNotification();
705 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
706 application.SendNotification();
707 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
708 application.SendNotification();
709 finishCheck.CheckSignalNotReceived();
711 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
712 application.SendNotification();
713 finishCheck.CheckSignalNotReceived(); // we never hit play
720 int UtcDaliAnimationSetLoopCountP4(void)
722 TestApplication application;
727 Actor actor = Actor::New();
728 application.GetScene().Add(actor);
730 // Build the animation
731 float durationSeconds(1.0f);
732 Animation animation = Animation::New(durationSeconds);
733 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
734 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
735 animation.SetEndAction(Animation::BAKE);
737 float intervalSeconds = 3.0f;
739 bool signalReceived(false);
740 AnimationFinishCheck finishCheck(signalReceived);
741 animation.FinishedSignal().Connect(&application, finishCheck);
743 animation.SetLoopCount(1);
745 DALI_TEST_CHECK(!animation.IsLooping());
747 application.SendNotification();
748 finishCheck.CheckSignalNotReceived();
749 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
750 application.SendNotification();
751 finishCheck.CheckSignalReceived();
753 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
754 actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
758 animation.Play(); // again
759 DALI_TEST_CHECK(!animation.IsLooping());
761 application.SendNotification();
762 finishCheck.CheckSignalNotReceived();
763 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
764 application.SendNotification();
765 finishCheck.CheckSignalReceived();
767 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
772 int UtcDaliAnimationGetLoopCountP(void)
774 TestApplication application;
776 Actor actor = Actor::New();
777 application.GetScene().Add(actor);
779 // Build the animation
780 float durationSeconds(1.0f);
781 Animation animation = Animation::New(durationSeconds);
782 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
783 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
785 DALI_TEST_CHECK(1 == animation.GetLoopCount());
787 // Start the animation
788 animation.SetLoopCount(3);
789 DALI_TEST_CHECK(animation.IsLooping());
790 DALI_TEST_CHECK(3 == animation.GetLoopCount());
794 application.Render(0);
795 application.SendNotification();
798 float intervalSeconds = 3.0f;
800 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
801 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
803 application.Render(0);
804 application.SendNotification();
806 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
807 application.SendNotification();
809 animation.SetLoopCount(0);
810 DALI_TEST_CHECK(animation.IsLooping());
811 DALI_TEST_CHECK(0 == animation.GetLoopCount());
813 animation.SetLoopCount(1);
814 DALI_TEST_CHECK(!animation.IsLooping());
815 DALI_TEST_CHECK(1 == animation.GetLoopCount());
820 int UtcDaliAnimationGetCurrentLoopP(void)
822 TestApplication application;
824 Actor actor = Actor::New();
825 application.GetScene().Add(actor);
827 // Build the animation
828 float durationSeconds(1.0f);
829 Animation animation = Animation::New(durationSeconds);
830 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
831 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
833 // Start the animation
834 animation.SetLoopCount(3);
835 DALI_TEST_CHECK(animation.IsLooping());
836 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
839 bool signalReceived(false);
840 AnimationFinishCheck finishCheck(signalReceived);
841 animation.FinishedSignal().Connect(&application, finishCheck);
843 application.SendNotification();
846 float intervalSeconds = 3.0f;
848 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
849 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
851 application.SendNotification();
852 finishCheck.CheckSignalNotReceived();
853 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
855 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
857 application.SendNotification();
858 finishCheck.CheckSignalReceived();
859 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
860 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
864 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
865 application.SendNotification();
866 finishCheck.CheckSignalNotReceived();
867 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
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.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
873 application.SendNotification();
874 finishCheck.CheckSignalNotReceived();
875 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
880 int UtcDaliAnimationIsLoopingP(void)
882 TestApplication application;
884 Animation animation = Animation::New(1.0f);
885 DALI_TEST_CHECK(!animation.IsLooping());
887 animation.SetLooping(true);
888 DALI_TEST_CHECK(animation.IsLooping());
892 int UtcDaliAnimationSetEndActionN(void)
894 TestApplication application;
896 Actor actor = Actor::New();
897 application.GetScene().Add(actor);
899 // Build the animation
900 float durationSeconds(1.0f);
901 Animation animation = Animation::New(durationSeconds);
902 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
904 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
905 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
907 // Start the animation
910 bool signalReceived(false);
911 AnimationFinishCheck finishCheck(signalReceived);
912 animation.FinishedSignal().Connect(&application, finishCheck);
914 application.SendNotification();
915 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
917 // We did expect the animation to finish
918 application.SendNotification();
919 finishCheck.CheckSignalReceived();
920 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
922 // Go back to the start
923 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
924 application.SendNotification();
925 application.Render(0);
926 DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
928 // Test BakeFinal, animate again, for half the duration
930 animation.SetEndAction(Animation::BAKE_FINAL);
931 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
934 application.SendNotification();
935 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f) /*half of the animation duration*/);
937 // Stop the animation early
940 // We did NOT expect the animation to finish
941 application.SendNotification();
942 finishCheck.CheckSignalNotReceived();
943 DALI_TEST_EQUALS(targetPosition * 0.5f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), VECTOR4_EPSILON, TEST_LOCATION);
945 // The position should be same with target position in the next frame
946 application.Render(0);
947 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
949 // Go back to the start
950 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
951 application.SendNotification();
952 application.Render(0);
953 DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
955 // Test EndAction::Discard, animate again, but don't bake this time
957 animation.SetEndAction(Animation::DISCARD);
958 DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
961 application.SendNotification();
962 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
964 // We did expect the animation to finish
965 application.SendNotification();
966 finishCheck.CheckSignalReceived();
967 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
969 // The position should be discarded in the next frame
970 application.Render(0);
971 DALI_TEST_EQUALS(Vector3::ZERO /*discarded*/, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
973 // Check that nothing has changed after a couple of buffer swaps
974 application.Render(0);
975 DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
976 application.Render(0);
977 DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
981 int UtcDaliAnimationGetEndActionP(void)
983 TestApplication application;
985 Animation animation = Animation::New(1.0f);
986 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
988 animation.SetEndAction(Animation::DISCARD);
989 DALI_TEST_CHECK(animation.GetEndAction() == Animation::DISCARD);
991 animation.SetEndAction(Animation::BAKE_FINAL);
992 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE_FINAL);
997 int UtcDaliAnimationSetDisconnectActionP(void)
999 TestApplication application;
1000 Integration::Scene stage(application.GetScene());
1002 // Default: BakeFinal
1004 Actor actor = Actor::New();
1007 // Build the animation
1008 float durationSeconds(1.0f);
1009 Animation animation = Animation::New(durationSeconds);
1010 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL);
1012 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1013 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1015 // Start the animation
1018 application.SendNotification();
1019 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1023 application.SendNotification();
1024 application.Render();
1026 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1031 Actor actor = Actor::New();
1034 // Build the animation
1035 float durationSeconds(1.0f);
1036 Animation animation = Animation::New(durationSeconds);
1037 animation.SetDisconnectAction(Animation::BAKE);
1039 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1040 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1042 // Start the animation
1045 application.SendNotification();
1046 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1050 application.SendNotification();
1051 application.Render();
1053 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition * 0.5f, TEST_LOCATION);
1058 Actor actor = Actor::New();
1061 // Build the animation
1062 float durationSeconds(1.0f);
1063 Animation animation = Animation::New(durationSeconds);
1064 animation.SetDisconnectAction(Animation::DISCARD);
1066 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1067 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1069 // Start the animation
1072 application.SendNotification();
1073 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1077 application.SendNotification();
1078 application.Render();
1080 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1083 // Don't play the animation: disconnect action should not be applied
1085 Actor actor = Actor::New();
1088 // Build the animation
1089 float durationSeconds(1.0f);
1090 Animation animation = Animation::New(durationSeconds);
1092 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1093 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1095 application.SendNotification();
1096 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
1100 application.SendNotification();
1101 application.Render();
1103 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
1109 int UtcDaliAnimationGetDisconnectActionP(void)
1111 TestApplication application;
1112 Animation animation = Animation::New(1.0f);
1113 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL); // default!
1115 animation.SetDisconnectAction(Animation::DISCARD);
1116 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::DISCARD);
1118 animation.SetDisconnectAction(Animation::BAKE);
1119 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE);
1124 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1126 TestApplication application;
1128 Animation animation = Animation::New(1.0f);
1129 AlphaFunction func = animation.GetDefaultAlphaFunction();
1130 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1132 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1133 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1134 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1138 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1140 TestApplication application;
1142 Animation animation = Animation::New(1.0f);
1143 AlphaFunction func = animation.GetDefaultAlphaFunction();
1145 // Test that the default is linear
1146 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1148 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1149 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1150 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1155 int UtcDaliAnimationSetCurrentProgressP(void)
1157 TestApplication application;
1159 Actor actor = Actor::New();
1160 application.GetScene().Add(actor);
1162 // Build the animation
1163 Animation animation = Animation::New(0.0f);
1166 float durationSeconds(1.0f);
1167 animation.SetDuration(durationSeconds);
1169 bool signalReceived(false);
1170 AnimationFinishCheck finishCheck(signalReceived);
1171 animation.FinishedSignal().Connect(&application, finishCheck);
1172 application.SendNotification();
1174 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1175 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1177 // Start the animation from 40% progress
1178 animation.SetCurrentProgress(0.4f);
1181 application.SendNotification();
1182 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1184 // We didn't expect the animation to finish yet
1185 application.SendNotification();
1186 finishCheck.CheckSignalNotReceived();
1187 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1188 DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1190 animation.Play(); // Test that calling play has no effect, when animation is already playing
1191 application.SendNotification();
1193 //Set the progress to 70%
1194 animation.SetCurrentProgress(0.7f);
1195 application.SendNotification();
1196 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1197 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1199 application.SendNotification();
1200 finishCheck.CheckSignalNotReceived();
1201 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1202 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1204 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1205 // We did expect the animation to finish
1206 application.SendNotification();
1207 finishCheck.CheckSignalReceived();
1208 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1210 // Check that nothing has changed after a couple of buffer swaps
1211 application.Render(0);
1212 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1213 application.Render(0);
1214 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1218 int UtcDaliAnimationSetCurrentProgressN(void)
1220 TestApplication application;
1222 Actor actor = Actor::New();
1223 application.GetScene().Add(actor);
1225 // Build the animation
1226 Animation animation = Animation::New(0.0f);
1229 float durationSeconds(1.0f);
1230 animation.SetDuration(durationSeconds);
1232 bool signalReceived(false);
1233 AnimationFinishCheck finishCheck(signalReceived);
1234 animation.FinishedSignal().Connect(&application, finishCheck);
1235 application.SendNotification();
1237 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1238 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1240 //Trying to set the current cursor outside the range [0..1] is ignored
1241 animation.SetCurrentProgress(-1.0f);
1242 application.SendNotification();
1243 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1245 animation.SetCurrentProgress(100.0f);
1246 application.SendNotification();
1247 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1251 int UtcDaliAnimationGetCurrentProgressP(void)
1253 TestApplication application;
1255 Actor actor = Actor::New();
1256 application.GetScene().Add(actor);
1258 // Build the animation
1259 Animation animation = Animation::New(0.0f);
1262 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1263 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1265 animation.SetCurrentProgress(0.5f);
1266 application.SendNotification();
1267 application.Render(static_cast<unsigned int>(100.0f));
1269 //Progress should still be 0.0
1270 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
1273 float durationSeconds(1.0f);
1274 animation.SetDuration(durationSeconds);
1275 application.SendNotification();
1277 bool signalReceived(false);
1278 AnimationFinishCheck finishCheck(signalReceived);
1279 animation.FinishedSignal().Connect(&application, finishCheck);
1280 application.SendNotification();
1282 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1283 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1285 // Start the animation from 40% progress
1286 animation.SetCurrentProgress(0.4f);
1289 application.SendNotification();
1290 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1292 // We didn't expect the animation to finish yet
1293 application.SendNotification();
1294 finishCheck.CheckSignalNotReceived();
1295 DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
1297 animation.Play(); // Test that calling play has no effect, when animation is already playing
1298 application.SendNotification();
1300 //Set the progress to 70%
1301 animation.SetCurrentProgress(0.7f);
1302 application.SendNotification();
1303 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
1304 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1306 application.SendNotification();
1307 finishCheck.CheckSignalNotReceived();
1308 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
1310 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1311 // We did expect the animation to finish
1312 application.SendNotification();
1313 finishCheck.CheckSignalReceived();
1317 int UtcDaliAnimationSetSpeedFactorP1(void)
1319 TestApplication application;
1321 tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1323 Actor actor = Actor::New();
1324 application.GetScene().Add(actor);
1326 // Build the animation
1327 float durationSeconds(1.0f);
1328 Animation animation = Animation::New(durationSeconds);
1330 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1331 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1333 KeyFrames keyframes = KeyFrames::New();
1334 keyframes.Add(0.0f, initialPosition);
1335 keyframes.Add(1.0f, targetPosition);
1336 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1338 //Set speed to be x2
1339 animation.SetSpeedFactor(2.0f);
1341 // Start the animation
1344 bool signalReceived(false);
1345 AnimationFinishCheck finishCheck(signalReceived);
1346 animation.FinishedSignal().Connect(&application, finishCheck);
1348 application.SendNotification();
1349 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1351 // We didn't expect the animation to finish yet
1352 application.SendNotification();
1353 finishCheck.CheckSignalNotReceived();
1354 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1356 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1358 // We didn't expect the animation to finish yet
1359 application.SendNotification();
1360 finishCheck.CheckSignalNotReceived();
1361 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1363 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond half the duration*/);
1365 // We did expect the animation to finish
1366 application.SendNotification();
1367 finishCheck.CheckSignalReceived();
1368 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1370 // Check that nothing has changed after a couple of buffer swaps
1371 application.Render(0);
1372 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1373 application.Render(0);
1374 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1379 int UtcDaliAnimationSetSpeedFactorP2(void)
1381 TestApplication application;
1383 Actor actor = Actor::New();
1384 application.GetScene().Add(actor);
1386 // Build the animation
1387 float durationSeconds(1.0f);
1388 Animation animation = Animation::New(durationSeconds);
1390 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1391 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1393 KeyFrames keyframes = KeyFrames::New();
1394 keyframes.Add(0.0f, initialPosition);
1395 keyframes.Add(1.0f, targetPosition);
1396 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1398 tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1399 animation.SetSpeedFactor(-1.0f);
1401 // Start the animation
1404 bool signalReceived(false);
1405 AnimationFinishCheck finishCheck(signalReceived);
1406 animation.FinishedSignal().Connect(&application, finishCheck);
1408 application.SendNotification();
1409 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
1411 // We didn't expect the animation to finish yet
1412 application.SendNotification();
1413 finishCheck.CheckSignalNotReceived();
1414 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
1416 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
1418 // We didn't expect the animation to finish yet
1419 application.SendNotification();
1420 finishCheck.CheckSignalNotReceived();
1421 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
1423 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1425 // We didn't expect the animation to finish yet
1426 application.SendNotification();
1427 finishCheck.CheckSignalNotReceived();
1428 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1430 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1432 // We didn't expect the animation to finish yet
1433 application.SendNotification();
1434 finishCheck.CheckSignalNotReceived();
1435 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1437 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1439 // We did expect the animation to finish
1440 application.SendNotification();
1441 finishCheck.CheckSignalReceived();
1442 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1444 // Check that nothing has changed after a couple of buffer swaps
1445 application.Render(0);
1446 DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1447 application.Render(0);
1448 DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1453 int UtcDaliAnimationSetSpeedFactorP3(void)
1455 TestApplication application;
1457 Actor actor = Actor::New();
1458 application.GetScene().Add(actor);
1460 // Build the animation
1461 float durationSeconds(1.0f);
1462 Animation animation = Animation::New(durationSeconds);
1464 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1465 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1467 KeyFrames keyframes = KeyFrames::New();
1468 keyframes.Add(0.0f, initialPosition);
1469 keyframes.Add(1.0f, targetPosition);
1470 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1472 bool signalReceived(false);
1473 AnimationFinishCheck finishCheck(signalReceived);
1474 animation.FinishedSignal().Connect(&application, finishCheck);
1476 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1478 //Set speed to be half of normal speed
1479 animation.SetSpeedFactor(0.5f);
1481 // Start the animation
1484 application.SendNotification();
1485 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1487 // We didn't expect the animation to finish yet
1488 application.SendNotification();
1489 finishCheck.CheckSignalNotReceived();
1490 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1492 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1494 // We didn't expect the animation to finish yet
1495 application.SendNotification();
1496 finishCheck.CheckSignalNotReceived();
1497 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1499 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1501 // We didn't expect the animation to finish yet
1502 application.SendNotification();
1503 finishCheck.CheckSignalNotReceived();
1504 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1506 application.SendNotification();
1507 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
1509 // We didn't expect the animation to finish yet
1510 application.SendNotification();
1511 finishCheck.CheckSignalNotReceived();
1512 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
1514 application.Render(static_cast<unsigned int>(durationSeconds * 1200.0f) + 1u /*just beyond the animation duration*/);
1516 // We did expect the animation to finish
1517 application.SendNotification();
1518 finishCheck.CheckSignalReceived();
1519 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
1521 // Check that nothing has changed after a couple of buffer swaps
1522 application.Render(0);
1523 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1524 application.Render(0);
1525 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1529 int UtcDaliAnimationSetSpeedFactorP4(void)
1531 TestApplication application;
1533 Actor actor = Actor::New();
1534 application.GetScene().Add(actor);
1536 // Build the animation
1537 float durationSeconds(1.0f);
1538 Animation animation = Animation::New(durationSeconds);
1540 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1541 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1543 KeyFrames keyframes = KeyFrames::New();
1544 keyframes.Add(0.0f, initialPosition);
1545 keyframes.Add(1.0f, targetPosition);
1546 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1548 bool signalReceived(false);
1549 AnimationFinishCheck finishCheck(signalReceived);
1550 animation.FinishedSignal().Connect(&application, finishCheck);
1552 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1554 tet_printf("Set speed to be half of normal speed\n");
1555 tet_printf("SetSpeedFactor(0.5f)\n");
1556 animation.SetSpeedFactor(0.5f);
1558 // Start the animation
1561 application.SendNotification();
1562 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1564 // We didn't expect the animation to finish yet
1565 application.SendNotification();
1566 finishCheck.CheckSignalNotReceived();
1567 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
1569 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1571 // We didn't expect the animation to finish yet
1572 application.SendNotification();
1573 finishCheck.CheckSignalNotReceived();
1574 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1576 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
1578 // We didn't expect the animation to finish yet
1579 application.SendNotification();
1580 finishCheck.CheckSignalNotReceived();
1581 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
1583 tet_printf("Reverse direction of animation whilst playing\n");
1584 tet_printf("SetSpeedFactor(-0.5f)\n");
1585 animation.SetSpeedFactor(-0.5f);
1587 application.SendNotification();
1588 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
1590 // We didn't expect the animation to finish yet
1591 application.SendNotification();
1592 finishCheck.CheckSignalNotReceived();
1593 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
1595 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
1597 // We didn't expect the animation to finish yet
1598 application.SendNotification();
1599 finishCheck.CheckSignalNotReceived();
1600 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), 0.0001, TEST_LOCATION);
1602 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
1604 // We did expect the animation to finish
1605 application.SendNotification();
1606 finishCheck.CheckSignalReceived();
1607 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
1609 // Check that nothing has changed after a couple of buffer swaps
1610 application.Render(0);
1611 DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1612 application.Render(0);
1613 DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1617 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1619 TestApplication application;
1621 const unsigned int NUM_FRAMES(15);
1629 float expected[NUM_FRAMES];
1632 TestData testData[] = {
1634 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1635 /* |----------PlayRange---------------| */
1637 {0.0f, 1.0f, // TimePeriod
1641 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1645 60.0f, /* Reverse direction */
1655 // ACTOR 1 - Across start of range
1656 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1657 /* |----------PlayRange---------------| */
1659 {0.2f, 0.5f, // TimePeriod
1662 {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1666 50.0f, /* Reverse direction @ frame #9 */
1674 // ACTOR 2 - Across end of range
1675 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1676 /* |----------PlayRange---------------| */
1678 {/**/ 0.5f, 0.9f, // TimePeriod
1690 60.0f, /* Reverse direction @ frame #9 */
1699 // ACTOR 3 - Before beginning of range
1700 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1701 /* |----------PlayRange---------------| */
1703 {/**/ 0.1f, 0.25f, // TimePeriod
1726 // ACTOR 4 - After end of range
1727 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1728 /* |----------PlayRange---------------| */
1730 {/**/ 0.85f, 1.0f, // TimePeriod
1752 // Actor 5 - Middle of range
1753 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1754 /* |----------PlayRange---------------| */
1756 {/**/ 0.4f, 0.65f, // Time Period
1777 const size_t NUM_ENTRIES(sizeof(testData) / sizeof(TestData));
1779 // Build the animation
1780 float durationSeconds(1.0f);
1781 Animation animation = Animation::New(durationSeconds);
1782 bool signalReceived(false);
1783 AnimationFinishCheck finishCheck(signalReceived);
1784 animation.FinishedSignal().Connect(&application, finishCheck);
1786 std::vector<Dali::Actor> actors;
1788 for(unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex)
1790 Actor actor = Actor::New();
1791 actor.SetProperty(Actor::Property::POSITION, Vector3(testData[actorIndex].startX, 0, 0));
1792 actors.push_back(actor);
1793 application.GetScene().Add(actor);
1795 if(actorIndex == 0 || actorIndex == NUM_ENTRIES - 1)
1797 KeyFrames keyframes = KeyFrames::New();
1798 keyframes.Add(testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1799 keyframes.Add(testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1800 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1804 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(testData[actorIndex].endX, 0, 0), TimePeriod(testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime));
1808 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1809 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1810 tet_printf("SetSpeedFactor(0.5f)\n");
1811 animation.SetSpeedFactor(0.5f);
1812 animation.SetPlayRange(Vector2(0.3f, 0.8f));
1813 animation.SetLooping(true);
1815 // Start the animation
1817 application.SendNotification();
1818 application.Render(0); // Frame 0 tests initial values
1820 for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1822 unsigned int actorIndex = 0u;
1823 for(actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex)
1825 DALI_TEST_EQUALS(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION);
1826 if(!Equals(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame]))
1828 tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex);
1834 tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1835 tet_printf("SetSpeedFactor(-0.5f)\n");
1836 animation.SetSpeedFactor(-0.5f);
1837 application.SendNotification();
1839 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1841 // We didn't expect the animation to finish yet
1842 application.SendNotification();
1843 finishCheck.CheckSignalNotReceived();
1849 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1851 TestApplication application;
1853 const unsigned int NUM_FRAMES(15);
1861 float expected[NUM_FRAMES];
1866 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1867 /* |----------PlayRange---------------| */
1868 {0.0f, 1.0f, // TimePeriod
1872 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1886 // Build the animation
1887 float durationSeconds(1.0f);
1888 Animation animation = Animation::New(durationSeconds);
1889 bool signalReceived(false);
1890 AnimationFinishCheck finishCheck(signalReceived);
1891 animation.FinishedSignal().Connect(&application, finishCheck);
1893 std::vector<Dali::Actor> actors;
1895 Actor actor = Actor::New();
1896 actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1897 actors.push_back(actor);
1898 application.GetScene().Add(actor);
1900 KeyFrames keyframes = KeyFrames::New();
1901 keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1902 keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1903 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1905 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1906 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1907 tet_printf("SetSpeedFactor(0.5f)\n");
1908 tet_printf("SetLoopCount(3)\n");
1909 animation.SetSpeedFactor(0.5f);
1910 animation.SetPlayRange(Vector2(0.3f, 0.8f));
1911 animation.SetLoopCount(3);
1913 // Start the animation
1915 application.SendNotification();
1916 application.Render(0); // Frame 0 tests initial values
1918 for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
1920 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
1922 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1924 if(frame < NUM_FRAMES - 1)
1926 // We didn't expect the animation to finish yet
1927 application.SendNotification();
1928 finishCheck.CheckSignalNotReceived();
1932 // We did expect the animation to finish
1933 application.SendNotification();
1934 finishCheck.CheckSignalReceived();
1935 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 80.0f, 0.001, TEST_LOCATION);
1940 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1942 TestApplication application;
1944 const unsigned int NUM_FRAMES(15);
1952 float expected[NUM_FRAMES];
1957 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1958 /* |----------PlayRange---------------| */
1959 {0.0f, 1.0f, // TimePeriod
1980 // Build the animation
1981 float durationSeconds(1.0f);
1982 Animation animation = Animation::New(durationSeconds);
1983 bool signalReceived(false);
1984 AnimationFinishCheck finishCheck(signalReceived);
1985 animation.FinishedSignal().Connect(&application, finishCheck);
1987 std::vector<Dali::Actor> actors;
1989 Actor actor = Actor::New();
1990 actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
1991 actors.push_back(actor);
1992 application.GetScene().Add(actor);
1994 KeyFrames keyframes = KeyFrames::New();
1995 keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
1996 keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
1997 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1999 tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
2000 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
2001 tet_printf("SetSpeedFactor(-0.5f)\n");
2002 tet_printf("SetLoopCount(3)\n");
2003 animation.SetSpeedFactor(-0.5f);
2004 animation.SetPlayRange(Vector2(0.3f, 0.8f));
2005 animation.SetLoopCount(3);
2007 // Start the animation
2009 application.SendNotification();
2010 application.Render(0); // Frame 0 tests initial values
2012 for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
2014 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
2016 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
2018 if(frame < NUM_FRAMES - 1)
2020 // We didn't expect the animation to finish yet
2021 application.SendNotification();
2022 finishCheck.CheckSignalNotReceived();
2026 // We did expect the animation to finish
2027 application.SendNotification();
2028 finishCheck.CheckSignalReceived();
2029 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 30.0f, 0.001, TEST_LOCATION);
2034 int UtcDaliAnimationGetSpeedFactorP(void)
2036 TestApplication application;
2038 Animation animation = Animation::New(1.0f);
2039 animation.SetSpeedFactor(0.5f);
2040 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
2042 animation.SetSpeedFactor(-2.5f);
2043 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
2047 int UtcDaliAnimationSetPlayRangeP(void)
2049 TestApplication application;
2051 Actor actor = Actor::New();
2052 application.GetScene().Add(actor);
2054 // Build the animation
2055 float durationSeconds(1.0f);
2056 Animation animation = Animation::New(durationSeconds);
2058 bool signalReceived(false);
2059 AnimationFinishCheck finishCheck(signalReceived);
2060 animation.FinishedSignal().Connect(&application, finishCheck);
2061 application.SendNotification();
2063 // Set range between 0.4 and 0.8
2064 animation.SetPlayRange(Vector2(0.4f, 0.9f));
2065 application.SendNotification();
2066 DALI_TEST_EQUALS(Vector2(0.4f, 0.9f), animation.GetPlayRange(), TEST_LOCATION);
2068 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2069 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2071 // Start the animation from 40% progress
2074 application.SendNotification();
2075 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2077 // We didn't expect the animation to finish yet
2078 application.SendNotification();
2079 finishCheck.CheckSignalNotReceived();
2080 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2082 application.SendNotification();
2083 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2085 application.SendNotification();
2086 finishCheck.CheckSignalNotReceived();
2087 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2089 application.SendNotification();
2090 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond the animation duration*/);
2092 // We did expect the animation to finish
2093 application.SendNotification();
2094 finishCheck.CheckSignalReceived();
2095 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION);
2099 int UtcDaliAnimationSetPlayRangeN(void)
2101 TestApplication application;
2103 Actor actor = Actor::New();
2104 application.GetScene().Add(actor);
2106 // Build the animation
2107 Animation animation = Animation::New(0);
2108 application.SendNotification();
2110 //PlayRange out of bounds
2111 animation.SetPlayRange(Vector2(-1.0f, 1.0f));
2112 application.SendNotification();
2113 DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2114 animation.SetPlayRange(Vector2(0.0f, 2.0f));
2115 application.SendNotification();
2116 DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2118 //If playRange is not in the correct order it has to be ordered
2119 animation.SetPlayRange(Vector2(0.8f, 0.2f));
2120 application.SendNotification();
2121 DALI_TEST_EQUALS(Vector2(0.2f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2126 int UtcDaliAnimationGetPlayRangeP(void)
2128 TestApplication application;
2130 Actor actor = Actor::New();
2131 application.GetScene().Add(actor);
2133 // Build the animation
2134 Animation animation = Animation::New(1.0f);
2135 application.SendNotification();
2137 //If PlayRange not specified it should be 0.0-1.0 by default
2138 DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
2140 // Set range between 0.4 and 0.8
2141 animation.SetPlayRange(Vector2(0.4f, 0.8f));
2142 application.SendNotification();
2143 DALI_TEST_EQUALS(Vector2(0.4f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
2148 int UtcDaliAnimationPlayP(void)
2150 TestApplication application;
2152 Actor actor = Actor::New();
2153 application.GetScene().Add(actor);
2155 // Build the animation
2156 float durationSeconds(1.0f);
2157 Animation animation = Animation::New(durationSeconds);
2158 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2159 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2161 // Start the animation
2164 bool signalReceived(false);
2165 AnimationFinishCheck finishCheck(signalReceived);
2166 animation.FinishedSignal().Connect(&application, finishCheck);
2168 application.SendNotification();
2169 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2171 // We didn't expect the animation to finish yet
2172 application.SendNotification();
2173 finishCheck.CheckSignalNotReceived();
2174 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2176 animation.Play(); // Test that calling play has no effect, when animation is already playing
2177 application.SendNotification();
2178 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2180 // We didn't expect the animation to finish yet
2181 application.SendNotification();
2182 finishCheck.CheckSignalNotReceived();
2183 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2185 animation.Play(); // Test that calling play has no effect, when animation is already playing
2186 application.SendNotification();
2187 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2189 // We didn't expect the animation to finish yet
2190 application.SendNotification();
2191 finishCheck.CheckSignalNotReceived();
2192 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2194 animation.Play(); // Test that calling play has no effect, when animation is already playing
2195 application.SendNotification();
2196 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2198 // We didn't expect the animation to finish yet
2199 application.SendNotification();
2200 finishCheck.CheckSignalNotReceived();
2201 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2203 animation.Play(); // Test that calling play has no effect, when animation is already playing
2204 application.SendNotification();
2205 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2207 // We did expect the animation to finish
2208 application.SendNotification();
2209 finishCheck.CheckSignalReceived();
2210 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2212 // Check that nothing has changed after a couple of buffer swaps
2213 application.Render(0);
2214 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2215 application.Render(0);
2216 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2220 int UtcDaliAnimationPlayOffSceneP(void)
2222 // Test that an animation cannot be played, when the actor is off-stage.
2223 // And the property value and the current property value should not be changed in the case.
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 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2236 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2238 // Start the animation
2241 bool signalReceived(false);
2242 AnimationFinishCheck finishCheck(signalReceived);
2243 animation.FinishedSignal().Connect(&application, finishCheck);
2245 application.SendNotification();
2246 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2248 application.SendNotification();
2249 finishCheck.CheckSignalReceived();
2251 // An animation can't be played. The position shouldn't be changed.
2252 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2253 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2256 application.GetScene().Add(actor);
2258 // Start the animation again
2261 application.SendNotification();
2262 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2264 // We did expect the animation to finish
2265 application.SendNotification();
2266 finishCheck.CheckSignalReceived();
2268 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2269 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2271 // Reset the position
2272 actor[Actor::Property::POSITION] = basePosition;
2274 application.SendNotification();
2275 application.Render();
2277 // Create an animator again
2279 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2281 // Remove from the stage
2282 application.GetScene().Remove(actor);
2284 signalReceived = false;
2286 // Start the animation again
2289 application.SendNotification();
2290 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
2292 application.SendNotification();
2293 finishCheck.CheckSignalReceived();
2295 // An animation can't be played. The position shouldn't be changed.
2296 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2297 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2302 int UtcDaliAnimationPlayOffSceneDiscardP(void)
2304 // Test that an animation cannot be played, when the actor is off-stage.
2305 // When the actor is added to the stage, it should appear at the current position
2306 // i.e. where it would have been anyway, if on-stage from the beginning.
2308 TestApplication application;
2310 Actor actor = Actor::New();
2311 Vector3 basePosition(Vector3::ZERO);
2312 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2313 // Not added to the stage yet!
2315 // Build the animation
2316 float durationSeconds(1.0f);
2317 Animation animation = Animation::New(durationSeconds);
2318 animation.SetDisconnectAction(Animation::DISCARD);
2319 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2320 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2322 // Start the animation
2325 bool signalReceived(false);
2326 AnimationFinishCheck finishCheck(signalReceived);
2327 animation.FinishedSignal().Connect(&application, finishCheck);
2329 application.SendNotification();
2330 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2332 // We didn't expect the animation to finish yet
2333 application.SendNotification();
2334 finishCheck.CheckSignalNotReceived();
2336 // An animation can't be played. The position shouldn't be changed.
2337 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2340 application.GetScene().Add(actor);
2342 application.SendNotification();
2343 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2345 // We didn't expect the animation to finish yet
2346 application.SendNotification();
2347 finishCheck.CheckSignalNotReceived();
2348 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2350 // Remove from the stage
2351 application.GetScene().Remove(actor);
2353 application.SendNotification();
2354 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2356 // We didn't expect the animation to finish yet
2357 application.SendNotification();
2358 finishCheck.CheckSignalNotReceived();
2359 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*back to start position as disconnect behaviour is discard*/, TEST_LOCATION);
2360 // Check that nothing has changed after a couple of buffer swaps
2361 application.Render(0);
2362 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2363 application.Render(0);
2364 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2365 application.Render(0);
2366 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2369 application.GetScene().Add(actor);
2371 application.SendNotification();
2372 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2374 // We didn't expect the animation to finish yet
2375 application.SendNotification();
2376 finishCheck.CheckSignalNotReceived();
2377 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(80, 80, 80), TEST_LOCATION);
2379 application.SendNotification();
2380 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2382 // We did expect the animation to finish
2383 application.SendNotification();
2384 finishCheck.CheckSignalReceived();
2385 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2387 // Check that nothing has changed after a couple of buffer swaps
2388 application.Render(0);
2389 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2391 application.Render(0);
2392 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2396 int UtcDaliAnimationPlayOffSceneBakeFinalP(void)
2398 // Test that an animation cannot be played, when the actor is off-stage.
2399 // When the actor is added to the stage, it should appear at the current position
2400 // i.e. where it would have been anyway, if on-stage from the beginning.
2402 TestApplication application;
2404 Actor actor = Actor::New();
2405 Vector3 basePosition(Vector3::ZERO);
2406 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2407 // Not added to the stage!
2409 // Build the animation
2410 float durationSeconds(1.0f);
2411 Animation animation = Animation::New(durationSeconds);
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();
2429 // An animation can't be played. The position shouldn't be changed.
2430 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2433 application.GetScene().Add(actor);
2435 application.SendNotification();
2436 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2438 // We didn't expect the animation to finish yet
2439 application.SendNotification();
2440 finishCheck.CheckSignalNotReceived();
2441 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2443 // Remove from the stage
2444 application.GetScene().Remove(actor);
2446 application.SendNotification();
2447 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2449 // We didn't expect the animation to finish yet
2450 application.SendNotification();
2451 finishCheck.CheckSignalNotReceived();
2452 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final*/, TEST_LOCATION);
2455 application.GetScene().Add(actor);
2457 application.SendNotification();
2458 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2460 // We didn't expect the animation to finish yet
2461 application.SendNotification();
2462 finishCheck.CheckSignalNotReceived();
2463 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final removed the */, TEST_LOCATION);
2465 application.SendNotification();
2466 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2468 // We did expect the animation to finish
2469 application.SendNotification();
2470 finishCheck.CheckSignalReceived();
2471 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2473 // Check that nothing has changed after a couple of buffer swaps
2474 application.Render(0);
2475 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2477 application.Render(0);
2478 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2482 int UtcDaliAnimationPlayOffSceneBakeP(void)
2484 // Test that an animation cannot be played, when the actor is off-stage.
2485 // When the actor is added to the stage, it should appear at the current position
2486 // i.e. where it would have been anyway, if on-stage from the beginning.
2488 TestApplication application;
2490 Actor actor = Actor::New();
2491 Vector3 basePosition(Vector3::ZERO);
2492 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2493 // Not added to the stage!
2495 // Build the animation
2496 float durationSeconds(1.0f);
2497 Animation animation = Animation::New(durationSeconds);
2498 animation.SetDisconnectAction(Animation::BAKE);
2499 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2500 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2502 // Start the animation
2505 bool signalReceived(false);
2506 AnimationFinishCheck finishCheck(signalReceived);
2507 animation.FinishedSignal().Connect(&application, finishCheck);
2509 application.SendNotification();
2510 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2512 // We didn't expect the animation to finish yet
2513 application.SendNotification();
2514 finishCheck.CheckSignalNotReceived();
2516 // An animation can't be played. The position shouldn't be changed.
2517 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
2520 application.GetScene().Add(actor);
2522 application.SendNotification();
2523 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2525 // We didn't expect the animation to finish yet
2526 application.SendNotification();
2527 finishCheck.CheckSignalNotReceived();
2528 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
2530 // Remove from the stage
2531 application.GetScene().Remove(actor); // baked here
2533 application.SendNotification();
2534 // this render is a no-op in this case as animator is disabled while off stage
2535 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% 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), Vector3(40, 40, 40) /*baked value*/, TEST_LOCATION);
2541 // Add back to the stage
2542 application.GetScene().Add(actor);
2544 application.SendNotification();
2545 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2546 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION);
2547 application.Render(static_cast<unsigned int>(0.0f));
2548 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2549 application.Render(static_cast<unsigned int>(0.0f));
2550 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2552 // Remove from the stage
2553 application.GetScene().Remove(actor); // baked here
2555 application.SendNotification();
2556 // this render is a no-op in this case as animator is disabled while off stage
2557 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2558 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2559 application.Render(static_cast<unsigned int>(0.0f));
2560 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2561 application.Render(static_cast<unsigned int>(0.0f));
2562 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
2564 // Add back to the stage
2565 application.GetScene().Add(actor);
2567 // We didn't expect the animation to finish yet
2568 application.SendNotification();
2569 finishCheck.CheckSignalNotReceived();
2570 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88), TEST_LOCATION);
2572 application.SendNotification();
2573 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2575 // We did expect the animation to finish
2576 application.SendNotification();
2577 finishCheck.CheckSignalReceived();
2578 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2580 // Check that nothing has changed after a couple of buffer swaps
2581 application.Render(0);
2582 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2584 application.Render(0);
2585 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2589 int UtcDaliAnimationPlayDiscardHandleP(void)
2591 TestApplication application;
2593 Actor actor = Actor::New();
2594 application.GetScene().Add(actor);
2596 // Build the animation
2597 float durationSeconds(1.0f);
2598 Animation animation = Animation::New(durationSeconds);
2599 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2600 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2602 bool signalReceived(false);
2603 AnimationFinishCheck finishCheck(signalReceived);
2604 animation.FinishedSignal().Connect(&application, finishCheck);
2606 // Start the animation
2609 // This is a test of the "Fire and Forget" behaviour
2610 // Discard the animation handle!
2612 DALI_TEST_CHECK(!animation);
2614 application.SendNotification();
2615 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2617 // We didn't expect the animation to finish yet
2618 application.SendNotification();
2619 finishCheck.CheckSignalNotReceived();
2620 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2622 application.SendNotification();
2623 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2625 // We didn't expect the animation to finish yet
2626 application.SendNotification();
2627 finishCheck.CheckSignalNotReceived();
2628 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
2630 application.SendNotification();
2631 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2633 // We didn't expect the animation to finish yet
2634 application.SendNotification();
2635 finishCheck.CheckSignalNotReceived();
2636 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2638 application.SendNotification();
2639 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2641 // We didn't expect the animation to finish yet
2642 application.SendNotification();
2643 finishCheck.CheckSignalNotReceived();
2644 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2646 application.SendNotification();
2647 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2649 // We did expect the animation to finish
2650 application.SendNotification();
2651 finishCheck.CheckSignalReceived();
2652 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2654 // Check that nothing has changed after a couple of buffer swaps
2655 application.Render(0);
2656 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2657 application.Render(0);
2658 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2662 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2664 TestApplication application;
2666 Actor actor = Actor::New();
2667 application.GetScene().Add(actor);
2669 // Build the animation
2670 float durationSeconds(1.0f);
2671 Animation animation = Animation::New(durationSeconds);
2672 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2673 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2675 // Start the animation
2678 bool signalReceived(false);
2679 AnimationFinishCheck finishCheck(signalReceived);
2680 animation.FinishedSignal().Connect(&application, finishCheck);
2682 application.SendNotification();
2683 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
2685 // We didn't expect the animation to finish yet
2686 application.SendNotification();
2687 finishCheck.CheckSignalNotReceived();
2688 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2690 // This is a test of the "Fire and Forget" behaviour
2691 // Stop the animation, and Discard the animation handle!
2694 DALI_TEST_CHECK(!animation);
2696 application.SendNotification();
2697 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
2699 // We expect the animation to finish at 20% progress
2700 application.SendNotification();
2701 finishCheck.CheckSignalReceived();
2702 finishCheck.Reset();
2703 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2705 application.SendNotification();
2706 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2708 // Check that nothing has changed
2709 application.SendNotification();
2710 finishCheck.CheckSignalNotReceived();
2711 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2713 application.SendNotification();
2714 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2716 // Check that nothing has changed
2717 application.SendNotification();
2718 finishCheck.CheckSignalNotReceived();
2719 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2721 application.SendNotification();
2722 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
2724 // Check that nothing has changed
2725 application.SendNotification();
2726 finishCheck.CheckSignalNotReceived();
2727 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
2731 int UtcDaliAnimationPlayRangeP(void)
2733 TestApplication application;
2735 Actor actor = Actor::New();
2736 application.GetScene().Add(actor);
2738 // Build the animation
2739 float durationSeconds(1.0f);
2740 Animation animation = Animation::New(durationSeconds);
2741 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2742 KeyFrames keyframes = KeyFrames::New();
2743 keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
2744 keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
2746 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
2748 // Set range between 0.4 and 0.8
2749 animation.SetPlayRange(Vector2(0.4f, 0.8f));
2752 bool signalReceived(false);
2753 AnimationFinishCheck finishCheck(signalReceived);
2754 animation.FinishedSignal().Connect(&application, finishCheck);
2756 //Test that setting progress outside the range doesn't work
2757 animation.SetCurrentProgress(0.9f);
2758 application.SendNotification();
2759 application.Render(0);
2760 DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2761 animation.SetCurrentProgress(0.2f);
2762 application.SendNotification();
2763 application.Render(0);
2764 DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
2766 application.SendNotification();
2767 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2769 // We didn't expect the animation to finish yet
2770 application.SendNotification();
2771 finishCheck.CheckSignalNotReceived();
2772 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2774 animation.Play(); // Test that calling play has no effect, when animation is already playing
2775 application.SendNotification();
2776 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /* 80% progress */);
2778 // We did expect the animation to finish
2779 application.SendNotification();
2780 finishCheck.CheckSignalReceived();
2781 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2783 // Check that nothing has changed after a couple of buffer swaps
2784 application.Render(0);
2785 DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2786 application.Render(0);
2787 DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2789 //Loop inside the range
2790 finishCheck.Reset();
2791 animation.SetLooping(true);
2793 application.SendNotification();
2794 float intervalSeconds = 0.1f;
2795 float progress = 0.4f;
2796 for(int iterations = 0; iterations < 10; ++iterations)
2798 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2800 progress += intervalSeconds;
2803 progress = progress - 0.4f;
2806 DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2809 // We didn't expect the animation to finish yet
2810 application.SendNotification();
2811 finishCheck.CheckSignalNotReceived();
2813 //Test change range on the fly
2814 animation.SetPlayRange(Vector2(0.2f, 0.9f));
2815 application.SendNotification();
2817 for(int iterations = 0; iterations < 10; ++iterations)
2819 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
2821 progress += intervalSeconds;
2824 progress = progress - 0.7f;
2827 DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
2833 int UtcDaliAnimationPlayFromP(void)
2835 TestApplication application;
2837 Actor actor = Actor::New();
2838 application.GetScene().Add(actor);
2840 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
2842 // Build the animation
2843 float durationSeconds(1.0f);
2844 Animation animation = Animation::New(durationSeconds);
2845 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2846 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2848 // Start the animation from 40% progress
2849 animation.PlayFrom(0.4f);
2851 // Target value should be updated straight away
2852 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2854 bool signalReceived(false);
2855 AnimationFinishCheck finishCheck(signalReceived);
2856 animation.FinishedSignal().Connect(&application, finishCheck);
2858 application.SendNotification();
2859 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
2861 // We didn't expect the animation to finish yet
2862 application.SendNotification();
2863 finishCheck.CheckSignalNotReceived();
2864 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
2866 animation.Play(); // Test that calling play has no effect, when animation is already playing
2867 application.SendNotification();
2868 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
2870 // We didn't expect the animation to finish yet
2871 application.SendNotification();
2872 finishCheck.CheckSignalNotReceived();
2873 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
2875 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
2876 // We did expect the animation to finish
2877 application.SendNotification();
2878 finishCheck.CheckSignalReceived();
2879 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2881 // Check that nothing has changed after a couple of buffer swaps
2882 application.Render(0);
2883 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2884 application.Render(0);
2885 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2889 int UtcDaliAnimationPlayFromN(void)
2891 TestApplication application;
2893 Actor actor = Actor::New();
2894 application.GetScene().Add(actor);
2896 // Build the animation
2897 float durationSeconds(1.0f);
2898 Animation animation = Animation::New(durationSeconds);
2899 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2900 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2902 //PlayFrom with an argument outside the range [0..1] will be ignored
2903 animation.PlayFrom(-1.0f);
2904 application.SendNotification();
2905 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2907 animation.PlayFrom(100.0f);
2908 application.SendNotification();
2909 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
2913 int UtcDaliAnimationPauseP(void)
2915 TestApplication application;
2917 Actor actor = Actor::New();
2918 application.GetScene().Add(actor);
2920 // Build the animation
2921 float durationSeconds(1.0f);
2922 Animation animation = Animation::New(durationSeconds);
2923 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2924 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2926 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2928 // Start the animation
2931 bool signalReceived(false);
2932 AnimationFinishCheck finishCheck(signalReceived);
2933 animation.FinishedSignal().Connect(&application, finishCheck);
2935 application.SendNotification();
2936 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
2938 // We didn't expect the animation to finish yet
2939 application.SendNotification();
2940 finishCheck.CheckSignalNotReceived();
2941 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
2943 // Pause the animation
2945 application.SendNotification();
2948 for(int i = 0; i < 5; ++i)
2950 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
2952 // We didn't expect the animation to finish yet
2953 application.SendNotification();
2954 finishCheck.CheckSignalNotReceived();
2955 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
2960 application.SendNotification();
2961 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
2963 // We didn't expect the animation to finish yet
2964 application.SendNotification();
2965 finishCheck.CheckSignalNotReceived();
2967 application.SendNotification();
2968 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
2970 // We did expect the animation to finish
2971 application.SendNotification();
2972 finishCheck.CheckSignalReceived();
2973 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
2975 // Check that nothing has changed after a couple of buffer swaps
2976 application.Render(0);
2977 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2978 application.Render(0);
2979 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
2983 int UtcDaliAnimationGetStateP(void)
2985 TestApplication application;
2987 Actor actor = Actor::New();
2988 application.GetScene().Add(actor);
2990 // Build the animation
2991 float durationSeconds(1.0f);
2992 Animation animation = Animation::New(durationSeconds);
2993 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2994 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2995 DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
2997 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2999 // Start the animation
3002 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
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(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3015 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3017 // Pause the animation
3019 DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3020 application.SendNotification();
3021 application.Render(0.f);
3024 for(int i = 0; i < 5; ++i)
3026 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3028 // We didn't expect the animation to finish yet
3029 application.SendNotification();
3030 finishCheck.CheckSignalNotReceived();
3031 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
3032 DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
3036 finishCheck.Reset();
3038 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3039 application.SendNotification();
3040 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3041 // We didn't expect the animation to finish yet
3042 application.SendNotification();
3043 finishCheck.CheckSignalNotReceived();
3044 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3046 application.SendNotification();
3047 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
3049 // We did expect the animation to finish
3050 application.SendNotification();
3051 finishCheck.CheckSignalReceived();
3052 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
3053 DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3055 // Check that nothing has changed after a couple of buffer swaps
3056 application.Render(0);
3057 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3058 application.Render(0);
3059 DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
3060 DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
3063 finishCheck.Reset();
3065 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3066 application.SendNotification();
3067 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
3068 application.SendNotification();
3069 finishCheck.CheckSignalNotReceived();
3070 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
3075 int UtcDaliAnimationStopP(void)
3077 TestApplication application;
3079 Actor actor = Actor::New();
3080 application.GetScene().Add(actor);
3082 // Build the animation
3083 float durationSeconds(1.0f);
3084 Animation animation = Animation::New(durationSeconds);
3085 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3086 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3088 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3090 // Start the animation
3093 bool signalReceived(false);
3094 AnimationFinishCheck finishCheck(signalReceived);
3095 animation.FinishedSignal().Connect(&application, finishCheck);
3097 application.SendNotification();
3098 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3100 // We didn't expect the animation to finish yet
3101 application.SendNotification();
3102 finishCheck.CheckSignalNotReceived();
3103 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3105 // Stop the animation
3107 application.SendNotification();
3110 for(int i = 0; i < 5; ++i)
3112 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3114 // We did expect the animation to finish
3115 application.SendNotification();
3116 finishCheck.CheckSignalReceived();
3117 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when stopped */, TEST_LOCATION);
3122 int UtcDaliAnimationStopSetPositionP(void)
3124 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
3125 // i.e. to check that the animation does not interfere with the position set.
3127 TestApplication application;
3129 Actor actor = Actor::New();
3130 application.GetScene().Add(actor);
3132 // Build the animation
3133 float durationSeconds(1.0f);
3134 Animation animation = Animation::New(durationSeconds);
3135 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3136 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3138 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3140 // Start the animation
3143 bool signalReceived(false);
3144 AnimationFinishCheck finishCheck(signalReceived);
3145 animation.FinishedSignal().Connect(&application, finishCheck);
3147 application.SendNotification();
3148 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3150 // We didn't expect the animation to finish yet
3151 application.SendNotification();
3152 finishCheck.CheckSignalNotReceived();
3153 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3155 // Stop the animation
3157 Vector3 positionSet(2.0f, 3.0f, 4.0f);
3158 actor.SetProperty(Actor::Property::POSITION, positionSet);
3159 application.SendNotification();
3162 for(int i = 0; i < 5; ++i)
3164 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
3166 // We did expect the animation to finish
3167 application.SendNotification();
3168 finishCheck.CheckSignalReceived();
3169 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), positionSet /*Animation should not interfere with this*/, TEST_LOCATION);
3174 int UtcDaliAnimationClearP(void)
3176 TestApplication application;
3178 Actor actor = Actor::New();
3179 application.GetScene().Add(actor);
3181 // Build the animation
3182 float durationSeconds(1.0f);
3183 Animation animation = Animation::New(durationSeconds);
3184 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3185 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3187 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3189 // Start the animation
3192 bool signalReceived(false);
3193 AnimationFinishCheck finishCheck(signalReceived);
3194 animation.FinishedSignal().Connect(&application, finishCheck);
3196 application.SendNotification();
3197 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3199 // We didn't expect the animation to finish yet
3200 application.SendNotification();
3201 finishCheck.CheckSignalNotReceived();
3202 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3204 // Clear the animation
3206 application.SendNotification();
3208 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3210 // We don't expect the animation to finish now
3211 application.SendNotification();
3212 finishCheck.CheckSignalNotReceived();
3213 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
3215 // Restart as a scale animation; this should not move the actor's position
3216 finishCheck.Reset();
3217 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
3218 Vector3 targetScale(3.0f, 3.0f, 3.0f);
3219 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
3222 application.SendNotification();
3223 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3225 // We didn't expect the animation to finish yet
3226 application.SendNotification();
3227 finishCheck.CheckSignalNotReceived();
3228 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3229 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
3231 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3233 // We did expect the animation to finish
3234 application.SendNotification();
3235 finishCheck.CheckSignalReceived();
3236 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3237 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
3241 int UtcDaliAnimationFinishedSignalP(void)
3243 TestApplication application;
3245 // Start the empty animation
3246 float durationSeconds(1.0f);
3247 Animation animation = Animation::New(durationSeconds);
3250 bool signalReceived(false);
3251 AnimationFinishCheck finishCheck(signalReceived);
3252 animation.FinishedSignal().Connect(&application, finishCheck);
3254 application.SendNotification();
3255 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
3257 // We did expect the animation to finish
3258 application.SendNotification();
3259 finishCheck.CheckSignalReceived();
3263 int UtcDaliAnimationAnimateByBooleanP(void)
3265 TestApplication application;
3267 Actor actor = Actor::New();
3269 // Register a boolean property
3270 bool startValue(false);
3271 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3272 application.GetScene().Add(actor);
3273 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3274 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3276 // Build the animation
3277 float durationSeconds(2.0f);
3278 Animation animation = Animation::New(durationSeconds);
3279 const bool relativeValue(true);
3280 const bool finalValue(false || relativeValue);
3281 animation.AnimateBy(Property(actor, index), relativeValue);
3283 // Start the animation
3286 // Target value should be retrievable straight away
3287 DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
3289 bool signalReceived(false);
3290 AnimationFinishCheck finishCheck(signalReceived);
3291 animation.FinishedSignal().Connect(&application, finishCheck);
3293 application.SendNotification();
3294 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3296 // We didn't expect the animation to finish yet
3297 application.SendNotification();
3298 finishCheck.CheckSignalNotReceived();
3299 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3301 application.SendNotification();
3302 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3304 // We did expect the animation to finish
3305 application.SendNotification();
3306 finishCheck.CheckSignalReceived();
3307 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3309 // Check that nothing has changed after a couple of buffer swaps
3310 application.Render(0);
3311 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3312 application.Render(0);
3313 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3315 // Repeat with relative value "false" - this should be an NOOP
3316 animation = Animation::New(durationSeconds);
3317 bool noOpValue(false);
3318 animation.AnimateBy(Property(actor, index), noOpValue);
3320 // Start the animation
3323 finishCheck.Reset();
3324 animation.FinishedSignal().Connect(&application, finishCheck);
3326 application.SendNotification();
3327 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3329 // We didn't expect the animation to finish yet
3330 application.SendNotification();
3331 finishCheck.CheckSignalNotReceived();
3332 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3334 application.SendNotification();
3335 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3337 // We did expect the animation to finish
3338 application.SendNotification();
3339 finishCheck.CheckSignalReceived();
3340 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3342 // Check that nothing has changed after a couple of buffer swaps
3343 application.Render(0);
3344 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3345 application.Render(0);
3346 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3350 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3352 TestApplication application;
3354 Actor actor = Actor::New();
3356 // Register a boolean property
3357 bool startValue(false);
3358 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3359 application.GetScene().Add(actor);
3360 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3361 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3363 // Build the animation
3364 float durationSeconds(2.0f);
3365 Animation animation = Animation::New(durationSeconds);
3366 bool relativeValue(true);
3367 bool finalValue(false || relativeValue);
3368 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3370 // Start the animation
3373 bool signalReceived(false);
3374 AnimationFinishCheck finishCheck(signalReceived);
3375 animation.FinishedSignal().Connect(&application, finishCheck);
3377 application.SendNotification();
3378 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3380 // We didn't expect the animation to finish yet
3381 application.SendNotification();
3382 finishCheck.CheckSignalNotReceived();
3383 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3385 application.SendNotification();
3386 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3388 // We did expect the animation to finish
3389 application.SendNotification();
3390 finishCheck.CheckSignalReceived();
3391 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3393 // Check that nothing has changed after a couple of buffer swaps
3394 application.Render(0);
3395 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3396 application.Render(0);
3397 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3399 // Repeat with relative value "false" - this should be an NOOP
3400 animation = Animation::New(durationSeconds);
3401 bool noOpValue(false);
3402 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3404 // Start the animation
3407 finishCheck.Reset();
3408 animation.FinishedSignal().Connect(&application, finishCheck);
3410 application.SendNotification();
3411 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3413 // We didn't expect the animation to finish yet
3414 application.SendNotification();
3415 finishCheck.CheckSignalNotReceived();
3416 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3418 application.SendNotification();
3419 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3421 // We did expect the animation to finish
3422 application.SendNotification();
3423 finishCheck.CheckSignalReceived();
3424 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3428 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3430 TestApplication application;
3432 Actor actor = Actor::New();
3434 // Register a boolean property
3435 bool startValue(false);
3436 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3437 application.GetScene().Add(actor);
3438 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3439 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3441 // Build the animation
3442 float durationSeconds(2.0f);
3443 Animation animation = Animation::New(durationSeconds);
3444 bool relativeValue(true);
3445 bool finalValue(false || relativeValue);
3446 float animatorDurationSeconds(durationSeconds * 0.5f);
3447 animation.AnimateBy(Property(actor, index),
3449 TimePeriod(animatorDurationSeconds));
3451 // Start the animation
3454 bool signalReceived(false);
3455 AnimationFinishCheck finishCheck(signalReceived);
3456 animation.FinishedSignal().Connect(&application, finishCheck);
3458 application.SendNotification();
3459 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3461 // We didn't expect the animation to finish yet
3462 application.SendNotification();
3463 finishCheck.CheckSignalNotReceived();
3464 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3466 application.SendNotification();
3467 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3469 // We didn't expect the animation to finish yet...
3470 application.SendNotification();
3471 finishCheck.CheckSignalNotReceived();
3473 // ...however we should have reached the final value
3474 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3476 application.SendNotification();
3477 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3479 // We did expect the animation to finish
3480 application.SendNotification();
3481 finishCheck.CheckSignalReceived();
3482 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3484 // Check that nothing has changed after a couple of buffer swaps
3485 application.Render(0);
3486 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3487 application.Render(0);
3488 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3492 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3494 TestApplication application;
3496 Actor actor = Actor::New();
3498 // Register a boolean property
3499 bool startValue(false);
3500 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3501 application.GetScene().Add(actor);
3502 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3503 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3505 // Build the animation
3506 float durationSeconds(2.0f);
3507 Animation animation = Animation::New(durationSeconds);
3508 bool relativeValue(true);
3509 bool finalValue(false || relativeValue);
3510 float animatorDurationSeconds(durationSeconds * 0.5f);
3511 animation.AnimateBy(Property(actor, index),
3513 AlphaFunction::EASE_IN_OUT,
3514 TimePeriod(animatorDurationSeconds));
3516 // Start the animation
3519 bool signalReceived(false);
3520 AnimationFinishCheck finishCheck(signalReceived);
3521 animation.FinishedSignal().Connect(&application, finishCheck);
3523 application.SendNotification();
3524 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3526 // We didn't expect the animation to finish yet
3527 application.SendNotification();
3528 finishCheck.CheckSignalNotReceived();
3529 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3531 application.SendNotification();
3532 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3534 // We didn't expect the animation to finish yet...
3535 application.SendNotification();
3536 finishCheck.CheckSignalNotReceived();
3538 // ...however we should have reached the final value
3539 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3541 application.SendNotification();
3542 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3544 // We did expect the animation to finish
3545 application.SendNotification();
3546 finishCheck.CheckSignalReceived();
3547 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3549 // Check that nothing has changed after a couple of buffer swaps
3550 application.Render(0);
3551 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3552 application.Render(0);
3553 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3557 int UtcDaliAnimationAnimateByFloatP(void)
3559 TestApplication application;
3561 Actor actor = Actor::New();
3563 // Register a float property
3564 float startValue(10.0f);
3565 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3566 application.GetScene().Add(actor);
3567 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3568 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3570 // Build the animation
3571 float durationSeconds(2.0f);
3572 Animation animation = Animation::New(durationSeconds);
3573 float targetValue(50.0f);
3574 float relativeValue(targetValue - startValue);
3575 animation.AnimateBy(Property(actor, index), relativeValue);
3577 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3579 // Start the animation
3582 // Target value should be retrievable straight away
3583 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
3585 bool signalReceived(false);
3586 AnimationFinishCheck finishCheck(signalReceived);
3587 animation.FinishedSignal().Connect(&application, finishCheck);
3589 application.SendNotification();
3590 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3592 // We didn't expect the animation to finish yet
3593 application.SendNotification();
3594 finishCheck.CheckSignalNotReceived();
3595 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
3597 application.SendNotification();
3598 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3600 // We did expect the animation to finish
3601 application.SendNotification();
3602 finishCheck.CheckSignalReceived();
3603 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3605 // Check that nothing has changed after a couple of buffer swaps
3606 application.Render(0);
3607 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3608 application.Render(0);
3609 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3613 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3615 TestApplication application;
3617 Actor actor = Actor::New();
3619 // Register a float property
3620 float startValue(10.0f);
3621 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3622 application.GetScene().Add(actor);
3623 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3624 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3626 // Build the animation
3627 float durationSeconds(1.0f);
3628 Animation animation = Animation::New(durationSeconds);
3629 float targetValue(90.0f);
3630 float relativeValue(targetValue - startValue);
3631 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3633 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3635 // Start the animation
3638 bool signalReceived(false);
3639 AnimationFinishCheck finishCheck(signalReceived);
3640 animation.FinishedSignal().Connect(&application, finishCheck);
3642 application.SendNotification();
3643 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3645 // We didn't expect the animation to finish yet
3646 application.SendNotification();
3647 finishCheck.CheckSignalNotReceived();
3649 // The position should have moved more, than with a linear alpha function
3650 float current(actor.GetCurrentProperty<float>(index));
3651 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3653 application.SendNotification();
3654 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3656 // We did expect the animation to finish
3657 application.SendNotification();
3658 finishCheck.CheckSignalReceived();
3659 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3661 // Check that nothing has changed after a couple of buffer swaps
3662 application.Render(0);
3663 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3664 application.Render(0);
3665 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3669 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3671 TestApplication application;
3673 Actor actor = Actor::New();
3675 // Register a float property
3676 float startValue(10.0f);
3677 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3678 application.GetScene().Add(actor);
3679 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3680 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3682 // Build the animation
3683 float durationSeconds(1.0f);
3684 Animation animation = Animation::New(durationSeconds);
3685 float targetValue(30.0f);
3686 float relativeValue(targetValue - startValue);
3688 animation.AnimateBy(Property(actor, index),
3690 TimePeriod(delay, durationSeconds - delay));
3692 // Start the animation
3695 bool signalReceived(false);
3696 AnimationFinishCheck finishCheck(signalReceived);
3697 animation.FinishedSignal().Connect(&application, finishCheck);
3699 application.SendNotification();
3700 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3702 // We didn't expect the animation to finish yet
3703 application.SendNotification();
3704 finishCheck.CheckSignalNotReceived();
3705 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3707 application.SendNotification();
3708 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3710 // We didn't expect the animation to finish yet
3711 application.SendNotification();
3712 finishCheck.CheckSignalNotReceived();
3713 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3715 application.SendNotification();
3716 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3718 // We did expect the animation to finish
3719 application.SendNotification();
3720 finishCheck.CheckSignalReceived();
3721 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3723 // Check that nothing has changed after a couple of buffer swaps
3724 application.Render(0);
3725 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3726 application.Render(0);
3727 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3731 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3733 TestApplication application;
3735 Actor actor = Actor::New();
3737 // Register a float property
3738 float startValue(10.0f);
3739 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3740 application.GetScene().Add(actor);
3741 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3742 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3744 // Build the animation
3745 float durationSeconds(1.0f);
3746 Animation animation = Animation::New(durationSeconds);
3747 float targetValue(30.0f);
3748 float relativeValue(targetValue - startValue);
3750 animation.AnimateBy(Property(actor, index),
3752 AlphaFunction::LINEAR,
3753 TimePeriod(delay, durationSeconds - delay));
3755 // Start the animation
3758 bool signalReceived(false);
3759 AnimationFinishCheck finishCheck(signalReceived);
3760 animation.FinishedSignal().Connect(&application, finishCheck);
3762 application.SendNotification();
3763 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3765 // We didn't expect the animation to finish yet
3766 application.SendNotification();
3767 finishCheck.CheckSignalNotReceived();
3768 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3770 application.SendNotification();
3771 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3773 // We didn't expect the animation to finish yet
3774 application.SendNotification();
3775 finishCheck.CheckSignalNotReceived();
3776 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3778 application.SendNotification();
3779 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3781 // We did expect the animation to finish
3782 application.SendNotification();
3783 finishCheck.CheckSignalReceived();
3784 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3786 // Check that nothing has changed after a couple of buffer swaps
3787 application.Render(0);
3788 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3789 application.Render(0);
3790 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3794 int UtcDaliAnimationAnimateByIntegerP(void)
3796 TestApplication application;
3798 Actor actor = Actor::New();
3800 // Register an integer property
3802 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3803 application.GetScene().Add(actor);
3804 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3805 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3807 // Build the animation
3808 float durationSeconds(2.0f);
3809 Animation animation = Animation::New(durationSeconds);
3810 int targetValue(50);
3811 int relativeValue(targetValue - startValue);
3812 animation.AnimateBy(Property(actor, index), relativeValue);
3814 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3816 // Start the animation
3819 // Target value should be retrievable straight away
3820 DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
3822 bool signalReceived(false);
3823 AnimationFinishCheck finishCheck(signalReceived);
3824 animation.FinishedSignal().Connect(&application, finishCheck);
3826 application.SendNotification();
3827 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3829 // We didn't expect the animation to finish yet
3830 application.SendNotification();
3831 finishCheck.CheckSignalNotReceived();
3832 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
3834 application.SendNotification();
3835 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3837 // We did expect the animation to finish
3838 application.SendNotification();
3839 finishCheck.CheckSignalReceived();
3840 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3842 // Check that nothing has changed after a couple of buffer swaps
3843 application.Render(0);
3844 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3845 application.Render(0);
3846 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3850 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3852 TestApplication application;
3854 Actor actor = Actor::New();
3856 // Register an integer property
3858 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3859 application.GetScene().Add(actor);
3860 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3861 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3863 // Build the animation
3864 float durationSeconds(1.0f);
3865 Animation animation = Animation::New(durationSeconds);
3866 int targetValue(90);
3867 int relativeValue(targetValue - startValue);
3868 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3870 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3872 // Start the animation
3875 bool signalReceived(false);
3876 AnimationFinishCheck finishCheck(signalReceived);
3877 animation.FinishedSignal().Connect(&application, finishCheck);
3879 application.SendNotification();
3880 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3882 // We didn't expect the animation to finish yet
3883 application.SendNotification();
3884 finishCheck.CheckSignalNotReceived();
3886 // The position should have moved more, than with a linear alpha function
3887 int current(actor.GetCurrentProperty<int>(index));
3888 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3890 application.SendNotification();
3891 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3893 // We did expect the animation to finish
3894 application.SendNotification();
3895 finishCheck.CheckSignalReceived();
3896 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3898 // Check that nothing has changed after a couple of buffer swaps
3899 application.Render(0);
3900 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3901 application.Render(0);
3902 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3906 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3908 TestApplication application;
3910 Actor actor = Actor::New();
3912 // Register an integer property
3914 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3915 application.GetScene().Add(actor);
3916 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3917 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3919 // Build the animation
3920 float durationSeconds(1.0f);
3921 Animation animation = Animation::New(durationSeconds);
3922 int targetValue(30);
3923 int relativeValue(targetValue - startValue);
3925 animation.AnimateBy(Property(actor, index),
3927 TimePeriod(delay, durationSeconds - delay));
3929 // Start the animation
3932 bool signalReceived(false);
3933 AnimationFinishCheck finishCheck(signalReceived);
3934 animation.FinishedSignal().Connect(&application, finishCheck);
3936 application.SendNotification();
3937 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3939 // We didn't expect the animation to finish yet
3940 application.SendNotification();
3941 finishCheck.CheckSignalNotReceived();
3942 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3944 application.SendNotification();
3945 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3947 // We didn't expect the animation to finish yet
3948 application.SendNotification();
3949 finishCheck.CheckSignalNotReceived();
3950 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
3952 application.SendNotification();
3953 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3955 // We did expect the animation to finish
3956 application.SendNotification();
3957 finishCheck.CheckSignalReceived();
3958 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3960 // Check that nothing has changed after a couple of buffer swaps
3961 application.Render(0);
3962 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3963 application.Render(0);
3964 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
3968 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3970 TestApplication application;
3972 Actor actor = Actor::New();
3974 // Register an integer property
3976 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3977 application.GetScene().Add(actor);
3978 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3979 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3981 // Build the animation
3982 float durationSeconds(1.0f);
3983 Animation animation = Animation::New(durationSeconds);
3984 int targetValue(30);
3985 int relativeValue(targetValue - startValue);
3987 animation.AnimateBy(Property(actor, index),
3989 AlphaFunction::LINEAR,
3990 TimePeriod(delay, durationSeconds - delay));
3992 // Start the animation
3995 bool signalReceived(false);
3996 AnimationFinishCheck finishCheck(signalReceived);
3997 animation.FinishedSignal().Connect(&application, finishCheck);
3999 application.SendNotification();
4000 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4002 // We didn't expect the animation to finish yet
4003 application.SendNotification();
4004 finishCheck.CheckSignalNotReceived();
4005 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4007 application.SendNotification();
4008 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4010 // We didn't expect the animation to finish yet
4011 application.SendNotification();
4012 finishCheck.CheckSignalNotReceived();
4013 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
4015 application.SendNotification();
4016 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4018 // We did expect the animation to finish
4019 application.SendNotification();
4020 finishCheck.CheckSignalReceived();
4021 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4023 // Check that nothing has changed after a couple of buffer swaps
4024 application.Render(0);
4025 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4026 application.Render(0);
4027 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4031 int UtcDaliAnimationAnimateByQuaternionP(void)
4033 TestApplication application;
4035 Actor actor = Actor::New();
4037 // Register a quaternion property
4038 const Quaternion startValue(Degree(90), Vector3::XAXIS);
4039 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4040 application.GetScene().Add(actor);
4041 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4042 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4044 // Build the animation
4045 float durationSeconds(2.0f);
4046 Animation animation = Animation::New(durationSeconds);
4047 const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
4048 const Quaternion finalValue(startValue * relativeValue);
4049 animation.AnimateBy(Property(actor, index), relativeValue);
4051 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4052 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4054 // Start the animation
4057 // Target value should be retrievable straight away
4058 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4060 application.SendNotification();
4061 application.Render(2000); // animation complete
4063 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4064 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
4069 int UtcDaliAnimationAnimateByVector2P(void)
4071 TestApplication application;
4073 Actor actor = Actor::New();
4075 // Register a Vector2 property
4076 Vector2 startValue(10.0f, 10.0f);
4077 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4078 application.GetScene().Add(actor);
4079 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4080 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4082 // Build the animation
4083 float durationSeconds(2.0f);
4084 Animation animation = Animation::New(durationSeconds);
4085 Vector2 targetValue(60.0f, 60.0f);
4086 Vector2 relativeValue(targetValue - startValue);
4087 animation.AnimateBy(Property(actor, index), relativeValue);
4089 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4091 // Start the animation
4094 // Target value should be retrievable straight away
4095 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
4097 bool signalReceived(false);
4098 AnimationFinishCheck finishCheck(signalReceived);
4099 animation.FinishedSignal().Connect(&application, finishCheck);
4101 application.SendNotification();
4102 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4104 // We didn't expect the animation to finish yet
4105 application.SendNotification();
4106 finishCheck.CheckSignalNotReceived();
4107 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
4109 application.SendNotification();
4110 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4112 // We did expect the animation to finish
4113 application.SendNotification();
4114 finishCheck.CheckSignalReceived();
4115 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4117 // Check that nothing has changed after a couple of buffer swaps
4118 application.Render(0);
4119 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4120 application.Render(0);
4121 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4125 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
4127 TestApplication application;
4129 Actor actor = Actor::New();
4131 // Register a Vector2 property
4132 Vector2 startValue(100.0f, 100.0f);
4133 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4134 application.GetScene().Add(actor);
4135 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4136 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4138 // Build the animation
4139 float durationSeconds(1.0f);
4140 Animation animation = Animation::New(durationSeconds);
4141 Vector2 targetValue(20.0f, 20.0f);
4142 Vector2 relativeValue(targetValue - startValue);
4143 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4145 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4147 // Start the animation
4150 bool signalReceived(false);
4151 AnimationFinishCheck finishCheck(signalReceived);
4152 animation.FinishedSignal().Connect(&application, finishCheck);
4154 application.SendNotification();
4155 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4157 // We didn't expect the animation to finish yet
4158 application.SendNotification();
4159 finishCheck.CheckSignalNotReceived();
4161 // The position should have moved more, than with a linear alpha function
4162 Vector2 current(actor.GetCurrentProperty<Vector2>(index));
4163 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4164 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4166 application.SendNotification();
4167 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4169 // We did expect the animation to finish
4170 application.SendNotification();
4171 finishCheck.CheckSignalReceived();
4172 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4174 // Check that nothing has changed after a couple of buffer swaps
4175 application.Render(0);
4176 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4177 application.Render(0);
4178 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4182 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4184 TestApplication application;
4186 Actor actor = Actor::New();
4188 // Register a Vector2 property
4189 Vector2 startValue(10.0f, 10.0f);
4190 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4191 application.GetScene().Add(actor);
4192 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4193 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4195 // Build the animation
4196 float durationSeconds(1.0f);
4197 Animation animation = Animation::New(durationSeconds);
4198 Vector2 targetValue(30.0f, 30.0f);
4199 Vector2 relativeValue(targetValue - startValue);
4201 animation.AnimateBy(Property(actor, index),
4203 TimePeriod(delay, durationSeconds - delay));
4205 // Start the animation
4208 bool signalReceived(false);
4209 AnimationFinishCheck finishCheck(signalReceived);
4210 animation.FinishedSignal().Connect(&application, finishCheck);
4212 application.SendNotification();
4213 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4215 // We didn't expect the animation to finish yet
4216 application.SendNotification();
4217 finishCheck.CheckSignalNotReceived();
4218 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4220 application.SendNotification();
4221 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4223 // We didn't expect the animation to finish yet
4224 application.SendNotification();
4225 finishCheck.CheckSignalNotReceived();
4226 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4228 application.SendNotification();
4229 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4231 // We did expect the animation to finish
4232 application.SendNotification();
4233 finishCheck.CheckSignalReceived();
4234 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4236 // Check that nothing has changed after a couple of buffer swaps
4237 application.Render(0);
4238 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4239 application.Render(0);
4240 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4244 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4246 TestApplication application;
4248 Actor actor = Actor::New();
4250 // Register a Vector2 property
4251 Vector2 startValue(5.0f, 5.0f);
4252 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4253 application.GetScene().Add(actor);
4254 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4255 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4257 // Build the animation
4258 float durationSeconds(1.0f);
4259 Animation animation = Animation::New(durationSeconds);
4260 Vector2 targetValue(10.0f, 10.0f);
4261 Vector2 relativeValue(targetValue - startValue);
4263 animation.AnimateBy(Property(actor, index),
4265 AlphaFunction::LINEAR,
4266 TimePeriod(delay, durationSeconds - delay));
4268 // Start the animation
4271 bool signalReceived(false);
4272 AnimationFinishCheck finishCheck(signalReceived);
4273 animation.FinishedSignal().Connect(&application, finishCheck);
4275 application.SendNotification();
4276 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4278 // We didn't expect the animation to finish yet
4279 application.SendNotification();
4280 finishCheck.CheckSignalNotReceived();
4281 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4283 application.SendNotification();
4284 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4286 // We didn't expect the animation to finish yet
4287 application.SendNotification();
4288 finishCheck.CheckSignalNotReceived();
4289 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4291 application.SendNotification();
4292 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4294 // We did expect the animation to finish
4295 application.SendNotification();
4296 finishCheck.CheckSignalReceived();
4297 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4299 // Check that nothing has changed after a couple of buffer swaps
4300 application.Render(0);
4301 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4302 application.Render(0);
4303 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4307 int UtcDaliAnimationAnimateByVector3P(void)
4309 TestApplication application;
4311 Actor actor = Actor::New();
4313 // Register a Vector3 property
4314 Vector3 startValue(10.0f, 10.0f, 10.0f);
4315 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4316 application.GetScene().Add(actor);
4317 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4318 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4320 // Build the animation
4321 float durationSeconds(2.0f);
4322 Animation animation = Animation::New(durationSeconds);
4323 Vector3 targetValue(60.0f, 60.0f, 60.0f);
4324 Vector3 relativeValue(targetValue - startValue);
4325 animation.AnimateBy(Property(actor, index), relativeValue);
4327 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4329 // Start the animation
4332 // Target value should be retrievable straight away
4333 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
4335 bool signalReceived(false);
4336 AnimationFinishCheck finishCheck(signalReceived);
4337 animation.FinishedSignal().Connect(&application, finishCheck);
4339 application.SendNotification();
4340 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4342 // We didn't expect the animation to finish yet
4343 application.SendNotification();
4344 finishCheck.CheckSignalNotReceived();
4345 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
4347 application.SendNotification();
4348 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4350 // We did expect the animation to finish
4351 application.SendNotification();
4352 finishCheck.CheckSignalReceived();
4353 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4355 // Check that nothing has changed after a couple of buffer swaps
4356 application.Render(0);
4357 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4358 application.Render(0);
4359 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4363 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4365 TestApplication application;
4367 Actor actor = Actor::New();
4369 // Register a Vector3 property
4370 Vector3 startValue(100.0f, 100.0f, 100.0f);
4371 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4372 application.GetScene().Add(actor);
4373 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4374 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4376 // Build the animation
4377 float durationSeconds(1.0f);
4378 Animation animation = Animation::New(durationSeconds);
4379 Vector3 targetValue(20.0f, 20.0f, 20.0f);
4380 Vector3 relativeValue(targetValue - startValue);
4381 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4383 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4385 // Start the animation
4388 bool signalReceived(false);
4389 AnimationFinishCheck finishCheck(signalReceived);
4390 animation.FinishedSignal().Connect(&application, finishCheck);
4392 application.SendNotification();
4393 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4395 // We didn't expect the animation to finish yet
4396 application.SendNotification();
4397 finishCheck.CheckSignalNotReceived();
4399 // The position should have moved more, than with a linear alpha function
4400 Vector3 current(actor.GetCurrentProperty<Vector3>(index));
4401 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4402 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4403 DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4405 application.SendNotification();
4406 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4408 // We did expect the animation to finish
4409 application.SendNotification();
4410 finishCheck.CheckSignalReceived();
4411 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4413 // Check that nothing has changed after a couple of buffer swaps
4414 application.Render(0);
4415 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4416 application.Render(0);
4417 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4421 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4423 TestApplication application;
4425 Actor actor = Actor::New();
4427 // Register a Vector3 property
4428 Vector3 startValue(10.0f, 10.0f, 10.0f);
4429 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4430 application.GetScene().Add(actor);
4431 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4432 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4434 // Build the animation
4435 float durationSeconds(1.0f);
4436 Animation animation = Animation::New(durationSeconds);
4437 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4438 Vector3 relativeValue(targetValue - startValue);
4440 animation.AnimateBy(Property(actor, index),
4442 TimePeriod(delay, durationSeconds - delay));
4444 // Start the animation
4447 bool signalReceived(false);
4448 AnimationFinishCheck finishCheck(signalReceived);
4449 animation.FinishedSignal().Connect(&application, finishCheck);
4451 application.SendNotification();
4452 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4454 // We didn't expect the animation to finish yet
4455 application.SendNotification();
4456 finishCheck.CheckSignalNotReceived();
4457 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4459 application.SendNotification();
4460 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4462 // We didn't expect the animation to finish yet
4463 application.SendNotification();
4464 finishCheck.CheckSignalNotReceived();
4465 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4467 application.SendNotification();
4468 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4470 // We did expect the animation to finish
4471 application.SendNotification();
4472 finishCheck.CheckSignalReceived();
4473 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4475 // Check that nothing has changed after a couple of buffer swaps
4476 application.Render(0);
4477 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4478 application.Render(0);
4479 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4483 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4485 TestApplication application;
4487 Actor actor = Actor::New();
4489 // Register a Vector3 property
4490 Vector3 startValue(5.0f, 5.0f, 5.0f);
4491 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4492 application.GetScene().Add(actor);
4493 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4494 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4496 // Build the animation
4497 float durationSeconds(1.0f);
4498 Animation animation = Animation::New(durationSeconds);
4499 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4500 Vector3 relativeValue(targetValue - startValue);
4502 animation.AnimateBy(Property(actor, index),
4504 AlphaFunction::LINEAR,
4505 TimePeriod(delay, durationSeconds - delay));
4507 // Start the animation
4510 bool signalReceived(false);
4511 AnimationFinishCheck finishCheck(signalReceived);
4512 animation.FinishedSignal().Connect(&application, finishCheck);
4514 application.SendNotification();
4515 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4517 // We didn't expect the animation to finish yet
4518 application.SendNotification();
4519 finishCheck.CheckSignalNotReceived();
4520 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4522 application.SendNotification();
4523 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4525 // We didn't expect the animation to finish yet
4526 application.SendNotification();
4527 finishCheck.CheckSignalNotReceived();
4528 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4530 application.SendNotification();
4531 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4533 // We did expect the animation to finish
4534 application.SendNotification();
4535 finishCheck.CheckSignalReceived();
4536 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4538 // Check that nothing has changed after a couple of buffer swaps
4539 application.Render(0);
4540 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4541 application.Render(0);
4542 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4546 int UtcDaliAnimationAnimateByVector4P(void)
4548 TestApplication application;
4550 Actor actor = Actor::New();
4552 // Register a Vector4 property
4553 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4554 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4555 application.GetScene().Add(actor);
4556 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4557 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4559 // Build the animation
4560 float durationSeconds(2.0f);
4561 Animation animation = Animation::New(durationSeconds);
4562 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4563 Vector4 relativeValue(targetValue - startValue);
4564 animation.AnimateBy(Property(actor, index), relativeValue);
4566 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4568 // Start the animation
4571 // Target value should be retrievable straight away
4572 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
4574 bool signalReceived(false);
4575 AnimationFinishCheck finishCheck(signalReceived);
4576 animation.FinishedSignal().Connect(&application, finishCheck);
4578 application.SendNotification();
4579 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4581 // We didn't expect the animation to finish yet
4582 application.SendNotification();
4583 finishCheck.CheckSignalNotReceived();
4584 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
4586 application.SendNotification();
4587 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4589 // We did expect the animation to finish
4590 application.SendNotification();
4591 finishCheck.CheckSignalReceived();
4592 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4594 // Check that nothing has changed after a couple of buffer swaps
4595 application.Render(0);
4596 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4597 application.Render(0);
4598 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4602 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4604 TestApplication application;
4606 Actor actor = Actor::New();
4608 // Register a Vector4 property
4609 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4610 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4611 application.GetScene().Add(actor);
4612 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4613 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4615 // Build the animation
4616 float durationSeconds(1.0f);
4617 Animation animation = Animation::New(durationSeconds);
4618 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4619 Vector4 relativeValue(targetValue - startValue);
4620 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4622 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4624 // Start the animation
4627 bool signalReceived(false);
4628 AnimationFinishCheck finishCheck(signalReceived);
4629 animation.FinishedSignal().Connect(&application, finishCheck);
4631 application.SendNotification();
4632 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4634 // We didn't expect the animation to finish yet
4635 application.SendNotification();
4636 finishCheck.CheckSignalNotReceived();
4638 // The position should have moved more, than with a linear alpha function
4639 Vector4 current(actor.GetCurrentProperty<Vector4>(index));
4640 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4641 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4642 DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4643 DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
4645 application.SendNotification();
4646 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4648 // We did expect the animation to finish
4649 application.SendNotification();
4650 finishCheck.CheckSignalReceived();
4651 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4653 // Check that nothing has changed after a couple of buffer swaps
4654 application.Render(0);
4655 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4656 application.Render(0);
4657 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4661 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4663 TestApplication application;
4665 Actor actor = Actor::New();
4667 // Register a Vector4 property
4668 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4669 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4670 application.GetScene().Add(actor);
4671 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4672 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4674 // Build the animation
4675 float durationSeconds(1.0f);
4676 Animation animation = Animation::New(durationSeconds);
4677 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4678 Vector4 relativeValue(targetValue - startValue);
4680 animation.AnimateBy(Property(actor, index),
4682 TimePeriod(delay, durationSeconds - delay));
4684 // Start the animation
4687 bool signalReceived(false);
4688 AnimationFinishCheck finishCheck(signalReceived);
4689 animation.FinishedSignal().Connect(&application, finishCheck);
4691 application.SendNotification();
4692 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4694 // We didn't expect the animation to finish yet
4695 application.SendNotification();
4696 finishCheck.CheckSignalNotReceived();
4697 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4699 application.SendNotification();
4700 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4702 // We didn't expect the animation to finish yet
4703 application.SendNotification();
4704 finishCheck.CheckSignalNotReceived();
4705 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4707 application.SendNotification();
4708 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4710 // We did expect the animation to finish
4711 application.SendNotification();
4712 finishCheck.CheckSignalReceived();
4713 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4715 // Check that nothing has changed after a couple of buffer swaps
4716 application.Render(0);
4717 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4718 application.Render(0);
4719 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4723 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4725 TestApplication application;
4727 Actor actor = Actor::New();
4729 // Register a Vector4 property
4730 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4731 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4732 application.GetScene().Add(actor);
4733 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4734 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4736 // Build the animation
4737 float durationSeconds(1.0f);
4738 Animation animation = Animation::New(durationSeconds);
4739 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4740 Vector4 relativeValue(targetValue - startValue);
4742 animation.AnimateBy(Property(actor, index),
4744 AlphaFunction::LINEAR,
4745 TimePeriod(delay, durationSeconds - delay));
4747 // Start the animation
4750 bool signalReceived(false);
4751 AnimationFinishCheck finishCheck(signalReceived);
4752 animation.FinishedSignal().Connect(&application, finishCheck);
4754 application.SendNotification();
4755 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4757 // We didn't expect the animation to finish yet
4758 application.SendNotification();
4759 finishCheck.CheckSignalNotReceived();
4760 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4762 application.SendNotification();
4763 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4765 // We didn't expect the animation to finish yet
4766 application.SendNotification();
4767 finishCheck.CheckSignalNotReceived();
4768 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4770 application.SendNotification();
4771 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4773 // We did expect the animation to finish
4774 application.SendNotification();
4775 finishCheck.CheckSignalReceived();
4776 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4778 // Check that nothing has changed after a couple of buffer swaps
4779 application.Render(0);
4780 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4781 application.Render(0);
4782 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4786 int UtcDaliAnimationAnimateByActorPositionP(void)
4788 TestApplication application;
4790 Actor actor = Actor::New();
4791 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4792 actor.SetProperty(Actor::Property::POSITION, startPosition);
4793 application.GetScene().Add(actor);
4794 application.SendNotification();
4795 application.Render(0);
4796 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4798 // Build the animation
4799 float durationSeconds(1.0f);
4800 Animation animation = Animation::New(durationSeconds);
4801 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4802 Vector3 relativePosition(targetPosition - startPosition);
4803 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4805 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4807 // Start the animation
4810 // Target value should be retrievable straight away
4811 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4813 bool signalReceived(false);
4814 AnimationFinishCheck finishCheck(signalReceived);
4815 animation.FinishedSignal().Connect(&application, finishCheck);
4817 application.SendNotification();
4818 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4820 // We didn't expect the animation to finish yet
4821 application.SendNotification();
4822 finishCheck.CheckSignalNotReceived();
4823 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
4825 application.SendNotification();
4826 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4828 // We did expect the animation to finish
4829 application.SendNotification();
4830 finishCheck.CheckSignalReceived();
4831 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4833 // Check that nothing has changed after a couple of buffer swaps
4834 application.Render(0);
4835 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4836 application.Render(0);
4837 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4841 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4843 TestApplication application;
4845 Actor actor = Actor::New();
4846 application.GetScene().Add(actor);
4847 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4849 // Build the animation
4850 float durationSeconds(1.0f);
4851 Animation animation = Animation::New(durationSeconds);
4852 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4853 Vector3 relativePosition(targetPosition - Vector3::ZERO);
4854 animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
4855 animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
4856 animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
4858 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4859 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
4861 // Start the animation
4864 // Target value should be retrievable straight away
4865 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4866 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
4867 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
4868 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
4870 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
4872 application.SendNotification();
4873 application.Render(1000); // 1 second progress
4875 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4880 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4882 TestApplication application;
4884 Actor actor = Actor::New();
4885 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4886 actor.SetProperty(Actor::Property::POSITION, startPosition);
4887 application.GetScene().Add(actor);
4888 application.SendNotification();
4889 application.Render(0);
4890 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4892 // Build the animation
4893 float durationSeconds(1.0f);
4894 Animation animation = Animation::New(durationSeconds);
4895 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4896 Vector3 relativePosition(targetPosition - startPosition);
4897 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4899 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4901 // Start the animation
4904 bool signalReceived(false);
4905 AnimationFinishCheck finishCheck(signalReceived);
4906 animation.FinishedSignal().Connect(&application, finishCheck);
4908 application.SendNotification();
4909 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4911 // We didn't expect the animation to finish yet
4912 application.SendNotification();
4913 finishCheck.CheckSignalNotReceived();
4915 // The position should have moved more, than with a linear alpha function
4916 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
4917 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
4918 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
4919 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
4921 application.SendNotification();
4922 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4924 // We did expect the animation to finish
4925 application.SendNotification();
4926 finishCheck.CheckSignalReceived();
4927 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4929 // Check that nothing has changed after a couple of buffer swaps
4930 application.Render(0);
4931 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4932 application.Render(0);
4933 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4937 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4939 TestApplication application;
4941 Actor actor = Actor::New();
4942 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4943 actor.SetProperty(Actor::Property::POSITION, startPosition);
4944 application.GetScene().Add(actor);
4945 application.SendNotification();
4946 application.Render(0);
4947 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4949 // Build the animation
4950 float durationSeconds(1.0f);
4951 Animation animation = Animation::New(durationSeconds);
4952 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4953 Vector3 relativePosition(targetPosition - startPosition);
4955 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4957 TimePeriod(delay, durationSeconds - delay));
4959 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4961 // Start the animation
4964 bool signalReceived(false);
4965 AnimationFinishCheck finishCheck(signalReceived);
4966 animation.FinishedSignal().Connect(&application, finishCheck);
4968 application.SendNotification();
4969 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4971 // We didn't expect the animation to finish yet
4972 application.SendNotification();
4973 finishCheck.CheckSignalNotReceived();
4974 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4976 application.SendNotification();
4977 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
4979 // We did expect the animation to finish
4980 application.SendNotification();
4981 finishCheck.CheckSignalReceived();
4982 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4984 // Check that nothing has changed after a couple of buffer swaps
4985 application.Render(0);
4986 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4987 application.Render(0);
4988 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4992 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4994 TestApplication application;
4996 Actor actor = Actor::New();
4997 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4998 actor.SetProperty(Actor::Property::POSITION, startPosition);
4999 application.GetScene().Add(actor);
5000 application.SendNotification();
5001 application.Render(0);
5002 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5004 // Build the animation
5005 float durationSeconds(1.0f);
5006 Animation animation = Animation::New(durationSeconds);
5007 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5008 Vector3 relativePosition(targetPosition - startPosition);
5010 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
5012 AlphaFunction::LINEAR,
5013 TimePeriod(delay, durationSeconds - delay));
5015 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5017 // Start the animation
5020 bool signalReceived(false);
5021 AnimationFinishCheck finishCheck(signalReceived);
5022 animation.FinishedSignal().Connect(&application, finishCheck);
5024 application.SendNotification();
5025 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5027 // We didn't expect the animation to finish yet
5028 application.SendNotification();
5029 finishCheck.CheckSignalNotReceived();
5030 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5032 application.SendNotification();
5033 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5035 // We did expect the animation to finish
5036 application.SendNotification();
5037 finishCheck.CheckSignalReceived();
5038 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5040 // Check that nothing has changed after a couple of buffer swaps
5041 application.Render(0);
5042 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5043 application.Render(0);
5044 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5048 int UtcDaliAnimationAnimateByActorOrientationP1(void)
5050 TestApplication application;
5052 Actor actor = Actor::New();
5053 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5054 application.GetScene().Add(actor);
5055 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5057 // Build the animation
5058 float durationSeconds(1.0f);
5059 Animation animation = Animation::New(durationSeconds);
5060 Degree relativeRotationDegrees(360.0f);
5061 Radian relativeRotationRadians(relativeRotationDegrees);
5062 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
5064 // Start the animation
5067 // Target value should be retrievable straight away
5068 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
5070 bool signalReceived(false);
5071 AnimationFinishCheck finishCheck(signalReceived);
5072 animation.FinishedSignal().Connect(&application, finishCheck);
5074 application.SendNotification();
5075 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5077 // We didn't expect the animation to finish yet
5078 application.SendNotification();
5079 finishCheck.CheckSignalNotReceived();
5080 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5082 application.SendNotification();
5083 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5085 // We didn't expect the animation to finish yet
5086 application.SendNotification();
5087 finishCheck.CheckSignalNotReceived();
5088 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5090 application.SendNotification();
5091 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5093 // We didn't expect the animation to finish yet
5094 application.SendNotification();
5095 finishCheck.CheckSignalNotReceived();
5096 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5098 application.SendNotification();
5099 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5101 // We did expect the animation to finish
5102 application.SendNotification();
5103 finishCheck.CheckSignalReceived();
5104 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5108 int UtcDaliAnimationAnimateByActorOrientationP2(void)
5110 TestApplication application;
5112 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
5114 Actor actor = Actor::New();
5115 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5116 application.GetScene().Add(actor);
5117 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5119 // Build the animation
5120 float durationSeconds(1.0f);
5121 Animation animation = Animation::New(durationSeconds);
5122 Degree relativeRotationDegrees(710.0f);
5123 Radian relativeRotationRadians(relativeRotationDegrees);
5125 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
5127 // Start the animation
5130 bool signalReceived(false);
5131 AnimationFinishCheck finishCheck(signalReceived);
5132 animation.FinishedSignal().Connect(&application, finishCheck);
5134 application.SendNotification();
5135 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5137 // We didn't expect the animation to finish yet
5138 application.SendNotification();
5139 finishCheck.CheckSignalNotReceived();
5140 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5142 application.SendNotification();
5143 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5145 // We didn't expect the animation to finish yet
5146 application.SendNotification();
5147 finishCheck.CheckSignalNotReceived();
5148 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5150 application.SendNotification();
5151 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5153 // We didn't expect the animation to finish yet
5154 application.SendNotification();
5155 finishCheck.CheckSignalNotReceived();
5156 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5158 application.SendNotification();
5159 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5161 // We did expect the animation to finish
5162 application.SendNotification();
5163 finishCheck.CheckSignalReceived();
5164 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5168 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5170 TestApplication application;
5172 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5174 Actor actor = Actor::New();
5175 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5176 application.GetScene().Add(actor);
5177 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5179 // Build the animation
5180 float durationSeconds(1.0f);
5181 Animation animation = Animation::New(durationSeconds);
5182 Degree relativeRotationDegrees(730.0f);
5183 Radian relativeRotationRadians(relativeRotationDegrees);
5185 Radian actualRotationRadians(Degree(10.0f));
5187 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
5189 // Start the animation
5192 bool signalReceived(false);
5193 AnimationFinishCheck finishCheck(signalReceived);
5194 animation.FinishedSignal().Connect(&application, finishCheck);
5196 application.SendNotification();
5197 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5199 // We didn't expect the animation to finish yet
5200 application.SendNotification();
5201 finishCheck.CheckSignalNotReceived();
5202 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5204 application.SendNotification();
5205 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5207 // We didn't expect the animation to finish yet
5208 application.SendNotification();
5209 finishCheck.CheckSignalNotReceived();
5210 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5212 application.SendNotification();
5213 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5215 // We didn't expect the animation to finish yet
5216 application.SendNotification();
5217 finishCheck.CheckSignalNotReceived();
5218 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5220 application.SendNotification();
5221 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5223 // We did expect the animation to finish
5224 application.SendNotification();
5225 finishCheck.CheckSignalReceived();
5226 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5227 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5231 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5233 TestApplication application;
5235 Actor actor = Actor::New();
5236 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5237 application.GetScene().Add(actor);
5238 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5240 // Build the animation
5241 float durationSeconds(1.0f);
5242 Animation animation = Animation::New(durationSeconds);
5243 Degree relativeRotationDegrees(360.0f);
5244 Radian relativeRotationRadians(relativeRotationDegrees);
5245 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
5247 // Start the animation
5250 bool signalReceived(false);
5251 AnimationFinishCheck finishCheck(signalReceived);
5252 animation.FinishedSignal().Connect(&application, finishCheck);
5254 application.SendNotification();
5255 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5257 // We didn't expect the animation to finish yet
5258 application.SendNotification();
5259 finishCheck.CheckSignalNotReceived();
5260 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5262 application.SendNotification();
5263 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5265 // We didn't expect the animation to finish yet
5266 application.SendNotification();
5267 finishCheck.CheckSignalNotReceived();
5268 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5270 application.SendNotification();
5271 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5273 // We didn't expect the animation to finish yet
5274 application.SendNotification();
5275 finishCheck.CheckSignalNotReceived();
5276 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5278 application.SendNotification();
5279 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5281 // We did expect the animation to finish
5282 application.SendNotification();
5283 finishCheck.CheckSignalReceived();
5284 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5288 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5290 TestApplication application;
5292 Actor actor = Actor::New();
5293 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5294 application.GetScene().Add(actor);
5295 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5297 // Build the animation
5298 float durationSeconds(1.0f);
5299 Animation animation = Animation::New(durationSeconds);
5300 Degree relativeRotationDegrees(360.0f);
5301 Radian relativeRotationRadians(relativeRotationDegrees);
5303 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
5305 // Start the animation
5308 bool signalReceived(false);
5309 AnimationFinishCheck finishCheck(signalReceived);
5310 animation.FinishedSignal().Connect(&application, finishCheck);
5312 application.SendNotification();
5313 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5315 // We didn't expect the animation to finish yet
5316 application.SendNotification();
5317 finishCheck.CheckSignalNotReceived();
5318 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5319 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5321 application.SendNotification();
5322 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5324 // We didn't expect the animation to finish yet
5325 application.SendNotification();
5326 finishCheck.CheckSignalNotReceived();
5327 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5328 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5330 application.SendNotification();
5331 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5333 // We didn't expect the animation to finish yet
5334 application.SendNotification();
5335 finishCheck.CheckSignalNotReceived();
5336 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5337 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5339 application.SendNotification();
5340 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5342 // We did expect the animation to finish
5343 application.SendNotification();
5344 finishCheck.CheckSignalReceived();
5345 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5349 int UtcDaliAnimationAnimateByActorScaleP(void)
5351 TestApplication application;
5353 Actor actor = Actor::New();
5354 application.GetScene().Add(actor);
5355 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5357 // Build the animation
5358 float durationSeconds(1.0f);
5359 Animation animation = Animation::New(durationSeconds);
5360 Vector3 targetScale(2.0f, 2.0f, 2.0f);
5361 Vector3 relativeScale(targetScale - Vector3::ONE);
5362 animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
5364 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
5366 // Start the animation
5369 // Target value should be retrievable straight away
5370 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5372 bool signalReceived(false);
5373 AnimationFinishCheck finishCheck(signalReceived);
5374 animation.FinishedSignal().Connect(&application, finishCheck);
5376 application.SendNotification();
5377 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5379 // We didn't expect the animation to finish yet
5380 application.SendNotification();
5381 finishCheck.CheckSignalNotReceived();
5382 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
5384 application.SendNotification();
5385 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5387 // We did expect the animation to finish
5388 application.SendNotification();
5389 finishCheck.CheckSignalReceived();
5390 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5393 finishCheck.Reset();
5394 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5395 application.SendNotification();
5396 application.Render(0);
5397 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5399 // Repeat with a different (ease-in) alpha function
5400 animation = Animation::New(durationSeconds);
5401 animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
5402 animation.FinishedSignal().Connect(&application, finishCheck);
5405 application.SendNotification();
5406 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5408 // We didn't expect the animation to finish yet
5409 application.SendNotification();
5410 finishCheck.CheckSignalNotReceived();
5412 // The scale should have grown less, than with a linear alpha function
5413 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
5414 DALI_TEST_CHECK(current.x > 1.0f);
5415 DALI_TEST_CHECK(current.y > 1.0f);
5416 DALI_TEST_CHECK(current.z > 1.0f);
5417 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
5418 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
5419 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
5421 application.SendNotification();
5422 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5424 // We did expect the animation to finish
5425 application.SendNotification();
5426 finishCheck.CheckSignalReceived();
5427 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5430 finishCheck.Reset();
5431 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5432 application.SendNotification();
5433 application.Render(0);
5434 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5436 // Repeat with a delay
5438 animation = Animation::New(durationSeconds);
5439 animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5440 animation.FinishedSignal().Connect(&application, finishCheck);
5443 application.SendNotification();
5444 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5446 // We didn't expect the animation to finish yet
5447 application.SendNotification();
5448 finishCheck.CheckSignalNotReceived();
5449 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5451 application.SendNotification();
5452 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5454 // We did expect the animation to finish
5455 application.SendNotification();
5456 finishCheck.CheckSignalReceived();
5457 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5461 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5463 TestApplication application;
5465 Actor actor = Actor::New();
5466 application.GetScene().Add(actor);
5467 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5469 // Build the animation
5470 float durationSeconds(1.0f);
5471 Animation animation = Animation::New(durationSeconds);
5472 Vector3 targetScale(2.0f, 3.0f, 4.0f);
5473 Vector3 relativeScale(targetScale - Vector3::ONE);
5474 animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
5475 animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
5476 animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
5478 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5479 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5481 // Start the animation
5484 // Target value should be retrievable straight away
5485 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5486 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
5487 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
5488 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
5490 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
5492 application.SendNotification();
5493 application.Render(1000); // 1 second progress
5495 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5500 int UtcDaliAnimationAnimateByActorColorP(void)
5502 TestApplication application;
5504 Actor actor = Actor::New();
5505 application.GetScene().Add(actor);
5506 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5508 // Build the animation
5509 float durationSeconds(1.0f);
5510 Animation animation = Animation::New(durationSeconds);
5511 Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5512 Vector4 relativeColor(targetColor - Color::WHITE);
5513 animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
5515 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5516 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5518 // Start the animation
5521 // Target value should be retrievable straight away
5522 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5523 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5524 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5525 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5526 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5528 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5530 application.SendNotification();
5531 application.Render(1000); // 1 second progress
5533 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5538 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5540 TestApplication application;
5542 Actor actor = Actor::New();
5543 application.GetScene().Add(actor);
5544 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5546 // Build the animation
5547 float durationSeconds(1.0f);
5548 Animation animation = Animation::New(durationSeconds);
5549 Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5550 Vector4 relativeColor(targetColor - Color::WHITE);
5551 animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
5552 animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
5553 animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
5554 animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
5556 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5557 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5559 // Start the animation
5562 // Target value should be retrievable straight away
5563 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5564 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5565 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5566 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5567 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5569 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5571 application.SendNotification();
5572 application.Render(1000); // 1 second progress
5574 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5579 int UtcDaliAnimationAnimateByActorSizeP(void)
5581 TestApplication application;
5583 Actor actor = Actor::New();
5584 application.GetScene().Add(actor);
5585 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5587 // Build the animation
5588 float durationSeconds(1.0f);
5589 Animation animation = Animation::New(durationSeconds);
5590 Vector3 targetSize(100.0f, 200.0f, 300.0f);
5591 Vector3 relativeSize(targetSize - Vector3::ZERO);
5592 animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
5594 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5595 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5597 // Start the animation
5600 // Target value should be retrievable straight away
5601 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5602 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5603 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5604 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5606 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5608 application.SendNotification();
5609 application.Render(1000); // 1 second progress
5611 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5616 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5618 TestApplication application;
5620 Actor actor = Actor::New();
5621 application.GetScene().Add(actor);
5622 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5624 // Build the animation
5625 float durationSeconds(1.0f);
5626 Animation animation = Animation::New(durationSeconds);
5627 Vector3 targetSize(100.0f, 200.0f, 300.0f);
5628 Vector3 relativeSize(targetSize - Vector3::ZERO);
5629 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
5630 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
5631 animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
5633 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5634 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5636 // Start the animation
5639 // Target value should be retrievable straight away
5640 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5641 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5642 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5643 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5645 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5647 application.SendNotification();
5648 application.Render(1000); // 1 second progress
5650 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5655 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5657 TestApplication application;
5659 Actor actor = Actor::New();
5660 application.GetScene().Add(actor);
5661 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5663 actor.SetProperty(Actor::Property::VISIBLE, false);
5665 application.SendNotification();
5666 application.Render();
5668 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5670 // Build the animation
5671 float durationSeconds(1.0f);
5672 Animation animation = Animation::New(durationSeconds);
5673 bool targetVisibility(true);
5674 bool relativeVisibility(targetVisibility);
5675 animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
5677 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5679 // Start the animation
5682 // Target value should be retrievable straight away
5683 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
5684 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
5686 application.SendNotification();
5687 application.Render(1000); // 1 second progress
5689 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5694 int UtcDaliAnimationAnimateToBooleanP(void)
5696 TestApplication application;
5698 Actor actor = Actor::New();
5700 // Register a boolean property
5701 const bool startValue(false);
5702 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5703 application.GetScene().Add(actor);
5704 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5705 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5707 // Build the animation
5708 float durationSeconds(2.0f);
5709 Animation animation = Animation::New(durationSeconds);
5710 const bool targetValue(!startValue);
5711 animation.AnimateTo(Property(actor, index), targetValue);
5713 // Start the animation
5716 bool signalReceived(false);
5717 AnimationFinishCheck finishCheck(signalReceived);
5718 animation.FinishedSignal().Connect(&application, finishCheck);
5720 application.SendNotification();
5721 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5723 // We didn't expect the animation to finish yet
5724 application.SendNotification();
5725 finishCheck.CheckSignalNotReceived();
5726 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5728 application.SendNotification();
5729 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5731 // We did expect the animation to finish
5732 application.SendNotification();
5733 finishCheck.CheckSignalReceived();
5734 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5736 // Check that nothing has changed after a couple of buffer swaps
5737 application.Render(0);
5738 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5739 application.Render(0);
5740 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5742 // Repeat with target value "false"
5743 animation = Animation::New(durationSeconds);
5744 const bool finalValue(!targetValue);
5745 animation.AnimateTo(Property(actor, index), finalValue);
5747 // Start the animation
5750 finishCheck.Reset();
5751 animation.FinishedSignal().Connect(&application, finishCheck);
5753 application.SendNotification();
5754 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5756 // We didn't expect the animation to finish yet
5757 application.SendNotification();
5758 finishCheck.CheckSignalNotReceived();
5759 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5761 application.SendNotification();
5762 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5764 // We did expect the animation to finish
5765 application.SendNotification();
5766 finishCheck.CheckSignalReceived();
5767 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5769 // Check that nothing has changed after a couple of buffer swaps
5770 application.Render(0);
5771 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5772 application.Render(0);
5773 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5777 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5779 TestApplication application;
5781 Actor actor = Actor::New();
5783 // Register a boolean property
5784 const bool startValue(false);
5785 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5786 application.GetScene().Add(actor);
5787 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5788 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5790 // Build the animation
5791 float durationSeconds(2.0f);
5792 Animation animation = Animation::New(durationSeconds);
5793 const bool targetValue(!startValue);
5794 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5796 // Start the animation
5799 bool signalReceived(false);
5800 AnimationFinishCheck finishCheck(signalReceived);
5801 animation.FinishedSignal().Connect(&application, finishCheck);
5803 application.SendNotification();
5804 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5806 // We didn't expect the animation to finish yet
5807 application.SendNotification();
5808 finishCheck.CheckSignalNotReceived();
5809 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5811 application.SendNotification();
5812 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5814 // We did expect the animation to finish
5815 application.SendNotification();
5816 finishCheck.CheckSignalReceived();
5817 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5819 // Check that nothing has changed after a couple of buffer swaps
5820 application.Render(0);
5821 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5822 application.Render(0);
5823 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5825 // Repeat with target value "false"
5826 animation = Animation::New(durationSeconds);
5827 const bool finalValue(!targetValue);
5828 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5830 // Start the animation
5833 finishCheck.Reset();
5834 animation.FinishedSignal().Connect(&application, finishCheck);
5836 application.SendNotification();
5837 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5839 // We didn't expect the animation to finish yet
5840 application.SendNotification();
5841 finishCheck.CheckSignalNotReceived();
5842 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5844 application.SendNotification();
5845 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5847 // We did expect the animation to finish
5848 application.SendNotification();
5849 finishCheck.CheckSignalReceived();
5850 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5852 // Check that nothing has changed after a couple of buffer swaps
5853 application.Render(0);
5854 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5855 application.Render(0);
5856 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5860 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5862 TestApplication application;
5864 Actor actor = Actor::New();
5866 // Register a boolean property
5867 bool startValue(false);
5868 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5869 application.GetScene().Add(actor);
5870 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5871 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5873 // Build the animation
5874 float durationSeconds(2.0f);
5875 Animation animation = Animation::New(durationSeconds);
5876 bool finalValue(!startValue);
5877 float animatorDurationSeconds(durationSeconds * 0.5f);
5878 animation.AnimateTo(Property(actor, index),
5880 TimePeriod(animatorDurationSeconds));
5882 // Start the animation
5885 bool signalReceived(false);
5886 AnimationFinishCheck finishCheck(signalReceived);
5887 animation.FinishedSignal().Connect(&application, finishCheck);
5889 application.SendNotification();
5890 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5892 // We didn't expect the animation to finish yet
5893 application.SendNotification();
5894 finishCheck.CheckSignalNotReceived();
5895 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5897 application.SendNotification();
5898 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5900 // We didn't expect the animation to finish yet...
5901 application.SendNotification();
5902 finishCheck.CheckSignalNotReceived();
5904 // ...however we should have reached the final value
5905 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5907 application.SendNotification();
5908 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5910 // We did expect the animation to finish
5911 application.SendNotification();
5912 finishCheck.CheckSignalReceived();
5913 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5915 // Check that nothing has changed after a couple of buffer swaps
5916 application.Render(0);
5917 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5918 application.Render(0);
5919 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5923 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5925 TestApplication application;
5927 Actor actor = Actor::New();
5929 // Register a boolean property
5930 bool startValue(false);
5931 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5932 application.GetScene().Add(actor);
5933 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5934 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5936 // Build the animation
5937 float durationSeconds(2.0f);
5938 Animation animation = Animation::New(durationSeconds);
5939 bool finalValue(!startValue);
5940 float animatorDurationSeconds(durationSeconds * 0.5f);
5941 animation.AnimateTo(Property(actor, index),
5943 AlphaFunction::LINEAR,
5944 TimePeriod(animatorDurationSeconds));
5946 // Start the animation
5949 bool signalReceived(false);
5950 AnimationFinishCheck finishCheck(signalReceived);
5951 animation.FinishedSignal().Connect(&application, finishCheck);
5953 application.SendNotification();
5954 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
5956 // We didn't expect the animation to finish yet
5957 application.SendNotification();
5958 finishCheck.CheckSignalNotReceived();
5959 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5961 application.SendNotification();
5962 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
5964 // We didn't expect the animation to finish yet...
5965 application.SendNotification();
5966 finishCheck.CheckSignalNotReceived();
5968 // ...however we should have reached the final value
5969 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5971 application.SendNotification();
5972 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
5974 // We did expect the animation to finish
5975 application.SendNotification();
5976 finishCheck.CheckSignalReceived();
5977 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5979 // Check that nothing has changed after a couple of buffer swaps
5980 application.Render(0);
5981 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5982 application.Render(0);
5983 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5987 int UtcDaliAnimationAnimateToFloatP(void)
5989 TestApplication application;
5991 Actor actor = Actor::New();
5993 // Register a float property
5994 float startValue(10.0f);
5995 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5996 application.GetScene().Add(actor);
5997 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
5998 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6000 // Build the animation
6001 float durationSeconds(2.0f);
6002 Animation animation = Animation::New(durationSeconds);
6003 float targetValue(50.0f);
6004 float relativeValue(targetValue - startValue);
6005 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6007 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6009 // Start the animation
6012 bool signalReceived(false);
6013 AnimationFinishCheck finishCheck(signalReceived);
6014 animation.FinishedSignal().Connect(&application, finishCheck);
6016 application.SendNotification();
6017 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6019 // We didn't expect the animation to finish yet
6020 application.SendNotification();
6021 finishCheck.CheckSignalNotReceived();
6022 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
6024 application.SendNotification();
6025 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6027 // We did expect the animation to finish
6028 application.SendNotification();
6029 finishCheck.CheckSignalReceived();
6030 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6034 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
6036 TestApplication application;
6038 Actor actor = Actor::New();
6040 // Register a float property
6041 float startValue(10.0f);
6042 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6043 application.GetScene().Add(actor);
6044 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6045 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6047 // Build the animation
6048 float durationSeconds(1.0f);
6049 Animation animation = Animation::New(durationSeconds);
6050 float targetValue(90.0f);
6051 float relativeValue(targetValue - startValue);
6052 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6054 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6056 // Start the animation
6059 bool signalReceived(false);
6060 AnimationFinishCheck finishCheck(signalReceived);
6061 animation.FinishedSignal().Connect(&application, finishCheck);
6063 application.SendNotification();
6064 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6066 // We didn't expect the animation to finish yet
6067 application.SendNotification();
6068 finishCheck.CheckSignalNotReceived();
6070 // The position should have moved more, than with a linear alpha function
6071 float current(actor.GetCurrentProperty<float>(index));
6072 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6074 application.SendNotification();
6075 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6077 // We did expect the animation to finish
6078 application.SendNotification();
6079 finishCheck.CheckSignalReceived();
6080 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6084 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
6086 TestApplication application;
6088 Actor actor = Actor::New();
6090 // Register a float property
6091 float startValue(10.0f);
6092 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6093 application.GetScene().Add(actor);
6094 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6095 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6097 // Build the animation
6098 float durationSeconds(1.0f);
6099 Animation animation = Animation::New(durationSeconds);
6100 float targetValue(30.0f);
6101 float relativeValue(targetValue - startValue);
6103 animation.AnimateTo(Property(actor, index),
6105 TimePeriod(delay, durationSeconds - delay));
6107 // Start the animation
6110 bool signalReceived(false);
6111 AnimationFinishCheck finishCheck(signalReceived);
6112 animation.FinishedSignal().Connect(&application, finishCheck);
6114 application.SendNotification();
6115 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6117 // We didn't expect the animation to finish yet
6118 application.SendNotification();
6119 finishCheck.CheckSignalNotReceived();
6120 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6122 application.SendNotification();
6123 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6125 // We didn't expect the animation to finish yet
6126 application.SendNotification();
6127 finishCheck.CheckSignalNotReceived();
6128 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6130 application.SendNotification();
6131 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6133 // We did expect the animation to finish
6134 application.SendNotification();
6135 finishCheck.CheckSignalReceived();
6136 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6140 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
6142 TestApplication application;
6144 Actor actor = Actor::New();
6146 // Register a float property
6147 float startValue(10.0f);
6148 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6149 application.GetScene().Add(actor);
6150 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6151 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6153 // Build the animation
6154 float durationSeconds(1.0f);
6155 Animation animation = Animation::New(durationSeconds);
6156 float targetValue(30.0f);
6157 float relativeValue(targetValue - startValue);
6159 animation.AnimateTo(Property(actor, index),
6161 AlphaFunction::LINEAR,
6162 TimePeriod(delay, durationSeconds - delay));
6164 // Start the animation
6167 bool signalReceived(false);
6168 AnimationFinishCheck finishCheck(signalReceived);
6169 animation.FinishedSignal().Connect(&application, finishCheck);
6171 application.SendNotification();
6172 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6174 // We didn't expect the animation to finish yet
6175 application.SendNotification();
6176 finishCheck.CheckSignalNotReceived();
6177 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6179 application.SendNotification();
6180 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6182 // We didn't expect the animation to finish yet
6183 application.SendNotification();
6184 finishCheck.CheckSignalNotReceived();
6185 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6187 application.SendNotification();
6188 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6190 // We did expect the animation to finish
6191 application.SendNotification();
6192 finishCheck.CheckSignalReceived();
6193 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6197 int UtcDaliAnimationAnimateToIntegerP(void)
6199 TestApplication application;
6201 Actor actor = Actor::New();
6203 // Register an integer property
6205 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6206 application.GetScene().Add(actor);
6207 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6208 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6210 // Build the animation
6211 float durationSeconds(2.0f);
6212 Animation animation = Animation::New(durationSeconds);
6213 int targetValue(50);
6214 int relativeValue(targetValue - startValue);
6215 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6217 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6219 // Start the animation
6222 bool signalReceived(false);
6223 AnimationFinishCheck finishCheck(signalReceived);
6224 animation.FinishedSignal().Connect(&application, finishCheck);
6226 application.SendNotification();
6227 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6229 // We didn't expect the animation to finish yet
6230 application.SendNotification();
6231 finishCheck.CheckSignalNotReceived();
6232 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
6234 application.SendNotification();
6235 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6237 // We did expect the animation to finish
6238 application.SendNotification();
6239 finishCheck.CheckSignalReceived();
6240 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6244 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6246 TestApplication application;
6248 Actor actor = Actor::New();
6250 // Register an integer property
6252 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6253 application.GetScene().Add(actor);
6254 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6255 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6257 // Build the animation
6258 float durationSeconds(1.0f);
6259 Animation animation = Animation::New(durationSeconds);
6260 int targetValue(90);
6261 int relativeValue(targetValue - startValue);
6262 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6264 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6266 // Start the animation
6269 bool signalReceived(false);
6270 AnimationFinishCheck finishCheck(signalReceived);
6271 animation.FinishedSignal().Connect(&application, finishCheck);
6273 application.SendNotification();
6274 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6276 // We didn't expect the animation to finish yet
6277 application.SendNotification();
6278 finishCheck.CheckSignalNotReceived();
6280 // The position should have moved more, than with a linear alpha function
6281 int current(actor.GetCurrentProperty<int>(index));
6282 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6284 application.SendNotification();
6285 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6287 // We did expect the animation to finish
6288 application.SendNotification();
6289 finishCheck.CheckSignalReceived();
6290 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6294 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6296 TestApplication application;
6298 Actor actor = Actor::New();
6300 // Register an integer property
6302 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6303 application.GetScene().Add(actor);
6304 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6305 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6307 // Build the animation
6308 float durationSeconds(1.0f);
6309 Animation animation = Animation::New(durationSeconds);
6310 int targetValue(30);
6311 int relativeValue(targetValue - startValue);
6313 animation.AnimateTo(Property(actor, index),
6315 TimePeriod(delay, durationSeconds - delay));
6317 // Start the animation
6320 bool signalReceived(false);
6321 AnimationFinishCheck finishCheck(signalReceived);
6322 animation.FinishedSignal().Connect(&application, finishCheck);
6324 application.SendNotification();
6325 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6327 // We didn't expect the animation to finish yet
6328 application.SendNotification();
6329 finishCheck.CheckSignalNotReceived();
6330 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6332 application.SendNotification();
6333 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6335 // We didn't expect the animation to finish yet
6336 application.SendNotification();
6337 finishCheck.CheckSignalNotReceived();
6338 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6340 application.SendNotification();
6341 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6343 // We did expect the animation to finish
6344 application.SendNotification();
6345 finishCheck.CheckSignalReceived();
6346 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6350 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6352 TestApplication application;
6354 Actor actor = Actor::New();
6356 // Register an integer property
6358 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6359 application.GetScene().Add(actor);
6360 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6361 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6363 // Build the animation
6364 float durationSeconds(1.0f);
6365 Animation animation = Animation::New(durationSeconds);
6366 int targetValue(30);
6367 int relativeValue(targetValue - startValue);
6369 animation.AnimateTo(Property(actor, index),
6371 AlphaFunction::LINEAR,
6372 TimePeriod(delay, durationSeconds - delay));
6374 // Start the animation
6377 bool signalReceived(false);
6378 AnimationFinishCheck finishCheck(signalReceived);
6379 animation.FinishedSignal().Connect(&application, finishCheck);
6381 application.SendNotification();
6382 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6384 // We didn't expect the animation to finish yet
6385 application.SendNotification();
6386 finishCheck.CheckSignalNotReceived();
6387 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6389 application.SendNotification();
6390 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6392 // We didn't expect the animation to finish yet
6393 application.SendNotification();
6394 finishCheck.CheckSignalNotReceived();
6395 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6397 application.SendNotification();
6398 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6400 // We did expect the animation to finish
6401 application.SendNotification();
6402 finishCheck.CheckSignalReceived();
6403 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6407 int UtcDaliAnimationAnimateToVector2P(void)
6409 TestApplication application;
6411 Actor actor = Actor::New();
6413 // Register a Vector2 property
6414 Vector2 startValue(-50.0f, -50.0f);
6415 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6416 application.GetScene().Add(actor);
6417 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6418 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6420 // Build the animation
6421 float durationSeconds(2.0f);
6422 Animation animation = Animation::New(durationSeconds);
6423 Vector2 targetValue(50.0f, 50.0f);
6424 Vector2 relativeValue(targetValue - startValue);
6425 animation.AnimateTo(Property(actor, index), targetValue);
6427 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6429 // Start the animation
6432 bool signalReceived(false);
6433 AnimationFinishCheck finishCheck(signalReceived);
6434 animation.FinishedSignal().Connect(&application, finishCheck);
6436 application.SendNotification();
6437 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6439 // We didn't expect the animation to finish yet
6440 application.SendNotification();
6441 finishCheck.CheckSignalNotReceived();
6442 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
6444 application.SendNotification();
6445 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6447 // We did expect the animation to finish
6448 application.SendNotification();
6449 finishCheck.CheckSignalReceived();
6450 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6454 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6456 TestApplication application;
6458 Actor actor = Actor::New();
6460 // Register a Vector2 property
6461 Vector2 startValue(1000.0f, 1000.0f);
6462 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6463 application.GetScene().Add(actor);
6464 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6465 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6467 // Build the animation
6468 float durationSeconds(1.0f);
6469 Animation animation = Animation::New(durationSeconds);
6470 Vector2 targetValue(9000.0f, 9000.0f);
6471 Vector2 relativeValue(targetValue - startValue);
6472 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6474 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6476 // Start the animation
6479 bool signalReceived(false);
6480 AnimationFinishCheck finishCheck(signalReceived);
6481 animation.FinishedSignal().Connect(&application, finishCheck);
6483 application.SendNotification();
6484 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6486 // We didn't expect the animation to finish yet
6487 application.SendNotification();
6488 finishCheck.CheckSignalNotReceived();
6490 // The position should have moved more, than with a linear alpha function
6491 Vector2 current(actor.GetCurrentProperty<Vector2>(index));
6492 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6493 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6495 application.SendNotification();
6496 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6498 // We did expect the animation to finish
6499 application.SendNotification();
6500 finishCheck.CheckSignalReceived();
6501 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6505 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6507 TestApplication application;
6509 Actor actor = Actor::New();
6511 // Register a Vector2 property
6512 Vector2 startValue(10.0f, 10.0f);
6513 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6514 application.GetScene().Add(actor);
6515 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6516 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6518 // Build the animation
6519 float durationSeconds(1.0f);
6520 Animation animation = Animation::New(durationSeconds);
6521 Vector2 targetValue(-10.0f, 20.0f);
6522 Vector2 relativeValue(targetValue - startValue);
6524 animation.AnimateTo(Property(actor, index),
6526 TimePeriod(delay, durationSeconds - delay));
6528 // Start the animation
6531 bool signalReceived(false);
6532 AnimationFinishCheck finishCheck(signalReceived);
6533 animation.FinishedSignal().Connect(&application, finishCheck);
6535 application.SendNotification();
6536 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6538 // We didn't expect the animation to finish yet
6539 application.SendNotification();
6540 finishCheck.CheckSignalNotReceived();
6541 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6543 application.SendNotification();
6544 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6546 // We didn't expect the animation to finish yet
6547 application.SendNotification();
6548 finishCheck.CheckSignalNotReceived();
6549 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6551 application.SendNotification();
6552 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6554 // We did expect the animation to finish
6555 application.SendNotification();
6556 finishCheck.CheckSignalReceived();
6557 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6561 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6563 TestApplication application;
6565 Actor actor = Actor::New();
6567 // Register a Vector2 property
6568 Vector2 startValue(10.0f, 10.0f);
6569 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6570 application.GetScene().Add(actor);
6571 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6572 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6574 // Build the animation
6575 float durationSeconds(1.0f);
6576 Animation animation = Animation::New(durationSeconds);
6577 Vector2 targetValue(30.0f, 30.0f);
6578 Vector2 relativeValue(targetValue - startValue);
6580 animation.AnimateTo(Property(actor, index),
6582 AlphaFunction::LINEAR,
6583 TimePeriod(delay, durationSeconds - delay));
6585 // Start the animation
6588 bool signalReceived(false);
6589 AnimationFinishCheck finishCheck(signalReceived);
6590 animation.FinishedSignal().Connect(&application, finishCheck);
6592 application.SendNotification();
6593 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6595 // We didn't expect the animation to finish yet, but cached value should be the final one
6596 application.SendNotification();
6597 finishCheck.CheckSignalNotReceived();
6598 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6599 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6601 application.SendNotification();
6602 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6604 // We didn't expect the animation to finish yet
6605 application.SendNotification();
6606 finishCheck.CheckSignalNotReceived();
6607 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6609 application.SendNotification();
6610 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6612 // We did expect the animation to finish
6613 application.SendNotification();
6614 finishCheck.CheckSignalReceived();
6615 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6616 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6620 int UtcDaliAnimationAnimateToVector3P(void)
6622 TestApplication application;
6624 Actor actor = Actor::New();
6626 // Register a Vector3 property
6627 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6628 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6629 application.GetScene().Add(actor);
6630 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6631 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6633 // Build the animation
6634 float durationSeconds(2.0f);
6635 Animation animation = Animation::New(durationSeconds);
6636 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6637 Vector3 relativeValue(targetValue - startValue);
6638 animation.AnimateTo(Property(actor, index), targetValue);
6640 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6642 // Start the animation
6645 bool signalReceived(false);
6646 AnimationFinishCheck finishCheck(signalReceived);
6647 animation.FinishedSignal().Connect(&application, finishCheck);
6649 application.SendNotification();
6650 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6652 // We didn't expect the animation to finish yet
6653 application.SendNotification();
6654 finishCheck.CheckSignalNotReceived();
6655 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
6657 application.SendNotification();
6658 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6660 // We did expect the animation to finish
6661 application.SendNotification();
6662 finishCheck.CheckSignalReceived();
6663 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6667 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6669 TestApplication application;
6671 Actor actor = Actor::New();
6673 // Register a Vector3 property
6674 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6675 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6676 application.GetScene().Add(actor);
6677 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6678 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6680 // Build the animation
6681 float durationSeconds(1.0f);
6682 Animation animation = Animation::New(durationSeconds);
6683 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6684 Vector3 relativeValue(targetValue - startValue);
6685 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6687 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6689 // Start the animation
6692 bool signalReceived(false);
6693 AnimationFinishCheck finishCheck(signalReceived);
6694 animation.FinishedSignal().Connect(&application, finishCheck);
6696 application.SendNotification();
6697 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6699 // We didn't expect the animation to finish yet
6700 application.SendNotification();
6701 finishCheck.CheckSignalNotReceived();
6703 // The position should have moved more, than with a linear alpha function
6704 Vector3 current(actor.GetCurrentProperty<Vector3>(index));
6705 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6706 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6707 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6709 application.SendNotification();
6710 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6712 // We did expect the animation to finish
6713 application.SendNotification();
6714 finishCheck.CheckSignalReceived();
6715 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6719 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6721 TestApplication application;
6723 Actor actor = Actor::New();
6725 // Register a Vector3 property
6726 Vector3 startValue(10.0f, 10.0f, 10.0f);
6727 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6728 application.GetScene().Add(actor);
6729 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6730 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6732 // Build the animation
6733 float durationSeconds(1.0f);
6734 Animation animation = Animation::New(durationSeconds);
6735 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6736 Vector3 relativeValue(targetValue - startValue);
6738 animation.AnimateTo(Property(actor, index),
6740 TimePeriod(delay, durationSeconds - delay));
6742 // Start the animation
6745 bool signalReceived(false);
6746 AnimationFinishCheck finishCheck(signalReceived);
6747 animation.FinishedSignal().Connect(&application, finishCheck);
6749 application.SendNotification();
6750 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6752 // We didn't expect the animation to finish yet
6753 application.SendNotification();
6754 finishCheck.CheckSignalNotReceived();
6755 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6757 application.SendNotification();
6758 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6760 // We didn't expect the animation to finish yet
6761 application.SendNotification();
6762 finishCheck.CheckSignalNotReceived();
6763 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6765 application.SendNotification();
6766 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6768 // We did expect the animation to finish
6769 application.SendNotification();
6770 finishCheck.CheckSignalReceived();
6771 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6775 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6777 TestApplication application;
6779 Actor actor = Actor::New();
6781 // Register a Vector3 property
6782 Vector3 startValue(10.0f, 10.0f, 10.0f);
6783 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6784 application.GetScene().Add(actor);
6785 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6786 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6788 // Build the animation
6789 float durationSeconds(1.0f);
6790 Animation animation = Animation::New(durationSeconds);
6791 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6792 Vector3 relativeValue(targetValue - startValue);
6794 animation.AnimateTo(Property(actor, "testProperty"),
6796 AlphaFunction::LINEAR,
6797 TimePeriod(delay, durationSeconds - delay));
6799 // Start the animation
6802 bool signalReceived(false);
6803 AnimationFinishCheck finishCheck(signalReceived);
6804 animation.FinishedSignal().Connect(&application, finishCheck);
6806 application.SendNotification();
6807 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6809 // We didn't expect the animation to finish yet
6810 application.SendNotification();
6811 finishCheck.CheckSignalNotReceived();
6812 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6814 application.SendNotification();
6815 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6817 // We didn't expect the animation to finish yet
6818 application.SendNotification();
6819 finishCheck.CheckSignalNotReceived();
6820 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6822 application.SendNotification();
6823 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6825 // We did expect the animation to finish
6826 application.SendNotification();
6827 finishCheck.CheckSignalReceived();
6828 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6832 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6834 TestApplication application;
6836 Actor actor = Actor::New();
6838 // Register a Vector3 property
6839 Vector3 startValue(10.0f, 10.0f, 10.0f);
6840 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6841 application.GetScene().Add(actor);
6842 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6843 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6845 // Build the animation
6846 float durationSeconds(1.0f);
6847 Animation animation = Animation::New(durationSeconds);
6848 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6849 Vector3 relativeValue(targetValue - startValue);
6851 animation.AnimateTo(Property(actor, "testProperty", 0),
6853 AlphaFunction::LINEAR,
6854 TimePeriod(delay, durationSeconds - delay));
6855 animation.AnimateTo(Property(actor, index, 1),
6857 AlphaFunction::LINEAR,
6858 TimePeriod(delay, durationSeconds - delay));
6860 // Start the animation
6863 bool signalReceived(false);
6864 AnimationFinishCheck finishCheck(signalReceived);
6865 animation.FinishedSignal().Connect(&application, finishCheck);
6867 application.SendNotification();
6868 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6870 // We didn't expect the animation to finish yet
6871 application.SendNotification();
6872 finishCheck.CheckSignalNotReceived();
6873 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6875 application.SendNotification();
6876 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6878 // We didn't expect the animation to finish yet
6879 application.SendNotification();
6880 finishCheck.CheckSignalNotReceived();
6881 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6883 application.SendNotification();
6884 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6886 // We did expect the animation to finish
6887 application.SendNotification();
6888 finishCheck.CheckSignalReceived();
6889 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6893 int UtcDaliAnimationAnimateToVector4P(void)
6895 TestApplication application;
6897 Actor actor = Actor::New();
6899 // Register a Vector4 property
6900 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6901 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6902 application.GetScene().Add(actor);
6903 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6904 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6906 // Build the animation
6907 float durationSeconds(2.0f);
6908 Animation animation = Animation::New(durationSeconds);
6909 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6910 Vector4 relativeValue(targetValue - startValue);
6911 animation.AnimateTo(Property(actor, index), targetValue);
6913 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6915 // Start the animation
6918 bool signalReceived(false);
6919 AnimationFinishCheck finishCheck(signalReceived);
6920 animation.FinishedSignal().Connect(&application, finishCheck);
6922 application.SendNotification();
6923 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6925 // We didn't expect the animation to finish yet
6926 application.SendNotification();
6927 finishCheck.CheckSignalNotReceived();
6928 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
6930 application.SendNotification();
6931 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6933 // We did expect the animation to finish
6934 application.SendNotification();
6935 finishCheck.CheckSignalReceived();
6936 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6940 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6942 TestApplication application;
6944 Actor actor = Actor::New();
6946 // Register a Vector4 property
6947 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6948 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6949 application.GetScene().Add(actor);
6950 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
6951 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
6953 // Build the animation
6954 float durationSeconds(1.0f);
6955 Animation animation = Animation::New(durationSeconds);
6956 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6957 Vector4 relativeValue(targetValue - startValue);
6958 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6960 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6962 // Start the animation
6965 bool signalReceived(false);
6966 AnimationFinishCheck finishCheck(signalReceived);
6967 animation.FinishedSignal().Connect(&application, finishCheck);
6969 application.SendNotification();
6970 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6972 // We didn't expect the animation to finish yet
6973 application.SendNotification();
6974 finishCheck.CheckSignalNotReceived();
6976 // The position should have moved more, than with a linear alpha function
6977 Vector4 current(actor.GetCurrentProperty<Vector4>(index));
6978 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6979 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6980 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6981 DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
6983 application.SendNotification();
6984 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6986 // We did expect the animation to finish
6987 application.SendNotification();
6988 finishCheck.CheckSignalReceived();
6989 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
6993 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6995 TestApplication application;
6997 Actor actor = Actor::New();
6999 // Register a Vector4 property
7000 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
7001 Property::Index index = actor.RegisterProperty("testProperty", startValue);
7002 application.GetScene().Add(actor);
7003 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7004 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7006 // Build the animation
7007 float durationSeconds(1.0f);
7008 Animation animation = Animation::New(durationSeconds);
7009 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
7010 Vector4 relativeValue(targetValue - startValue);
7012 animation.AnimateTo(Property(actor, index),
7014 TimePeriod(delay, durationSeconds - delay));
7016 // Start the animation
7019 bool signalReceived(false);
7020 AnimationFinishCheck finishCheck(signalReceived);
7021 animation.FinishedSignal().Connect(&application, finishCheck);
7023 application.SendNotification();
7024 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7026 // We didn't expect the animation to finish yet
7027 application.SendNotification();
7028 finishCheck.CheckSignalNotReceived();
7029 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7031 application.SendNotification();
7032 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7034 // We didn't expect the animation to finish yet
7035 application.SendNotification();
7036 finishCheck.CheckSignalNotReceived();
7037 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
7039 application.SendNotification();
7040 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7042 // We did expect the animation to finish
7043 application.SendNotification();
7044 finishCheck.CheckSignalReceived();
7045 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
7049 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
7051 TestApplication application;
7053 Actor actor = Actor::New();
7055 // Register a Vector4 property
7056 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
7057 Property::Index index = actor.RegisterProperty("testProperty", startValue);
7058 application.GetScene().Add(actor);
7059 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7060 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7062 // Build the animation
7063 float durationSeconds(1.0f);
7064 Animation animation = Animation::New(durationSeconds);
7065 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
7066 Vector4 relativeValue(targetValue - startValue);
7068 animation.AnimateTo(Property(actor, index),
7070 AlphaFunction::LINEAR,
7071 TimePeriod(delay, durationSeconds - delay));
7073 // Start the animation
7076 bool signalReceived(false);
7077 AnimationFinishCheck finishCheck(signalReceived);
7078 animation.FinishedSignal().Connect(&application, finishCheck);
7080 application.SendNotification();
7081 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7083 // We didn't expect the animation to finish yet
7084 application.SendNotification();
7085 finishCheck.CheckSignalNotReceived();
7086 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7088 application.SendNotification();
7089 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7091 // We didn't expect the animation to finish yet
7092 application.SendNotification();
7093 finishCheck.CheckSignalNotReceived();
7094 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7096 application.SendNotification();
7097 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7099 // We did expect the animation to finish
7100 application.SendNotification();
7101 finishCheck.CheckSignalReceived();
7102 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7106 int UtcDaliAnimationAnimateToActorParentOriginP(void)
7108 TestApplication application;
7110 Actor actor = Actor::New();
7111 application.GetScene().Add(actor);
7112 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
7114 // Build the animation
7115 float durationSeconds(1.0f);
7116 Animation animation = Animation::New(durationSeconds);
7117 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
7119 DALI_TEST_ASSERTION(
7121 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
7123 "Property is not animatable");
7128 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
7130 TestApplication application;
7132 Actor actor = Actor::New();
7133 application.GetScene().Add(actor);
7134 float startValue(0.0f);
7135 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
7136 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
7138 // Build the animation
7139 float durationSeconds(1.0f);
7140 Animation animation = Animation::New(durationSeconds);
7141 float targetX(1.0f);
7143 DALI_TEST_ASSERTION(
7145 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
7147 "Property is not animatable");
7152 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7154 TestApplication application;
7156 Actor actor = Actor::New();
7157 application.GetScene().Add(actor);
7158 float startValue(0.0f);
7159 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
7160 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
7162 // Build the animation
7163 float durationSeconds(1.0f);
7164 Animation animation = Animation::New(durationSeconds);
7165 float targetY(1.0f);
7167 DALI_TEST_ASSERTION(
7169 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
7171 "Property is not animatable");
7176 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7178 TestApplication application;
7180 Actor actor = Actor::New();
7181 application.GetScene().Add(actor);
7182 float startValue(0.5f);
7183 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
7184 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
7186 // Build the animation
7187 float durationSeconds(1.0f);
7188 Animation animation = Animation::New(durationSeconds);
7189 float targetZ(1.0f);
7191 DALI_TEST_ASSERTION(
7193 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
7195 "Property is not animatable");
7200 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7202 TestApplication application;
7204 Actor actor = Actor::New();
7205 application.GetScene().Add(actor);
7206 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
7208 // Build the animation
7209 float durationSeconds(1.0f);
7210 Animation animation = Animation::New(durationSeconds);
7211 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
7213 DALI_TEST_ASSERTION(
7215 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7217 "Property is not animatable");
7222 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7224 TestApplication application;
7226 Actor actor = Actor::New();
7227 application.GetScene().Add(actor);
7228 float startValue(0.5f);
7229 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
7230 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
7232 // Build the animation
7233 float durationSeconds(1.0f);
7234 Animation animation = Animation::New(durationSeconds);
7235 float targetX(1.0f);
7237 DALI_TEST_ASSERTION(
7239 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
7241 "Property is not animatable");
7246 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7248 TestApplication application;
7250 Actor actor = Actor::New();
7251 application.GetScene().Add(actor);
7252 float startValue(0.5f);
7253 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
7254 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
7256 // Build the animation
7257 float durationSeconds(1.0f);
7258 Animation animation = Animation::New(durationSeconds);
7259 float targetY(0.0f);
7261 DALI_TEST_ASSERTION(
7263 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
7265 "Property is not animatable");
7270 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7272 TestApplication application;
7274 Actor actor = Actor::New();
7275 application.GetScene().Add(actor);
7276 float startValue(0.5f);
7277 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
7278 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
7280 // Build the animation
7281 float durationSeconds(1.0f);
7282 Animation animation = Animation::New(durationSeconds);
7283 float targetZ(100.0f);
7285 DALI_TEST_ASSERTION(
7287 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
7289 "Property is not animatable");
7294 int UtcDaliAnimationAnimateToActorSizeP(void)
7296 TestApplication application;
7298 Actor actor = Actor::New();
7299 application.GetScene().Add(actor);
7300 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7302 // Build the animation
7303 float durationSeconds(1.0f);
7304 Animation animation = Animation::New(durationSeconds);
7305 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7306 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7308 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7310 // Should return the initial properties before play
7311 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7312 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
7313 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
7314 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
7316 // Start the animation
7319 // Should return the target property after play
7320 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7321 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
7322 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
7323 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
7325 bool signalReceived(false);
7326 AnimationFinishCheck finishCheck(signalReceived);
7327 animation.FinishedSignal().Connect(&application, finishCheck);
7329 application.SendNotification();
7330 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7332 // We didn't expect the animation to finish yet
7333 application.SendNotification();
7334 finishCheck.CheckSignalNotReceived();
7335 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7337 application.SendNotification();
7338 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7340 // We did expect the animation to finish
7341 application.SendNotification();
7342 finishCheck.CheckSignalReceived();
7343 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7346 finishCheck.Reset();
7347 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7348 application.SendNotification();
7349 application.Render(0);
7350 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7352 // Repeat with a different (ease-in) alpha function
7353 animation = Animation::New(durationSeconds);
7354 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7355 animation.FinishedSignal().Connect(&application, finishCheck);
7358 application.SendNotification();
7359 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7361 // We didn't expect the animation to finish yet
7362 application.SendNotification();
7363 finishCheck.CheckSignalNotReceived();
7365 // The size should have travelled less, than with a linear alpha function
7366 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7367 DALI_TEST_CHECK(current.x > 0.0f);
7368 DALI_TEST_CHECK(current.y > 0.0f);
7369 DALI_TEST_CHECK(current.z > 0.0f);
7370 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7371 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7372 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
7374 application.SendNotification();
7375 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7377 // We did expect the animation to finish
7378 application.SendNotification();
7379 finishCheck.CheckSignalReceived();
7380 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7383 finishCheck.Reset();
7384 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7385 application.SendNotification();
7386 application.Render(0);
7387 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7389 // Repeat with a delay
7391 animation = Animation::New(durationSeconds);
7392 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7393 animation.FinishedSignal().Connect(&application, finishCheck);
7396 application.SendNotification();
7397 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7399 // We didn't expect the animation to finish yet
7400 application.SendNotification();
7401 finishCheck.CheckSignalNotReceived();
7402 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7404 application.SendNotification();
7405 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7407 // We did expect the animation to finish
7408 application.SendNotification();
7409 finishCheck.CheckSignalReceived();
7410 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7414 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7416 TestApplication application;
7418 Actor actor = Actor::New();
7419 application.GetScene().Add(actor);
7420 float startValue(0.0f);
7421 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
7422 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7424 // Build the animation
7425 float durationSeconds(1.0f);
7426 Animation animation = Animation::New(durationSeconds);
7427 float targetWidth(10.0f);
7428 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
7430 float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
7432 // Should return the initial properties before play
7433 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7434 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7436 // Start the animation
7439 // Should return the target property after play
7440 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
7441 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7443 bool signalReceived(false);
7444 AnimationFinishCheck finishCheck(signalReceived);
7445 animation.FinishedSignal().Connect(&application, finishCheck);
7447 application.SendNotification();
7448 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7450 // We didn't expect the animation to finish yet
7451 application.SendNotification();
7452 finishCheck.CheckSignalNotReceived();
7453 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
7455 application.SendNotification();
7456 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7458 // We did expect the animation to finish
7459 application.SendNotification();
7460 finishCheck.CheckSignalReceived();
7461 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
7462 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7466 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7468 TestApplication application;
7470 Actor actor = Actor::New();
7471 application.GetScene().Add(actor);
7472 float startValue(0.0f);
7473 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
7474 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7476 // Build the animation
7477 float durationSeconds(1.0f);
7478 Animation animation = Animation::New(durationSeconds);
7479 float targetHeight(-10.0f);
7480 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
7482 float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
7484 // Should return the initial properties before play
7485 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7486 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7488 // Start the animation
7491 // Should return the target property after play
7492 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
7493 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7495 bool signalReceived(false);
7496 AnimationFinishCheck finishCheck(signalReceived);
7497 animation.FinishedSignal().Connect(&application, finishCheck);
7499 application.SendNotification();
7500 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7502 // We didn't expect the animation to finish yet
7503 application.SendNotification();
7504 finishCheck.CheckSignalNotReceived();
7505 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
7507 application.SendNotification();
7508 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7510 // We did expect the animation to finish
7511 application.SendNotification();
7512 finishCheck.CheckSignalReceived();
7513 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
7514 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7518 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7520 TestApplication application;
7522 Actor actor = Actor::New();
7523 application.GetScene().Add(actor);
7524 float startValue(0.0f);
7525 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
7526 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7528 // Build the animation
7529 float durationSeconds(1.0f);
7530 Animation animation = Animation::New(durationSeconds);
7531 float targetDepth(-10.0f);
7532 animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
7534 float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
7536 // Should return the initial properties before play
7537 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7538 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7540 // Start the animation
7543 // Should return the target property after play
7544 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
7545 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7547 bool signalReceived(false);
7548 AnimationFinishCheck finishCheck(signalReceived);
7549 animation.FinishedSignal().Connect(&application, finishCheck);
7551 application.SendNotification();
7552 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7554 // We didn't expect the animation to finish yet
7555 application.SendNotification();
7556 finishCheck.CheckSignalNotReceived();
7557 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
7559 application.SendNotification();
7560 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7562 // We did expect the animation to finish
7563 application.SendNotification();
7564 finishCheck.CheckSignalReceived();
7565 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
7566 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7570 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7572 TestApplication application;
7574 Actor actor = Actor::New();
7575 application.GetScene().Add(actor);
7576 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7578 // Build the animation
7579 float durationSeconds(1.0f);
7580 Animation animation = Animation::New(durationSeconds);
7581 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7582 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7584 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7586 // Start the animation
7589 bool signalReceived(false);
7590 AnimationFinishCheck finishCheck(signalReceived);
7591 animation.FinishedSignal().Connect(&application, finishCheck);
7593 application.SendNotification();
7594 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7596 // We didn't expect the animation to finish yet
7597 application.SendNotification();
7598 finishCheck.CheckSignalNotReceived();
7599 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7601 application.SendNotification();
7602 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7604 // We did expect the animation to finish
7605 application.SendNotification();
7606 finishCheck.CheckSignalReceived();
7607 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7610 finishCheck.Reset();
7611 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7612 application.SendNotification();
7613 application.Render(0);
7614 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7616 // Repeat with a different (ease-in) alpha function
7617 animation = Animation::New(durationSeconds);
7618 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
7619 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
7620 animation.FinishedSignal().Connect(&application, finishCheck);
7623 application.SendNotification();
7624 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7626 // We didn't expect the animation to finish yet
7627 application.SendNotification();
7628 finishCheck.CheckSignalNotReceived();
7630 // The size should have travelled less, than with a linear alpha function
7631 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7632 DALI_TEST_CHECK(current.x > 0.0f);
7633 DALI_TEST_CHECK(current.y > 0.0f);
7634 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7635 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7637 application.SendNotification();
7638 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7640 // We did expect the animation to finish
7641 application.SendNotification();
7642 finishCheck.CheckSignalReceived();
7643 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7644 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7647 finishCheck.Reset();
7648 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7649 application.SendNotification();
7650 application.Render(0);
7651 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7653 // Repeat with a delay
7655 animation = Animation::New(durationSeconds);
7656 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7657 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7658 animation.FinishedSignal().Connect(&application, finishCheck);
7661 application.SendNotification();
7662 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7664 // We didn't expect the animation to finish yet
7665 application.SendNotification();
7666 finishCheck.CheckSignalNotReceived();
7667 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7669 application.SendNotification();
7670 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7672 // We did expect the animation to finish
7673 application.SendNotification();
7674 finishCheck.CheckSignalReceived();
7675 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7676 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7680 int UtcDaliAnimationAnimateToActorPositionP(void)
7682 TestApplication application;
7684 Actor actor = Actor::New();
7685 application.GetScene().Add(actor);
7686 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7688 // Build the animation
7689 float durationSeconds(1.0f);
7690 Animation animation = Animation::New(durationSeconds);
7691 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7692 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7694 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7696 // Should return the initial properties before play
7697 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7698 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
7699 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
7700 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
7702 // Start the animation
7705 // Should return the target property after play
7706 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7707 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
7708 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
7709 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
7711 bool signalReceived(false);
7712 AnimationFinishCheck finishCheck(signalReceived);
7713 animation.FinishedSignal().Connect(&application, finishCheck);
7715 application.SendNotification();
7716 application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7718 // We didn't expect the animation to finish yet
7719 application.SendNotification();
7720 finishCheck.CheckSignalNotReceived();
7721 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7723 application.SendNotification();
7724 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7726 // We did expect the animation to finish
7727 application.SendNotification();
7728 finishCheck.CheckSignalReceived();
7729 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7733 int UtcDaliAnimationAnimateToActorPositionXP(void)
7735 TestApplication application;
7737 Actor actor = Actor::New();
7738 application.GetScene().Add(actor);
7739 float startValue(0.0f);
7740 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
7741 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7742 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7743 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7745 // Build the animation
7746 float durationSeconds(1.0f);
7747 Animation animation = Animation::New(durationSeconds);
7748 float targetX(1.0f);
7749 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
7751 float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
7753 // Should return the initial properties before play
7754 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7755 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7757 // Start the animation
7760 // Should return the target property after play
7761 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
7762 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7764 bool signalReceived(false);
7765 AnimationFinishCheck finishCheck(signalReceived);
7766 animation.FinishedSignal().Connect(&application, finishCheck);
7768 application.SendNotification();
7769 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7771 // We didn't expect the animation to finish yet
7772 application.SendNotification();
7773 finishCheck.CheckSignalNotReceived();
7774 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
7776 application.SendNotification();
7777 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7779 // We did expect the animation to finish
7780 application.SendNotification();
7781 finishCheck.CheckSignalReceived();
7782 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
7783 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7784 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7785 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7789 int UtcDaliAnimationAnimateToActorPositionYP(void)
7791 TestApplication application;
7793 Actor actor = Actor::New();
7794 application.GetScene().Add(actor);
7795 float startValue(0.0f);
7796 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
7797 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7798 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7799 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7801 // Build the animation
7802 float durationSeconds(1.0f);
7803 Animation animation = Animation::New(durationSeconds);
7804 float targetY(10.0f);
7805 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
7807 float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
7809 // Should return the initial properties before play
7810 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7811 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7813 // Start the animation
7816 // Should return the target property after play
7817 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
7818 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7820 bool signalReceived(false);
7821 AnimationFinishCheck finishCheck(signalReceived);
7822 animation.FinishedSignal().Connect(&application, finishCheck);
7824 application.SendNotification();
7825 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7827 // We didn't expect the animation to finish yet
7828 application.SendNotification();
7829 finishCheck.CheckSignalNotReceived();
7830 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
7832 application.SendNotification();
7833 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7835 // We did expect the animation to finish
7836 application.SendNotification();
7837 finishCheck.CheckSignalReceived();
7838 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
7839 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7840 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7841 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7845 int UtcDaliAnimationAnimateToActorPositionZP(void)
7847 TestApplication application;
7849 Actor actor = Actor::New();
7850 application.GetScene().Add(actor);
7851 float startValue(0.0f);
7852 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
7853 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7854 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7855 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7857 // Build the animation
7858 float durationSeconds(1.0f);
7859 Animation animation = Animation::New(durationSeconds);
7860 float targetZ(-5.0f);
7861 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
7863 float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
7865 // Should return the initial properties before play
7866 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7867 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7869 // Start the animation
7872 // Should return the target property after play
7873 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
7874 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7876 bool signalReceived(false);
7877 AnimationFinishCheck finishCheck(signalReceived);
7878 animation.FinishedSignal().Connect(&application, finishCheck);
7880 application.SendNotification();
7881 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7883 // We didn't expect the animation to finish yet
7884 application.SendNotification();
7885 finishCheck.CheckSignalNotReceived();
7886 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
7888 application.SendNotification();
7889 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7891 // We did expect the animation to finish
7892 application.SendNotification();
7893 finishCheck.CheckSignalReceived();
7894 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
7895 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7896 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7897 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
7901 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7903 TestApplication application;
7905 Actor actor = Actor::New();
7906 application.GetScene().Add(actor);
7907 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7909 // Build the animation
7910 float durationSeconds(1.0f);
7911 Animation animation = Animation::New(durationSeconds);
7912 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7913 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7915 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7917 // Start the animation
7920 bool signalReceived(false);
7921 AnimationFinishCheck finishCheck(signalReceived);
7922 animation.FinishedSignal().Connect(&application, finishCheck);
7924 application.SendNotification();
7925 application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7927 // We didn't expect the animation to finish yet
7928 application.SendNotification();
7929 finishCheck.CheckSignalNotReceived();
7931 // The position should have moved less, than with a linear alpha function
7932 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
7933 DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
7934 DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
7935 DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
7936 DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
7937 DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
7938 DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
7940 application.SendNotification();
7941 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7943 // We did expect the animation to finish
7944 application.SendNotification();
7945 finishCheck.CheckSignalReceived();
7946 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7950 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7952 TestApplication application;
7954 Actor actor = Actor::New();
7955 application.GetScene().Add(actor);
7956 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7958 // Build the animation
7959 float durationSeconds(1.0f);
7960 Animation animation = Animation::New(durationSeconds);
7961 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7963 animation.AnimateTo(Property(actor, Actor::Property::POSITION),
7965 TimePeriod(delay, durationSeconds - delay));
7967 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7969 // Start the animation
7972 bool signalReceived(false);
7973 AnimationFinishCheck finishCheck(signalReceived);
7974 animation.FinishedSignal().Connect(&application, finishCheck);
7976 application.SendNotification();
7977 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7979 // We didn't expect the animation to finish yet
7980 application.SendNotification();
7981 finishCheck.CheckSignalNotReceived();
7982 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7984 application.SendNotification();
7985 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
7987 // We didn't expect the animation to finish yet
7988 application.SendNotification();
7989 finishCheck.CheckSignalNotReceived();
7990 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7992 application.SendNotification();
7993 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
7995 // We did expect the animation to finish
7996 application.SendNotification();
7997 finishCheck.CheckSignalReceived();
7998 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8002 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
8004 TestApplication application;
8006 Actor actor = Actor::New();
8007 application.GetScene().Add(actor);
8008 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8010 // Build the animation
8011 float durationSeconds(1.0f);
8012 Animation animation = Animation::New(durationSeconds);
8013 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8015 animation.AnimateTo(Property(actor, Actor::Property::POSITION),
8017 AlphaFunction::LINEAR,
8018 TimePeriod(delay, durationSeconds - delay));
8020 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8022 // Start the animation
8025 bool signalReceived(false);
8026 AnimationFinishCheck finishCheck(signalReceived);
8027 animation.FinishedSignal().Connect(&application, finishCheck);
8029 application.SendNotification();
8030 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8032 // We didn't expect the animation to finish yet
8033 application.SendNotification();
8034 finishCheck.CheckSignalNotReceived();
8035 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8037 application.SendNotification();
8038 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
8040 // We didn't expect the animation to finish yet
8041 application.SendNotification();
8042 finishCheck.CheckSignalNotReceived();
8043 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
8045 application.SendNotification();
8046 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
8048 // We did expect the animation to finish
8049 application.SendNotification();
8050 finishCheck.CheckSignalReceived();
8051 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8055 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
8057 TestApplication application;
8059 Actor actor = Actor::New();
8060 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8061 application.GetScene().Add(actor);
8062 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8064 // Build the animation
8065 float durationSeconds(1.0f);
8066 Animation animation = Animation::New(durationSeconds);
8067 Degree targetRotationDegrees(90.0f);
8068 Radian targetRotationRadians(targetRotationDegrees);
8069 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
8071 // Start the animation
8074 // Target value should be retrievable straight away
8075 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8077 bool signalReceived(false);
8078 AnimationFinishCheck finishCheck(signalReceived);
8079 animation.FinishedSignal().Connect(&application, finishCheck);
8081 application.SendNotification();
8082 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8084 // We didn't expect the animation to finish yet
8085 application.SendNotification();
8086 finishCheck.CheckSignalNotReceived();
8087 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8089 application.SendNotification();
8090 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8092 // We didn't expect the animation to finish yet
8093 application.SendNotification();
8094 finishCheck.CheckSignalNotReceived();
8095 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8097 application.SendNotification();
8098 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8100 // We didn't expect the animation to finish yet
8101 application.SendNotification();
8102 finishCheck.CheckSignalNotReceived();
8103 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8105 application.SendNotification();
8106 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8108 // We did expect the animation to finish
8109 application.SendNotification();
8110 finishCheck.CheckSignalReceived();
8111 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8115 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
8117 TestApplication application;
8119 Actor actor = Actor::New();
8120 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8121 application.GetScene().Add(actor);
8122 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8124 // Build the animation
8125 float durationSeconds(1.0f);
8126 Animation animation = Animation::New(durationSeconds);
8127 Degree targetRotationDegrees(90.0f);
8128 Radian targetRotationRadians(targetRotationDegrees);
8129 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8130 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
8132 // Start the animation
8135 bool signalReceived(false);
8136 AnimationFinishCheck finishCheck(signalReceived);
8137 animation.FinishedSignal().Connect(&application, finishCheck);
8139 application.SendNotification();
8140 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8142 // We didn't expect the animation to finish yet
8143 application.SendNotification();
8144 finishCheck.CheckSignalNotReceived();
8145 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8147 application.SendNotification();
8148 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8150 // We didn't expect the animation to finish yet
8151 application.SendNotification();
8152 finishCheck.CheckSignalNotReceived();
8153 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8155 application.SendNotification();
8156 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8158 // We didn't expect the animation to finish yet
8159 application.SendNotification();
8160 finishCheck.CheckSignalNotReceived();
8161 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8163 application.SendNotification();
8164 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8166 // We did expect the animation to finish
8167 application.SendNotification();
8168 finishCheck.CheckSignalReceived();
8169 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8173 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8175 TestApplication application;
8177 Actor actor = Actor::New();
8178 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8179 application.GetScene().Add(actor);
8180 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8182 // Build the animation
8183 float durationSeconds(1.0f);
8184 Animation animation = Animation::New(durationSeconds);
8185 Degree targetRotationDegrees(90.0f);
8186 Radian targetRotationRadians(targetRotationDegrees);
8187 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8189 // Start the animation
8192 bool signalReceived(false);
8193 AnimationFinishCheck finishCheck(signalReceived);
8194 animation.FinishedSignal().Connect(&application, finishCheck);
8196 application.SendNotification();
8197 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8199 // We didn't expect the animation to finish yet
8200 application.SendNotification();
8201 finishCheck.CheckSignalNotReceived();
8202 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8204 application.SendNotification();
8205 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8207 // We didn't expect the animation to finish yet
8208 application.SendNotification();
8209 finishCheck.CheckSignalNotReceived();
8210 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8212 application.SendNotification();
8213 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8215 // We didn't expect the animation to finish yet
8216 application.SendNotification();
8217 finishCheck.CheckSignalNotReceived();
8218 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8220 application.SendNotification();
8221 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8223 // We did expect the animation to finish
8224 application.SendNotification();
8225 finishCheck.CheckSignalReceived();
8226 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8230 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8232 TestApplication application;
8234 Actor actor = Actor::New();
8235 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8236 application.GetScene().Add(actor);
8237 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8239 // Build the animation
8240 float durationSeconds(1.0f);
8241 Animation animation = Animation::New(durationSeconds);
8242 Degree targetRotationDegrees(90.0f);
8243 Radian targetRotationRadians(targetRotationDegrees);
8245 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8247 // Start the animation
8250 bool signalReceived(false);
8251 AnimationFinishCheck finishCheck(signalReceived);
8252 animation.FinishedSignal().Connect(&application, finishCheck);
8254 application.SendNotification();
8255 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8257 // We didn't expect the animation to finish yet
8258 application.SendNotification();
8259 finishCheck.CheckSignalNotReceived();
8260 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8261 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8263 application.SendNotification();
8264 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8266 // We didn't expect the animation to finish yet
8267 application.SendNotification();
8268 finishCheck.CheckSignalNotReceived();
8269 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8270 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8272 application.SendNotification();
8273 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8275 // We didn't expect the animation to finish yet
8276 application.SendNotification();
8277 finishCheck.CheckSignalNotReceived();
8278 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8279 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8281 application.SendNotification();
8282 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8284 // We did expect the animation to finish
8285 application.SendNotification();
8286 finishCheck.CheckSignalReceived();
8287 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8291 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8293 TestApplication application;
8295 Actor actor = Actor::New();
8296 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8297 application.GetScene().Add(actor);
8298 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8300 // Build the animation
8301 float durationSeconds(1.0f);
8302 Animation animation = Animation::New(durationSeconds);
8303 Degree targetRotationDegrees(90.0f);
8304 Radian targetRotationRadians(targetRotationDegrees);
8306 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8308 // Start the animation
8311 bool signalReceived(false);
8312 AnimationFinishCheck finishCheck(signalReceived);
8313 animation.FinishedSignal().Connect(&application, finishCheck);
8315 application.SendNotification();
8316 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8318 // We didn't expect the animation to finish yet
8319 application.SendNotification();
8320 finishCheck.CheckSignalNotReceived();
8321 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8322 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8324 application.SendNotification();
8325 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8327 // We didn't expect the animation to finish yet
8328 application.SendNotification();
8329 finishCheck.CheckSignalNotReceived();
8330 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8331 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8333 application.SendNotification();
8334 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8336 // We didn't expect the animation to finish yet
8337 application.SendNotification();
8338 finishCheck.CheckSignalNotReceived();
8339 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8340 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8342 application.SendNotification();
8343 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8345 // We did expect the animation to finish
8346 application.SendNotification();
8347 finishCheck.CheckSignalReceived();
8348 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8352 int UtcDaliAnimationAnimateToActorScaleP(void)
8354 TestApplication application;
8356 Actor actor = Actor::New();
8357 application.GetScene().Add(actor);
8358 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8360 // Build the animation
8361 float durationSeconds(1.0f);
8362 Animation animation = Animation::New(durationSeconds);
8363 Vector3 targetScale(2.0f, 2.0f, 2.0f);
8364 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
8366 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
8368 // Start the animation
8371 // Target value should be retrievable straight away
8372 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8373 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
8374 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
8375 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
8377 bool signalReceived(false);
8378 AnimationFinishCheck finishCheck(signalReceived);
8379 animation.FinishedSignal().Connect(&application, finishCheck);
8381 application.SendNotification();
8382 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8384 // We didn't expect the animation to finish yet
8385 application.SendNotification();
8386 finishCheck.CheckSignalNotReceived();
8387 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
8389 application.SendNotification();
8390 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8392 // We did expect the animation to finish
8393 application.SendNotification();
8394 finishCheck.CheckSignalReceived();
8395 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8398 finishCheck.Reset();
8399 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8400 application.SendNotification();
8401 application.Render(0);
8402 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8404 // Repeat with a different (ease-in) alpha function
8405 animation = Animation::New(durationSeconds);
8406 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8407 animation.FinishedSignal().Connect(&application, finishCheck);
8410 application.SendNotification();
8411 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8413 // We didn't expect the animation to finish yet
8414 application.SendNotification();
8415 finishCheck.CheckSignalNotReceived();
8417 // The scale should have grown less, than with a linear alpha function
8418 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
8419 DALI_TEST_CHECK(current.x > 1.0f);
8420 DALI_TEST_CHECK(current.y > 1.0f);
8421 DALI_TEST_CHECK(current.z > 1.0f);
8422 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
8423 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
8424 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
8426 application.SendNotification();
8427 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8429 // We did expect the animation to finish
8430 application.SendNotification();
8431 finishCheck.CheckSignalReceived();
8432 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8435 finishCheck.Reset();
8436 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8437 application.SendNotification();
8438 application.Render(0);
8439 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8441 // Repeat with a delay
8443 animation = Animation::New(durationSeconds);
8444 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8445 animation.FinishedSignal().Connect(&application, finishCheck);
8448 application.SendNotification();
8449 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8451 // We didn't expect the animation to finish yet
8452 application.SendNotification();
8453 finishCheck.CheckSignalNotReceived();
8454 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8456 application.SendNotification();
8457 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8459 // We did expect the animation to finish
8460 application.SendNotification();
8461 finishCheck.CheckSignalReceived();
8462 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8466 int UtcDaliAnimationAnimateToActorScaleXP(void)
8468 TestApplication application;
8470 Actor actor = Actor::New();
8471 application.GetScene().Add(actor);
8472 float startValue(1.0f);
8473 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
8474 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8475 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8476 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8477 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8478 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8479 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8481 // Build the animation
8482 float durationSeconds(1.0f);
8483 Animation animation = Animation::New(durationSeconds);
8484 float targetX(10.0f);
8485 animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
8487 float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
8489 // Start the animation
8492 // Target value should be retrievable straight away
8493 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
8494 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8496 bool signalReceived(false);
8497 AnimationFinishCheck finishCheck(signalReceived);
8498 animation.FinishedSignal().Connect(&application, finishCheck);
8500 application.SendNotification();
8501 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8503 // We didn't expect the animation to finish yet
8504 application.SendNotification();
8505 finishCheck.CheckSignalNotReceived();
8506 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
8507 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
8508 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8509 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8511 application.SendNotification();
8512 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8514 // We did expect the animation to finish
8515 application.SendNotification();
8516 finishCheck.CheckSignalReceived();
8517 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
8518 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8519 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8520 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8524 int UtcDaliAnimationAnimateToActorScaleYP(void)
8526 TestApplication application;
8528 Actor actor = Actor::New();
8529 application.GetScene().Add(actor);
8530 float startValue(1.0f);
8531 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
8532 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8533 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8534 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8535 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8536 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8537 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8539 // Build the animation
8540 float durationSeconds(1.0f);
8541 Animation animation = Animation::New(durationSeconds);
8542 float targetY(1000.0f);
8543 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
8545 float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
8547 // Start the animation
8550 // Target value should be retrievable straight away
8551 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
8552 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8554 bool signalReceived(false);
8555 AnimationFinishCheck finishCheck(signalReceived);
8556 animation.FinishedSignal().Connect(&application, finishCheck);
8558 application.SendNotification();
8559 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8561 // We didn't expect the animation to finish yet
8562 application.SendNotification();
8563 finishCheck.CheckSignalNotReceived();
8564 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION);
8565 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8566 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION);
8567 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8569 application.SendNotification();
8570 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8572 // We did expect the animation to finish
8573 application.SendNotification();
8574 finishCheck.CheckSignalReceived();
8575 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
8576 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8577 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8578 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8582 int UtcDaliAnimationAnimateToActorScaleZP(void)
8584 TestApplication application;
8586 Actor actor = Actor::New();
8587 application.GetScene().Add(actor);
8588 float startValue(1.0f);
8589 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
8590 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8591 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8592 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8593 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8594 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8595 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8597 // Build the animation
8598 float durationSeconds(1.0f);
8599 Animation animation = Animation::New(durationSeconds);
8600 float targetZ(-1000.0f);
8601 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
8603 float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8605 // Start the animation
8608 // Target value should be retrievable straight away
8609 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
8610 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8612 bool signalReceived(false);
8613 AnimationFinishCheck finishCheck(signalReceived);
8614 animation.FinishedSignal().Connect(&application, finishCheck);
8616 application.SendNotification();
8617 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8619 // We didn't expect the animation to finish yet
8620 application.SendNotification();
8621 finishCheck.CheckSignalNotReceived();
8622 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION);
8623 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8624 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8625 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION);
8627 application.SendNotification();
8628 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8630 // We did expect the animation to finish
8631 application.SendNotification();
8632 finishCheck.CheckSignalReceived();
8633 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
8634 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8635 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8636 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8640 int UtcDaliAnimationAnimateToActorColorP(void)
8642 TestApplication application;
8644 Actor actor = Actor::New();
8645 application.GetScene().Add(actor);
8646 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8648 // Build the animation
8649 float durationSeconds(1.0f);
8650 Animation animation = Animation::New(durationSeconds);
8651 Vector4 targetColor(Color::RED);
8652 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
8654 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8655 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8657 // Start the animation
8660 // Target value should be retrievable straight away
8661 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8662 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
8663 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
8664 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
8665 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
8666 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
8668 bool signalReceived(false);
8669 AnimationFinishCheck finishCheck(signalReceived);
8670 animation.FinishedSignal().Connect(&application, finishCheck);
8672 application.SendNotification();
8673 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8675 // We didn't expect the animation to finish yet
8676 application.SendNotification();
8677 finishCheck.CheckSignalNotReceived();
8678 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
8680 application.SendNotification();
8681 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8683 // We did expect the animation to finish
8684 application.SendNotification();
8685 finishCheck.CheckSignalReceived();
8686 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8689 finishCheck.Reset();
8690 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8691 application.SendNotification();
8692 application.Render(0);
8693 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8695 // Repeat with a different (ease-in) alpha function
8696 animation = Animation::New(durationSeconds);
8697 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8698 animation.FinishedSignal().Connect(&application, finishCheck);
8701 application.SendNotification();
8702 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8704 // We didn't expect the animation to finish yet
8705 application.SendNotification();
8706 finishCheck.CheckSignalNotReceived();
8708 // The color should have changed less, than with a linear alpha function
8709 Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
8710 DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
8711 DALI_TEST_CHECK(current.y < 1.0f);
8712 DALI_TEST_CHECK(current.y > tenPercentProgress.y);
8713 DALI_TEST_CHECK(current.z < 1.0f);
8714 DALI_TEST_CHECK(current.z > tenPercentProgress.z);
8715 DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
8717 application.SendNotification();
8718 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8720 // We did expect the animation to finish
8721 application.SendNotification();
8722 finishCheck.CheckSignalReceived();
8723 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8726 finishCheck.Reset();
8727 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8728 application.SendNotification();
8729 application.Render(0);
8730 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8732 // Repeat with a shorter animator duration
8733 float animatorDuration = 0.5f;
8734 animation = Animation::New(durationSeconds);
8735 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8736 animation.FinishedSignal().Connect(&application, finishCheck);
8739 application.SendNotification();
8740 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
8742 // We didn't expect the animation to finish yet
8743 application.SendNotification();
8744 finishCheck.CheckSignalNotReceived();
8745 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
8747 application.SendNotification();
8748 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
8750 // We didn't expect the animation to finish yet
8751 application.SendNotification();
8752 finishCheck.CheckSignalNotReceived();
8753 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8755 application.SendNotification();
8756 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8758 // We did expect the animation to finish
8759 application.SendNotification();
8760 finishCheck.CheckSignalReceived();
8761 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8765 int UtcDaliAnimationAnimateToActorColorRedP(void)
8767 TestApplication application;
8769 Actor actor = Actor::New();
8770 application.GetScene().Add(actor);
8771 float startValue(1.0f);
8772 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
8773 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8774 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8775 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8776 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8777 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8778 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8779 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8780 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8782 // Build the animation
8783 float durationSeconds(1.0f);
8784 Animation animation = Animation::New(durationSeconds);
8785 float targetRed(0.5f);
8786 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
8788 float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
8790 // Start the animation
8793 // Target value should be retrievable straight away
8794 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
8795 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8797 bool signalReceived(false);
8798 AnimationFinishCheck finishCheck(signalReceived);
8799 animation.FinishedSignal().Connect(&application, finishCheck);
8801 application.SendNotification();
8802 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8804 // We didn't expect the animation to finish yet
8805 application.SendNotification();
8806 finishCheck.CheckSignalNotReceived();
8807 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
8808 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
8809 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8810 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8811 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8813 application.SendNotification();
8814 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8816 // We did expect the animation to finish
8817 application.SendNotification();
8818 finishCheck.CheckSignalReceived();
8819 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
8820 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8821 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8822 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8823 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8827 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8829 TestApplication application;
8831 Actor actor = Actor::New();
8832 application.GetScene().Add(actor);
8833 float startValue(1.0f);
8834 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
8835 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8836 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8837 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8838 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8839 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8840 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8841 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8842 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8844 // Build the animation
8845 float durationSeconds(1.0f);
8846 Animation animation = Animation::New(durationSeconds);
8847 float targetGreen(0.5f);
8848 animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
8850 float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
8852 // Start the animation
8855 // Target value should be retrievable straight away
8856 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
8857 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8859 bool signalReceived(false);
8860 AnimationFinishCheck finishCheck(signalReceived);
8861 animation.FinishedSignal().Connect(&application, finishCheck);
8863 application.SendNotification();
8864 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8866 // We didn't expect the animation to finish yet
8867 application.SendNotification();
8868 finishCheck.CheckSignalNotReceived();
8869 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
8870 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8871 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
8872 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8873 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8875 application.SendNotification();
8876 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8878 // We did expect the animation to finish
8879 application.SendNotification();
8880 finishCheck.CheckSignalReceived();
8881 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
8882 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8883 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
8884 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8885 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8889 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8891 TestApplication application;
8893 Actor actor = Actor::New();
8894 application.GetScene().Add(actor);
8895 float startValue(1.0f);
8896 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
8897 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8898 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8899 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8900 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8901 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8902 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8903 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8904 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8906 // Build the animation
8907 float durationSeconds(1.0f);
8908 Animation animation = Animation::New(durationSeconds);
8909 float targetBlue(0.5f);
8910 animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
8912 float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
8914 // Start the animation
8917 // Target value should be retrievable straight away
8918 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
8919 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8921 bool signalReceived(false);
8922 AnimationFinishCheck finishCheck(signalReceived);
8923 animation.FinishedSignal().Connect(&application, finishCheck);
8925 application.SendNotification();
8926 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8928 // We didn't expect the animation to finish yet
8929 application.SendNotification();
8930 finishCheck.CheckSignalNotReceived();
8931 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
8932 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8933 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8934 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
8935 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8937 application.SendNotification();
8938 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8940 // We did expect the animation to finish
8941 application.SendNotification();
8942 finishCheck.CheckSignalReceived();
8943 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
8944 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8945 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8946 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
8947 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8951 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8953 TestApplication application;
8955 Actor actor = Actor::New();
8956 application.GetScene().Add(actor);
8957 float startValue(1.0f);
8958 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
8959 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8960 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8961 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8962 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8963 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8964 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8965 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8966 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8968 // Build the animation
8969 float durationSeconds(1.0f);
8970 Animation animation = Animation::New(durationSeconds);
8971 float targetAlpha(0.5f);
8972 animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
8974 float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
8976 // Start the animation
8979 // Target value should be retrievable straight away
8980 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
8981 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
8982 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
8984 bool signalReceived(false);
8985 AnimationFinishCheck finishCheck(signalReceived);
8986 animation.FinishedSignal().Connect(&application, finishCheck);
8988 application.SendNotification();
8989 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8991 // We didn't expect the animation to finish yet
8992 application.SendNotification();
8993 finishCheck.CheckSignalNotReceived();
8994 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
8995 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8996 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8997 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8998 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
9000 application.SendNotification();
9001 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9003 // We did expect the animation to finish
9004 application.SendNotification();
9005 finishCheck.CheckSignalReceived();
9006 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
9007 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9008 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9009 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9010 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
9014 int UtcDaliAnimationKeyFrames01P(void)
9016 TestApplication application;
9018 KeyFrames keyFrames = KeyFrames::New();
9019 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9021 keyFrames.Add(0.0f, 0.1f);
9023 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9025 KeyFrames keyFrames2(keyFrames);
9026 DALI_TEST_CHECK(keyFrames2);
9027 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
9029 KeyFrames keyFrames3 = KeyFrames::New();
9030 keyFrames3.Add(0.6f, true);
9031 DALI_TEST_CHECK(keyFrames3);
9032 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
9034 keyFrames3 = keyFrames;
9035 DALI_TEST_CHECK(keyFrames3);
9036 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
9041 int UtcDaliAnimationKeyFrames02N(void)
9043 TestApplication application;
9045 KeyFrames keyFrames = KeyFrames::New();
9046 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9048 keyFrames.Add(0.0f, 0.1f);
9049 keyFrames.Add(0.2f, 0.5f);
9050 keyFrames.Add(0.4f, 0.0f);
9051 keyFrames.Add(0.6f, 1.0f);
9052 keyFrames.Add(0.8f, 0.7f);
9053 keyFrames.Add(1.0f, 0.9f);
9055 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9057 DALI_TEST_ASSERTION(
9059 keyFrames.Add(1.9f, false);
9061 "mType == value.GetType()");
9066 int UtcDaliAnimationKeyFrames03N(void)
9068 TestApplication application;
9070 KeyFrames keyFrames = KeyFrames::New();
9071 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9073 keyFrames.Add(0.0f, true);
9074 keyFrames.Add(0.2f, false);
9075 keyFrames.Add(0.4f, false);
9076 keyFrames.Add(0.6f, true);
9077 keyFrames.Add(0.8f, true);
9078 keyFrames.Add(1.0f, false);
9080 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
9082 DALI_TEST_ASSERTION(
9084 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9086 "mType == value.GetType()");
9091 int UtcDaliAnimationKeyFrames04N(void)
9093 TestApplication application;
9095 KeyFrames keyFrames = KeyFrames::New();
9096 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9098 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
9099 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
9100 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
9101 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
9102 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
9103 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
9105 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
9107 DALI_TEST_ASSERTION(
9109 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9111 "mType == value.GetType()");
9116 int UtcDaliAnimationKeyFrames05N(void)
9118 TestApplication application;
9120 KeyFrames keyFrames = KeyFrames::New();
9121 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9123 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
9124 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
9125 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
9126 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
9127 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
9128 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
9130 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
9132 DALI_TEST_ASSERTION(
9134 keyFrames.Add(0.7f, 1.0f);
9136 "mType == value.GetType()");
9141 int UtcDaliAnimationKeyFrames06N(void)
9143 TestApplication application;
9145 KeyFrames keyFrames = KeyFrames::New();
9146 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9148 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
9149 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9150 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
9151 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
9152 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
9153 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
9155 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
9157 DALI_TEST_ASSERTION(
9159 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9161 "mType == value.GetType()");
9166 int UtcDaliAnimationKeyFrames07N(void)
9168 TestApplication application;
9170 KeyFrames keyFrames = KeyFrames::New();
9171 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9173 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9174 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9175 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9176 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9177 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9178 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9180 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9182 DALI_TEST_ASSERTION(
9184 keyFrames.Add(0.7f, 1.1f);
9186 "mType == value.GetType()");
9191 int UtcDaliAnimationKeyFramesGetKeyFrameCountP(void)
9193 TestApplication application;
9195 KeyFrames keyFrames = KeyFrames::New();
9196 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9197 keyFrames.Add(0.6f, Vector4(0.0f, 0.0f, 0.0f, 0.3f));
9198 keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9200 DALI_TEST_EQUALS(DevelKeyFrames::GetKeyFrameCount(keyFrames), 3, TEST_LOCATION);
9205 int UtcDaliAnimationKeyFramesGetKeyFrameP(void)
9207 TestApplication application;
9209 float inputTime = 0.6f;
9210 Vector4 inputValue = Vector4(0.0f, 0.0f, 0.0f, 0.3f);
9212 KeyFrames keyFrames = KeyFrames::New();
9213 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9214 keyFrames.Add(inputTime, inputValue);
9215 keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9218 Property::Value outputValue;
9220 DevelKeyFrames::GetKeyFrame(keyFrames, 3, outputTime, outputValue);
9222 DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9224 DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9226 DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9227 DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9228 DALI_TEST_EQUALS(outputValue.Get<Vector4>(), inputValue, TEST_LOCATION);
9233 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9235 TestApplication application;
9237 float startValue(1.0f);
9238 Actor actor = Actor::New();
9239 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9240 application.GetScene().Add(actor);
9242 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9243 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9244 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9245 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9246 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9247 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9248 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9249 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9250 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9252 // Build the animation
9253 float durationSeconds(1.0f);
9254 Animation animation = Animation::New(durationSeconds);
9256 KeyFrames keyFrames = KeyFrames::New();
9257 keyFrames.Add(0.0f, 0.1f);
9258 keyFrames.Add(0.2f, 0.5f);
9259 keyFrames.Add(0.4f, 0.0f);
9260 keyFrames.Add(0.6f, 1.0f);
9261 keyFrames.Add(0.8f, 0.7f);
9262 keyFrames.Add(1.0f, 0.9f);
9264 animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
9266 // Start the animation
9269 // Final key frame value should be retrievable straight away
9270 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
9272 bool signalReceived(false);
9273 AnimationFinishCheck finishCheck(signalReceived);
9274 animation.FinishedSignal().Connect(&application, finishCheck);
9275 application.SendNotification();
9276 application.Render(0);
9277 application.SendNotification();
9278 finishCheck.CheckSignalNotReceived();
9279 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9281 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% 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.3f, 0.01f, TEST_LOCATION);
9287 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
9289 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% 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.25f, 0.01f, TEST_LOCATION);
9295 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
9297 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9298 application.SendNotification();
9299 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9300 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9301 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9302 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9303 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9305 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9306 application.SendNotification();
9307 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9308 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9309 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9310 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9311 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9313 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9314 application.SendNotification();
9315 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9316 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9317 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9318 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
9319 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
9321 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9322 application.SendNotification();
9323 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9324 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9325 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9326 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9327 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9329 // We did expect the animation to finish
9331 finishCheck.CheckSignalReceived();
9335 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9337 TestApplication application;
9339 float startValue(1.0f);
9340 Actor actor = Actor::New();
9341 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9342 application.GetScene().Add(actor);
9344 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9345 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9346 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9347 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9348 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9349 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9350 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9351 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9352 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9354 // Build the animation
9355 float durationSeconds(1.0f);
9356 Animation animation = Animation::New(durationSeconds);
9358 KeyFrames keyFrames = KeyFrames::New();
9359 keyFrames.Add(0.0f, 0.1f);
9360 keyFrames.Add(0.2f, 0.5f);
9361 keyFrames.Add(0.4f, 0.0f);
9362 keyFrames.Add(0.6f, 1.0f);
9363 keyFrames.Add(0.8f, 0.7f);
9364 keyFrames.Add(1.0f, 0.9f);
9366 animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
9368 // Start the animation
9371 bool signalReceived(false);
9372 AnimationFinishCheck finishCheck(signalReceived);
9373 animation.FinishedSignal().Connect(&application, finishCheck);
9374 application.SendNotification();
9375 application.Render(0);
9376 application.SendNotification();
9377 finishCheck.CheckSignalNotReceived();
9378 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9380 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9381 application.SendNotification();
9382 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9383 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9384 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9385 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
9386 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
9388 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9389 application.SendNotification();
9390 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9391 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9392 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9393 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
9394 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
9396 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9397 application.SendNotification();
9398 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9399 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9400 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9401 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9402 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9404 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9405 application.SendNotification();
9406 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9407 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9408 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9409 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9410 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9412 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9413 application.SendNotification();
9414 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9415 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9416 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9417 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION);
9418 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
9420 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9421 application.SendNotification();
9422 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9423 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9424 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9425 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9426 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9428 // We did expect the animation to finish
9430 finishCheck.CheckSignalReceived();
9434 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9436 TestApplication application;
9438 float startValue(1.0f);
9439 Actor actor = Actor::New();
9440 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9441 application.GetScene().Add(actor);
9443 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9444 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9445 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9446 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9447 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9448 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9449 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9450 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9451 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9453 // Build the animation
9454 float durationSeconds(1.0f);
9455 Animation animation = Animation::New(durationSeconds);
9457 KeyFrames keyFrames = KeyFrames::New();
9458 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9459 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9460 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9462 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
9464 // Start the animation
9467 bool signalReceived(false);
9468 AnimationFinishCheck finishCheck(signalReceived);
9469 animation.FinishedSignal().Connect(&application, finishCheck);
9470 application.SendNotification();
9471 application.Render(0);
9472 application.SendNotification();
9473 finishCheck.CheckSignalNotReceived();
9474 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9475 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9476 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9477 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9479 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9480 application.SendNotification();
9481 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9482 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9483 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9484 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9486 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9487 application.SendNotification();
9488 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9489 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9490 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9491 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9493 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9494 application.SendNotification();
9495 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9496 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9497 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9498 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9500 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9501 application.SendNotification();
9502 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9503 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9504 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9505 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9507 // We did expect the animation to finish
9509 finishCheck.CheckSignalReceived();
9513 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9515 TestApplication application;
9517 float startValue(1.0f);
9518 Actor actor = Actor::New();
9519 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9520 application.GetScene().Add(actor);
9522 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9523 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9524 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9525 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9526 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9527 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9528 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9529 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9530 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9532 // Build the animation
9533 float durationSeconds(1.0f);
9534 Animation animation = Animation::New(durationSeconds);
9536 KeyFrames keyFrames = KeyFrames::New();
9537 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9538 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9539 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9541 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
9543 // Start the animation
9546 bool signalReceived(false);
9547 AnimationFinishCheck finishCheck(signalReceived);
9548 animation.FinishedSignal().Connect(&application, finishCheck);
9549 application.SendNotification();
9550 application.Render(0);
9551 application.SendNotification();
9552 finishCheck.CheckSignalNotReceived();
9553 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9554 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9555 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9556 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9558 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9559 application.SendNotification();
9560 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9561 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9562 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9563 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9565 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9566 application.SendNotification();
9567 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9568 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9569 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9570 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9572 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9573 application.SendNotification();
9574 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9575 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9576 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9577 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9579 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9580 application.SendNotification();
9581 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9582 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9583 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9584 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9586 // We did expect the animation to finish
9588 finishCheck.CheckSignalReceived();
9592 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9594 TestApplication application;
9596 Actor actor = Actor::New();
9597 AngleAxis aa(Degree(90), Vector3::XAXIS);
9598 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9599 application.GetScene().Add(actor);
9601 application.SendNotification();
9602 application.Render(0);
9604 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9606 // Build the animation
9607 float durationSeconds(1.0f);
9608 Animation animation = Animation::New(durationSeconds);
9610 KeyFrames keyFrames = KeyFrames::New();
9611 keyFrames.Add(0.0f, false);
9612 keyFrames.Add(0.2f, true);
9613 keyFrames.Add(0.4f, true);
9614 keyFrames.Add(0.8f, false);
9615 keyFrames.Add(1.0f, true);
9617 animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
9619 // Start the animation
9622 // Final key frame value should be retrievable straight away
9623 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9625 bool signalReceived(false);
9626 AnimationFinishCheck finishCheck(signalReceived);
9627 animation.FinishedSignal().Connect(&application, finishCheck);
9628 application.SendNotification();
9629 application.SendNotification();
9630 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9631 application.SendNotification();
9632 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9633 application.SendNotification();
9635 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9636 finishCheck.CheckSignalReceived();
9640 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9642 TestApplication application;
9644 Actor actor = Actor::New();
9645 AngleAxis aa(Degree(90), Vector3::XAXIS);
9646 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9647 application.GetScene().Add(actor);
9649 application.SendNotification();
9650 application.Render(0);
9652 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9654 // Build the animation
9655 float durationSeconds(1.0f);
9656 Animation animation = Animation::New(durationSeconds);
9658 KeyFrames keyFrames = KeyFrames::New();
9659 keyFrames.Add(0.0f, false);
9660 keyFrames.Add(0.2f, true);
9661 keyFrames.Add(0.4f, true);
9662 keyFrames.Add(0.8f, false);
9663 keyFrames.Add(1.0f, true);
9665 //Cubic interpolation for boolean values should be ignored
9666 animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
9668 // Start the animation
9671 bool signalReceived(false);
9672 AnimationFinishCheck finishCheck(signalReceived);
9673 animation.FinishedSignal().Connect(&application, finishCheck);
9674 application.SendNotification();
9675 application.SendNotification();
9676 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9677 application.SendNotification();
9678 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9679 application.SendNotification();
9681 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9682 finishCheck.CheckSignalReceived();
9686 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9688 TestApplication application;
9690 Actor actor = Actor::New();
9691 AngleAxis aa(Degree(90), Vector3::XAXIS);
9692 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9693 application.GetScene().Add(actor);
9695 application.SendNotification();
9696 application.Render(0);
9697 Quaternion start(Radian(aa.angle), aa.axis);
9698 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9700 // Build the animation
9701 float durationSeconds(1.0f);
9702 Animation animation = Animation::New(durationSeconds);
9704 KeyFrames keyFrames = KeyFrames::New();
9705 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9707 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9709 // Start the animation
9712 // Final key frame value should be retrievable straight away
9713 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
9715 bool signalReceived(false);
9716 AnimationFinishCheck finishCheck(signalReceived);
9717 animation.FinishedSignal().Connect(&application, finishCheck);
9718 application.SendNotification();
9719 application.SendNotification();
9720 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9721 application.SendNotification();
9722 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9723 application.SendNotification();
9725 Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9727 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9728 finishCheck.CheckSignalReceived();
9732 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9734 TestApplication application;
9736 Actor actor = Actor::New();
9737 AngleAxis aa(Degree(90), Vector3::XAXIS);
9738 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9739 application.SendNotification();
9740 application.Render(0);
9741 application.GetScene().Add(actor);
9743 Quaternion start(Radian(aa.angle), aa.axis);
9744 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9746 // Build the animation
9747 float durationSeconds(1.0f);
9748 Animation animation = Animation::New(durationSeconds);
9750 KeyFrames keyFrames = KeyFrames::New();
9751 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9752 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9753 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9755 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9757 // Start the animation
9760 bool signalReceived(false);
9761 AnimationFinishCheck finishCheck(signalReceived);
9762 animation.FinishedSignal().Connect(&application, finishCheck);
9763 application.SendNotification();
9764 application.Render(0);
9765 application.SendNotification();
9766 finishCheck.CheckSignalNotReceived();
9768 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9769 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9771 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9772 application.SendNotification();
9773 check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9774 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9776 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9777 application.SendNotification();
9778 check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9779 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9781 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9782 application.SendNotification();
9783 check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9784 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9786 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9787 application.SendNotification();
9788 check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9789 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9791 // We did expect the animation to finish
9793 finishCheck.CheckSignalReceived();
9797 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9799 TestApplication application;
9801 Actor actor = Actor::New();
9802 AngleAxis aa(Degree(90), Vector3::XAXIS);
9803 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9804 application.GetScene().Add(actor);
9806 application.SendNotification();
9807 application.Render(0);
9808 Quaternion start(Radian(aa.angle), aa.axis);
9809 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9811 // Build the animation
9812 float durationSeconds(1.0f);
9813 Animation animation = Animation::New(durationSeconds);
9815 KeyFrames keyFrames = KeyFrames::New();
9816 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9818 //Cubic interpolation should be ignored for quaternions
9819 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9821 // Start the animation
9824 bool signalReceived(false);
9825 AnimationFinishCheck finishCheck(signalReceived);
9826 animation.FinishedSignal().Connect(&application, finishCheck);
9827 application.SendNotification();
9828 application.SendNotification();
9829 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9830 application.SendNotification();
9831 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9832 application.SendNotification();
9834 Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9836 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9837 finishCheck.CheckSignalReceived();
9841 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9843 TestApplication application;
9845 Actor actor = Actor::New();
9846 AngleAxis aa(Degree(90), Vector3::XAXIS);
9847 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9848 application.SendNotification();
9849 application.Render(0);
9850 application.GetScene().Add(actor);
9852 Quaternion start(Radian(aa.angle), aa.axis);
9853 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9855 // Build the animation
9856 float durationSeconds(1.0f);
9857 Animation animation = Animation::New(durationSeconds);
9859 KeyFrames keyFrames = KeyFrames::New();
9860 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9861 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9862 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9864 //Cubic interpolation should be ignored for quaternions
9865 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
9867 // Start the animation
9870 bool signalReceived(false);
9871 AnimationFinishCheck finishCheck(signalReceived);
9872 animation.FinishedSignal().Connect(&application, finishCheck);
9873 application.SendNotification();
9874 application.Render(0);
9875 application.SendNotification();
9876 finishCheck.CheckSignalNotReceived();
9878 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9879 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9881 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9882 application.SendNotification();
9883 check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9884 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9886 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9887 application.SendNotification();
9888 check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
9889 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9891 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9892 application.SendNotification();
9893 check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
9894 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9896 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9897 application.SendNotification();
9898 check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
9899 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9901 // We did expect the animation to finish
9903 finishCheck.CheckSignalReceived();
9907 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9909 TestApplication application;
9911 float startValue(1.0f);
9912 Actor actor = Actor::New();
9913 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9914 application.GetScene().Add(actor);
9916 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9917 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9918 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9919 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9920 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9921 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9922 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9923 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9924 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9926 // Build the animation
9927 float durationSeconds(1.0f);
9928 Animation animation = Animation::New(durationSeconds);
9930 KeyFrames keyFrames = KeyFrames::New();
9931 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9932 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9933 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9935 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
9937 // Start the animation
9940 bool signalReceived(false);
9941 AnimationFinishCheck finishCheck(signalReceived);
9942 animation.FinishedSignal().Connect(&application, finishCheck);
9943 application.SendNotification();
9944 application.Render(0);
9945 application.SendNotification();
9946 finishCheck.CheckSignalNotReceived();
9947 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9948 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9949 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9950 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9952 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9953 application.SendNotification();
9954 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9955 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9956 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9957 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9959 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9960 application.SendNotification();
9961 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9962 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9963 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9964 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9966 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9967 application.SendNotification();
9968 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9969 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9970 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9971 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9973 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9974 application.SendNotification();
9975 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9976 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9977 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9978 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9980 // We did expect the animation to finish
9982 finishCheck.CheckSignalReceived();
9986 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9988 TestApplication application;
9990 float startValue(1.0f);
9991 Actor actor = Actor::New();
9992 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9993 application.GetScene().Add(actor);
9995 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9996 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9997 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9998 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9999 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10000 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10001 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10002 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10003 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10005 // Build the animation
10006 float durationSeconds(1.0f);
10007 Animation animation = Animation::New(durationSeconds);
10009 KeyFrames keyFrames = KeyFrames::New();
10010 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10011 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10012 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10014 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
10016 // Start the animation
10019 bool signalReceived(false);
10020 AnimationFinishCheck finishCheck(signalReceived);
10021 animation.FinishedSignal().Connect(&application, finishCheck);
10022 application.SendNotification();
10023 application.Render(0);
10024 application.SendNotification();
10025 finishCheck.CheckSignalNotReceived();
10026 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10027 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10028 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10029 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10031 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10032 application.SendNotification();
10033 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10034 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10035 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10036 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10038 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10039 application.SendNotification();
10040 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10041 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10042 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10043 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10045 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10046 application.SendNotification();
10047 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10048 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10049 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10050 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10052 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10053 application.SendNotification();
10054 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10055 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10056 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10057 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10059 // We did expect the animation to finish
10061 finishCheck.CheckSignalReceived();
10065 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
10067 TestApplication application;
10069 float startValue(1.0f);
10070 Actor actor = Actor::New();
10071 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10072 application.GetScene().Add(actor);
10074 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10075 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10076 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10077 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10078 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10079 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10080 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10081 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10082 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10084 // Build the animation
10085 float durationSeconds(1.0f);
10086 float delay = 0.5f;
10087 Animation animation = Animation::New(durationSeconds);
10089 KeyFrames keyFrames = KeyFrames::New();
10090 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10091 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10092 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10094 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay));
10096 // Start the animation
10099 bool signalReceived(false);
10100 AnimationFinishCheck finishCheck(signalReceived);
10101 animation.FinishedSignal().Connect(&application, finishCheck);
10102 application.SendNotification();
10104 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10105 application.SendNotification();
10106 finishCheck.CheckSignalNotReceived();
10107 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10108 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10109 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10110 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10112 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10113 application.SendNotification();
10114 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10115 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10116 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10117 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10119 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10120 application.SendNotification();
10121 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10122 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10123 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10124 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10126 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10127 application.SendNotification();
10128 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10129 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10130 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10131 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10133 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10134 application.SendNotification();
10135 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10136 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10137 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10138 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10140 // We did expect the animation to finish
10142 finishCheck.CheckSignalReceived();
10146 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
10148 TestApplication application;
10150 float startValue(1.0f);
10151 Actor actor = Actor::New();
10152 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10153 application.GetScene().Add(actor);
10155 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10156 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10157 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10158 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10159 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10160 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10161 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10162 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10163 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10165 // Build the animation
10166 float durationSeconds(1.0f);
10167 float delay = 0.5f;
10168 Animation animation = Animation::New(durationSeconds);
10170 KeyFrames keyFrames = KeyFrames::New();
10171 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10172 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10173 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10175 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10177 // Start the animation
10180 bool signalReceived(false);
10181 AnimationFinishCheck finishCheck(signalReceived);
10182 animation.FinishedSignal().Connect(&application, finishCheck);
10183 application.SendNotification();
10185 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10186 application.SendNotification();
10187 finishCheck.CheckSignalNotReceived();
10188 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10189 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10190 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10191 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10193 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10194 application.SendNotification();
10195 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10196 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10197 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10198 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10200 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10201 application.SendNotification();
10202 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10203 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10204 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10205 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10207 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10208 application.SendNotification();
10209 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10210 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10211 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10212 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10214 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10215 application.SendNotification();
10216 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10217 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10218 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10219 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10221 // We did expect the animation to finish
10223 finishCheck.CheckSignalReceived();
10227 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10229 TestApplication application;
10231 float startValue(1.0f);
10232 float delay = 0.5f;
10233 Actor actor = Actor::New();
10234 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10235 application.GetScene().Add(actor);
10237 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10238 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10239 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10240 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10241 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10242 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10243 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10244 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10245 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10247 // Build the animation
10248 float durationSeconds(1.0f);
10249 Animation animation = Animation::New(durationSeconds);
10251 KeyFrames keyFrames = KeyFrames::New();
10252 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10253 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10254 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10256 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
10258 // Start the animation
10261 bool signalReceived(false);
10262 AnimationFinishCheck finishCheck(signalReceived);
10263 animation.FinishedSignal().Connect(&application, finishCheck);
10264 application.SendNotification();
10266 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10267 application.SendNotification();
10268 finishCheck.CheckSignalNotReceived();
10269 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10270 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10271 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10272 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10274 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10275 application.SendNotification();
10276 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10277 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10278 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10279 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10281 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10282 application.SendNotification();
10283 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10284 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10285 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10286 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10288 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10289 application.SendNotification();
10290 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10291 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10292 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10293 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10295 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10296 application.SendNotification();
10297 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10298 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10299 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10300 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10302 // We did expect the animation to finish
10304 finishCheck.CheckSignalReceived();
10308 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10310 TestApplication application;
10312 float startValue(1.0f);
10313 Actor actor = Actor::New();
10314 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10315 application.GetScene().Add(actor);
10317 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10318 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10319 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10320 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10321 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10322 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10323 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10324 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10325 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10327 // Build the animation
10328 float durationSeconds(1.0f);
10329 float delay = 0.5f;
10330 Animation animation = Animation::New(durationSeconds);
10332 KeyFrames keyFrames = KeyFrames::New();
10333 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10334 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10335 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10337 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10339 // Start the animation
10342 bool signalReceived(false);
10343 AnimationFinishCheck finishCheck(signalReceived);
10344 animation.FinishedSignal().Connect(&application, finishCheck);
10345 application.SendNotification();
10347 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10348 application.SendNotification();
10349 finishCheck.CheckSignalNotReceived();
10350 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10351 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10352 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10353 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10355 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10356 application.SendNotification();
10357 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10358 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10359 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10360 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10362 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10363 application.SendNotification();
10364 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10365 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10366 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10367 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10369 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10370 application.SendNotification();
10371 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10372 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10373 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10374 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10376 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10377 application.SendNotification();
10378 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10379 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10380 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10381 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10383 // We did expect the animation to finish
10385 finishCheck.CheckSignalReceived();
10389 int UtcDaliAnimationAnimateP(void)
10391 TestApplication application;
10393 Actor actor = Actor::New();
10394 application.GetScene().Add(actor);
10397 Vector3 position0(30.0, 80.0, 0.0);
10398 Vector3 position1(70.0, 120.0, 0.0);
10399 Vector3 position2(100.0, 100.0, 0.0);
10401 Dali::Path path = Dali::Path::New();
10402 path.AddPoint(position0);
10403 path.AddPoint(position1);
10404 path.AddPoint(position2);
10406 //Control points for first segment
10407 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10408 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10410 //Control points for second segment
10411 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10412 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10414 // Build the animation
10415 float durationSeconds(1.0f);
10416 Animation animation = Animation::New(durationSeconds);
10417 animation.Animate(actor, path, Vector3::XAXIS);
10419 // Start the animation
10422 bool signalReceived(false);
10423 AnimationFinishCheck finishCheck(signalReceived);
10424 animation.FinishedSignal().Connect(&application, finishCheck);
10425 application.SendNotification();
10426 application.Render(0);
10427 application.SendNotification();
10428 finishCheck.CheckSignalNotReceived();
10429 Vector3 position, tangent;
10430 Quaternion rotation;
10431 path.Sample(0.0f, position, tangent);
10432 rotation = Quaternion(Vector3::XAXIS, tangent);
10433 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10434 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10436 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10437 application.SendNotification();
10438 path.Sample(0.25f, position, tangent);
10439 rotation = Quaternion(Vector3::XAXIS, tangent);
10440 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10441 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10443 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10444 application.SendNotification();
10445 path.Sample(0.5f, position, tangent);
10446 rotation = Quaternion(Vector3::XAXIS, tangent);
10447 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10448 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10450 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10451 application.SendNotification();
10452 path.Sample(0.75f, position, tangent);
10453 rotation = Quaternion(Vector3::XAXIS, tangent);
10454 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10455 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10457 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10458 application.SendNotification();
10459 path.Sample(1.0f, position, tangent);
10460 rotation = Quaternion(Vector3::XAXIS, tangent);
10461 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10462 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10464 finishCheck.CheckSignalReceived();
10468 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10470 TestApplication application;
10472 Actor actor = Actor::New();
10473 application.GetScene().Add(actor);
10476 Vector3 position0(30.0, 80.0, 0.0);
10477 Vector3 position1(70.0, 120.0, 0.0);
10478 Vector3 position2(100.0, 100.0, 0.0);
10480 Dali::Path path = Dali::Path::New();
10481 path.AddPoint(position0);
10482 path.AddPoint(position1);
10483 path.AddPoint(position2);
10485 //Control points for first segment
10486 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10487 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10489 //Control points for second segment
10490 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10491 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10493 // Build the animation
10494 float durationSeconds(1.0f);
10495 Animation animation = Animation::New(durationSeconds);
10496 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10498 // Start the animation
10501 bool signalReceived(false);
10502 AnimationFinishCheck finishCheck(signalReceived);
10503 animation.FinishedSignal().Connect(&application, finishCheck);
10504 application.SendNotification();
10505 application.Render(0);
10506 application.SendNotification();
10507 finishCheck.CheckSignalNotReceived();
10508 Vector3 position, tangent;
10509 Quaternion rotation;
10510 path.Sample(0.0f, position, tangent);
10511 rotation = Quaternion(Vector3::XAXIS, tangent);
10512 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10513 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10515 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10516 application.SendNotification();
10517 path.Sample(0.25f, position, tangent);
10518 rotation = Quaternion(Vector3::XAXIS, tangent);
10519 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10520 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10522 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10523 application.SendNotification();
10524 path.Sample(0.5f, position, tangent);
10525 rotation = Quaternion(Vector3::XAXIS, tangent);
10526 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10527 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10529 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10530 application.SendNotification();
10531 path.Sample(0.75f, position, tangent);
10532 rotation = Quaternion(Vector3::XAXIS, tangent);
10533 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10534 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10536 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10537 application.SendNotification();
10538 path.Sample(1.0f, position, tangent);
10539 rotation = Quaternion(Vector3::XAXIS, tangent);
10540 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10541 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10543 finishCheck.CheckSignalReceived();
10547 int UtcDaliAnimationAnimateTimePeriodP(void)
10549 TestApplication application;
10551 Actor actor = Actor::New();
10552 application.GetScene().Add(actor);
10555 Vector3 position0(30.0, 80.0, 0.0);
10556 Vector3 position1(70.0, 120.0, 0.0);
10557 Vector3 position2(100.0, 100.0, 0.0);
10559 Dali::Path path = Dali::Path::New();
10560 path.AddPoint(position0);
10561 path.AddPoint(position1);
10562 path.AddPoint(position2);
10564 //Control points for first segment
10565 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10566 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10568 //Control points for second segment
10569 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10570 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10572 // Build the animation
10573 float durationSeconds(1.0f);
10574 Animation animation = Animation::New(durationSeconds);
10575 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10577 // Start the animation
10580 bool signalReceived(false);
10581 AnimationFinishCheck finishCheck(signalReceived);
10582 animation.FinishedSignal().Connect(&application, finishCheck);
10583 application.SendNotification();
10584 application.Render(0);
10585 application.SendNotification();
10586 finishCheck.CheckSignalNotReceived();
10587 Vector3 position, tangent;
10588 Quaternion rotation;
10589 path.Sample(0.0f, position, tangent);
10590 rotation = Quaternion(Vector3::XAXIS, tangent);
10591 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10592 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10594 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10595 application.SendNotification();
10596 path.Sample(0.25f, position, tangent);
10597 rotation = Quaternion(Vector3::XAXIS, tangent);
10598 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10599 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10601 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10602 application.SendNotification();
10603 path.Sample(0.5f, position, tangent);
10604 rotation = Quaternion(Vector3::XAXIS, tangent);
10605 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10606 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10608 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10609 application.SendNotification();
10610 path.Sample(0.75f, position, tangent);
10611 rotation = Quaternion(Vector3::XAXIS, tangent);
10612 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10613 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10615 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10616 application.SendNotification();
10617 path.Sample(1.0f, position, tangent);
10618 rotation = Quaternion(Vector3::XAXIS, tangent);
10619 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10620 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10622 finishCheck.CheckSignalReceived();
10626 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10628 TestApplication application;
10630 Actor actor = Actor::New();
10631 application.GetScene().Add(actor);
10634 Vector3 position0(30.0, 80.0, 0.0);
10635 Vector3 position1(70.0, 120.0, 0.0);
10636 Vector3 position2(100.0, 100.0, 0.0);
10638 Dali::Path path = Dali::Path::New();
10639 path.AddPoint(position0);
10640 path.AddPoint(position1);
10641 path.AddPoint(position2);
10643 //Control points for first segment
10644 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10645 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10647 //Control points for second segment
10648 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10649 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10651 // Build the animation
10652 float durationSeconds(1.0f);
10653 Animation animation = Animation::New(durationSeconds);
10654 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10656 // Start the animation
10659 bool signalReceived(false);
10660 AnimationFinishCheck finishCheck(signalReceived);
10661 animation.FinishedSignal().Connect(&application, finishCheck);
10662 application.SendNotification();
10663 application.Render(0);
10664 application.SendNotification();
10665 finishCheck.CheckSignalNotReceived();
10666 Vector3 position, tangent;
10667 Quaternion rotation;
10668 path.Sample(0.0f, position, tangent);
10669 rotation = Quaternion(Vector3::XAXIS, tangent);
10670 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10671 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10673 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10674 application.SendNotification();
10675 path.Sample(0.25f, position, tangent);
10676 rotation = Quaternion(Vector3::XAXIS, tangent);
10677 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10678 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10680 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10681 application.SendNotification();
10682 path.Sample(0.5f, position, tangent);
10683 rotation = Quaternion(Vector3::XAXIS, tangent);
10684 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10685 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10687 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10688 application.SendNotification();
10689 path.Sample(0.75f, position, tangent);
10690 rotation = Quaternion(Vector3::XAXIS, tangent);
10691 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10692 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10694 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10695 application.SendNotification();
10696 path.Sample(1.0f, position, tangent);
10697 rotation = Quaternion(Vector3::XAXIS, tangent);
10698 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10699 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10701 finishCheck.CheckSignalReceived();
10705 int UtcDaliAnimationShowP(void)
10707 TestApplication application;
10709 Actor actor = Actor::New();
10710 actor.SetProperty(Actor::Property::VISIBLE, false);
10711 application.SendNotification();
10712 application.Render(0);
10713 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10714 application.GetScene().Add(actor);
10716 // Start the animation
10717 float durationSeconds(10.0f);
10718 Animation animation = Animation::New(durationSeconds);
10719 animation.Show(actor, durationSeconds * 0.5f);
10722 bool signalReceived(false);
10723 AnimationFinishCheck finishCheck(signalReceived);
10724 animation.FinishedSignal().Connect(&application, finishCheck);
10726 application.SendNotification();
10727 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10729 // We didn't expect the animation to finish yet
10730 application.SendNotification();
10731 finishCheck.CheckSignalNotReceived();
10732 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10734 application.SendNotification();
10735 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
10737 // We didn't expect the animation to finish yet
10738 application.SendNotification();
10739 finishCheck.CheckSignalNotReceived();
10740 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10742 application.SendNotification();
10743 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10745 // We did expect the animation to finish
10746 application.SendNotification();
10747 finishCheck.CheckSignalReceived();
10748 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10752 int UtcDaliAnimationHideP(void)
10754 TestApplication application;
10756 Actor actor = Actor::New();
10757 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10758 application.GetScene().Add(actor);
10760 // Start the animation
10761 float durationSeconds(10.0f);
10762 Animation animation = Animation::New(durationSeconds);
10763 animation.Hide(actor, durationSeconds * 0.5f);
10766 bool signalReceived(false);
10767 AnimationFinishCheck finishCheck(signalReceived);
10768 animation.FinishedSignal().Connect(&application, finishCheck);
10770 application.SendNotification();
10771 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10773 // We didn't expect the animation to finish yet
10774 application.SendNotification();
10775 finishCheck.CheckSignalNotReceived();
10776 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10778 application.SendNotification();
10779 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
10781 // We didn't expect the animation to finish yet
10782 application.SendNotification();
10783 finishCheck.CheckSignalNotReceived();
10784 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10786 application.SendNotification();
10787 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10789 // We did expect the animation to finish
10790 application.SendNotification();
10791 finishCheck.CheckSignalReceived();
10792 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10796 int UtcDaliAnimationShowHideAtEndP(void)
10798 // Test that show/hide delay can be the same as animation duration
10799 // i.e. to show/hide at the end of the animation
10801 TestApplication application;
10803 Actor actor = Actor::New();
10804 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10805 application.GetScene().Add(actor);
10807 // Start Hide animation
10808 float durationSeconds(10.0f);
10809 Animation animation = Animation::New(durationSeconds);
10810 animation.Hide(actor, durationSeconds /*Hide at end*/);
10813 bool signalReceived(false);
10814 AnimationFinishCheck finishCheck(signalReceived);
10815 animation.FinishedSignal().Connect(&application, finishCheck);
10817 application.SendNotification();
10818 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10820 // We did expect the animation to finish
10821 application.SendNotification();
10822 finishCheck.CheckSignalReceived();
10823 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10825 // Start Show animation
10826 animation = Animation::New(durationSeconds);
10827 animation.Show(actor, durationSeconds /*Show at end*/);
10828 animation.FinishedSignal().Connect(&application, finishCheck);
10831 application.SendNotification();
10832 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
10834 // We did expect the animation to finish
10835 application.SendNotification();
10836 finishCheck.CheckSignalReceived();
10837 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10841 int UtcDaliKeyFramesCreateDestroyP(void)
10843 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10845 KeyFrames* keyFrames = new KeyFrames;
10847 DALI_TEST_CHECK(true);
10851 int UtcDaliKeyFramesDownCastP(void)
10853 TestApplication application;
10854 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10856 KeyFrames keyFrames = KeyFrames::New();
10857 BaseHandle object(keyFrames);
10859 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10860 DALI_TEST_CHECK(keyFrames2);
10862 KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
10863 DALI_TEST_CHECK(keyFrames3);
10865 BaseHandle unInitializedObject;
10866 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10867 DALI_TEST_CHECK(!keyFrames4);
10869 KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
10870 DALI_TEST_CHECK(!keyFrames5);
10874 int UtcDaliAnimationCreateDestroyP(void)
10876 TestApplication application;
10877 Animation* animation = new Animation;
10878 DALI_TEST_CHECK(animation);
10883 struct UpdateManagerTestConstraint
10885 UpdateManagerTestConstraint(TestApplication& application)
10886 : mApplication(application)
10890 void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
10892 mApplication.SendNotification(); // Process events
10895 TestApplication& mApplication;
10898 int UtcDaliAnimationUpdateManagerP(void)
10900 TestApplication application;
10902 Actor actor = Actor::New();
10903 application.GetScene().Add(actor);
10905 // Build the animation
10906 Animation animation = Animation::New(0.0f);
10908 bool signalReceived = false;
10909 AnimationFinishCheck finishCheck(signalReceived);
10910 animation.FinishedSignal().Connect(&application, finishCheck);
10912 Vector3 startValue(1.0f, 1.0f, 1.0f);
10913 Property::Index index = actor.RegisterProperty("testProperty", startValue);
10914 Constraint constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
10915 constraint.Apply();
10917 // Apply animation to actor
10918 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
10919 animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
10923 application.SendNotification();
10924 application.UpdateOnly(16);
10926 finishCheck.CheckSignalNotReceived();
10928 application.SendNotification(); // Process events
10930 finishCheck.CheckSignalReceived();
10935 int UtcDaliAnimationSignalOrderP(void)
10937 TestApplication application;
10939 Actor actor = Actor::New();
10940 application.GetScene().Add(actor);
10942 // Build the animations
10943 Animation animation1 = Animation::New(0.0f); // finishes first frame
10944 Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
10946 bool signal1Received = false;
10947 animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
10949 bool signal2Received = false;
10950 animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
10952 // Apply animations to actor
10953 animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
10955 animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
10958 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10959 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10961 application.SendNotification();
10962 application.UpdateOnly(10); // 10ms progress
10964 // no notifications yet
10965 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10966 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10968 application.SendNotification();
10971 DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
10972 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
10973 signal1Received = false;
10975 // 1st animation is complete now, do another update with no ProcessEvents in between
10976 application.UpdateOnly(20); // 20ms progress
10979 application.SendNotification();
10981 // 2nd should complete now
10982 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
10983 DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
10988 int UtcDaliAnimationExtendDurationP(void)
10990 TestApplication application;
10992 Actor actor = Actor::New();
10994 // Register a float property
10995 float startValue(10.0f);
10996 Property::Index index = actor.RegisterProperty("testProperty", startValue);
10997 application.GetScene().Add(actor);
10998 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
10999 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11001 // Build the animation
11002 float initialDurationSeconds(1.0f);
11003 float animatorDelay = 5.0f;
11004 float animatorDurationSeconds(5.0f);
11005 float extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
11006 Animation animation = Animation::New(initialDurationSeconds);
11007 float targetValue(30.0f);
11008 float relativeValue(targetValue - startValue);
11010 animation.AnimateTo(Property(actor, index),
11012 TimePeriod(animatorDelay, animatorDurationSeconds));
11014 // The duration should have been extended
11015 DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
11017 // Start the animation
11020 bool signalReceived(false);
11021 AnimationFinishCheck finishCheck(signalReceived);
11022 animation.FinishedSignal().Connect(&application, finishCheck);
11024 application.SendNotification();
11025 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11027 // We didn't expect the animation to finish yet, but cached value should be the final one
11028 application.SendNotification();
11029 finishCheck.CheckSignalNotReceived();
11030 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11031 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11033 application.SendNotification();
11034 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11036 // We didn't expect the animation to finish yet
11037 application.SendNotification();
11038 finishCheck.CheckSignalNotReceived();
11039 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
11041 application.SendNotification();
11042 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11044 // We did expect the animation to finish
11045 application.SendNotification();
11046 finishCheck.CheckSignalReceived();
11047 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
11048 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11052 int UtcDaliAnimationCustomIntProperty(void)
11054 TestApplication application;
11056 Actor actor = Actor::New();
11057 application.GetScene().Add(actor);
11058 int startValue(0u);
11060 Property::Index index = actor.RegisterProperty("anIndex", startValue);
11061 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
11062 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11064 // Build the animation
11065 float durationSeconds(1.0f);
11066 Animation animation = Animation::New(durationSeconds);
11067 animation.AnimateTo(Property(actor, index), 20);
11069 // Start the animation
11072 // Target value should be retrievable straight away
11073 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11075 bool signalReceived(false);
11076 AnimationFinishCheck finishCheck(signalReceived);
11077 animation.FinishedSignal().Connect(&application, finishCheck);
11079 application.SendNotification();
11080 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
11082 // We didn't expect the animation to finish yet
11083 application.SendNotification();
11084 finishCheck.CheckSignalNotReceived();
11085 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
11087 application.SendNotification();
11088 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11090 // We did expect the animation to finish
11091 application.SendNotification();
11092 finishCheck.CheckSignalReceived();
11093 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
11094 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11098 int UtcDaliAnimationDuration(void)
11100 TestApplication application;
11102 Actor actor = Actor::New();
11103 application.GetScene().Add(actor);
11105 Animation animation = Animation::New(0.0f);
11106 DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
11108 // The animation duration should automatically increase depending on the animator time period
11110 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
11111 DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
11113 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
11114 DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
11119 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
11121 TestApplication application;
11123 Actor actor = Actor::New();
11125 // Register an integer property
11127 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11128 application.GetScene().Add(actor);
11129 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11131 DALI_TEST_ASSERTION(
11133 // Build the animation
11134 Animation animation = Animation::New(2.0f);
11135 std::string relativeValue = "relative string";
11136 animation.AnimateBy(Property(actor, index), relativeValue);
11137 tet_result(TET_FAIL);
11139 "Target value is not animatable");
11144 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
11146 TestApplication application;
11148 Actor actor = Actor::New();
11150 // Register an integer property
11152 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11153 application.GetScene().Add(actor);
11154 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11156 DALI_TEST_ASSERTION(
11158 // Build the animation
11159 Animation animation = Animation::New(2.0f);
11160 std::string relativeValue = "relative string";
11161 animation.AnimateTo(Property(actor, index), relativeValue);
11163 "Target value is not animatable");
11168 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
11170 TestApplication application;
11172 Actor actor = Actor::New();
11174 // Register an integer property
11176 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11177 application.GetScene().Add(actor);
11178 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11180 DALI_TEST_ASSERTION(
11182 // Build the animation
11183 KeyFrames keyFrames = KeyFrames::New();
11184 keyFrames.Add(0.0f, std::string("relative string1"));
11185 keyFrames.Add(1.0f, std::string("relative string2"));
11186 // no need to really create the animation as keyframes do the check
11188 "Property type is not animatable");
11193 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
11195 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
11197 TestApplication application;
11199 tet_infoline("Set initial position and set up animation to re-position actor");
11201 Actor actor = Actor::New();
11202 application.GetScene().Add(actor);
11203 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11204 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11206 // Build the animation
11207 Animation animation = Animation::New(2.0f);
11209 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11210 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11211 DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11213 tet_infoline("Set target position in animation without intiating play");
11215 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11216 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11218 application.SendNotification();
11219 application.Render();
11221 tet_infoline("Ensure position of actor is still at intial value");
11223 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11224 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11225 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11227 tet_infoline("Play animation and ensure actor position is now target");
11230 application.SendNotification();
11231 application.Render(1000u);
11233 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11235 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11236 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11237 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11239 tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11241 application.Render(2000u);
11243 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11245 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11246 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11247 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11252 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11254 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11256 TestApplication application;
11258 std::vector<Vector3> targetPositions;
11260 targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
11261 targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11262 targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
11264 tet_infoline("Set initial position and set up animation to re-position actor");
11266 Actor actor = Actor::New();
11267 application.GetScene().Add(actor);
11268 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11269 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11271 // Build the animation
11272 Animation animation = Animation::New(2.0f);
11274 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11275 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11276 DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11278 tet_infoline("Set target position in animation without intiating play");
11280 for(unsigned int i = 0; i < targetPositions.size(); i++)
11282 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11285 application.SendNotification();
11286 application.Render();
11288 tet_infoline("Ensure position of actor is still at intial value");
11290 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11291 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11292 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11294 tet_infoline("Play animation and ensure actor position is now target");
11297 application.SendNotification();
11298 application.Render(1000u);
11300 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11302 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11303 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11304 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11306 tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11308 application.Render(2000u);
11310 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11312 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11313 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11314 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11319 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11321 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");
11323 TestApplication application;
11325 std::vector<Vector3> targetSizes;
11326 std::vector<Vector3> targetPositions;
11328 targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11329 targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
11331 targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11333 tet_infoline("Set initial position and set up animation to re-position actor");
11335 Actor actor = Actor::New();
11336 application.GetScene().Add(actor);
11337 Vector3 initialSize(10.0f, 10.0f, 10.0f);
11338 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11340 actor.SetProperty(Actor::Property::SIZE, initialSize);
11341 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11343 // Build the animation
11344 Animation animation = Animation::New(2.0f);
11346 tet_infoline("Set target size in animation without intiating play");
11347 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11348 tet_infoline("Set target position in animation without intiating play");
11349 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11350 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11352 application.SendNotification();
11353 application.Render();
11355 tet_infoline("Ensure position of actor is still at intial size and position");
11357 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11358 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11359 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11361 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
11362 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
11363 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
11365 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11368 application.SendNotification();
11369 application.Render(2000u);
11371 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11373 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11374 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11375 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11377 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
11378 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
11379 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
11384 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11386 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11388 TestApplication application;
11390 std::vector<Vector3> targetSizes;
11391 std::vector<float> targetColors;
11393 targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11394 targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
11396 targetColors.push_back(1.0f);
11398 tet_infoline("Set initial position and set up animation to re-position actor");
11400 Actor actor = Actor::New();
11401 application.GetScene().Add(actor);
11402 Vector3 initialSize(10.0f, 5.0f, 10.0f);
11404 actor.SetProperty(Actor::Property::SIZE, initialSize);
11406 // Build the animation
11407 Animation animation = Animation::New(2.0f);
11409 tet_infoline("Set target size in animation without initiating play");
11410 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11411 tet_infoline("Set target position in animation without intiating play");
11412 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11413 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11415 application.SendNotification();
11416 application.Render();
11418 tet_infoline("Ensure position of actor is still at initial size and position");
11420 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11421 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11422 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11424 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11427 application.SendNotification();
11428 application.Render(2000u);
11430 tet_infoline("Ensure position and size of actor is at target value when animation playing");
11432 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11433 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11434 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11436 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
11441 int UtcDaliAnimationTimePeriodOrder(void)
11443 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
11445 TestApplication application;
11447 Actor actor = Actor::New();
11448 application.GetScene().Add(actor);
11450 application.SendNotification();
11451 application.Render();
11453 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11454 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11455 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11456 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11457 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11459 //////////////////////////////////////////////////////////////////////////////////
11461 tet_infoline("With two AnimateTo calls");
11463 Animation animation = Animation::New(0.0f);
11464 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11465 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11468 tet_infoline("The target position should change instantly");
11469 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11470 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11472 application.SendNotification();
11473 application.Render(5000); // After the animation is complete
11475 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11476 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11477 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11479 //////////////////////////////////////////////////////////////////////////////////
11481 tet_infoline("Same animation again but in a different order - should yield the same result");
11483 actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11484 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11485 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11487 application.SendNotification();
11488 application.Render();
11490 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11491 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11492 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11494 animation = Animation::New(0.0f);
11495 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11496 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11499 tet_infoline("The target position should change instantly");
11500 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11501 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11503 application.SendNotification();
11504 application.Render(5000); // After the animation is complete
11506 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11507 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11508 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11513 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11515 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");
11517 TestApplication application;
11519 Actor actor = Actor::New();
11520 application.GetScene().Add(actor);
11522 application.SendNotification();
11523 application.Render();
11525 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11526 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11527 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11528 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11529 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11531 //////////////////////////////////////////////////////////////////////////////////
11535 Animation animation = Animation::New(0.0f);
11536 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11537 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11538 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11539 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11540 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11541 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11544 tet_infoline("The target position should change instantly");
11545 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11546 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11548 application.SendNotification();
11549 application.Render(14000); // After the animation is complete
11551 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11552 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11553 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11555 //////////////////////////////////////////////////////////////////////////////////
11557 tet_infoline("Same animation again but in a different order - should end up at the same point");
11559 actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11561 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11562 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11564 application.SendNotification();
11565 application.Render();
11567 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11568 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11569 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11571 animation = Animation::New(0.0f);
11572 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11573 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11574 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11575 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11576 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11577 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11580 tet_infoline("The target position should change instantly");
11581 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11582 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11584 application.SendNotification();
11585 application.Render(14000); // After the animation is complete
11587 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11588 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11589 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11594 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11596 TestApplication application;
11599 Actor actor = Actor::New();
11600 const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11601 application.GetScene().Add(actor);
11603 application.Render();
11604 application.SendNotification();
11606 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11608 // Build the animation
11609 float durationSeconds(1.0f);
11610 Animation animation = Animation::New(durationSeconds);
11612 KeyFrames keyFrames = KeyFrames::New();
11613 keyFrames.Add(0.0f, 10);
11614 keyFrames.Add(0.2f, 20);
11615 keyFrames.Add(0.4f, 30);
11616 keyFrames.Add(0.6f, 40);
11617 keyFrames.Add(0.8f, 50);
11618 keyFrames.Add(1.0f, 60);
11620 animation.AnimateBetween(Property(actor, index), keyFrames);
11622 // Start the animation
11625 // Target value should change to the last key-frame's value straight away
11626 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
11631 int UtcDaliAnimationAnimateBetweenVector2P(void)
11633 TestApplication application;
11635 Vector2 startValue(10.0f, 20.0f);
11636 Actor actor = Actor::New();
11637 const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11638 application.GetScene().Add(actor);
11640 application.Render();
11641 application.SendNotification();
11643 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
11645 // Build the animation
11646 float durationSeconds(1.0f);
11647 Animation animation = Animation::New(durationSeconds);
11649 KeyFrames keyFrames = KeyFrames::New();
11650 keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
11651 keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
11652 keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
11653 keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
11654 keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
11655 keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
11657 animation.AnimateBetween(Property(actor, index), keyFrames);
11659 // Start the animation
11662 // Target value should change to the last key-frame's value straight away
11663 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
11668 int UtcDaliAnimationProgressCallbackP(void)
11670 TestApplication application;
11672 Actor actor = Actor::New();
11673 application.GetScene().Add(actor);
11675 // Build the animation
11676 Animation animation = Animation::New(0.0f);
11679 float durationSeconds(1.0f);
11680 animation.SetDuration(durationSeconds);
11682 bool finishedSignalReceived(false);
11683 bool progressSignalReceived(false);
11685 AnimationFinishCheck finishCheck(finishedSignalReceived);
11686 animation.FinishedSignal().Connect(&application, finishCheck);
11688 AnimationProgressCheck progressCheck(progressSignalReceived);
11689 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
11690 application.SendNotification();
11692 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11693 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11695 tet_infoline("Animation Progress notification set to 30%");
11696 DevelAnimation::SetProgressNotification(animation, 0.3f);
11698 application.SendNotification();
11699 application.Render();
11701 DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
11703 progressCheck.CheckSignalNotReceived();
11705 // Start the animation from 10% progress
11706 animation.SetCurrentProgress(0.1f);
11709 tet_infoline("Animation Playing from 10%");
11711 application.SendNotification();
11712 application.Render(0); // start animation
11713 application.Render(durationSeconds * 100.0f); // 20% progress
11715 tet_infoline("Animation at 20%");
11717 progressCheck.CheckSignalNotReceived();
11719 application.SendNotification();
11720 application.Render(durationSeconds * 200.0f); // 40% progress
11721 application.SendNotification();
11722 tet_infoline("Animation at 40%");
11723 DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
11725 progressCheck.CheckSignalReceived();
11727 tet_infoline("Progress check reset");
11728 progressCheck.Reset();
11730 application.Render(durationSeconds * 100.0f); // 50% progress
11731 tet_infoline("Animation at 50%");
11732 application.SendNotification();
11734 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
11736 progressCheck.CheckSignalNotReceived();
11738 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
11739 application.SendNotification();
11741 tet_infoline("Animation at 60%");
11743 finishCheck.CheckSignalNotReceived();
11745 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
11746 application.SendNotification();
11747 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
11748 tet_infoline("Animation at 80%");
11750 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
11751 // We did expect the animation to finish
11752 application.SendNotification();
11753 finishCheck.CheckSignalReceived();
11754 tet_infoline("Animation finished");
11755 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11760 int UtcDaliAnimationPlayAfterP(void)
11762 TestApplication application;
11764 tet_printf("Testing that playing after 2 seconds\n");
11767 Actor actor = Actor::New();
11768 application.GetScene().Add(actor);
11770 // Build the animation
11771 float durationSeconds(1.0f);
11772 Animation animation = Animation::New(durationSeconds);
11774 bool signalReceived(false);
11775 AnimationFinishCheck finishCheck(signalReceived);
11776 animation.FinishedSignal().Connect(&application, finishCheck);
11777 application.SendNotification();
11779 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11780 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11782 // Play animation after the initial delay time
11783 animation.PlayAfter(0.2f);
11784 application.SendNotification();
11785 application.Render(0); // start animation
11787 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11788 application.SendNotification();
11789 finishCheck.CheckSignalNotReceived();
11790 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11792 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11794 // We didn't expect the animation to finish yet
11795 application.SendNotification();
11796 finishCheck.CheckSignalNotReceived();
11797 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11799 application.SendNotification();
11800 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11802 application.SendNotification();
11803 finishCheck.CheckSignalNotReceived();
11804 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11806 application.SendNotification();
11807 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11809 // We did expect the animation to finish
11810 application.SendNotification();
11811 finishCheck.CheckSignalReceived();
11812 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11814 // Check that nothing has changed after a couple of buffer swaps
11815 application.Render(0);
11816 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11819 tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11822 Actor actor = Actor::New();
11823 application.GetScene().Add(actor);
11825 // Build the animation
11826 float durationSeconds(1.0f);
11827 Animation animation = Animation::New(durationSeconds);
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 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11844 application.SendNotification();
11845 finishCheck.CheckSignalNotReceived();
11846 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11848 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11850 // We didn't expect the animation to finish yet
11851 application.SendNotification();
11852 finishCheck.CheckSignalNotReceived();
11853 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11855 application.SendNotification();
11856 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11858 application.SendNotification();
11859 finishCheck.CheckSignalNotReceived();
11860 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11862 application.SendNotification();
11863 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11865 // We did expect the animation to finish
11866 application.SendNotification();
11867 finishCheck.CheckSignalReceived();
11868 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
11870 // Check that nothing has changed after a couple of buffer swaps
11871 application.Render(0);
11872 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
11878 int UtcDaliAnimationPlayAfterP2(void)
11880 TestApplication application;
11882 tet_printf("Testing that playing after 2 seconds before looping\n");
11885 Actor actor = Actor::New();
11886 application.GetScene().Add(actor);
11888 // Build the animation
11889 float durationSeconds(1.0f);
11890 Animation animation = Animation::New(durationSeconds);
11891 animation.SetLooping(true);
11893 bool signalReceived(false);
11894 AnimationFinishCheck finishCheck(signalReceived);
11895 animation.FinishedSignal().Connect(&application, finishCheck);
11896 application.SendNotification();
11898 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11899 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11901 // Play animation after the initial delay time
11902 animation.PlayAfter(0.2f);
11903 application.SendNotification();
11904 application.Render(0); // start animation
11906 for(int iterations = 0; iterations < 3; ++iterations)
11908 // The initial delay time of PlayAfter() applies only once in looping mode.
11909 if(iterations == 0)
11911 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11912 application.SendNotification();
11913 finishCheck.CheckSignalNotReceived();
11914 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
11917 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11919 // We didn't expect the animation to finish yet
11920 application.SendNotification();
11921 finishCheck.CheckSignalNotReceived();
11922 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
11924 application.SendNotification();
11925 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11927 application.SendNotification();
11928 finishCheck.CheckSignalNotReceived();
11929 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11931 application.SendNotification();
11932 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
11934 // We did expect the animation to finish
11935 application.SendNotification();
11936 finishCheck.CheckSignalNotReceived();
11937 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11940 animation.SetLooping(false);
11941 application.SendNotification();
11942 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11944 application.SendNotification();
11945 finishCheck.CheckSignalReceived();
11946 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11949 tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11952 Actor actor = Actor::New();
11953 application.GetScene().Add(actor);
11955 // Build the animation
11956 float durationSeconds(1.0f);
11957 Animation animation = Animation::New(durationSeconds);
11958 animation.SetLooping(true);
11959 animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0
11961 bool signalReceived(false);
11962 AnimationFinishCheck finishCheck(signalReceived);
11963 animation.FinishedSignal().Connect(&application, finishCheck);
11964 application.SendNotification();
11966 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11967 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
11969 // Play animation after the initial delay time
11970 animation.PlayAfter(0.2f);
11971 application.SendNotification();
11972 application.Render(0); // start animation
11974 for(int iterations = 0; iterations < 3; ++iterations)
11976 // The initial delay time of PlayAfter() applies only once in looping mode.
11977 if(iterations == 0)
11979 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
11980 application.SendNotification();
11981 finishCheck.CheckSignalNotReceived();
11982 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11985 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
11987 // We didn't expect the animation to finish yet
11988 application.SendNotification();
11989 finishCheck.CheckSignalNotReceived();
11990 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
11992 application.SendNotification();
11993 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
11995 application.SendNotification();
11996 finishCheck.CheckSignalNotReceived();
11997 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
11999 application.SendNotification();
12000 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
12002 // We did expect the animation to finish
12003 application.SendNotification();
12004 finishCheck.CheckSignalNotReceived();
12005 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
12008 animation.SetLooping(false);
12009 application.SendNotification();
12010 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12012 application.SendNotification();
12013 finishCheck.CheckSignalReceived();
12014 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
12020 int UtcDaliAnimationPlayAfterP3(void)
12022 TestApplication application;
12024 tet_printf("Testing that PlayAfter with the negative delay seconds\n");
12026 Actor actor = Actor::New();
12027 application.GetScene().Add(actor);
12029 // Build the animation
12030 float durationSeconds(1.0f);
12031 Animation animation = Animation::New(durationSeconds);
12033 bool signalReceived(false);
12034 AnimationFinishCheck finishCheck(signalReceived);
12035 animation.FinishedSignal().Connect(&application, finishCheck);
12036 application.SendNotification();
12038 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12039 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12041 // When the delay time is negative value, it would treat as play immediately.
12042 animation.PlayAfter(-2.0f);
12043 application.SendNotification();
12044 application.Render(0); // start animation
12046 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12048 // We didn't expect the animation to finish yet
12049 application.SendNotification();
12050 finishCheck.CheckSignalNotReceived();
12051 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12053 application.SendNotification();
12054 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12056 application.SendNotification();
12057 finishCheck.CheckSignalNotReceived();
12058 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12060 application.SendNotification();
12061 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
12063 // We did expect the animation to finish
12064 application.SendNotification();
12065 finishCheck.CheckSignalReceived();
12066 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12068 // Check that nothing has changed after a couple of buffer swaps
12069 application.Render(0);
12070 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12074 int UtcDaliAnimationPlayAfterP4(void)
12076 TestApplication application;
12078 tet_printf("Testing that PlayAfter with progress value\n");
12080 Actor actor = Actor::New();
12081 application.GetScene().Add(actor);
12083 // Build the animation
12084 float durationSeconds(1.0f);
12085 Animation animation = Animation::New(durationSeconds);
12087 bool signalReceived(false);
12088 AnimationFinishCheck finishCheck(signalReceived);
12089 animation.FinishedSignal().Connect(&application, finishCheck);
12090 application.SendNotification();
12092 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12093 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12095 // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
12096 animation.PlayAfter(durationSeconds * 0.3f);
12097 application.SendNotification();
12098 application.Render(0); // start animation
12100 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
12102 // We didn't expect the animation to finish yet
12103 application.SendNotification();
12104 finishCheck.CheckSignalNotReceived();
12105 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
12107 application.SendNotification();
12108 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
12110 application.SendNotification();
12111 finishCheck.CheckSignalNotReceived();
12112 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12114 application.SendNotification();
12115 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
12117 application.SendNotification();
12118 finishCheck.CheckSignalNotReceived();
12119 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12121 application.SendNotification();
12122 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
12124 application.SendNotification();
12125 finishCheck.CheckSignalNotReceived();
12126 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
12128 application.SendNotification();
12129 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
12131 application.SendNotification();
12132 finishCheck.CheckSignalNotReceived();
12133 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
12135 application.SendNotification();
12136 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
12138 // We did expect the animation to finish
12139 application.SendNotification();
12140 finishCheck.CheckSignalReceived();
12141 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12143 // Check that nothing has changed after a couple of buffer swaps
12144 application.Render(0);
12145 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12149 int UtcDaliAnimationSetLoopingModeP(void)
12151 // Test Loop forever and Loop mode being set
12152 TestApplication application;
12153 Integration::Scene stage(application.GetScene());
12155 // Default: LoopingMode::RESTART
12157 Actor actor = Actor::New();
12160 float durationSeconds(1.0f);
12161 Animation animation = Animation::New(durationSeconds);
12162 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12164 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
12165 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12167 // Start the animation
12169 application.SendNotification();
12170 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
12174 application.SendNotification();
12175 application.Render();
12176 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12179 // LoopingMode::AUTO_REVERSE
12181 Actor actor = Actor::New();
12184 float durationSeconds(1.0f);
12185 Animation animation = Animation::New(durationSeconds);
12186 animation.SetLooping(true);
12188 bool signalReceived(false);
12189 AnimationFinishCheck finishCheck(signalReceived);
12190 animation.FinishedSignal().Connect(&application, finishCheck);
12191 application.SendNotification();
12193 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12194 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12196 animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
12197 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12199 // Start the animation
12201 application.SendNotification();
12202 application.Render(0);
12204 for(int iterations = 0; iterations < 3; ++iterations)
12206 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12207 application.SendNotification();
12208 finishCheck.CheckSignalNotReceived();
12210 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12211 // and arrives at the beginning.
12212 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12214 application.SendNotification();
12215 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12217 // We did expect the animation to finish
12218 application.SendNotification();
12219 finishCheck.CheckSignalNotReceived();
12220 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12223 animation.SetLooping(false);
12224 application.SendNotification();
12225 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12227 application.SendNotification();
12228 finishCheck.CheckSignalReceived();
12230 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12233 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12235 Actor actor = Actor::New();
12238 float durationSeconds(1.0f);
12239 Animation animation = Animation::New(durationSeconds);
12240 animation.SetLooping(true);
12242 bool signalReceived(false);
12243 AnimationFinishCheck finishCheck(signalReceived);
12244 animation.FinishedSignal().Connect(&application, finishCheck);
12245 application.SendNotification();
12247 // Specify a negative multiplier to play the animation in reverse
12248 animation.SetSpeedFactor(-1.0f);
12250 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12251 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12253 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12254 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12256 // Start the animation
12258 application.SendNotification();
12259 application.Render(0);
12261 for(int iterations = 0; iterations < 3; ++iterations)
12263 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12264 application.SendNotification();
12265 finishCheck.CheckSignalNotReceived();
12267 // Setting a negative speed factor is to play the animation in reverse.
12268 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12269 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12270 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12272 application.SendNotification();
12273 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12275 // We did expect the animation to finish
12276 application.SendNotification();
12277 finishCheck.CheckSignalNotReceived();
12278 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12281 animation.SetLooping(false);
12282 application.SendNotification();
12283 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12285 application.SendNotification();
12286 finishCheck.CheckSignalReceived();
12288 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12294 int UtcDaliAnimationSetLoopingModeP2(void)
12296 // Test Loop Count and Loop mode being set
12297 TestApplication application;
12298 Integration::Scene stage(application.GetScene());
12300 // LoopingMode::AUTO_REVERSE
12302 Actor actor = Actor::New();
12305 float durationSeconds(1.0f);
12306 Animation animation = Animation::New(durationSeconds);
12307 animation.SetLoopCount(3);
12308 DALI_TEST_CHECK(animation.IsLooping());
12310 bool signalReceived(false);
12311 AnimationFinishCheck finishCheck(signalReceived);
12312 animation.FinishedSignal().Connect(&application, finishCheck);
12313 application.SendNotification();
12315 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12316 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12318 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12319 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12321 // Start the animation
12324 application.Render(0);
12325 application.SendNotification();
12326 application.Render(0);
12327 application.SendNotification();
12328 application.Render(0);
12329 application.SendNotification();
12330 application.Render(0);
12331 application.SendNotification();
12334 float intervalSeconds = 3.0f;
12336 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12337 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12338 // and arrives at the beginning.
12339 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12341 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12343 application.Render(0);
12344 application.SendNotification();
12345 application.Render(0);
12346 application.SendNotification();
12347 application.Render(0);
12348 application.SendNotification();
12349 application.Render(0);
12350 application.SendNotification();
12351 finishCheck.CheckSignalNotReceived();
12353 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12355 application.SendNotification();
12356 finishCheck.CheckSignalReceived();
12357 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12359 finishCheck.Reset();
12362 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12364 Actor actor = Actor::New();
12367 float durationSeconds(1.0f);
12368 Animation animation = Animation::New(durationSeconds);
12369 animation.SetLoopCount(3);
12370 DALI_TEST_CHECK(animation.IsLooping());
12372 bool signalReceived(false);
12373 AnimationFinishCheck finishCheck(signalReceived);
12374 animation.FinishedSignal().Connect(&application, finishCheck);
12375 application.SendNotification();
12377 // Specify a negative multiplier to play the animation in reverse
12378 animation.SetSpeedFactor(-1.0f);
12380 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12381 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12383 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12384 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12386 // Start the animation
12389 application.Render(0);
12390 application.SendNotification();
12391 application.Render(0);
12392 application.SendNotification();
12393 application.Render(0);
12394 application.SendNotification();
12395 application.Render(0);
12396 application.SendNotification();
12399 float intervalSeconds = 3.0f;
12401 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12402 // Setting a negative speed factor is to play the animation in reverse.
12403 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12404 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12405 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12407 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12409 application.Render(0);
12410 application.SendNotification();
12411 application.Render(0);
12412 application.SendNotification();
12413 application.Render(0);
12414 application.SendNotification();
12415 application.Render(0);
12416 application.SendNotification();
12417 finishCheck.CheckSignalNotReceived();
12419 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12421 application.SendNotification();
12422 finishCheck.CheckSignalReceived();
12423 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12425 finishCheck.Reset();
12431 int UtcDaliAnimationSetLoopingModeP3(void)
12433 // Test Loop Count is 1 (== default) and Loop mode being set
12434 TestApplication application;
12435 Integration::Scene stage(application.GetScene());
12437 // LoopingMode::AUTO_REVERSE
12439 Actor actor = Actor::New();
12442 float durationSeconds(1.0f);
12443 Animation animation = Animation::New(durationSeconds);
12444 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12446 bool signalReceived(false);
12447 AnimationFinishCheck finishCheck(signalReceived);
12448 animation.FinishedSignal().Connect(&application, finishCheck);
12449 application.SendNotification();
12451 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12452 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12454 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12455 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12457 // Start the animation
12459 application.Render(0);
12460 application.SendNotification();
12462 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12463 application.SendNotification();
12464 finishCheck.CheckSignalNotReceived();
12466 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12467 // and arrives at the beginning.
12468 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12470 application.SendNotification();
12471 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12473 application.SendNotification();
12474 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12476 application.SendNotification();
12477 application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12479 application.SendNotification();
12480 application.Render(0);
12481 application.SendNotification();
12482 finishCheck.CheckSignalReceived();
12484 // After all animation finished, arrives at the beginning.
12485 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12487 finishCheck.Reset();
12490 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12492 Actor actor = Actor::New();
12495 float durationSeconds(1.0f);
12496 Animation animation = Animation::New(durationSeconds);
12497 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12499 bool signalReceived(false);
12500 AnimationFinishCheck finishCheck(signalReceived);
12501 animation.FinishedSignal().Connect(&application, finishCheck);
12502 application.SendNotification();
12504 // Specify a negative multiplier to play the animation in reverse
12505 animation.SetSpeedFactor(-1.0f);
12507 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12508 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12510 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12511 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12513 // Start the animation
12515 application.Render(0);
12516 application.SendNotification();
12518 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12519 application.SendNotification();
12520 finishCheck.CheckSignalNotReceived();
12522 // Setting a negative speed factor is to play the animation in reverse.
12523 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12524 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12525 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12527 application.SendNotification();
12528 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12530 application.SendNotification();
12531 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12533 application.SendNotification();
12534 application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12536 application.SendNotification();
12537 application.Render(0);
12538 application.SendNotification();
12539 finishCheck.CheckSignalReceived();
12541 // After all animation finished, arrives at the target.
12542 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12544 finishCheck.Reset();
12550 int UtcDaliAnimationGetLoopingModeP(void)
12552 TestApplication application;
12554 Animation animation = Animation::New(1.0f);
12557 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12559 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12560 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12565 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12567 TestApplication application;
12569 tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
12571 Actor actor = Actor::New();
12572 application.GetScene().Add(actor);
12574 // Build the animation
12575 Animation animation = Animation::New(0.0f);
12578 float durationSeconds(1.0f);
12579 animation.SetDuration(durationSeconds);
12581 bool finishedSignalReceived(false);
12582 bool progressSignalReceived(false);
12584 AnimationFinishCheck finishCheck(finishedSignalReceived);
12585 animation.FinishedSignal().Connect(&application, finishCheck);
12587 AnimationProgressCheck progressCheck(progressSignalReceived);
12588 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12589 application.SendNotification();
12591 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12592 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12594 progressCheck.CheckSignalNotReceived();
12598 application.SendNotification();
12599 application.Render(0); // start animation
12600 application.Render(durationSeconds * 100.0f); // 10% progress
12601 application.SendNotification();
12603 tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
12604 progressCheck.CheckSignalNotReceived();
12606 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
12608 application.SendNotification();
12609 finishCheck.CheckSignalReceived();
12610 tet_infoline("Animation finished");
12611 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12616 int UtcDaliAnimationMultipleProgressSignalsP(void)
12618 tet_infoline("Multiple animations with different progress markers");
12620 TestApplication application;
12622 Actor actor = Actor::New();
12623 application.GetScene().Add(actor);
12625 // Build the animation
12626 Animation animationAlpha = Animation::New(0.0f);
12627 Animation animationBeta = Animation::New(0.0f);
12630 float durationSeconds(1.0f);
12631 animationAlpha.SetDuration(durationSeconds);
12632 animationBeta.SetDuration(durationSeconds);
12634 bool progressSignalReceivedAlpha(false);
12635 bool progressSignalReceivedBeta(false);
12637 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12638 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12640 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12641 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12642 application.SendNotification();
12644 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12645 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12646 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12648 tet_infoline("AnimationAlpha Progress notification set to 30%");
12649 DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12651 tet_infoline("AnimationBeta Progress notification set to 50%");
12652 DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
12654 application.SendNotification();
12655 application.Render();
12657 progressCheckAlpha.CheckSignalNotReceived();
12658 progressCheckBeta.CheckSignalNotReceived();
12660 // Start the animations from 10% progress
12661 animationAlpha.SetCurrentProgress(0.1f);
12662 animationBeta.SetCurrentProgress(0.1f);
12663 animationAlpha.Play();
12664 animationBeta.Play();
12666 tet_infoline("Animation Playing from 10%");
12668 application.SendNotification();
12669 application.Render(0); // start animation
12670 application.Render(durationSeconds * 100.0f); // 20% progress
12672 tet_infoline("Animation at 20% - No signals to be received");
12674 progressCheckAlpha.CheckSignalNotReceived();
12675 progressCheckBeta.CheckSignalNotReceived();
12677 application.SendNotification();
12678 application.Render(durationSeconds * 200.0f); // 40% progress
12679 application.SendNotification();
12680 tet_infoline("Animation at 40% - Alpha signal should be received");
12681 DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12683 progressCheckAlpha.CheckSignalReceived();
12684 progressCheckBeta.CheckSignalNotReceived();
12686 tet_infoline("Progress check reset");
12687 progressCheckAlpha.Reset();
12688 progressCheckBeta.Reset();
12690 application.Render(durationSeconds * 100.0f); // 50% progress
12691 tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
12692 application.SendNotification();
12694 DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12696 progressCheckAlpha.CheckSignalNotReceived();
12697 progressCheckBeta.CheckSignalReceived();
12698 tet_infoline("Progress check reset");
12699 progressCheckAlpha.Reset();
12700 progressCheckBeta.Reset();
12702 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
12703 application.SendNotification();
12705 tet_infoline("Animation at 60%");
12707 progressCheckAlpha.CheckSignalNotReceived();
12708 progressCheckBeta.CheckSignalNotReceived();
12710 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12711 application.SendNotification();
12712 tet_infoline("Animation at 80%");
12714 progressCheckAlpha.CheckSignalNotReceived();
12715 progressCheckBeta.CheckSignalNotReceived();
12717 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12718 // We did expect the animation to finish
12719 tet_infoline("Animation finished");
12724 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12726 tet_infoline("Multiple animations with different progress markers and big step time");
12728 TestApplication application;
12730 Actor actor = Actor::New();
12731 application.GetScene().Add(actor);
12733 // Build the animation
12734 Animation animationAlpha = Animation::New(0.0f);
12735 Animation animationBeta = Animation::New(0.0f);
12738 const float durationSeconds(1.0f);
12739 animationAlpha.SetDuration(durationSeconds);
12740 animationBeta.SetDuration(durationSeconds);
12742 bool progressSignalReceivedAlpha(false);
12743 bool progressSignalReceivedBeta(false);
12745 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12746 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12748 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12749 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12750 application.SendNotification();
12752 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12753 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12754 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12756 tet_infoline("AnimationAlpha Progress notification set to 1%");
12757 DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
12759 tet_infoline("AnimationBeta Progress notification set to 99%");
12760 DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
12762 application.SendNotification();
12763 application.Render();
12765 progressCheckAlpha.CheckSignalNotReceived();
12766 progressCheckBeta.CheckSignalNotReceived();
12768 // Start the animations unlimited looping
12769 animationAlpha.SetLooping(true);
12770 animationBeta.SetLooping(true);
12771 animationAlpha.Play();
12772 animationBeta.Play();
12774 application.SendNotification();
12775 application.Render(0); // start animation
12776 application.Render(durationSeconds * 20.0f); // 2% progress
12777 application.SendNotification();
12778 DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12780 tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
12782 progressCheckAlpha.CheckSignalReceived();
12783 progressCheckBeta.CheckSignalNotReceived();
12785 tet_infoline("Progress check reset");
12786 progressCheckAlpha.Reset();
12787 progressCheckBeta.Reset();
12789 application.SendNotification();
12790 application.Render(durationSeconds * 960.0f); // 98% progress
12791 application.SendNotification();
12792 tet_infoline("Animation at 98% - No signal received");
12793 DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12795 progressCheckAlpha.CheckSignalNotReceived();
12796 progressCheckBeta.CheckSignalNotReceived();
12798 application.SendNotification();
12799 application.Render(durationSeconds * 40.0f); // 2% progress
12800 application.SendNotification();
12801 tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
12802 application.SendNotification();
12804 DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12806 progressCheckAlpha.CheckSignalReceived();
12807 progressCheckBeta.CheckSignalReceived();
12809 tet_infoline("Progress check reset");
12810 progressCheckAlpha.Reset();
12811 progressCheckBeta.Reset();
12813 application.SendNotification();
12814 application.Render(durationSeconds * 980.0f); // 100% progress
12815 application.SendNotification();
12816 tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
12817 application.SendNotification();
12819 progressCheckAlpha.CheckSignalNotReceived();
12820 progressCheckBeta.CheckSignalReceived();
12822 tet_infoline("Progress check reset");
12823 progressCheckAlpha.Reset();
12824 progressCheckBeta.Reset();
12826 animationAlpha.SetLooping(false);
12827 animationBeta.SetLooping(false);
12829 application.SendNotification();
12830 application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
12831 application.SendNotification();
12833 // We did expect the animation to finish
12834 tet_infoline("Animation finished");
12839 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12841 tet_infoline("Multiple animations with different progress markers");
12843 TestApplication application;
12845 Actor actor = Actor::New();
12846 application.GetScene().Add(actor);
12848 // Build the animation
12849 Animation animationAlpha = Animation::New(0.0f);
12850 Animation animationBeta = Animation::New(0.0f);
12853 float durationSeconds(1.0f);
12854 float delaySeconds(0.5f);
12855 animationAlpha.SetDuration(durationSeconds);
12856 animationBeta.SetDuration(durationSeconds);
12858 bool progressSignalReceivedAlpha(false);
12859 bool progressSignalReceivedBeta(false);
12861 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12862 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12864 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12865 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12866 application.SendNotification();
12868 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12869 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12870 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12872 tet_infoline("AnimationAlpha Progress notification set to 30%");
12873 DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12875 tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
12876 DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
12878 application.SendNotification();
12879 application.Render();
12881 progressCheckAlpha.CheckSignalNotReceived();
12882 progressCheckBeta.CheckSignalNotReceived();
12884 // Start the animations from 10% progress
12885 animationAlpha.PlayAfter(delaySeconds);
12886 animationBeta.PlayAfter(delaySeconds);
12888 application.SendNotification();
12889 application.Render(0); // start animation
12890 application.Render(delaySeconds * 500.0f); // 50% wait progress
12892 tet_infoline("Delay at 50% - No signals to be received");
12894 progressCheckAlpha.CheckSignalNotReceived();
12895 progressCheckBeta.CheckSignalNotReceived();
12897 application.SendNotification();
12898 application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
12899 application.SendNotification();
12900 tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
12901 DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12903 progressCheckBeta.CheckSignalReceived();
12904 progressCheckAlpha.CheckSignalNotReceived();
12906 tet_infoline("Progress check reset");
12907 progressCheckAlpha.Reset();
12908 progressCheckBeta.Reset();
12910 application.Render(durationSeconds * 200.0f); // 25% progress
12911 tet_infoline("Animation at 25% - No signals to be received");
12912 application.SendNotification();
12914 progressCheckAlpha.CheckSignalNotReceived();
12915 progressCheckBeta.CheckSignalNotReceived();
12917 application.Render(durationSeconds * 200.0f); // 45% progress
12918 tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
12919 application.SendNotification();
12921 DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12923 progressCheckAlpha.CheckSignalReceived();
12924 progressCheckBeta.CheckSignalNotReceived();
12926 tet_infoline("Progress check reset");
12927 progressCheckAlpha.Reset();
12928 progressCheckBeta.Reset();
12930 application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
12931 application.SendNotification();
12933 tet_infoline("Animation at 60%");
12935 progressCheckAlpha.CheckSignalNotReceived();
12936 progressCheckBeta.CheckSignalNotReceived();
12938 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12939 application.SendNotification();
12940 tet_infoline("Animation at 80%");
12942 progressCheckAlpha.CheckSignalNotReceived();
12943 progressCheckBeta.CheckSignalNotReceived();
12945 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12946 // We did expect the animation to finish
12947 tet_infoline("Animation finished");
12952 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12954 TestApplication application;
12956 Actor actor = Actor::New();
12957 application.GetScene().Add(actor);
12959 // Build the animation
12960 Animation animation = Animation::New(0.0f);
12963 const float durationSeconds(1.0f);
12964 animation.SetDuration(durationSeconds);
12966 // Set Looping Count
12967 const int loopCount(4);
12968 animation.SetLoopCount(loopCount);
12970 bool finishedSignalReceived(false);
12971 bool progressSignalReceived(false);
12973 AnimationFinishCheck finishCheck(finishedSignalReceived);
12974 animation.FinishedSignal().Connect(&application, finishCheck);
12976 AnimationProgressCheck progressCheck(progressSignalReceived);
12977 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12978 application.SendNotification();
12980 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12981 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12983 tet_infoline("Animation Progress notification set to 50% with looping count 4");
12984 DevelAnimation::SetProgressNotification(animation, 0.5f);
12986 application.SendNotification();
12987 application.Render();
12989 progressCheck.CheckSignalNotReceived();
12993 for(int count = 0; count < loopCount; count++)
12995 application.SendNotification();
12996 application.Render(0); // start animation
12997 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
12998 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13000 tet_infoline("Animation at 25%");
13002 progressCheck.CheckSignalNotReceived();
13004 application.SendNotification();
13005 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13006 application.SendNotification();
13007 tet_infoline("Animation at 50%");
13008 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13010 progressCheck.CheckSignalReceived();
13012 tet_infoline("Progress check reset");
13013 progressCheck.Reset();
13015 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13016 tet_infoline("Animation at 75%");
13017 application.SendNotification();
13019 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13021 progressCheck.CheckSignalNotReceived();
13023 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13024 tet_infoline("Animation at 100%");
13025 application.SendNotification();
13027 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13028 application.SendNotification();
13030 application.Render(10u);
13031 application.SendNotification();
13032 application.Render(0u);
13033 application.SendNotification();
13035 finishCheck.CheckSignalReceived();
13040 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
13042 TestApplication application;
13044 Actor actor = Actor::New();
13045 application.GetScene().Add(actor);
13047 // Build the animation
13048 Animation animation = Animation::New(0.0f);
13051 const float durationSeconds(1.0f);
13052 animation.SetDuration(durationSeconds);
13054 // Set Looping Unlmited
13055 animation.SetLooping(true);
13057 bool finishedSignalReceived(false);
13058 bool progressSignalReceived(false);
13060 AnimationFinishCheck finishCheck(finishedSignalReceived);
13061 animation.FinishedSignal().Connect(&application, finishCheck);
13063 AnimationProgressCheck progressCheck(progressSignalReceived);
13064 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13065 application.SendNotification();
13067 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13068 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13070 tet_infoline("Animation Progress notification set to 50% with unlimited looping");
13071 DevelAnimation::SetProgressNotification(animation, 0.5f);
13073 application.SendNotification();
13074 application.Render();
13076 progressCheck.CheckSignalNotReceived();
13080 for(int count = 0; count < 4; count++)
13082 application.SendNotification();
13083 application.Render(0); // start animation
13084 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13085 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13087 tet_infoline("Animation at 25%");
13089 progressCheck.CheckSignalNotReceived();
13091 application.SendNotification();
13092 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13093 application.SendNotification();
13094 tet_infoline("Animation at 50%");
13095 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13097 progressCheck.CheckSignalReceived();
13099 tet_infoline("Progress check reset");
13100 progressCheck.Reset();
13102 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13103 tet_infoline("Animation at 75%");
13104 application.SendNotification();
13106 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13108 progressCheck.CheckSignalNotReceived();
13110 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13111 tet_infoline("Animation at 100%");
13112 application.SendNotification();
13114 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13115 finishCheck.CheckSignalNotReceived();
13116 application.SendNotification();
13118 finishCheck.CheckSignalNotReceived();
13120 animation.SetLooping(false);
13121 application.Render(0u);
13122 application.SendNotification();
13123 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
13124 application.SendNotification();
13125 application.Render(0u);
13126 application.SendNotification();
13128 finishCheck.CheckSignalReceived();
13133 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
13135 TestApplication application;
13137 Actor actor = Actor::New();
13138 application.GetScene().Add(actor);
13140 // Build the animation
13141 Animation animation = Animation::New(0.0f);
13144 const float durationSeconds(1.0f);
13145 animation.SetDuration(durationSeconds);
13147 //Set speed negative
13148 animation.SetSpeedFactor(-1.0f);
13150 // Set Looping Unlmited
13151 animation.SetLooping(true);
13153 bool finishedSignalReceived(false);
13154 bool progressSignalReceived(false);
13156 AnimationFinishCheck finishCheck(finishedSignalReceived);
13157 animation.FinishedSignal().Connect(&application, finishCheck);
13159 AnimationProgressCheck progressCheck(progressSignalReceived);
13160 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13161 application.SendNotification();
13163 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13164 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13166 tet_infoline("Animation Progress notification set to 50%");
13167 DevelAnimation::SetProgressNotification(animation, 0.5f);
13169 application.SendNotification();
13170 application.Render();
13172 progressCheck.CheckSignalNotReceived();
13176 for(int count = 0; count < 4; count++)
13178 application.SendNotification();
13179 application.Render(0); // start animation
13180 progressCheck.CheckSignalNotReceived();
13182 application.SendNotification();
13183 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13184 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13186 tet_infoline("Animation at 25%");
13188 progressCheck.CheckSignalNotReceived();
13190 application.SendNotification();
13191 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13192 application.SendNotification();
13193 tet_infoline("Animation at 50%");
13194 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13196 progressCheck.CheckSignalReceived();
13198 tet_infoline("Progress check reset");
13199 progressCheck.Reset();
13201 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13202 tet_infoline("Animation at 75%");
13203 application.SendNotification();
13205 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13207 progressCheck.CheckSignalNotReceived();
13209 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13210 tet_infoline("Animation at 100%");
13211 application.SendNotification();
13213 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13214 finishCheck.CheckSignalNotReceived();
13215 application.SendNotification();
13217 finishCheck.CheckSignalNotReceived();
13220 animation.SetLooping(false);
13221 animation.SetLoopCount(4);
13223 application.Render(0u);
13224 application.SendNotification();
13226 for(int count = 0; count < 4; count++)
13228 application.SendNotification();
13229 application.Render(0); // start animation
13230 progressCheck.CheckSignalNotReceived();
13232 application.SendNotification();
13233 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13234 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13236 tet_infoline("Animation at 25%");
13238 progressCheck.CheckSignalNotReceived();
13240 application.SendNotification();
13241 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13242 application.SendNotification();
13243 tet_infoline("Animation at 50%");
13244 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13246 progressCheck.CheckSignalReceived();
13248 tet_infoline("Progress check reset");
13249 progressCheck.Reset();
13251 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13252 tet_infoline("Animation at 75%");
13253 application.SendNotification();
13255 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13257 progressCheck.CheckSignalNotReceived();
13259 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13260 tet_infoline("Animation at 100%");
13261 application.SendNotification();
13263 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13264 application.SendNotification();
13266 application.Render(10u);
13267 application.SendNotification();
13268 application.Render(0u);
13269 application.SendNotification();
13271 finishCheck.CheckSignalReceived();
13276 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13278 TestApplication application;
13280 Actor actor = Actor::New();
13281 application.GetScene().Add(actor);
13283 // Build the animation
13284 Animation animation = Animation::New(0.0f);
13287 const float durationSeconds(1.0f);
13288 animation.SetDuration(durationSeconds);
13290 bool finishedSignalReceived(false);
13291 bool progressSignalReceived(false);
13293 AnimationFinishCheck finishCheck(finishedSignalReceived);
13294 animation.FinishedSignal().Connect(&application, finishCheck);
13296 AnimationProgressCheck progressCheck(progressSignalReceived);
13297 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13298 application.SendNotification();
13300 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13301 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13303 tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
13304 animation.SetPlayRange(Vector2(0.1f, 0.9f));
13306 tet_infoline("Animation Progress notification set to >90% that never can notificated");
13307 DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
13309 application.SendNotification();
13310 application.Render();
13312 progressCheck.CheckSignalNotReceived();
13316 application.SendNotification();
13317 application.Render(0); // start animation
13318 application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
13319 DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
13321 tet_infoline("Animation at 35%");
13323 progressCheck.CheckSignalNotReceived();
13325 application.SendNotification();
13326 application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
13327 application.SendNotification();
13328 DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
13330 tet_infoline("Animation at 60%");
13332 progressCheck.CheckSignalNotReceived();
13334 application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
13335 tet_infoline("Animation at 85%");
13336 application.SendNotification();
13337 DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
13339 progressCheck.CheckSignalNotReceived();
13341 application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
13342 tet_infoline("Animation over 90%");
13343 application.SendNotification();
13345 // progress never signaled because playrange is 90%
13346 progressCheck.CheckSignalNotReceived();
13351 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13353 TestApplication application;
13355 Actor actor = Actor::New();
13356 application.GetScene().Add(actor);
13358 // Build the animation
13359 Animation animation = Animation::New(0.0f);
13362 float durationSeconds(5.0f);
13363 animation.SetDuration(durationSeconds);
13365 bool finishedSignalReceived(false);
13366 bool progressSignalReceived(false);
13368 AnimationFinishCheck finishCheck(finishedSignalReceived);
13369 animation.FinishedSignal().Connect(&application, finishCheck);
13371 AnimationProgressCheck progressCheck(progressSignalReceived);
13372 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13373 application.SendNotification();
13375 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13376 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13378 tet_infoline("Animation Progress notification set to 50%");
13379 DevelAnimation::SetProgressNotification(animation, 0.5f);
13381 application.SendNotification();
13382 application.Render();
13384 progressCheck.CheckSignalNotReceived();
13388 application.SendNotification();
13389 application.Render(0); // start animation
13390 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13391 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13393 tet_infoline("Animation at 25%");
13395 progressCheck.CheckSignalNotReceived();
13397 application.SendNotification();
13398 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13399 application.SendNotification();
13400 tet_infoline("Animation at 50%");
13401 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13403 progressCheck.CheckSignalReceived();
13405 tet_infoline("Progress check reset");
13406 progressCheck.Reset();
13408 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13409 tet_infoline("Animation at 75%");
13410 application.SendNotification();
13412 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13414 progressCheck.CheckSignalNotReceived();
13419 int UtcDaliAnimationAnimateByInvalidParameters(void)
13421 TestApplication application;
13423 Actor actor = Actor::New();
13424 application.GetScene().Add(actor);
13426 // Create the animation
13427 Animation animation = Animation::New(1.0f);
13429 DALI_TEST_ASSERTION(
13431 // non animateable property (STRING)
13432 animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
13434 "Property type is not animatable");
13436 DALI_TEST_ASSERTION(
13438 // non animateable property (MATRIX)
13439 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
13440 animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
13442 "Property type is not animatable");
13445 DALI_TEST_ASSERTION(
13447 // non animateable target (NONE)
13448 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
13450 "Target value is not animatable");
13452 DALI_TEST_ASSERTION(
13454 // non animateable target (STRING)
13455 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
13457 "Target value is not animatable");
13459 DALI_TEST_ASSERTION(
13461 // not mathing properties (VECTOR3, FLOAT)
13462 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
13464 "Property and target types don't match");
13466 DALI_TEST_ASSERTION(
13468 // not mathing properties (VECTOR3.A, VECTOR2)
13469 animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
13471 "Property and target types don't match");
13473 DALI_TEST_ASSERTION(
13475 // negative duration
13476 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13478 "Duration must be >=0");
13483 int UtcDaliAnimationAnimateToInvalidParameters(void)
13485 TestApplication application;
13487 Actor actor = Actor::New();
13488 application.GetScene().Add(actor);
13490 // Create the animation
13491 Animation animation = Animation::New(1.0f);
13494 DALI_TEST_ASSERTION(
13496 // non animateable property (MAP)
13497 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
13498 animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
13500 "Property type is not animatable");
13502 DALI_TEST_ASSERTION(
13504 // non animateable target (NONE)
13505 animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
13507 "Property type is not animatable");
13509 DALI_TEST_ASSERTION(
13511 // non animateable target (ARRAY)
13512 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
13514 "Target value is not animatable");
13516 DALI_TEST_ASSERTION(
13518 // non animateable target (RECTANGLE)
13519 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
13521 "Target value is not animatable");
13523 DALI_TEST_ASSERTION(
13525 // not mathing properties (FLOAT, INT)
13526 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
13528 "Property and target types don't match");
13530 DALI_TEST_ASSERTION(
13532 // not mathing properties (VECTOR3, VECTOR2)
13533 animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
13535 "Property and target types don't match");
13537 DALI_TEST_ASSERTION(
13539 // negative duration
13540 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13542 "Duration must be >=0");
13547 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13549 TestApplication application;
13551 Actor actor = Actor::New();
13552 application.GetScene().Add(actor);
13554 // Create the animation
13555 Animation animation = Animation::New(1.0f);
13558 DALI_TEST_ASSERTION(
13560 // non animateable property (ARRAY)
13561 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
13562 KeyFrames keyframes = KeyFrames::New();
13563 keyframes.Add(0.5f, Property::Value(Property::ARRAY));
13564 animation.AnimateBetween(Property(actor, index), keyframes);
13566 "Property type is not animatable");
13568 DALI_TEST_ASSERTION(
13570 // non animateable target (NONE)
13571 KeyFrames keyframes = KeyFrames::New();
13572 keyframes.Add(0.5f, Property::Value());
13573 animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
13575 "Property type is not animatable");
13577 DALI_TEST_ASSERTION(
13579 // non animateable target (EXTENTS)
13580 KeyFrames keyframes = KeyFrames::New();
13581 keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
13582 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13584 "Property type is not animatable");
13586 DALI_TEST_ASSERTION(
13588 // non animateable target (RECTANGLE)
13589 KeyFrames keyframes = KeyFrames::New();
13590 keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
13591 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13593 "Property type is not animatable");
13595 DALI_TEST_ASSERTION(
13597 // not mathing properties (VECTOR2, VECTOR4)
13598 KeyFrames keyframes = KeyFrames::New();
13599 keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
13600 animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
13602 "Property and target types don't match");
13604 DALI_TEST_ASSERTION(
13606 // negative duration
13607 KeyFrames keyframes = KeyFrames::New();
13608 keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
13609 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
13611 "Duration must be >=0");
13616 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13624 void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
13626 tet_printf("Testing %s\n", testName);
13628 // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13629 // This test checks that that is being done
13631 const float durationSeconds(1.0f);
13632 unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13633 const Vector3 originalPosition(Vector3::ZERO);
13634 const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13635 const Vector3 halfWayToTarget(targetPosition * 0.5f);
13637 struct ExpectedValue
13639 Animation::EndAction endAction;
13640 Vector3 expectedGetPropertyValue;
13643 ExpectedValue expectedValueTable[] =
13645 {Animation::BAKE, halfWayToTarget}, // When baking, the current value is the final value.
13646 {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
13647 {Animation::DISCARD, originalPosition}, // When discarding, we should jump back to the original value when clearing or stopping.
13649 const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
13651 for(auto i = 0u; i < expectedValueTableCount; ++i)
13653 TestApplication application;
13655 Actor actor = Actor::New();
13656 application.GetScene().Add(actor);
13658 // Build the animation
13659 Animation animation = Animation::New(durationSeconds);
13660 animation.SetEndAction(expectedValueTable[i].endAction);
13661 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13663 // Start the animation
13666 application.SendNotification();
13667 application.Render(halfAnimationDuration);
13669 // Stop or Clear the animation early, both have the same effect
13670 if(functionToTest == TestFunction::STOP)
13679 // 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
13680 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13681 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13683 // After one frame, both values should match regardless of the End Action
13684 application.SendNotification();
13685 application.Render();
13687 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13688 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13691 } // unnamed namespace
13693 int UtcDaliAnimationStopPropertyValue(void)
13695 CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
13699 int UtcDaliAnimationClearPropertyValue01(void)
13701 CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
13705 int UtcDaliAnimationClearPropertyValue02(void)
13707 TestApplication application;
13709 Actor actor = Actor::New();
13710 application.GetScene().Add(actor);
13712 const float durationSeconds(1.0f);
13713 const Vector3 targetPosition1(10.0f, 10.0f, 10.0f);
13714 const Vector3 targetPosition2(20.0f, 20.0f, 20.0f);
13716 // Build the animation
13717 Animation animation1 = Animation::New(durationSeconds);
13718 animation1.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition1, AlphaFunction::LINEAR);
13721 application.SendNotification();
13722 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13724 // The event side property should be set the current value immediately
13725 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition1, VECTOR3_EPSILON, TEST_LOCATION);
13727 application.SendNotification();
13728 application.Render(2u /*just beyond the animation duration*/);
13730 // Build a new animation
13731 Animation animation2 = Animation::New(durationSeconds);
13732 animation2.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition2, AlphaFunction::LINEAR);
13735 application.SendNotification();
13736 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13738 // The event side property should be set the current value immediately
13739 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13741 // Clear the first animation after finished
13742 animation1.Clear();
13744 application.SendNotification();
13745 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13747 // The property should not be changed.
13748 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13753 int UtcDaliAnimationPausePropertyValue(void)
13755 const float durationSeconds(1.0f);
13756 unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13757 const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13758 const Vector3 halfWayToTarget(targetPosition * 0.5f);
13760 Animation::EndAction endActions[] =
13763 Animation::BAKE_FINAL,
13764 Animation::DISCARD,
13766 const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
13768 // For all end actions, when pausing, we stay at the current value
13769 for(auto i = 0u; i < endActionCount; ++i)
13771 TestApplication application;
13773 Actor actor = Actor::New();
13774 application.GetScene().Add(actor);
13776 // Build the animation
13777 Animation animation = Animation::New(durationSeconds);
13778 animation.SetEndAction(endActions[i]);
13779 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13781 // Start the animation
13784 application.SendNotification();
13785 application.Render(halfAnimationDuration);
13787 // Puase the animation early
13790 // The event side property should be set the current value immediately, the update side property will still only be halfway
13791 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13792 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13794 // After one frame, both values should match regardless of the End Action
13795 application.SendNotification();
13796 application.Render();
13798 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13799 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13805 int UtcDaliAnimationPlayFromWithLoopCount(void)
13807 TestApplication application;
13809 auto actor = Actor::New();
13810 application.GetScene().Add(actor);
13812 auto animation = Animation::New(1.0f);
13813 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
13814 animation.SetLoopCount(2);
13817 application.SendNotification();
13818 application.Render(1001);
13820 // One loop completed
13822 application.Render(2005);
13823 application.SendNotification();
13825 // 2 loops should have completed
13826 DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
13828 // Another render needs to occur after all the loops end
13829 application.SendNotification();
13830 application.Render(1000);
13832 // Stop the animation and use PlayFrom, previously we got an Assert here
13834 animation.PlayFrom(0.5f);
13836 application.SendNotification();
13837 application.Render(1000);
13839 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
13844 int UtcDaliAnimationCombineToAndByWithStop(void)
13846 tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
13848 TestApplication application;
13850 auto actor = Actor::New();
13851 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13852 application.GetScene().Add(actor);
13854 auto animation = Animation::New(1.0f);
13855 const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13856 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13857 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
13860 application.SendNotification();
13861 application.Render(500);
13863 application.SendNotification();
13864 application.Render(500);
13866 application.SendNotification();
13867 application.Render(500);
13869 // Stop and clear the animation using the current values
13873 // Check the y position, it should be the same as before
13874 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
13879 int UtcDaliAnimationCountAndGetAnimationAt(void)
13881 tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
13883 TestApplication application;
13885 auto actor = Actor::New();
13886 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
13887 application.GetScene().Add(actor);
13889 auto animation = Animation::New(1.0f);
13890 const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
13891 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
13894 application.SendNotification();
13895 application.Render(500);
13897 uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
13898 DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
13900 DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
13902 Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
13903 DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
13905 DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
13906 DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
13907 DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
13908 DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
13909 DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
13911 // Stop and clear the animation using the current values
13918 int UtcDaliAnimationSetLoopingNegative(void)
13920 TestApplication application;
13921 Dali::Animation instance;
13925 instance.SetLooping(arg1);
13926 DALI_TEST_CHECK(false); // Should not get here
13930 DALI_TEST_CHECK(true); // We expect an assert
13935 int UtcDaliAnimationSetDurationNegative(void)
13937 TestApplication application;
13938 Dali::Animation instance;
13942 instance.SetDuration(arg1);
13943 DALI_TEST_CHECK(false); // Should not get here
13947 DALI_TEST_CHECK(true); // We expect an assert
13952 int UtcDaliAnimationGetLoopCountNegative(void)
13954 TestApplication application;
13955 Dali::Animation instance;
13958 instance.GetLoopCount();
13959 DALI_TEST_CHECK(false); // Should not get here
13963 DALI_TEST_CHECK(true); // We expect an assert
13968 int UtcDaliAnimationSetEndActionNegative(void)
13970 TestApplication application;
13971 Dali::Animation instance;
13974 Dali::Animation::EndAction arg1(Animation::BAKE);
13975 instance.SetEndAction(arg1);
13976 DALI_TEST_CHECK(false); // Should not get here
13980 DALI_TEST_CHECK(true); // We expect an assert
13985 int UtcDaliAnimationSetLoopCountNegative(void)
13987 TestApplication application;
13988 Dali::Animation instance;
13992 instance.SetLoopCount(arg1);
13993 DALI_TEST_CHECK(false); // Should not get here
13997 DALI_TEST_CHECK(true); // We expect an assert
14002 int UtcDaliAnimationSetPlayRangeNegative(void)
14004 TestApplication application;
14005 Dali::Animation instance;
14008 Dali::Vector2 arg1;
14009 instance.SetPlayRange(arg1);
14010 DALI_TEST_CHECK(false); // Should not get here
14014 DALI_TEST_CHECK(true); // We expect an assert
14019 int UtcDaliAnimationAnimateBetweenNegative01(void)
14021 TestApplication application;
14022 Dali::Animation instance;
14026 Dali::Property arg1(actor, Actor::Property::POSITION);
14027 Dali::KeyFrames arg2;
14028 instance.AnimateBetween(arg1, arg2);
14029 DALI_TEST_CHECK(false); // Should not get here
14033 DALI_TEST_CHECK(true); // We expect an assert
14038 int UtcDaliAnimationAnimateBetweenNegative02(void)
14040 TestApplication application;
14041 Dali::Animation instance;
14045 Dali::Property arg1(actor, Actor::Property::POSITION);
14046 Dali::KeyFrames arg2;
14047 Dali::Animation::Interpolation arg3(Animation::LINEAR);
14048 instance.AnimateBetween(arg1, arg2, arg3);
14049 DALI_TEST_CHECK(false); // Should not get here
14053 DALI_TEST_CHECK(true); // We expect an assert
14058 int UtcDaliAnimationAnimateBetweenNegative03(void)
14060 TestApplication application;
14061 Dali::Animation instance;
14065 Dali::Property arg1(actor, Actor::Property::POSITION);
14066 Dali::KeyFrames arg2;
14067 Dali::TimePeriod arg3(1.0f);
14068 instance.AnimateBetween(arg1, arg2, arg3);
14069 DALI_TEST_CHECK(false); // Should not get here
14073 DALI_TEST_CHECK(true); // We expect an assert
14078 int UtcDaliAnimationAnimateBetweenNegative04(void)
14080 TestApplication application;
14081 Dali::Animation instance;
14085 Dali::Property arg1(actor, Actor::Property::POSITION);
14086 Dali::KeyFrames arg2;
14087 Dali::TimePeriod arg3(1.0f);
14088 Dali::Animation::Interpolation arg4(Animation::LINEAR);
14089 instance.AnimateBetween(arg1, arg2, arg3, arg4);
14090 DALI_TEST_CHECK(false); // Should not get here
14094 DALI_TEST_CHECK(true); // We expect an assert
14099 int UtcDaliAnimationAnimateBetweenNegative05(void)
14101 TestApplication application;
14102 Dali::Animation instance;
14106 Dali::Property arg1(actor, Actor::Property::POSITION);
14107 Dali::KeyFrames arg2;
14108 Dali::AlphaFunction arg3;
14109 instance.AnimateBetween(arg1, arg2, arg3);
14110 DALI_TEST_CHECK(false); // Should not get here
14114 DALI_TEST_CHECK(true); // We expect an assert
14119 int UtcDaliAnimationAnimateBetweenNegative06(void)
14121 TestApplication application;
14122 Dali::Animation instance;
14126 Dali::Property arg1(actor, Actor::Property::POSITION);
14127 Dali::KeyFrames arg2;
14128 Dali::AlphaFunction arg3;
14129 Dali::Animation::Interpolation arg4(Animation::LINEAR);
14130 instance.AnimateBetween(arg1, arg2, arg3, arg4);
14131 DALI_TEST_CHECK(false); // Should not get here
14135 DALI_TEST_CHECK(true); // We expect an assert
14140 int UtcDaliAnimationAnimateBetweenNegative07(void)
14142 TestApplication application;
14143 Dali::Animation instance;
14147 Dali::Property arg1(actor, Actor::Property::POSITION);
14148 Dali::KeyFrames arg2;
14149 Dali::AlphaFunction arg3;
14150 Dali::TimePeriod arg4(1.0f);
14151 instance.AnimateBetween(arg1, arg2, arg3, arg4);
14152 DALI_TEST_CHECK(false); // Should not get here
14156 DALI_TEST_CHECK(true); // We expect an assert
14161 int UtcDaliAnimationAnimateBetweenNegative08(void)
14163 TestApplication application;
14164 Dali::Animation instance;
14168 Dali::Property arg1(actor, Actor::Property::POSITION);
14169 Dali::KeyFrames arg2;
14170 Dali::AlphaFunction arg3;
14171 Dali::TimePeriod arg4(1.0f);
14172 Dali::Animation::Interpolation arg5(Animation::LINEAR);
14173 instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
14174 DALI_TEST_CHECK(false); // Should not get here
14178 DALI_TEST_CHECK(true); // We expect an assert
14183 int UtcDaliAnimationFinishedSignalNegative(void)
14185 TestApplication application;
14186 Dali::Animation instance;
14189 instance.FinishedSignal();
14190 DALI_TEST_CHECK(false); // Should not get here
14194 DALI_TEST_CHECK(true); // We expect an assert
14199 int UtcDaliAnimationGetCurrentLoopNegative(void)
14201 TestApplication application;
14202 Dali::Animation instance;
14205 instance.GetCurrentLoop();
14206 DALI_TEST_CHECK(false); // Should not get here
14210 DALI_TEST_CHECK(true); // We expect an assert
14215 int UtcDaliAnimationSetLoopingModeNegative(void)
14217 TestApplication application;
14218 Dali::Animation instance;
14221 Dali::Animation::LoopingMode arg1(Animation::RESTART);
14222 instance.SetLoopingMode(arg1);
14223 DALI_TEST_CHECK(false); // Should not get here
14227 DALI_TEST_CHECK(true); // We expect an assert
14232 int UtcDaliAnimationSetSpeedFactorNegative(void)
14234 TestApplication application;
14235 Dali::Animation instance;
14239 instance.SetSpeedFactor(arg1);
14240 DALI_TEST_CHECK(false); // Should not get here
14244 DALI_TEST_CHECK(true); // We expect an assert
14249 int UtcDaliAnimationGetCurrentProgressNegative(void)
14251 TestApplication application;
14252 Dali::Animation instance;
14255 instance.GetCurrentProgress();
14256 DALI_TEST_CHECK(false); // Should not get here
14260 DALI_TEST_CHECK(true); // We expect an assert
14265 int UtcDaliAnimationSetCurrentProgressNegative(void)
14267 TestApplication application;
14268 Dali::Animation instance;
14272 instance.SetCurrentProgress(arg1);
14273 DALI_TEST_CHECK(false); // Should not get here
14277 DALI_TEST_CHECK(true); // We expect an assert
14282 int UtcDaliAnimationSetDisconnectActionNegative(void)
14284 TestApplication application;
14285 Dali::Animation instance;
14288 Dali::Animation::EndAction arg1(Animation::BAKE);
14289 instance.SetDisconnectAction(arg1);
14290 DALI_TEST_CHECK(false); // Should not get here
14294 DALI_TEST_CHECK(true); // We expect an assert
14299 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14301 TestApplication application;
14302 Dali::Animation instance;
14305 Dali::AlphaFunction arg1;
14306 instance.SetDefaultAlphaFunction(arg1);
14307 DALI_TEST_CHECK(false); // Should not get here
14311 DALI_TEST_CHECK(true); // We expect an assert
14316 int UtcDaliAnimationHideNegative(void)
14318 TestApplication application;
14319 Dali::Animation instance;
14324 instance.Hide(arg1, arg2);
14325 DALI_TEST_CHECK(false); // Should not get here
14329 DALI_TEST_CHECK(true); // We expect an assert
14334 int UtcDaliAnimationPlayNegative(void)
14336 TestApplication application;
14337 Dali::Animation instance;
14341 DALI_TEST_CHECK(false); // Should not get here
14345 DALI_TEST_CHECK(true); // We expect an assert
14350 int UtcDaliAnimationShowNegative(void)
14352 TestApplication application;
14353 Dali::Animation instance;
14358 instance.Show(arg1, arg2);
14359 DALI_TEST_CHECK(false); // Should not get here
14363 DALI_TEST_CHECK(true); // We expect an assert
14368 int UtcDaliAnimationStopNegative(void)
14370 TestApplication application;
14371 Dali::Animation instance;
14375 DALI_TEST_CHECK(false); // Should not get here
14379 DALI_TEST_CHECK(true); // We expect an assert
14384 int UtcDaliAnimationClearNegative(void)
14386 TestApplication application;
14387 Dali::Animation instance;
14391 DALI_TEST_CHECK(false); // Should not get here
14395 DALI_TEST_CHECK(true); // We expect an assert
14400 int UtcDaliAnimationPauseNegative(void)
14402 TestApplication application;
14403 Dali::Animation instance;
14407 DALI_TEST_CHECK(false); // Should not get here
14411 DALI_TEST_CHECK(true); // We expect an assert
14416 int UtcDaliAnimationAnimateNegative01(void)
14418 TestApplication application;
14419 Dali::Animation instance;
14424 Dali::Vector3 arg3;
14425 instance.Animate(arg1, arg2, arg3);
14426 DALI_TEST_CHECK(false); // Should not get here
14430 DALI_TEST_CHECK(true); // We expect an assert
14435 int UtcDaliAnimationAnimateNegative02(void)
14437 TestApplication application;
14438 Dali::Animation instance;
14443 Dali::Vector3 arg3;
14444 Dali::TimePeriod arg4(1.0f);
14445 instance.Animate(arg1, arg2, arg3, arg4);
14446 DALI_TEST_CHECK(false); // Should not get here
14450 DALI_TEST_CHECK(true); // We expect an assert
14455 int UtcDaliAnimationAnimateNegative03(void)
14457 TestApplication application;
14458 Dali::Animation instance;
14463 Dali::Vector3 arg3;
14464 Dali::AlphaFunction arg4;
14465 instance.Animate(arg1, arg2, arg3, arg4);
14466 DALI_TEST_CHECK(false); // Should not get here
14470 DALI_TEST_CHECK(true); // We expect an assert
14475 int UtcDaliAnimationAnimateNegative04(void)
14477 TestApplication application;
14478 Dali::Animation instance;
14483 Dali::Vector3 arg3;
14484 Dali::AlphaFunction arg4;
14485 Dali::TimePeriod arg5(1.0f);
14486 instance.Animate(arg1, arg2, arg3, arg4, arg5);
14487 DALI_TEST_CHECK(false); // Should not get here
14491 DALI_TEST_CHECK(true); // We expect an assert
14496 int UtcDaliAnimationPlayFromNegative(void)
14498 TestApplication application;
14499 Dali::Animation instance;
14503 instance.PlayFrom(arg1);
14504 DALI_TEST_CHECK(false); // Should not get here
14508 DALI_TEST_CHECK(true); // We expect an assert
14513 int UtcDaliAnimationAnimateByNegative01(void)
14515 TestApplication application;
14516 Dali::Animation instance;
14520 Dali::Property arg1(actor, Actor::Property::POSITION);
14521 Dali::Property::Value arg2;
14522 instance.AnimateBy(arg1, arg2);
14523 DALI_TEST_CHECK(false); // Should not get here
14527 DALI_TEST_CHECK(true); // We expect an assert
14532 int UtcDaliAnimationAnimateByNegative02(void)
14534 TestApplication application;
14535 Dali::Animation instance;
14539 Dali::Property arg1(actor, Actor::Property::POSITION);
14540 Dali::Property::Value arg2;
14541 Dali::TimePeriod arg3(1.0f);
14542 instance.AnimateBy(arg1, arg2, arg3);
14543 DALI_TEST_CHECK(false); // Should not get here
14547 DALI_TEST_CHECK(true); // We expect an assert
14552 int UtcDaliAnimationAnimateByNegative03(void)
14554 TestApplication application;
14555 Dali::Animation instance;
14559 Dali::Property arg1(actor, Actor::Property::POSITION);
14560 Dali::Property::Value arg2;
14561 Dali::AlphaFunction arg3;
14562 instance.AnimateBy(arg1, arg2, arg3);
14563 DALI_TEST_CHECK(false); // Should not get here
14567 DALI_TEST_CHECK(true); // We expect an assert
14572 int UtcDaliAnimationAnimateByNegative04(void)
14574 TestApplication application;
14575 Dali::Animation instance;
14579 Dali::Property arg1(actor, Actor::Property::POSITION);
14580 Dali::Property::Value arg2;
14581 Dali::AlphaFunction arg3;
14582 Dali::TimePeriod arg4(1.0f);
14583 instance.AnimateBy(arg1, arg2, arg3, arg4);
14584 DALI_TEST_CHECK(false); // Should not get here
14588 DALI_TEST_CHECK(true); // We expect an assert
14593 int UtcDaliAnimationAnimateToNegative01(void)
14595 TestApplication application;
14597 Dali::Animation instance;
14600 Dali::Property arg1(actor, Actor::Property::POSITION);
14601 Dali::Property::Value arg2;
14602 instance.AnimateTo(arg1, arg2);
14603 DALI_TEST_CHECK(false); // Should not get here
14607 DALI_TEST_CHECK(true); // We expect an assert
14612 int UtcDaliAnimationAnimateToNegative02(void)
14614 TestApplication application;
14615 Dali::Animation instance;
14619 Dali::Property arg1(actor, Actor::Property::POSITION);
14620 Dali::Property::Value arg2;
14621 Dali::TimePeriod arg3(1.0f);
14622 instance.AnimateTo(arg1, arg2, arg3);
14623 DALI_TEST_CHECK(false); // Should not get here
14627 DALI_TEST_CHECK(true); // We expect an assert
14632 int UtcDaliAnimationAnimateToNegative03(void)
14634 TestApplication application;
14635 Dali::Animation instance;
14639 Dali::Property arg1(actor, Actor::Property::POSITION);
14640 Dali::Property::Value arg2;
14641 Dali::AlphaFunction arg3;
14642 instance.AnimateTo(arg1, arg2, arg3);
14643 DALI_TEST_CHECK(false); // Should not get here
14647 DALI_TEST_CHECK(true); // We expect an assert
14652 int UtcDaliAnimationAnimateToNegative04(void)
14654 TestApplication application;
14655 Dali::Animation instance;
14659 Dali::Property arg1(actor, Actor::Property::POSITION);
14660 Dali::Property::Value arg2;
14661 Dali::AlphaFunction arg3;
14662 Dali::TimePeriod arg4(1.0f);
14663 instance.AnimateTo(arg1, arg2, arg3, arg4);
14664 DALI_TEST_CHECK(false); // Should not get here
14668 DALI_TEST_CHECK(true); // We expect an assert
14673 int UtcDaliAnimationPlayAfterNegative(void)
14675 TestApplication application;
14676 Dali::Animation instance;
14680 instance.PlayAfter(arg1);
14681 DALI_TEST_CHECK(false); // Should not get here
14685 DALI_TEST_CHECK(true); // We expect an assert
14690 int UtcDaliAnimationGetDurationNegative(void)
14692 TestApplication application;
14693 Dali::Animation instance;
14696 instance.GetDuration();
14697 DALI_TEST_CHECK(false); // Should not get here
14701 DALI_TEST_CHECK(true); // We expect an assert
14706 int UtcDaliAnimationGetEndActionNegative(void)
14708 TestApplication application;
14709 Dali::Animation instance;
14712 instance.GetEndAction();
14713 DALI_TEST_CHECK(false); // Should not get here
14717 DALI_TEST_CHECK(true); // We expect an assert
14722 int UtcDaliAnimationGetPlayRangeNegative(void)
14724 TestApplication application;
14725 Dali::Animation instance;
14728 instance.GetPlayRange();
14729 DALI_TEST_CHECK(false); // Should not get here
14733 DALI_TEST_CHECK(true); // We expect an assert
14738 int UtcDaliAnimationGetLoopingModeNegative(void)
14740 TestApplication application;
14741 Dali::Animation instance;
14744 instance.GetLoopingMode();
14745 DALI_TEST_CHECK(false); // Should not get here
14749 DALI_TEST_CHECK(true); // We expect an assert
14754 int UtcDaliAnimationGetSpeedFactorNegative(void)
14756 TestApplication application;
14757 Dali::Animation instance;
14760 instance.GetSpeedFactor();
14761 DALI_TEST_CHECK(false); // Should not get here
14765 DALI_TEST_CHECK(true); // We expect an assert
14770 int UtcDaliAnimationGetDisconnectActionNegative(void)
14772 TestApplication application;
14773 Dali::Animation instance;
14776 instance.GetDisconnectAction();
14777 DALI_TEST_CHECK(false); // Should not get here
14781 DALI_TEST_CHECK(true); // We expect an assert
14786 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
14788 TestApplication application;
14789 Dali::Animation instance;
14792 instance.GetDefaultAlphaFunction();
14793 DALI_TEST_CHECK(false); // Should not get here
14797 DALI_TEST_CHECK(true); // We expect an assert
14802 int UtcDaliAnimationGetStateNegative(void)
14804 TestApplication application;
14805 Dali::Animation instance;
14808 instance.GetState();
14809 DALI_TEST_CHECK(false); // Should not get here
14813 DALI_TEST_CHECK(true); // We expect an assert
14818 int UtcDaliAnimationIsLoopingNegative(void)
14820 TestApplication application;
14821 Dali::Animation instance;
14824 instance.IsLooping();
14825 DALI_TEST_CHECK(false); // Should not get here
14829 DALI_TEST_CHECK(true); // We expect an assert
14834 int UtcDaliKeyFramesAddNegative01(void)
14836 TestApplication application;
14837 Dali::KeyFrames instance;
14841 Dali::Property::Value arg2;
14842 instance.Add(arg1, arg2);
14843 DALI_TEST_CHECK(false); // Should not get here
14847 DALI_TEST_CHECK(true); // We expect an assert
14852 int UtcDaliKeyFramesAddNegative02(void)
14854 TestApplication application;
14855 Dali::KeyFrames instance;
14859 Dali::Property::Value arg2;
14860 Dali::AlphaFunction arg3;
14861 instance.Add(arg1, arg2, arg3);
14862 DALI_TEST_CHECK(false); // Should not get here
14866 DALI_TEST_CHECK(true); // We expect an assert
14871 int UtcDaliKeyFramesGetTypeNegative(void)
14873 TestApplication application;
14874 Dali::KeyFrames instance;
14877 instance.GetType();
14878 DALI_TEST_CHECK(false); // Should not get here
14882 DALI_TEST_CHECK(true); // We expect an assert