2 * Copyright (c) 2023 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 UtcDaliAnimationStopEmitFinishedSignalImmediateP(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 bool signalReceived(false);
3188 AnimationFinishCheck finishCheck(signalReceived);
3189 animation.FinishedSignal().Connect(&application, finishCheck);
3193 tet_printf("Play and Stop immediately\n");
3194 // Start the animation, and stop immediately.
3198 finishCheck.CheckSignalNotReceived();
3200 application.SendNotification();
3201 application.Render(0);
3203 // expect finished signal recieved due to Stop API.
3204 application.SendNotification();
3205 finishCheck.CheckSignalReceived();
3206 finishCheck.Reset();
3208 application.SendNotification();
3209 application.Render(0);
3211 // Play multiple times
3213 tet_printf("Play and Stop immediately 2\n");
3214 // Start the animation, and stop immediately.
3223 finishCheck.CheckSignalNotReceived();
3225 application.SendNotification();
3226 application.Render(0);
3228 // expect finished signal recieved due to Stop API.
3229 application.SendNotification();
3230 finishCheck.CheckSignalReceived();
3231 finishCheck.Reset();
3233 application.SendNotification();
3234 application.Render(0);
3238 tet_printf("PlayAfter and Stop immediately\n");
3239 // Start the animation, and stop immediately.
3240 animation.PlayAfter(1.0f);
3243 finishCheck.CheckSignalNotReceived();
3245 application.SendNotification();
3246 application.Render(0);
3248 // expect finished signal recieved due to Stop API.
3249 application.SendNotification();
3250 finishCheck.CheckSignalReceived();
3251 finishCheck.Reset();
3253 application.SendNotification();
3254 application.Render(0);
3258 tet_printf("PlayFrom and Stop immediately\n");
3259 // Start the animation, and stop immediately.
3260 animation.PlayFrom(0.5f);
3263 finishCheck.CheckSignalNotReceived();
3265 application.SendNotification();
3266 application.Render(0);
3268 // expect finished signal recieved due to Stop API.
3269 application.SendNotification();
3270 finishCheck.CheckSignalReceived();
3271 finishCheck.Reset();
3273 application.SendNotification();
3274 application.Render(0);
3278 tet_printf("Play and Pause and Stop immediately\n");
3279 // Pause the animation, and stop immediately.
3284 finishCheck.CheckSignalNotReceived();
3286 application.SendNotification();
3287 application.Render(0);
3289 // expect finished signal recieved due to Stop API.
3290 application.SendNotification();
3291 finishCheck.CheckSignalReceived();
3292 finishCheck.Reset();
3294 application.SendNotification();
3295 application.Render(0);
3298 // Check finished signal not emmited if animation was not play state.
3300 tet_printf("Check whether stop-only case didnt send finished signal\n");
3306 finishCheck.CheckSignalNotReceived();
3308 application.SendNotification();
3309 application.Render(0);
3311 // expect finished signal recieved due to Stop API.
3312 application.SendNotification();
3313 finishCheck.CheckSignalNotReceived();
3314 finishCheck.Reset();
3316 application.SendNotification();
3317 application.Render(0);
3320 tet_printf("Check whether pause-stop case didnt send finished signal\n");
3325 finishCheck.CheckSignalNotReceived();
3327 application.SendNotification();
3328 application.Render(0);
3330 // expect finished signal recieved due to Stop API.
3331 application.SendNotification();
3332 finishCheck.CheckSignalNotReceived();
3333 finishCheck.Reset();
3335 application.SendNotification();
3336 application.Render(0);
3342 int UtcDaliAnimationClearP(void)
3344 TestApplication application;
3346 Actor actor = Actor::New();
3347 application.GetScene().Add(actor);
3349 // Build the animation
3350 float durationSeconds(1.0f);
3351 Animation animation = Animation::New(durationSeconds);
3352 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3353 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3355 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3357 // Start the animation
3360 bool signalReceived(false);
3361 AnimationFinishCheck finishCheck(signalReceived);
3362 animation.FinishedSignal().Connect(&application, finishCheck);
3364 application.SendNotification();
3365 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3367 // We didn't expect the animation to finish yet
3368 application.SendNotification();
3369 finishCheck.CheckSignalNotReceived();
3370 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
3372 // Clear the animation
3374 application.SendNotification();
3376 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3378 // We don't expect the animation to finish now
3379 application.SendNotification();
3380 finishCheck.CheckSignalNotReceived();
3381 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
3383 // Restart as a scale animation; this should not move the actor's position
3384 finishCheck.Reset();
3385 actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
3386 Vector3 targetScale(3.0f, 3.0f, 3.0f);
3387 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
3390 application.SendNotification();
3391 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
3393 // We didn't expect the animation to finish yet
3394 application.SendNotification();
3395 finishCheck.CheckSignalNotReceived();
3396 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3397 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
3399 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
3401 // We did expect the animation to finish
3402 application.SendNotification();
3403 finishCheck.CheckSignalReceived();
3404 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
3405 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
3409 int UtcDaliAnimationFinishedSignalP(void)
3411 TestApplication application;
3413 // Start the empty animation
3414 float durationSeconds(1.0f);
3415 Animation animation = Animation::New(durationSeconds);
3418 bool signalReceived(false);
3419 AnimationFinishCheck finishCheck(signalReceived);
3420 animation.FinishedSignal().Connect(&application, finishCheck);
3422 application.SendNotification();
3423 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
3425 // We did expect the animation to finish
3426 application.SendNotification();
3427 finishCheck.CheckSignalReceived();
3431 int UtcDaliAnimationAnimateByBooleanP(void)
3433 TestApplication application;
3435 Actor actor = Actor::New();
3437 // Register a boolean property
3438 bool startValue(false);
3439 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3440 application.GetScene().Add(actor);
3441 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3442 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3444 // Build the animation
3445 float durationSeconds(2.0f);
3446 Animation animation = Animation::New(durationSeconds);
3447 const bool relativeValue(true);
3448 const bool finalValue(false || relativeValue);
3449 animation.AnimateBy(Property(actor, index), relativeValue);
3451 // Start the animation
3454 // Target value should be retrievable straight away
3455 DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
3457 bool signalReceived(false);
3458 AnimationFinishCheck finishCheck(signalReceived);
3459 animation.FinishedSignal().Connect(&application, finishCheck);
3461 application.SendNotification();
3462 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3464 // We didn't expect the animation to finish yet
3465 application.SendNotification();
3466 finishCheck.CheckSignalNotReceived();
3467 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3469 application.SendNotification();
3470 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3472 // We did expect the animation to finish
3473 application.SendNotification();
3474 finishCheck.CheckSignalReceived();
3475 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3477 // Check that nothing has changed after a couple of buffer swaps
3478 application.Render(0);
3479 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3480 application.Render(0);
3481 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3483 // Repeat with relative value "false" - this should be an NOOP
3484 animation = Animation::New(durationSeconds);
3485 bool noOpValue(false);
3486 animation.AnimateBy(Property(actor, index), noOpValue);
3488 // Start the animation
3491 finishCheck.Reset();
3492 animation.FinishedSignal().Connect(&application, finishCheck);
3494 application.SendNotification();
3495 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3497 // We didn't expect the animation to finish yet
3498 application.SendNotification();
3499 finishCheck.CheckSignalNotReceived();
3500 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3502 application.SendNotification();
3503 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3505 // We did expect the animation to finish
3506 application.SendNotification();
3507 finishCheck.CheckSignalReceived();
3508 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3510 // Check that nothing has changed after a couple of buffer swaps
3511 application.Render(0);
3512 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3513 application.Render(0);
3514 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3518 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3520 TestApplication application;
3522 Actor actor = Actor::New();
3524 // Register a boolean property
3525 bool startValue(false);
3526 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3527 application.GetScene().Add(actor);
3528 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3529 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3531 // Build the animation
3532 float durationSeconds(2.0f);
3533 Animation animation = Animation::New(durationSeconds);
3534 bool relativeValue(true);
3535 bool finalValue(false || relativeValue);
3536 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3538 // Start the animation
3541 bool signalReceived(false);
3542 AnimationFinishCheck finishCheck(signalReceived);
3543 animation.FinishedSignal().Connect(&application, finishCheck);
3545 application.SendNotification();
3546 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3548 // We didn't expect the animation to finish yet
3549 application.SendNotification();
3550 finishCheck.CheckSignalNotReceived();
3551 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3553 application.SendNotification();
3554 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3556 // We did expect the animation to finish
3557 application.SendNotification();
3558 finishCheck.CheckSignalReceived();
3559 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3561 // Check that nothing has changed after a couple of buffer swaps
3562 application.Render(0);
3563 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3564 application.Render(0);
3565 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3567 // Repeat with relative value "false" - this should be an NOOP
3568 animation = Animation::New(durationSeconds);
3569 bool noOpValue(false);
3570 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3572 // Start the animation
3575 finishCheck.Reset();
3576 animation.FinishedSignal().Connect(&application, finishCheck);
3578 application.SendNotification();
3579 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3581 // We didn't expect the animation to finish yet
3582 application.SendNotification();
3583 finishCheck.CheckSignalNotReceived();
3584 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3586 application.SendNotification();
3587 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3589 // We did expect the animation to finish
3590 application.SendNotification();
3591 finishCheck.CheckSignalReceived();
3592 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3596 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3598 TestApplication application;
3600 Actor actor = Actor::New();
3602 // Register a boolean property
3603 bool startValue(false);
3604 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3605 application.GetScene().Add(actor);
3606 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3607 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3609 // Build the animation
3610 float durationSeconds(2.0f);
3611 Animation animation = Animation::New(durationSeconds);
3612 bool relativeValue(true);
3613 bool finalValue(false || relativeValue);
3614 float animatorDurationSeconds(durationSeconds * 0.5f);
3615 animation.AnimateBy(Property(actor, index),
3617 TimePeriod(animatorDurationSeconds));
3619 // Start the animation
3622 bool signalReceived(false);
3623 AnimationFinishCheck finishCheck(signalReceived);
3624 animation.FinishedSignal().Connect(&application, finishCheck);
3626 application.SendNotification();
3627 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3629 // We didn't expect the animation to finish yet
3630 application.SendNotification();
3631 finishCheck.CheckSignalNotReceived();
3632 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3634 application.SendNotification();
3635 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3637 // We didn't expect the animation to finish yet...
3638 application.SendNotification();
3639 finishCheck.CheckSignalNotReceived();
3641 // ...however we should have reached the final value
3642 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3644 application.SendNotification();
3645 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3647 // We did expect the animation to finish
3648 application.SendNotification();
3649 finishCheck.CheckSignalReceived();
3650 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3652 // Check that nothing has changed after a couple of buffer swaps
3653 application.Render(0);
3654 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3655 application.Render(0);
3656 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3660 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3662 TestApplication application;
3664 Actor actor = Actor::New();
3666 // Register a boolean property
3667 bool startValue(false);
3668 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3669 application.GetScene().Add(actor);
3670 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
3671 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3673 // Build the animation
3674 float durationSeconds(2.0f);
3675 Animation animation = Animation::New(durationSeconds);
3676 bool relativeValue(true);
3677 bool finalValue(false || relativeValue);
3678 float animatorDurationSeconds(durationSeconds * 0.5f);
3679 animation.AnimateBy(Property(actor, index),
3681 AlphaFunction::EASE_IN_OUT,
3682 TimePeriod(animatorDurationSeconds));
3684 // Start the animation
3687 bool signalReceived(false);
3688 AnimationFinishCheck finishCheck(signalReceived);
3689 animation.FinishedSignal().Connect(&application, finishCheck);
3691 application.SendNotification();
3692 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
3694 // We didn't expect the animation to finish yet
3695 application.SendNotification();
3696 finishCheck.CheckSignalNotReceived();
3697 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
3699 application.SendNotification();
3700 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
3702 // We didn't expect the animation to finish yet...
3703 application.SendNotification();
3704 finishCheck.CheckSignalNotReceived();
3706 // ...however we should have reached the final value
3707 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3709 application.SendNotification();
3710 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
3712 // We did expect the animation to finish
3713 application.SendNotification();
3714 finishCheck.CheckSignalReceived();
3715 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3717 // Check that nothing has changed after a couple of buffer swaps
3718 application.Render(0);
3719 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3720 application.Render(0);
3721 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
3725 int UtcDaliAnimationAnimateByFloatP(void)
3727 TestApplication application;
3729 Actor actor = Actor::New();
3731 // Register a float property
3732 float startValue(10.0f);
3733 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3734 application.GetScene().Add(actor);
3735 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3736 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3738 // Build the animation
3739 float durationSeconds(2.0f);
3740 Animation animation = Animation::New(durationSeconds);
3741 float targetValue(50.0f);
3742 float relativeValue(targetValue - startValue);
3743 animation.AnimateBy(Property(actor, index), relativeValue);
3745 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3747 // Start the animation
3750 // Target value should be retrievable straight away
3751 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
3753 bool signalReceived(false);
3754 AnimationFinishCheck finishCheck(signalReceived);
3755 animation.FinishedSignal().Connect(&application, finishCheck);
3757 application.SendNotification();
3758 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3760 // We didn't expect the animation to finish yet
3761 application.SendNotification();
3762 finishCheck.CheckSignalNotReceived();
3763 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
3765 application.SendNotification();
3766 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3768 // We did expect the animation to finish
3769 application.SendNotification();
3770 finishCheck.CheckSignalReceived();
3771 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3773 // Check that nothing has changed after a couple of buffer swaps
3774 application.Render(0);
3775 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3776 application.Render(0);
3777 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3781 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3783 TestApplication application;
3785 Actor actor = Actor::New();
3787 // Register a float property
3788 float startValue(10.0f);
3789 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3790 application.GetScene().Add(actor);
3791 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3792 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3794 // Build the animation
3795 float durationSeconds(1.0f);
3796 Animation animation = Animation::New(durationSeconds);
3797 float targetValue(90.0f);
3798 float relativeValue(targetValue - startValue);
3799 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3801 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
3803 // Start the animation
3806 bool signalReceived(false);
3807 AnimationFinishCheck finishCheck(signalReceived);
3808 animation.FinishedSignal().Connect(&application, finishCheck);
3810 application.SendNotification();
3811 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3813 // We didn't expect the animation to finish yet
3814 application.SendNotification();
3815 finishCheck.CheckSignalNotReceived();
3817 // The position should have moved more, than with a linear alpha function
3818 float current(actor.GetCurrentProperty<float>(index));
3819 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
3821 application.SendNotification();
3822 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
3824 // We did expect the animation to finish
3825 application.SendNotification();
3826 finishCheck.CheckSignalReceived();
3827 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3829 // Check that nothing has changed after a couple of buffer swaps
3830 application.Render(0);
3831 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3832 application.Render(0);
3833 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3837 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3839 TestApplication application;
3841 Actor actor = Actor::New();
3843 // Register a float property
3844 float startValue(10.0f);
3845 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3846 application.GetScene().Add(actor);
3847 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3848 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3850 // Build the animation
3851 float durationSeconds(1.0f);
3852 Animation animation = Animation::New(durationSeconds);
3853 float targetValue(30.0f);
3854 float relativeValue(targetValue - startValue);
3856 animation.AnimateBy(Property(actor, index),
3858 TimePeriod(delay, durationSeconds - delay));
3860 // Start the animation
3863 bool signalReceived(false);
3864 AnimationFinishCheck finishCheck(signalReceived);
3865 animation.FinishedSignal().Connect(&application, finishCheck);
3867 application.SendNotification();
3868 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3870 // We didn't expect the animation to finish yet
3871 application.SendNotification();
3872 finishCheck.CheckSignalNotReceived();
3873 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3875 application.SendNotification();
3876 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3878 // We didn't expect the animation to finish yet
3879 application.SendNotification();
3880 finishCheck.CheckSignalNotReceived();
3881 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3883 application.SendNotification();
3884 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3886 // We did expect the animation to finish
3887 application.SendNotification();
3888 finishCheck.CheckSignalReceived();
3889 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3891 // Check that nothing has changed after a couple of buffer swaps
3892 application.Render(0);
3893 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3894 application.Render(0);
3895 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3899 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3901 TestApplication application;
3903 Actor actor = Actor::New();
3905 // Register a float property
3906 float startValue(10.0f);
3907 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3908 application.GetScene().Add(actor);
3909 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
3910 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3912 // Build the animation
3913 float durationSeconds(1.0f);
3914 Animation animation = Animation::New(durationSeconds);
3915 float targetValue(30.0f);
3916 float relativeValue(targetValue - startValue);
3918 animation.AnimateBy(Property(actor, index),
3920 AlphaFunction::LINEAR,
3921 TimePeriod(delay, durationSeconds - delay));
3923 // Start the animation
3926 bool signalReceived(false);
3927 AnimationFinishCheck finishCheck(signalReceived);
3928 animation.FinishedSignal().Connect(&application, finishCheck);
3930 application.SendNotification();
3931 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
3933 // We didn't expect the animation to finish yet
3934 application.SendNotification();
3935 finishCheck.CheckSignalNotReceived();
3936 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
3938 application.SendNotification();
3939 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
3941 // We didn't expect the animation to finish yet
3942 application.SendNotification();
3943 finishCheck.CheckSignalNotReceived();
3944 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
3946 application.SendNotification();
3947 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
3949 // We did expect the animation to finish
3950 application.SendNotification();
3951 finishCheck.CheckSignalReceived();
3952 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3954 // Check that nothing has changed after a couple of buffer swaps
3955 application.Render(0);
3956 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3957 application.Render(0);
3958 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
3962 int UtcDaliAnimationAnimateByIntegerP(void)
3964 TestApplication application;
3966 Actor actor = Actor::New();
3968 // Register an integer property
3970 Property::Index index = actor.RegisterProperty("testProperty", startValue);
3971 application.GetScene().Add(actor);
3972 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
3973 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
3975 // Build the animation
3976 float durationSeconds(2.0f);
3977 Animation animation = Animation::New(durationSeconds);
3978 int targetValue(50);
3979 int relativeValue(targetValue - startValue);
3980 animation.AnimateBy(Property(actor, index), relativeValue);
3982 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
3984 // Start the animation
3987 // Target value should be retrievable straight away
3988 DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
3990 bool signalReceived(false);
3991 AnimationFinishCheck finishCheck(signalReceived);
3992 animation.FinishedSignal().Connect(&application, finishCheck);
3994 application.SendNotification();
3995 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
3997 // We didn't expect the animation to finish yet
3998 application.SendNotification();
3999 finishCheck.CheckSignalNotReceived();
4000 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
4002 application.SendNotification();
4003 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4005 // We did expect the animation to finish
4006 application.SendNotification();
4007 finishCheck.CheckSignalReceived();
4008 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4010 // Check that nothing has changed after a couple of buffer swaps
4011 application.Render(0);
4012 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4013 application.Render(0);
4014 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4018 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
4020 TestApplication application;
4022 Actor actor = Actor::New();
4024 // Register an integer property
4026 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4027 application.GetScene().Add(actor);
4028 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
4029 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4031 // Build the animation
4032 float durationSeconds(1.0f);
4033 Animation animation = Animation::New(durationSeconds);
4034 int targetValue(90);
4035 int relativeValue(targetValue - startValue);
4036 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4038 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
4040 // Start the animation
4043 bool signalReceived(false);
4044 AnimationFinishCheck finishCheck(signalReceived);
4045 animation.FinishedSignal().Connect(&application, finishCheck);
4047 application.SendNotification();
4048 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4050 // We didn't expect the animation to finish yet
4051 application.SendNotification();
4052 finishCheck.CheckSignalNotReceived();
4054 // The position should have moved more, than with a linear alpha function
4055 int current(actor.GetCurrentProperty<int>(index));
4056 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
4058 application.SendNotification();
4059 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4061 // We did expect the animation to finish
4062 application.SendNotification();
4063 finishCheck.CheckSignalReceived();
4064 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4066 // Check that nothing has changed after a couple of buffer swaps
4067 application.Render(0);
4068 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4069 application.Render(0);
4070 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4074 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
4076 TestApplication application;
4078 Actor actor = Actor::New();
4080 // Register an integer property
4082 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4083 application.GetScene().Add(actor);
4084 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
4085 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4087 // Build the animation
4088 float durationSeconds(1.0f);
4089 Animation animation = Animation::New(durationSeconds);
4090 int targetValue(30);
4091 int relativeValue(targetValue - startValue);
4093 animation.AnimateBy(Property(actor, index),
4095 TimePeriod(delay, durationSeconds - delay));
4097 // Start the animation
4100 bool signalReceived(false);
4101 AnimationFinishCheck finishCheck(signalReceived);
4102 animation.FinishedSignal().Connect(&application, finishCheck);
4104 application.SendNotification();
4105 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4107 // We didn't expect the animation to finish yet
4108 application.SendNotification();
4109 finishCheck.CheckSignalNotReceived();
4110 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4112 application.SendNotification();
4113 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4115 // We didn't expect the animation to finish yet
4116 application.SendNotification();
4117 finishCheck.CheckSignalNotReceived();
4118 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
4120 application.SendNotification();
4121 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4123 // We did expect the animation to finish
4124 application.SendNotification();
4125 finishCheck.CheckSignalReceived();
4126 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4128 // Check that nothing has changed after a couple of buffer swaps
4129 application.Render(0);
4130 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4131 application.Render(0);
4132 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4136 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
4138 TestApplication application;
4140 Actor actor = Actor::New();
4142 // Register an integer property
4144 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4145 application.GetScene().Add(actor);
4146 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
4147 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4149 // Build the animation
4150 float durationSeconds(1.0f);
4151 Animation animation = Animation::New(durationSeconds);
4152 int targetValue(30);
4153 int relativeValue(targetValue - startValue);
4155 animation.AnimateBy(Property(actor, index),
4157 AlphaFunction::LINEAR,
4158 TimePeriod(delay, durationSeconds - delay));
4160 // Start the animation
4163 bool signalReceived(false);
4164 AnimationFinishCheck finishCheck(signalReceived);
4165 animation.FinishedSignal().Connect(&application, finishCheck);
4167 application.SendNotification();
4168 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4170 // We didn't expect the animation to finish yet
4171 application.SendNotification();
4172 finishCheck.CheckSignalNotReceived();
4173 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
4175 application.SendNotification();
4176 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4178 // We didn't expect the animation to finish yet
4179 application.SendNotification();
4180 finishCheck.CheckSignalNotReceived();
4181 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
4183 application.SendNotification();
4184 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4186 // We did expect the animation to finish
4187 application.SendNotification();
4188 finishCheck.CheckSignalReceived();
4189 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4191 // Check that nothing has changed after a couple of buffer swaps
4192 application.Render(0);
4193 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4194 application.Render(0);
4195 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
4199 int UtcDaliAnimationAnimateByQuaternionP(void)
4201 TestApplication application;
4203 Actor actor = Actor::New();
4205 // Register a quaternion property
4206 const Quaternion startValue(Degree(90), Vector3::XAXIS);
4207 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4208 application.GetScene().Add(actor);
4209 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4210 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4212 // Build the animation
4213 float durationSeconds(2.0f);
4214 Animation animation = Animation::New(durationSeconds);
4215 const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
4216 const Quaternion finalValue(startValue * relativeValue);
4217 animation.AnimateBy(Property(actor, index), relativeValue);
4219 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
4220 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
4222 // Start the animation
4225 // Target value should be retrievable straight away
4226 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4228 application.SendNotification();
4229 application.Render(2000); // animation complete
4231 DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
4232 DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
4237 int UtcDaliAnimationAnimateByVector2P(void)
4239 TestApplication application;
4241 Actor actor = Actor::New();
4243 // Register a Vector2 property
4244 Vector2 startValue(10.0f, 10.0f);
4245 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4246 application.GetScene().Add(actor);
4247 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4248 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4250 // Build the animation
4251 float durationSeconds(2.0f);
4252 Animation animation = Animation::New(durationSeconds);
4253 Vector2 targetValue(60.0f, 60.0f);
4254 Vector2 relativeValue(targetValue - startValue);
4255 animation.AnimateBy(Property(actor, index), relativeValue);
4257 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4259 // Start the animation
4262 // Target value should be retrievable straight away
4263 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
4265 bool signalReceived(false);
4266 AnimationFinishCheck finishCheck(signalReceived);
4267 animation.FinishedSignal().Connect(&application, finishCheck);
4269 application.SendNotification();
4270 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4272 // We didn't expect the animation to finish yet
4273 application.SendNotification();
4274 finishCheck.CheckSignalNotReceived();
4275 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
4277 application.SendNotification();
4278 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4280 // We did expect the animation to finish
4281 application.SendNotification();
4282 finishCheck.CheckSignalReceived();
4283 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4285 // Check that nothing has changed after a couple of buffer swaps
4286 application.Render(0);
4287 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4288 application.Render(0);
4289 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4293 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
4295 TestApplication application;
4297 Actor actor = Actor::New();
4299 // Register a Vector2 property
4300 Vector2 startValue(100.0f, 100.0f);
4301 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4302 application.GetScene().Add(actor);
4303 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4304 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4306 // Build the animation
4307 float durationSeconds(1.0f);
4308 Animation animation = Animation::New(durationSeconds);
4309 Vector2 targetValue(20.0f, 20.0f);
4310 Vector2 relativeValue(targetValue - startValue);
4311 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4313 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4315 // Start the animation
4318 bool signalReceived(false);
4319 AnimationFinishCheck finishCheck(signalReceived);
4320 animation.FinishedSignal().Connect(&application, finishCheck);
4322 application.SendNotification();
4323 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4325 // We didn't expect the animation to finish yet
4326 application.SendNotification();
4327 finishCheck.CheckSignalNotReceived();
4329 // The position should have moved more, than with a linear alpha function
4330 Vector2 current(actor.GetCurrentProperty<Vector2>(index));
4331 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4332 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4334 application.SendNotification();
4335 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4337 // We did expect the animation to finish
4338 application.SendNotification();
4339 finishCheck.CheckSignalReceived();
4340 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4342 // Check that nothing has changed after a couple of buffer swaps
4343 application.Render(0);
4344 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4345 application.Render(0);
4346 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4350 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4352 TestApplication application;
4354 Actor actor = Actor::New();
4356 // Register a Vector2 property
4357 Vector2 startValue(10.0f, 10.0f);
4358 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4359 application.GetScene().Add(actor);
4360 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4361 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4363 // Build the animation
4364 float durationSeconds(1.0f);
4365 Animation animation = Animation::New(durationSeconds);
4366 Vector2 targetValue(30.0f, 30.0f);
4367 Vector2 relativeValue(targetValue - startValue);
4369 animation.AnimateBy(Property(actor, index),
4371 TimePeriod(delay, durationSeconds - delay));
4373 // Start the animation
4376 bool signalReceived(false);
4377 AnimationFinishCheck finishCheck(signalReceived);
4378 animation.FinishedSignal().Connect(&application, finishCheck);
4380 application.SendNotification();
4381 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4383 // We didn't expect the animation to finish yet
4384 application.SendNotification();
4385 finishCheck.CheckSignalNotReceived();
4386 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4388 application.SendNotification();
4389 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4391 // We didn't expect the animation to finish yet
4392 application.SendNotification();
4393 finishCheck.CheckSignalNotReceived();
4394 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4396 application.SendNotification();
4397 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4399 // We did expect the animation to finish
4400 application.SendNotification();
4401 finishCheck.CheckSignalReceived();
4402 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4404 // Check that nothing has changed after a couple of buffer swaps
4405 application.Render(0);
4406 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4407 application.Render(0);
4408 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4412 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4414 TestApplication application;
4416 Actor actor = Actor::New();
4418 // Register a Vector2 property
4419 Vector2 startValue(5.0f, 5.0f);
4420 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4421 application.GetScene().Add(actor);
4422 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
4423 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4425 // Build the animation
4426 float durationSeconds(1.0f);
4427 Animation animation = Animation::New(durationSeconds);
4428 Vector2 targetValue(10.0f, 10.0f);
4429 Vector2 relativeValue(targetValue - startValue);
4431 animation.AnimateBy(Property(actor, index),
4433 AlphaFunction::LINEAR,
4434 TimePeriod(delay, durationSeconds - delay));
4436 // Start the animation
4439 bool signalReceived(false);
4440 AnimationFinishCheck finishCheck(signalReceived);
4441 animation.FinishedSignal().Connect(&application, finishCheck);
4443 application.SendNotification();
4444 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4446 // We didn't expect the animation to finish yet
4447 application.SendNotification();
4448 finishCheck.CheckSignalNotReceived();
4449 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
4451 application.SendNotification();
4452 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4454 // We didn't expect the animation to finish yet
4455 application.SendNotification();
4456 finishCheck.CheckSignalNotReceived();
4457 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4459 application.SendNotification();
4460 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4462 // We did expect the animation to finish
4463 application.SendNotification();
4464 finishCheck.CheckSignalReceived();
4465 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4467 // Check that nothing has changed after a couple of buffer swaps
4468 application.Render(0);
4469 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4470 application.Render(0);
4471 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
4475 int UtcDaliAnimationAnimateByVector3P(void)
4477 TestApplication application;
4479 Actor actor = Actor::New();
4481 // Register a Vector3 property
4482 Vector3 startValue(10.0f, 10.0f, 10.0f);
4483 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4484 application.GetScene().Add(actor);
4485 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4486 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4488 // Build the animation
4489 float durationSeconds(2.0f);
4490 Animation animation = Animation::New(durationSeconds);
4491 Vector3 targetValue(60.0f, 60.0f, 60.0f);
4492 Vector3 relativeValue(targetValue - startValue);
4493 animation.AnimateBy(Property(actor, index), relativeValue);
4495 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4497 // Start the animation
4500 // Target value should be retrievable straight away
4501 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
4503 bool signalReceived(false);
4504 AnimationFinishCheck finishCheck(signalReceived);
4505 animation.FinishedSignal().Connect(&application, finishCheck);
4507 application.SendNotification();
4508 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4510 // We didn't expect the animation to finish yet
4511 application.SendNotification();
4512 finishCheck.CheckSignalNotReceived();
4513 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
4515 application.SendNotification();
4516 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4518 // We did expect the animation to finish
4519 application.SendNotification();
4520 finishCheck.CheckSignalReceived();
4521 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4523 // Check that nothing has changed after a couple of buffer swaps
4524 application.Render(0);
4525 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4526 application.Render(0);
4527 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4531 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4533 TestApplication application;
4535 Actor actor = Actor::New();
4537 // Register a Vector3 property
4538 Vector3 startValue(100.0f, 100.0f, 100.0f);
4539 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4540 application.GetScene().Add(actor);
4541 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4542 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4544 // Build the animation
4545 float durationSeconds(1.0f);
4546 Animation animation = Animation::New(durationSeconds);
4547 Vector3 targetValue(20.0f, 20.0f, 20.0f);
4548 Vector3 relativeValue(targetValue - startValue);
4549 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4551 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4553 // Start the animation
4556 bool signalReceived(false);
4557 AnimationFinishCheck finishCheck(signalReceived);
4558 animation.FinishedSignal().Connect(&application, finishCheck);
4560 application.SendNotification();
4561 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4563 // We didn't expect the animation to finish yet
4564 application.SendNotification();
4565 finishCheck.CheckSignalNotReceived();
4567 // The position should have moved more, than with a linear alpha function
4568 Vector3 current(actor.GetCurrentProperty<Vector3>(index));
4569 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4570 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4571 DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4573 application.SendNotification();
4574 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4576 // We did expect the animation to finish
4577 application.SendNotification();
4578 finishCheck.CheckSignalReceived();
4579 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4581 // Check that nothing has changed after a couple of buffer swaps
4582 application.Render(0);
4583 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4584 application.Render(0);
4585 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4589 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4591 TestApplication application;
4593 Actor actor = Actor::New();
4595 // Register a Vector3 property
4596 Vector3 startValue(10.0f, 10.0f, 10.0f);
4597 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4598 application.GetScene().Add(actor);
4599 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4600 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4602 // Build the animation
4603 float durationSeconds(1.0f);
4604 Animation animation = Animation::New(durationSeconds);
4605 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4606 Vector3 relativeValue(targetValue - startValue);
4608 animation.AnimateBy(Property(actor, index),
4610 TimePeriod(delay, durationSeconds - delay));
4612 // Start the animation
4615 bool signalReceived(false);
4616 AnimationFinishCheck finishCheck(signalReceived);
4617 animation.FinishedSignal().Connect(&application, finishCheck);
4619 application.SendNotification();
4620 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4622 // We didn't expect the animation to finish yet
4623 application.SendNotification();
4624 finishCheck.CheckSignalNotReceived();
4625 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4627 application.SendNotification();
4628 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4630 // We didn't expect the animation to finish yet
4631 application.SendNotification();
4632 finishCheck.CheckSignalNotReceived();
4633 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4635 application.SendNotification();
4636 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4638 // We did expect the animation to finish
4639 application.SendNotification();
4640 finishCheck.CheckSignalReceived();
4641 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4643 // Check that nothing has changed after a couple of buffer swaps
4644 application.Render(0);
4645 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4646 application.Render(0);
4647 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4651 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4653 TestApplication application;
4655 Actor actor = Actor::New();
4657 // Register a Vector3 property
4658 Vector3 startValue(5.0f, 5.0f, 5.0f);
4659 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4660 application.GetScene().Add(actor);
4661 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
4662 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4664 // Build the animation
4665 float durationSeconds(1.0f);
4666 Animation animation = Animation::New(durationSeconds);
4667 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4668 Vector3 relativeValue(targetValue - startValue);
4670 animation.AnimateBy(Property(actor, index),
4672 AlphaFunction::LINEAR,
4673 TimePeriod(delay, durationSeconds - delay));
4675 // Start the animation
4678 bool signalReceived(false);
4679 AnimationFinishCheck finishCheck(signalReceived);
4680 animation.FinishedSignal().Connect(&application, finishCheck);
4682 application.SendNotification();
4683 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4685 // We didn't expect the animation to finish yet
4686 application.SendNotification();
4687 finishCheck.CheckSignalNotReceived();
4688 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
4690 application.SendNotification();
4691 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4693 // We didn't expect the animation to finish yet
4694 application.SendNotification();
4695 finishCheck.CheckSignalNotReceived();
4696 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4698 application.SendNotification();
4699 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4701 // We did expect the animation to finish
4702 application.SendNotification();
4703 finishCheck.CheckSignalReceived();
4704 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4706 // Check that nothing has changed after a couple of buffer swaps
4707 application.Render(0);
4708 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4709 application.Render(0);
4710 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
4714 int UtcDaliAnimationAnimateByVector4P(void)
4716 TestApplication application;
4718 Actor actor = Actor::New();
4720 // Register a Vector4 property
4721 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4722 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4723 application.GetScene().Add(actor);
4724 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4725 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4727 // Build the animation
4728 float durationSeconds(2.0f);
4729 Animation animation = Animation::New(durationSeconds);
4730 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4731 Vector4 relativeValue(targetValue - startValue);
4732 animation.AnimateBy(Property(actor, index), relativeValue);
4734 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4736 // Start the animation
4739 // Target value should be retrievable straight away
4740 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
4742 bool signalReceived(false);
4743 AnimationFinishCheck finishCheck(signalReceived);
4744 animation.FinishedSignal().Connect(&application, finishCheck);
4746 application.SendNotification();
4747 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4749 // We didn't expect the animation to finish yet
4750 application.SendNotification();
4751 finishCheck.CheckSignalNotReceived();
4752 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
4754 application.SendNotification();
4755 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4757 // We did expect the animation to finish
4758 application.SendNotification();
4759 finishCheck.CheckSignalReceived();
4760 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4762 // Check that nothing has changed after a couple of buffer swaps
4763 application.Render(0);
4764 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4765 application.Render(0);
4766 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4770 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4772 TestApplication application;
4774 Actor actor = Actor::New();
4776 // Register a Vector4 property
4777 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4778 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4779 application.GetScene().Add(actor);
4780 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4781 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4783 // Build the animation
4784 float durationSeconds(1.0f);
4785 Animation animation = Animation::New(durationSeconds);
4786 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4787 Vector4 relativeValue(targetValue - startValue);
4788 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4790 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
4792 // Start the animation
4795 bool signalReceived(false);
4796 AnimationFinishCheck finishCheck(signalReceived);
4797 animation.FinishedSignal().Connect(&application, finishCheck);
4799 application.SendNotification();
4800 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4802 // We didn't expect the animation to finish yet
4803 application.SendNotification();
4804 finishCheck.CheckSignalNotReceived();
4806 // The position should have moved more, than with a linear alpha function
4807 Vector4 current(actor.GetCurrentProperty<Vector4>(index));
4808 DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
4809 DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
4810 DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
4811 DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
4813 application.SendNotification();
4814 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4816 // We did expect the animation to finish
4817 application.SendNotification();
4818 finishCheck.CheckSignalReceived();
4819 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4821 // Check that nothing has changed after a couple of buffer swaps
4822 application.Render(0);
4823 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4824 application.Render(0);
4825 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4829 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4831 TestApplication application;
4833 Actor actor = Actor::New();
4835 // Register a Vector4 property
4836 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4837 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4838 application.GetScene().Add(actor);
4839 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4840 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4842 // Build the animation
4843 float durationSeconds(1.0f);
4844 Animation animation = Animation::New(durationSeconds);
4845 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4846 Vector4 relativeValue(targetValue - startValue);
4848 animation.AnimateBy(Property(actor, index),
4850 TimePeriod(delay, durationSeconds - delay));
4852 // Start the animation
4855 bool signalReceived(false);
4856 AnimationFinishCheck finishCheck(signalReceived);
4857 animation.FinishedSignal().Connect(&application, finishCheck);
4859 application.SendNotification();
4860 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4862 // We didn't expect the animation to finish yet
4863 application.SendNotification();
4864 finishCheck.CheckSignalNotReceived();
4865 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4867 application.SendNotification();
4868 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4870 // We didn't expect the animation to finish yet
4871 application.SendNotification();
4872 finishCheck.CheckSignalNotReceived();
4873 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4875 application.SendNotification();
4876 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4878 // We did expect the animation to finish
4879 application.SendNotification();
4880 finishCheck.CheckSignalReceived();
4881 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4883 // Check that nothing has changed after a couple of buffer swaps
4884 application.Render(0);
4885 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4886 application.Render(0);
4887 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4891 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4893 TestApplication application;
4895 Actor actor = Actor::New();
4897 // Register a Vector4 property
4898 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4899 Property::Index index = actor.RegisterProperty("testProperty", startValue);
4900 application.GetScene().Add(actor);
4901 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
4902 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4904 // Build the animation
4905 float durationSeconds(1.0f);
4906 Animation animation = Animation::New(durationSeconds);
4907 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4908 Vector4 relativeValue(targetValue - startValue);
4910 animation.AnimateBy(Property(actor, index),
4912 AlphaFunction::LINEAR,
4913 TimePeriod(delay, durationSeconds - delay));
4915 // Start the animation
4918 bool signalReceived(false);
4919 AnimationFinishCheck finishCheck(signalReceived);
4920 animation.FinishedSignal().Connect(&application, finishCheck);
4922 application.SendNotification();
4923 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
4925 // We didn't expect the animation to finish yet
4926 application.SendNotification();
4927 finishCheck.CheckSignalNotReceived();
4928 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
4930 application.SendNotification();
4931 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
4933 // We didn't expect the animation to finish yet
4934 application.SendNotification();
4935 finishCheck.CheckSignalNotReceived();
4936 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
4938 application.SendNotification();
4939 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
4941 // We did expect the animation to finish
4942 application.SendNotification();
4943 finishCheck.CheckSignalReceived();
4944 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4946 // Check that nothing has changed after a couple of buffer swaps
4947 application.Render(0);
4948 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4949 application.Render(0);
4950 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
4954 int UtcDaliAnimationAnimateByActorPositionP(void)
4956 TestApplication application;
4958 Actor actor = Actor::New();
4959 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4960 actor.SetProperty(Actor::Property::POSITION, startPosition);
4961 application.GetScene().Add(actor);
4962 application.SendNotification();
4963 application.Render(0);
4964 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
4966 // Build the animation
4967 float durationSeconds(1.0f);
4968 Animation animation = Animation::New(durationSeconds);
4969 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4970 Vector3 relativePosition(targetPosition - startPosition);
4971 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4973 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
4975 // Start the animation
4978 // Target value should be retrievable straight away
4979 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
4981 bool signalReceived(false);
4982 AnimationFinishCheck finishCheck(signalReceived);
4983 animation.FinishedSignal().Connect(&application, finishCheck);
4985 application.SendNotification();
4986 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
4988 // We didn't expect the animation to finish yet
4989 application.SendNotification();
4990 finishCheck.CheckSignalNotReceived();
4991 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
4993 application.SendNotification();
4994 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
4996 // We did expect the animation to finish
4997 application.SendNotification();
4998 finishCheck.CheckSignalReceived();
4999 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5001 // Check that nothing has changed after a couple of buffer swaps
5002 application.Render(0);
5003 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5004 application.Render(0);
5005 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5009 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
5011 TestApplication application;
5013 Actor actor = Actor::New();
5014 application.GetScene().Add(actor);
5015 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
5017 // Build the animation
5018 float durationSeconds(1.0f);
5019 Animation animation = Animation::New(durationSeconds);
5020 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
5021 Vector3 relativePosition(targetPosition - Vector3::ZERO);
5022 animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
5023 animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
5024 animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
5026 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
5027 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
5029 // Start the animation
5032 // Target value should be retrievable straight away
5033 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5034 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
5035 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
5036 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
5038 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5040 application.SendNotification();
5041 application.Render(1000); // 1 second progress
5043 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5048 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
5050 TestApplication application;
5052 Actor actor = Actor::New();
5053 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5054 actor.SetProperty(Actor::Property::POSITION, startPosition);
5055 application.GetScene().Add(actor);
5056 application.SendNotification();
5057 application.Render(0);
5058 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5060 // Build the animation
5061 float durationSeconds(1.0f);
5062 Animation animation = Animation::New(durationSeconds);
5063 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5064 Vector3 relativePosition(targetPosition - startPosition);
5065 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
5067 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5069 // Start the animation
5072 bool signalReceived(false);
5073 AnimationFinishCheck finishCheck(signalReceived);
5074 animation.FinishedSignal().Connect(&application, finishCheck);
5076 application.SendNotification();
5077 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5079 // We didn't expect the animation to finish yet
5080 application.SendNotification();
5081 finishCheck.CheckSignalNotReceived();
5083 // The position should have moved more, than with a linear alpha function
5084 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
5085 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
5086 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
5087 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
5089 application.SendNotification();
5090 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5092 // We did expect the animation to finish
5093 application.SendNotification();
5094 finishCheck.CheckSignalReceived();
5095 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5097 // Check that nothing has changed after a couple of buffer swaps
5098 application.Render(0);
5099 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5100 application.Render(0);
5101 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5105 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
5107 TestApplication application;
5109 Actor actor = Actor::New();
5110 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5111 actor.SetProperty(Actor::Property::POSITION, startPosition);
5112 application.GetScene().Add(actor);
5113 application.SendNotification();
5114 application.Render(0);
5115 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5117 // Build the animation
5118 float durationSeconds(1.0f);
5119 Animation animation = Animation::New(durationSeconds);
5120 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5121 Vector3 relativePosition(targetPosition - startPosition);
5123 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
5125 TimePeriod(delay, durationSeconds - delay));
5127 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5129 // Start the animation
5132 bool signalReceived(false);
5133 AnimationFinishCheck finishCheck(signalReceived);
5134 animation.FinishedSignal().Connect(&application, finishCheck);
5136 application.SendNotification();
5137 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5139 // We didn't expect the animation to finish yet
5140 application.SendNotification();
5141 finishCheck.CheckSignalNotReceived();
5142 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5144 application.SendNotification();
5145 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5147 // We did expect the animation to finish
5148 application.SendNotification();
5149 finishCheck.CheckSignalReceived();
5150 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5152 // Check that nothing has changed after a couple of buffer swaps
5153 application.Render(0);
5154 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5155 application.Render(0);
5156 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5160 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
5162 TestApplication application;
5164 Actor actor = Actor::New();
5165 Vector3 startPosition(10.0f, 10.0f, 10.0f);
5166 actor.SetProperty(Actor::Property::POSITION, startPosition);
5167 application.GetScene().Add(actor);
5168 application.SendNotification();
5169 application.Render(0);
5170 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5172 // Build the animation
5173 float durationSeconds(1.0f);
5174 Animation animation = Animation::New(durationSeconds);
5175 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
5176 Vector3 relativePosition(targetPosition - startPosition);
5178 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
5180 AlphaFunction::LINEAR,
5181 TimePeriod(delay, durationSeconds - delay));
5183 Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
5185 // Start the animation
5188 bool signalReceived(false);
5189 AnimationFinishCheck finishCheck(signalReceived);
5190 animation.FinishedSignal().Connect(&application, finishCheck);
5192 application.SendNotification();
5193 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5195 // We didn't expect the animation to finish yet
5196 application.SendNotification();
5197 finishCheck.CheckSignalNotReceived();
5198 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
5200 application.SendNotification();
5201 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5203 // We did expect the animation to finish
5204 application.SendNotification();
5205 finishCheck.CheckSignalReceived();
5206 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5208 // Check that nothing has changed after a couple of buffer swaps
5209 application.Render(0);
5210 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5211 application.Render(0);
5212 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
5216 int UtcDaliAnimationAnimateByActorOrientationP1(void)
5218 TestApplication application;
5220 Actor actor = Actor::New();
5221 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5222 application.GetScene().Add(actor);
5223 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5225 // Build the animation
5226 float durationSeconds(1.0f);
5227 Animation animation = Animation::New(durationSeconds);
5228 Degree relativeRotationDegrees(360.0f);
5229 Radian relativeRotationRadians(relativeRotationDegrees);
5230 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
5232 // Start the animation
5235 // Target value should be retrievable straight away
5236 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
5238 bool signalReceived(false);
5239 AnimationFinishCheck finishCheck(signalReceived);
5240 animation.FinishedSignal().Connect(&application, finishCheck);
5242 application.SendNotification();
5243 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5245 // We didn't expect the animation to finish yet
5246 application.SendNotification();
5247 finishCheck.CheckSignalNotReceived();
5248 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5250 application.SendNotification();
5251 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5253 // We didn't expect the animation to finish yet
5254 application.SendNotification();
5255 finishCheck.CheckSignalNotReceived();
5256 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5258 application.SendNotification();
5259 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5261 // We didn't expect the animation to finish yet
5262 application.SendNotification();
5263 finishCheck.CheckSignalNotReceived();
5264 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5266 application.SendNotification();
5267 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5269 // We did expect the animation to finish
5270 application.SendNotification();
5271 finishCheck.CheckSignalReceived();
5272 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5276 int UtcDaliAnimationAnimateByActorOrientationP2(void)
5278 TestApplication application;
5280 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
5282 Actor actor = Actor::New();
5283 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5284 application.GetScene().Add(actor);
5285 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5287 // Build the animation
5288 float durationSeconds(1.0f);
5289 Animation animation = Animation::New(durationSeconds);
5290 Degree relativeRotationDegrees(710.0f);
5291 Radian relativeRotationRadians(relativeRotationDegrees);
5293 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
5295 // Start the animation
5298 bool signalReceived(false);
5299 AnimationFinishCheck finishCheck(signalReceived);
5300 animation.FinishedSignal().Connect(&application, finishCheck);
5302 application.SendNotification();
5303 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5305 // We didn't expect the animation to finish yet
5306 application.SendNotification();
5307 finishCheck.CheckSignalNotReceived();
5308 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5310 application.SendNotification();
5311 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5313 // We didn't expect the animation to finish yet
5314 application.SendNotification();
5315 finishCheck.CheckSignalNotReceived();
5316 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5318 application.SendNotification();
5319 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5321 // We didn't expect the animation to finish yet
5322 application.SendNotification();
5323 finishCheck.CheckSignalNotReceived();
5324 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5326 application.SendNotification();
5327 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5329 // We did expect the animation to finish
5330 application.SendNotification();
5331 finishCheck.CheckSignalReceived();
5332 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5336 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5338 TestApplication application;
5340 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5342 Actor actor = Actor::New();
5343 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
5344 application.GetScene().Add(actor);
5345 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5347 // Build the animation
5348 float durationSeconds(1.0f);
5349 Animation animation = Animation::New(durationSeconds);
5350 Degree relativeRotationDegrees(730.0f);
5351 Radian relativeRotationRadians(relativeRotationDegrees);
5353 Radian actualRotationRadians(Degree(10.0f));
5355 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
5357 // Start the animation
5360 bool signalReceived(false);
5361 AnimationFinishCheck finishCheck(signalReceived);
5362 animation.FinishedSignal().Connect(&application, finishCheck);
5364 application.SendNotification();
5365 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5367 // We didn't expect the animation to finish yet
5368 application.SendNotification();
5369 finishCheck.CheckSignalNotReceived();
5370 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5372 application.SendNotification();
5373 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5375 // We didn't expect the animation to finish yet
5376 application.SendNotification();
5377 finishCheck.CheckSignalNotReceived();
5378 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5380 application.SendNotification();
5381 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5383 // We didn't expect the animation to finish yet
5384 application.SendNotification();
5385 finishCheck.CheckSignalNotReceived();
5386 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5388 application.SendNotification();
5389 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5391 // We did expect the animation to finish
5392 application.SendNotification();
5393 finishCheck.CheckSignalReceived();
5394 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5395 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
5399 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5401 TestApplication application;
5403 Actor actor = Actor::New();
5404 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5405 application.GetScene().Add(actor);
5406 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5408 // Build the animation
5409 float durationSeconds(1.0f);
5410 Animation animation = Animation::New(durationSeconds);
5411 Degree relativeRotationDegrees(360.0f);
5412 Radian relativeRotationRadians(relativeRotationDegrees);
5413 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
5415 // Start the animation
5418 bool signalReceived(false);
5419 AnimationFinishCheck finishCheck(signalReceived);
5420 animation.FinishedSignal().Connect(&application, finishCheck);
5422 application.SendNotification();
5423 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5425 // We didn't expect the animation to finish yet
5426 application.SendNotification();
5427 finishCheck.CheckSignalNotReceived();
5428 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5430 application.SendNotification();
5431 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5433 // We didn't expect the animation to finish yet
5434 application.SendNotification();
5435 finishCheck.CheckSignalNotReceived();
5436 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5438 application.SendNotification();
5439 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5441 // We didn't expect the animation to finish yet
5442 application.SendNotification();
5443 finishCheck.CheckSignalNotReceived();
5444 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5446 application.SendNotification();
5447 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5449 // We did expect the animation to finish
5450 application.SendNotification();
5451 finishCheck.CheckSignalReceived();
5452 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5456 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5458 TestApplication application;
5460 Actor actor = Actor::New();
5461 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
5462 application.GetScene().Add(actor);
5463 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5465 // Build the animation
5466 float durationSeconds(1.0f);
5467 Animation animation = Animation::New(durationSeconds);
5468 Degree relativeRotationDegrees(360.0f);
5469 Radian relativeRotationRadians(relativeRotationDegrees);
5471 animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
5473 // Start the animation
5476 bool signalReceived(false);
5477 AnimationFinishCheck finishCheck(signalReceived);
5478 animation.FinishedSignal().Connect(&application, finishCheck);
5480 application.SendNotification();
5481 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
5483 // We didn't expect the animation to finish yet
5484 application.SendNotification();
5485 finishCheck.CheckSignalNotReceived();
5486 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5487 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5489 application.SendNotification();
5490 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
5492 // We didn't expect the animation to finish yet
5493 application.SendNotification();
5494 finishCheck.CheckSignalNotReceived();
5495 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5496 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5498 application.SendNotification();
5499 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
5501 // We didn't expect the animation to finish yet
5502 application.SendNotification();
5503 finishCheck.CheckSignalNotReceived();
5504 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5505 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5507 application.SendNotification();
5508 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
5510 // We did expect the animation to finish
5511 application.SendNotification();
5512 finishCheck.CheckSignalReceived();
5513 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
5517 int UtcDaliAnimationAnimateByActorScaleP(void)
5519 TestApplication application;
5521 Actor actor = Actor::New();
5522 application.GetScene().Add(actor);
5523 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5525 // Build the animation
5526 float durationSeconds(1.0f);
5527 Animation animation = Animation::New(durationSeconds);
5528 Vector3 targetScale(2.0f, 2.0f, 2.0f);
5529 Vector3 relativeScale(targetScale - Vector3::ONE);
5530 animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
5532 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
5534 // Start the animation
5537 // Target value should be retrievable straight away
5538 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5540 bool signalReceived(false);
5541 AnimationFinishCheck finishCheck(signalReceived);
5542 animation.FinishedSignal().Connect(&application, finishCheck);
5544 application.SendNotification();
5545 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5547 // We didn't expect the animation to finish yet
5548 application.SendNotification();
5549 finishCheck.CheckSignalNotReceived();
5550 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
5552 application.SendNotification();
5553 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5555 // We did expect the animation to finish
5556 application.SendNotification();
5557 finishCheck.CheckSignalReceived();
5558 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5561 finishCheck.Reset();
5562 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5563 application.SendNotification();
5564 application.Render(0);
5565 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5567 // Repeat with a different (ease-in) alpha function
5568 animation = Animation::New(durationSeconds);
5569 animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
5570 animation.FinishedSignal().Connect(&application, finishCheck);
5573 application.SendNotification();
5574 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
5576 // We didn't expect the animation to finish yet
5577 application.SendNotification();
5578 finishCheck.CheckSignalNotReceived();
5580 // The scale should have grown less, than with a linear alpha function
5581 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
5582 DALI_TEST_CHECK(current.x > 1.0f);
5583 DALI_TEST_CHECK(current.y > 1.0f);
5584 DALI_TEST_CHECK(current.z > 1.0f);
5585 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
5586 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
5587 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
5589 application.SendNotification();
5590 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
5592 // We did expect the animation to finish
5593 application.SendNotification();
5594 finishCheck.CheckSignalReceived();
5595 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5598 finishCheck.Reset();
5599 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
5600 application.SendNotification();
5601 application.Render(0);
5602 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5604 // Repeat with a delay
5606 animation = Animation::New(durationSeconds);
5607 animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
5608 animation.FinishedSignal().Connect(&application, finishCheck);
5611 application.SendNotification();
5612 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
5614 // We didn't expect the animation to finish yet
5615 application.SendNotification();
5616 finishCheck.CheckSignalNotReceived();
5617 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5619 application.SendNotification();
5620 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
5622 // We did expect the animation to finish
5623 application.SendNotification();
5624 finishCheck.CheckSignalReceived();
5625 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5629 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5631 TestApplication application;
5633 Actor actor = Actor::New();
5634 application.GetScene().Add(actor);
5635 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5637 // Build the animation
5638 float durationSeconds(1.0f);
5639 Animation animation = Animation::New(durationSeconds);
5640 Vector3 targetScale(2.0f, 3.0f, 4.0f);
5641 Vector3 relativeScale(targetScale - Vector3::ONE);
5642 animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
5643 animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
5644 animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
5646 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5647 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
5649 // Start the animation
5652 // Target value should be retrievable straight away
5653 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5654 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
5655 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
5656 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
5658 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
5660 application.SendNotification();
5661 application.Render(1000); // 1 second progress
5663 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
5668 int UtcDaliAnimationAnimateByActorColorP(void)
5670 TestApplication application;
5672 Actor actor = Actor::New();
5673 application.GetScene().Add(actor);
5674 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5676 // Build the animation
5677 float durationSeconds(1.0f);
5678 Animation animation = Animation::New(durationSeconds);
5679 Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5680 Vector4 relativeColor(targetColor - Color::WHITE);
5681 animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
5683 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5684 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5686 // Start the animation
5689 // Target value should be retrievable straight away
5690 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5691 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5692 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5693 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5694 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5696 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5698 application.SendNotification();
5699 application.Render(1000); // 1 second progress
5701 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5706 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5708 TestApplication application;
5710 Actor actor = Actor::New();
5711 application.GetScene().Add(actor);
5712 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5714 // Build the animation
5715 float durationSeconds(1.0f);
5716 Animation animation = Animation::New(durationSeconds);
5717 Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
5718 Vector4 relativeColor(targetColor - Color::WHITE);
5719 animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
5720 animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
5721 animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
5722 animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
5724 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5725 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
5727 // Start the animation
5730 // Target value should be retrievable straight away
5731 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5732 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
5733 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
5734 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
5735 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
5737 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
5739 application.SendNotification();
5740 application.Render(1000); // 1 second progress
5742 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
5747 int UtcDaliAnimationAnimateByActorSizeP(void)
5749 TestApplication application;
5751 Actor actor = Actor::New();
5752 application.GetScene().Add(actor);
5753 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5755 // Build the animation
5756 float durationSeconds(1.0f);
5757 Animation animation = Animation::New(durationSeconds);
5758 Vector3 targetSize(100.0f, 200.0f, 300.0f);
5759 Vector3 relativeSize(targetSize - Vector3::ZERO);
5760 animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
5762 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5763 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5765 // Start the animation
5768 // Target value should be retrievable straight away
5769 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5770 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5771 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5772 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5774 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5776 application.SendNotification();
5777 application.Render(1000); // 1 second progress
5779 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5784 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5786 TestApplication application;
5788 Actor actor = Actor::New();
5789 application.GetScene().Add(actor);
5790 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5792 // Build the animation
5793 float durationSeconds(1.0f);
5794 Animation animation = Animation::New(durationSeconds);
5795 Vector3 targetSize(100.0f, 200.0f, 300.0f);
5796 Vector3 relativeSize(targetSize - Vector3::ZERO);
5797 animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
5798 animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
5799 animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
5801 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5802 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
5804 // Start the animation
5807 // Target value should be retrievable straight away
5808 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5809 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
5810 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
5811 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
5813 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
5815 application.SendNotification();
5816 application.Render(1000); // 1 second progress
5818 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
5823 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5825 TestApplication application;
5827 Actor actor = Actor::New();
5828 application.GetScene().Add(actor);
5829 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5831 actor.SetProperty(Actor::Property::VISIBLE, false);
5833 application.SendNotification();
5834 application.Render();
5836 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5838 // Build the animation
5839 float durationSeconds(1.0f);
5840 Animation animation = Animation::New(durationSeconds);
5841 bool targetVisibility(true);
5842 bool relativeVisibility(targetVisibility);
5843 animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
5845 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
5847 // Start the animation
5850 // Target value should be retrievable straight away
5851 DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
5852 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
5854 application.SendNotification();
5855 application.Render(1000); // 1 second progress
5857 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
5862 int UtcDaliAnimationAnimateToBooleanP(void)
5864 TestApplication application;
5866 Actor actor = Actor::New();
5868 // Register a boolean property
5869 const bool startValue(false);
5870 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5871 application.GetScene().Add(actor);
5872 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5873 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5875 // Build the animation
5876 float durationSeconds(2.0f);
5877 Animation animation = Animation::New(durationSeconds);
5878 const bool targetValue(!startValue);
5879 animation.AnimateTo(Property(actor, index), targetValue);
5881 // Start the animation
5884 bool signalReceived(false);
5885 AnimationFinishCheck finishCheck(signalReceived);
5886 animation.FinishedSignal().Connect(&application, finishCheck);
5888 application.SendNotification();
5889 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5891 // We didn't expect the animation to finish yet
5892 application.SendNotification();
5893 finishCheck.CheckSignalNotReceived();
5894 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5896 application.SendNotification();
5897 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5899 // We did expect the animation to finish
5900 application.SendNotification();
5901 finishCheck.CheckSignalReceived();
5902 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5904 // Check that nothing has changed after a couple of buffer swaps
5905 application.Render(0);
5906 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5907 application.Render(0);
5908 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5910 // Repeat with target value "false"
5911 animation = Animation::New(durationSeconds);
5912 const bool finalValue(!targetValue);
5913 animation.AnimateTo(Property(actor, index), finalValue);
5915 // Start the animation
5918 finishCheck.Reset();
5919 animation.FinishedSignal().Connect(&application, finishCheck);
5921 application.SendNotification();
5922 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5924 // We didn't expect the animation to finish yet
5925 application.SendNotification();
5926 finishCheck.CheckSignalNotReceived();
5927 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5929 application.SendNotification();
5930 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5932 // We did expect the animation to finish
5933 application.SendNotification();
5934 finishCheck.CheckSignalReceived();
5935 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5937 // Check that nothing has changed after a couple of buffer swaps
5938 application.Render(0);
5939 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5940 application.Render(0);
5941 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
5945 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5947 TestApplication application;
5949 Actor actor = Actor::New();
5951 // Register a boolean property
5952 const bool startValue(false);
5953 Property::Index index = actor.RegisterProperty("testProperty", startValue);
5954 application.GetScene().Add(actor);
5955 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
5956 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5958 // Build the animation
5959 float durationSeconds(2.0f);
5960 Animation animation = Animation::New(durationSeconds);
5961 const bool targetValue(!startValue);
5962 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5964 // Start the animation
5967 bool signalReceived(false);
5968 AnimationFinishCheck finishCheck(signalReceived);
5969 animation.FinishedSignal().Connect(&application, finishCheck);
5971 application.SendNotification();
5972 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
5974 // We didn't expect the animation to finish yet
5975 application.SendNotification();
5976 finishCheck.CheckSignalNotReceived();
5977 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
5979 application.SendNotification();
5980 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
5982 // We did expect the animation to finish
5983 application.SendNotification();
5984 finishCheck.CheckSignalReceived();
5985 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5987 // Check that nothing has changed after a couple of buffer swaps
5988 application.Render(0);
5989 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5990 application.Render(0);
5991 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
5993 // Repeat with target value "false"
5994 animation = Animation::New(durationSeconds);
5995 const bool finalValue(!targetValue);
5996 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5998 // Start the animation
6001 finishCheck.Reset();
6002 animation.FinishedSignal().Connect(&application, finishCheck);
6004 application.SendNotification();
6005 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6007 // We didn't expect the animation to finish yet
6008 application.SendNotification();
6009 finishCheck.CheckSignalNotReceived();
6010 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
6012 application.SendNotification();
6013 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6015 // We did expect the animation to finish
6016 application.SendNotification();
6017 finishCheck.CheckSignalReceived();
6018 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6020 // Check that nothing has changed after a couple of buffer swaps
6021 application.Render(0);
6022 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6023 application.Render(0);
6024 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6028 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
6030 TestApplication application;
6032 Actor actor = Actor::New();
6034 // Register a boolean property
6035 bool startValue(false);
6036 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6037 application.GetScene().Add(actor);
6038 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
6039 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
6041 // Build the animation
6042 float durationSeconds(2.0f);
6043 Animation animation = Animation::New(durationSeconds);
6044 bool finalValue(!startValue);
6045 float animatorDurationSeconds(durationSeconds * 0.5f);
6046 animation.AnimateTo(Property(actor, index),
6048 TimePeriod(animatorDurationSeconds));
6050 // Start the animation
6053 bool signalReceived(false);
6054 AnimationFinishCheck finishCheck(signalReceived);
6055 animation.FinishedSignal().Connect(&application, finishCheck);
6057 application.SendNotification();
6058 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
6060 // We didn't expect the animation to finish yet
6061 application.SendNotification();
6062 finishCheck.CheckSignalNotReceived();
6063 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
6065 application.SendNotification();
6066 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
6068 // We didn't expect the animation to finish yet...
6069 application.SendNotification();
6070 finishCheck.CheckSignalNotReceived();
6072 // ...however we should have reached the final value
6073 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6075 application.SendNotification();
6076 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
6078 // We did expect the animation to finish
6079 application.SendNotification();
6080 finishCheck.CheckSignalReceived();
6081 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6083 // Check that nothing has changed after a couple of buffer swaps
6084 application.Render(0);
6085 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6086 application.Render(0);
6087 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6091 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
6093 TestApplication application;
6095 Actor actor = Actor::New();
6097 // Register a boolean property
6098 bool startValue(false);
6099 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6100 application.GetScene().Add(actor);
6101 DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
6102 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
6104 // Build the animation
6105 float durationSeconds(2.0f);
6106 Animation animation = Animation::New(durationSeconds);
6107 bool finalValue(!startValue);
6108 float animatorDurationSeconds(durationSeconds * 0.5f);
6109 animation.AnimateTo(Property(actor, index),
6111 AlphaFunction::LINEAR,
6112 TimePeriod(animatorDurationSeconds));
6114 // Start the animation
6117 bool signalReceived(false);
6118 AnimationFinishCheck finishCheck(signalReceived);
6119 animation.FinishedSignal().Connect(&application, finishCheck);
6121 application.SendNotification();
6122 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
6124 // We didn't expect the animation to finish yet
6125 application.SendNotification();
6126 finishCheck.CheckSignalNotReceived();
6127 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
6129 application.SendNotification();
6130 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
6132 // We didn't expect the animation to finish yet...
6133 application.SendNotification();
6134 finishCheck.CheckSignalNotReceived();
6136 // ...however we should have reached the final value
6137 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6139 application.SendNotification();
6140 application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
6142 // We did expect the animation to finish
6143 application.SendNotification();
6144 finishCheck.CheckSignalReceived();
6145 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6147 // Check that nothing has changed after a couple of buffer swaps
6148 application.Render(0);
6149 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6150 application.Render(0);
6151 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
6155 int UtcDaliAnimationAnimateToFloatP(void)
6157 TestApplication application;
6159 Actor actor = Actor::New();
6161 // Register a float property
6162 float startValue(10.0f);
6163 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6164 application.GetScene().Add(actor);
6165 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6166 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6168 // Build the animation
6169 float durationSeconds(2.0f);
6170 Animation animation = Animation::New(durationSeconds);
6171 float targetValue(50.0f);
6172 float relativeValue(targetValue - startValue);
6173 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6175 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6177 // Start the animation
6180 bool signalReceived(false);
6181 AnimationFinishCheck finishCheck(signalReceived);
6182 animation.FinishedSignal().Connect(&application, finishCheck);
6184 application.SendNotification();
6185 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6187 // We didn't expect the animation to finish yet
6188 application.SendNotification();
6189 finishCheck.CheckSignalNotReceived();
6190 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
6192 application.SendNotification();
6193 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6195 // We did expect the animation to finish
6196 application.SendNotification();
6197 finishCheck.CheckSignalReceived();
6198 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6202 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
6204 TestApplication application;
6206 Actor actor = Actor::New();
6208 // Register a float property
6209 float startValue(10.0f);
6210 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6211 application.GetScene().Add(actor);
6212 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6213 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6215 // Build the animation
6216 float durationSeconds(1.0f);
6217 Animation animation = Animation::New(durationSeconds);
6218 float targetValue(90.0f);
6219 float relativeValue(targetValue - startValue);
6220 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6222 float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6224 // Start the animation
6227 bool signalReceived(false);
6228 AnimationFinishCheck finishCheck(signalReceived);
6229 animation.FinishedSignal().Connect(&application, finishCheck);
6231 application.SendNotification();
6232 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6234 // We didn't expect the animation to finish yet
6235 application.SendNotification();
6236 finishCheck.CheckSignalNotReceived();
6238 // The position should have moved more, than with a linear alpha function
6239 float current(actor.GetCurrentProperty<float>(index));
6240 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6242 application.SendNotification();
6243 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6245 // We did expect the animation to finish
6246 application.SendNotification();
6247 finishCheck.CheckSignalReceived();
6248 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6252 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
6254 TestApplication application;
6256 Actor actor = Actor::New();
6258 // Register a float property
6259 float startValue(10.0f);
6260 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6261 application.GetScene().Add(actor);
6262 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6263 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6265 // Build the animation
6266 float durationSeconds(1.0f);
6267 Animation animation = Animation::New(durationSeconds);
6268 float targetValue(30.0f);
6269 float relativeValue(targetValue - startValue);
6271 animation.AnimateTo(Property(actor, index),
6273 TimePeriod(delay, durationSeconds - delay));
6275 // Start the animation
6278 bool signalReceived(false);
6279 AnimationFinishCheck finishCheck(signalReceived);
6280 animation.FinishedSignal().Connect(&application, finishCheck);
6282 application.SendNotification();
6283 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6285 // We didn't expect the animation to finish yet
6286 application.SendNotification();
6287 finishCheck.CheckSignalNotReceived();
6288 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6290 application.SendNotification();
6291 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6293 // We didn't expect the animation to finish yet
6294 application.SendNotification();
6295 finishCheck.CheckSignalNotReceived();
6296 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6298 application.SendNotification();
6299 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6301 // We did expect the animation to finish
6302 application.SendNotification();
6303 finishCheck.CheckSignalReceived();
6304 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6308 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
6310 TestApplication application;
6312 Actor actor = Actor::New();
6314 // Register a float property
6315 float startValue(10.0f);
6316 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6317 application.GetScene().Add(actor);
6318 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
6319 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6321 // Build the animation
6322 float durationSeconds(1.0f);
6323 Animation animation = Animation::New(durationSeconds);
6324 float targetValue(30.0f);
6325 float relativeValue(targetValue - startValue);
6327 animation.AnimateTo(Property(actor, index),
6329 AlphaFunction::LINEAR,
6330 TimePeriod(delay, durationSeconds - delay));
6332 // Start the animation
6335 bool signalReceived(false);
6336 AnimationFinishCheck finishCheck(signalReceived);
6337 animation.FinishedSignal().Connect(&application, finishCheck);
6339 application.SendNotification();
6340 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6342 // We didn't expect the animation to finish yet
6343 application.SendNotification();
6344 finishCheck.CheckSignalNotReceived();
6345 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
6347 application.SendNotification();
6348 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6350 // We didn't expect the animation to finish yet
6351 application.SendNotification();
6352 finishCheck.CheckSignalNotReceived();
6353 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6355 application.SendNotification();
6356 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6358 // We did expect the animation to finish
6359 application.SendNotification();
6360 finishCheck.CheckSignalReceived();
6361 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
6365 int UtcDaliAnimationAnimateToIntegerP(void)
6367 TestApplication application;
6369 Actor actor = Actor::New();
6371 // Register an integer property
6373 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6374 application.GetScene().Add(actor);
6375 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6376 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6378 // Build the animation
6379 float durationSeconds(2.0f);
6380 Animation animation = Animation::New(durationSeconds);
6381 int targetValue(50);
6382 int relativeValue(targetValue - startValue);
6383 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6385 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6387 // Start the animation
6390 bool signalReceived(false);
6391 AnimationFinishCheck finishCheck(signalReceived);
6392 animation.FinishedSignal().Connect(&application, finishCheck);
6394 application.SendNotification();
6395 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6397 // We didn't expect the animation to finish yet
6398 application.SendNotification();
6399 finishCheck.CheckSignalNotReceived();
6400 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
6402 application.SendNotification();
6403 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6405 // We did expect the animation to finish
6406 application.SendNotification();
6407 finishCheck.CheckSignalReceived();
6408 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6412 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6414 TestApplication application;
6416 Actor actor = Actor::New();
6418 // Register an integer property
6420 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6421 application.GetScene().Add(actor);
6422 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6423 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6425 // Build the animation
6426 float durationSeconds(1.0f);
6427 Animation animation = Animation::New(durationSeconds);
6428 int targetValue(90);
6429 int relativeValue(targetValue - startValue);
6430 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6432 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
6434 // Start the animation
6437 bool signalReceived(false);
6438 AnimationFinishCheck finishCheck(signalReceived);
6439 animation.FinishedSignal().Connect(&application, finishCheck);
6441 application.SendNotification();
6442 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6444 // We didn't expect the animation to finish yet
6445 application.SendNotification();
6446 finishCheck.CheckSignalNotReceived();
6448 // The position should have moved more, than with a linear alpha function
6449 int current(actor.GetCurrentProperty<int>(index));
6450 DALI_TEST_CHECK(current > ninetyFivePercentProgress);
6452 application.SendNotification();
6453 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6455 // We did expect the animation to finish
6456 application.SendNotification();
6457 finishCheck.CheckSignalReceived();
6458 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6462 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6464 TestApplication application;
6466 Actor actor = Actor::New();
6468 // Register an integer property
6470 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6471 application.GetScene().Add(actor);
6472 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6473 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6475 // Build the animation
6476 float durationSeconds(1.0f);
6477 Animation animation = Animation::New(durationSeconds);
6478 int targetValue(30);
6479 int relativeValue(targetValue - startValue);
6481 animation.AnimateTo(Property(actor, index),
6483 TimePeriod(delay, durationSeconds - delay));
6485 // Start the animation
6488 bool signalReceived(false);
6489 AnimationFinishCheck finishCheck(signalReceived);
6490 animation.FinishedSignal().Connect(&application, finishCheck);
6492 application.SendNotification();
6493 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6495 // We didn't expect the animation to finish yet
6496 application.SendNotification();
6497 finishCheck.CheckSignalNotReceived();
6498 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6500 application.SendNotification();
6501 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6503 // We didn't expect the animation to finish yet
6504 application.SendNotification();
6505 finishCheck.CheckSignalNotReceived();
6506 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6508 application.SendNotification();
6509 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6511 // We did expect the animation to finish
6512 application.SendNotification();
6513 finishCheck.CheckSignalReceived();
6514 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6518 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6520 TestApplication application;
6522 Actor actor = Actor::New();
6524 // Register an integer property
6526 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6527 application.GetScene().Add(actor);
6528 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
6529 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6531 // Build the animation
6532 float durationSeconds(1.0f);
6533 Animation animation = Animation::New(durationSeconds);
6534 int targetValue(30);
6535 int relativeValue(targetValue - startValue);
6537 animation.AnimateTo(Property(actor, index),
6539 AlphaFunction::LINEAR,
6540 TimePeriod(delay, durationSeconds - delay));
6542 // Start the animation
6545 bool signalReceived(false);
6546 AnimationFinishCheck finishCheck(signalReceived);
6547 animation.FinishedSignal().Connect(&application, finishCheck);
6549 application.SendNotification();
6550 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6552 // We didn't expect the animation to finish yet
6553 application.SendNotification();
6554 finishCheck.CheckSignalNotReceived();
6555 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
6557 application.SendNotification();
6558 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6560 // We didn't expect the animation to finish yet
6561 application.SendNotification();
6562 finishCheck.CheckSignalNotReceived();
6563 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
6565 application.SendNotification();
6566 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6568 // We did expect the animation to finish
6569 application.SendNotification();
6570 finishCheck.CheckSignalReceived();
6571 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
6575 int UtcDaliAnimationAnimateToVector2P(void)
6577 TestApplication application;
6579 Actor actor = Actor::New();
6581 // Register a Vector2 property
6582 Vector2 startValue(-50.0f, -50.0f);
6583 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6584 application.GetScene().Add(actor);
6585 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6586 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6588 // Build the animation
6589 float durationSeconds(2.0f);
6590 Animation animation = Animation::New(durationSeconds);
6591 Vector2 targetValue(50.0f, 50.0f);
6592 Vector2 relativeValue(targetValue - startValue);
6593 animation.AnimateTo(Property(actor, index), targetValue);
6595 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6597 // Start the animation
6600 bool signalReceived(false);
6601 AnimationFinishCheck finishCheck(signalReceived);
6602 animation.FinishedSignal().Connect(&application, finishCheck);
6604 application.SendNotification();
6605 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6607 // We didn't expect the animation to finish yet
6608 application.SendNotification();
6609 finishCheck.CheckSignalNotReceived();
6610 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
6612 application.SendNotification();
6613 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6615 // We did expect the animation to finish
6616 application.SendNotification();
6617 finishCheck.CheckSignalReceived();
6618 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6622 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6624 TestApplication application;
6626 Actor actor = Actor::New();
6628 // Register a Vector2 property
6629 Vector2 startValue(1000.0f, 1000.0f);
6630 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6631 application.GetScene().Add(actor);
6632 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6633 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6635 // Build the animation
6636 float durationSeconds(1.0f);
6637 Animation animation = Animation::New(durationSeconds);
6638 Vector2 targetValue(9000.0f, 9000.0f);
6639 Vector2 relativeValue(targetValue - startValue);
6640 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6642 Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6644 // Start the animation
6647 bool signalReceived(false);
6648 AnimationFinishCheck finishCheck(signalReceived);
6649 animation.FinishedSignal().Connect(&application, finishCheck);
6651 application.SendNotification();
6652 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6654 // We didn't expect the animation to finish yet
6655 application.SendNotification();
6656 finishCheck.CheckSignalNotReceived();
6658 // The position should have moved more, than with a linear alpha function
6659 Vector2 current(actor.GetCurrentProperty<Vector2>(index));
6660 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6661 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6663 application.SendNotification();
6664 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6666 // We did expect the animation to finish
6667 application.SendNotification();
6668 finishCheck.CheckSignalReceived();
6669 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6673 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6675 TestApplication application;
6677 Actor actor = Actor::New();
6679 // Register a Vector2 property
6680 Vector2 startValue(10.0f, 10.0f);
6681 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6682 application.GetScene().Add(actor);
6683 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6684 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6686 // Build the animation
6687 float durationSeconds(1.0f);
6688 Animation animation = Animation::New(durationSeconds);
6689 Vector2 targetValue(-10.0f, 20.0f);
6690 Vector2 relativeValue(targetValue - startValue);
6692 animation.AnimateTo(Property(actor, index),
6694 TimePeriod(delay, durationSeconds - delay));
6696 // Start the animation
6699 bool signalReceived(false);
6700 AnimationFinishCheck finishCheck(signalReceived);
6701 animation.FinishedSignal().Connect(&application, finishCheck);
6703 application.SendNotification();
6704 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6706 // We didn't expect the animation to finish yet
6707 application.SendNotification();
6708 finishCheck.CheckSignalNotReceived();
6709 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6711 application.SendNotification();
6712 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6714 // We didn't expect the animation to finish yet
6715 application.SendNotification();
6716 finishCheck.CheckSignalNotReceived();
6717 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6719 application.SendNotification();
6720 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6722 // We did expect the animation to finish
6723 application.SendNotification();
6724 finishCheck.CheckSignalReceived();
6725 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6729 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6731 TestApplication application;
6733 Actor actor = Actor::New();
6735 // Register a Vector2 property
6736 Vector2 startValue(10.0f, 10.0f);
6737 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6738 application.GetScene().Add(actor);
6739 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
6740 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6742 // Build the animation
6743 float durationSeconds(1.0f);
6744 Animation animation = Animation::New(durationSeconds);
6745 Vector2 targetValue(30.0f, 30.0f);
6746 Vector2 relativeValue(targetValue - startValue);
6748 animation.AnimateTo(Property(actor, index),
6750 AlphaFunction::LINEAR,
6751 TimePeriod(delay, durationSeconds - delay));
6753 // Start the animation
6756 bool signalReceived(false);
6757 AnimationFinishCheck finishCheck(signalReceived);
6758 animation.FinishedSignal().Connect(&application, finishCheck);
6760 application.SendNotification();
6761 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6763 // We didn't expect the animation to finish yet, but cached value should be the final one
6764 application.SendNotification();
6765 finishCheck.CheckSignalNotReceived();
6766 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6767 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
6769 application.SendNotification();
6770 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6772 // We didn't expect the animation to finish yet
6773 application.SendNotification();
6774 finishCheck.CheckSignalNotReceived();
6775 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6777 application.SendNotification();
6778 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6780 // We did expect the animation to finish
6781 application.SendNotification();
6782 finishCheck.CheckSignalReceived();
6783 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
6784 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
6788 int UtcDaliAnimationAnimateToVector3P(void)
6790 TestApplication application;
6792 Actor actor = Actor::New();
6794 // Register a Vector3 property
6795 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6796 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6797 application.GetScene().Add(actor);
6798 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6799 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6801 // Build the animation
6802 float durationSeconds(2.0f);
6803 Animation animation = Animation::New(durationSeconds);
6804 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6805 Vector3 relativeValue(targetValue - startValue);
6806 animation.AnimateTo(Property(actor, index), targetValue);
6808 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6810 // Start the animation
6813 bool signalReceived(false);
6814 AnimationFinishCheck finishCheck(signalReceived);
6815 animation.FinishedSignal().Connect(&application, finishCheck);
6817 application.SendNotification();
6818 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6820 // We didn't expect the animation to finish yet
6821 application.SendNotification();
6822 finishCheck.CheckSignalNotReceived();
6823 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
6825 application.SendNotification();
6826 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6828 // We did expect the animation to finish
6829 application.SendNotification();
6830 finishCheck.CheckSignalReceived();
6831 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6835 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6837 TestApplication application;
6839 Actor actor = Actor::New();
6841 // Register a Vector3 property
6842 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6843 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6844 application.GetScene().Add(actor);
6845 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6846 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6848 // Build the animation
6849 float durationSeconds(1.0f);
6850 Animation animation = Animation::New(durationSeconds);
6851 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6852 Vector3 relativeValue(targetValue - startValue);
6853 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6855 Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
6857 // Start the animation
6860 bool signalReceived(false);
6861 AnimationFinishCheck finishCheck(signalReceived);
6862 animation.FinishedSignal().Connect(&application, finishCheck);
6864 application.SendNotification();
6865 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
6867 // We didn't expect the animation to finish yet
6868 application.SendNotification();
6869 finishCheck.CheckSignalNotReceived();
6871 // The position should have moved more, than with a linear alpha function
6872 Vector3 current(actor.GetCurrentProperty<Vector3>(index));
6873 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
6874 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
6875 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
6877 application.SendNotification();
6878 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
6880 // We did expect the animation to finish
6881 application.SendNotification();
6882 finishCheck.CheckSignalReceived();
6883 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6887 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6889 TestApplication application;
6891 Actor actor = Actor::New();
6893 // Register a Vector3 property
6894 Vector3 startValue(10.0f, 10.0f, 10.0f);
6895 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6896 application.GetScene().Add(actor);
6897 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6898 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6900 // Build the animation
6901 float durationSeconds(1.0f);
6902 Animation animation = Animation::New(durationSeconds);
6903 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6904 Vector3 relativeValue(targetValue - startValue);
6906 animation.AnimateTo(Property(actor, index),
6908 TimePeriod(delay, durationSeconds - delay));
6910 // Start the animation
6913 bool signalReceived(false);
6914 AnimationFinishCheck finishCheck(signalReceived);
6915 animation.FinishedSignal().Connect(&application, finishCheck);
6917 application.SendNotification();
6918 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6920 // We didn't expect the animation to finish yet
6921 application.SendNotification();
6922 finishCheck.CheckSignalNotReceived();
6923 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6925 application.SendNotification();
6926 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6928 // We didn't expect the animation to finish yet
6929 application.SendNotification();
6930 finishCheck.CheckSignalNotReceived();
6931 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6933 application.SendNotification();
6934 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6936 // We did expect the animation to finish
6937 application.SendNotification();
6938 finishCheck.CheckSignalReceived();
6939 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
6943 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6945 TestApplication application;
6947 Actor actor = Actor::New();
6949 // Register a Vector3 property
6950 Vector3 startValue(10.0f, 10.0f, 10.0f);
6951 Property::Index index = actor.RegisterProperty("testProperty", startValue);
6952 application.GetScene().Add(actor);
6953 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
6954 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6956 // Build the animation
6957 float durationSeconds(1.0f);
6958 Animation animation = Animation::New(durationSeconds);
6959 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6960 Vector3 relativeValue(targetValue - startValue);
6962 animation.AnimateTo(Property(actor, "testProperty"),
6964 AlphaFunction::LINEAR,
6965 TimePeriod(delay, durationSeconds - delay));
6967 // Start the animation
6970 bool signalReceived(false);
6971 AnimationFinishCheck finishCheck(signalReceived);
6972 animation.FinishedSignal().Connect(&application, finishCheck);
6974 application.SendNotification();
6975 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
6977 // We didn't expect the animation to finish yet
6978 application.SendNotification();
6979 finishCheck.CheckSignalNotReceived();
6980 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
6982 application.SendNotification();
6983 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
6985 // We didn't expect the animation to finish yet
6986 application.SendNotification();
6987 finishCheck.CheckSignalNotReceived();
6988 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
6990 application.SendNotification();
6991 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
6993 // We did expect the animation to finish
6994 application.SendNotification();
6995 finishCheck.CheckSignalReceived();
6996 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
7000 int UtcDaliAnimationAnimateToVector3ComponentP(void)
7002 TestApplication application;
7004 Actor actor = Actor::New();
7006 // Register a Vector3 property
7007 Vector3 startValue(10.0f, 10.0f, 10.0f);
7008 Property::Index index = actor.RegisterProperty("testProperty", startValue);
7009 application.GetScene().Add(actor);
7010 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
7011 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
7013 // Build the animation
7014 float durationSeconds(1.0f);
7015 Animation animation = Animation::New(durationSeconds);
7016 Vector3 targetValue(30.0f, 30.0f, 10.0f);
7017 Vector3 relativeValue(targetValue - startValue);
7019 animation.AnimateTo(Property(actor, "testProperty", 0),
7021 AlphaFunction::LINEAR,
7022 TimePeriod(delay, durationSeconds - delay));
7023 animation.AnimateTo(Property(actor, index, 1),
7025 AlphaFunction::LINEAR,
7026 TimePeriod(delay, durationSeconds - delay));
7028 // Start the animation
7031 bool signalReceived(false);
7032 AnimationFinishCheck finishCheck(signalReceived);
7033 animation.FinishedSignal().Connect(&application, finishCheck);
7035 application.SendNotification();
7036 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7038 // We didn't expect the animation to finish yet
7039 application.SendNotification();
7040 finishCheck.CheckSignalNotReceived();
7041 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
7043 application.SendNotification();
7044 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7046 // We didn't expect the animation to finish yet
7047 application.SendNotification();
7048 finishCheck.CheckSignalNotReceived();
7049 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7051 application.SendNotification();
7052 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7054 // We did expect the animation to finish
7055 application.SendNotification();
7056 finishCheck.CheckSignalReceived();
7057 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
7061 int UtcDaliAnimationAnimateToVector4P(void)
7063 TestApplication application;
7065 Actor actor = Actor::New();
7067 // Register a Vector4 property
7068 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
7069 Property::Index index = actor.RegisterProperty("testProperty", startValue);
7070 application.GetScene().Add(actor);
7071 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7072 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7074 // Build the animation
7075 float durationSeconds(2.0f);
7076 Animation animation = Animation::New(durationSeconds);
7077 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
7078 Vector4 relativeValue(targetValue - startValue);
7079 animation.AnimateTo(Property(actor, index), targetValue);
7081 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
7083 // Start the animation
7086 bool signalReceived(false);
7087 AnimationFinishCheck finishCheck(signalReceived);
7088 animation.FinishedSignal().Connect(&application, finishCheck);
7090 application.SendNotification();
7091 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
7093 // We didn't expect the animation to finish yet
7094 application.SendNotification();
7095 finishCheck.CheckSignalNotReceived();
7096 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
7098 application.SendNotification();
7099 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
7101 // We did expect the animation to finish
7102 application.SendNotification();
7103 finishCheck.CheckSignalReceived();
7104 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7108 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
7110 TestApplication application;
7112 Actor actor = Actor::New();
7114 // Register a Vector4 property
7115 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
7116 Property::Index index = actor.RegisterProperty("testProperty", startValue);
7117 application.GetScene().Add(actor);
7118 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7119 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7121 // Build the animation
7122 float durationSeconds(1.0f);
7123 Animation animation = Animation::New(durationSeconds);
7124 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
7125 Vector4 relativeValue(targetValue - startValue);
7126 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
7128 Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
7130 // Start the animation
7133 bool signalReceived(false);
7134 AnimationFinishCheck finishCheck(signalReceived);
7135 animation.FinishedSignal().Connect(&application, finishCheck);
7137 application.SendNotification();
7138 application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
7140 // We didn't expect the animation to finish yet
7141 application.SendNotification();
7142 finishCheck.CheckSignalNotReceived();
7144 // The position should have moved more, than with a linear alpha function
7145 Vector4 current(actor.GetCurrentProperty<Vector4>(index));
7146 DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
7147 DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
7148 DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
7149 DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
7151 application.SendNotification();
7152 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
7154 // We did expect the animation to finish
7155 application.SendNotification();
7156 finishCheck.CheckSignalReceived();
7157 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7161 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
7163 TestApplication application;
7165 Actor actor = Actor::New();
7167 // Register a Vector4 property
7168 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
7169 Property::Index index = actor.RegisterProperty("testProperty", startValue);
7170 application.GetScene().Add(actor);
7171 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7172 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7174 // Build the animation
7175 float durationSeconds(1.0f);
7176 Animation animation = Animation::New(durationSeconds);
7177 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
7178 Vector4 relativeValue(targetValue - startValue);
7180 animation.AnimateTo(Property(actor, index),
7182 TimePeriod(delay, durationSeconds - delay));
7184 // Start the animation
7187 bool signalReceived(false);
7188 AnimationFinishCheck finishCheck(signalReceived);
7189 animation.FinishedSignal().Connect(&application, finishCheck);
7191 application.SendNotification();
7192 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7194 // We didn't expect the animation to finish yet
7195 application.SendNotification();
7196 finishCheck.CheckSignalNotReceived();
7197 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
7199 application.SendNotification();
7200 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7202 // We didn't expect the animation to finish yet
7203 application.SendNotification();
7204 finishCheck.CheckSignalNotReceived();
7205 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
7207 application.SendNotification();
7208 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7210 // We did expect the animation to finish
7211 application.SendNotification();
7212 finishCheck.CheckSignalReceived();
7213 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
7217 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
7219 TestApplication application;
7221 Actor actor = Actor::New();
7223 // Register a Vector4 property
7224 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
7225 Property::Index index = actor.RegisterProperty("testProperty", startValue);
7226 application.GetScene().Add(actor);
7227 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
7228 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7230 // Build the animation
7231 float durationSeconds(1.0f);
7232 Animation animation = Animation::New(durationSeconds);
7233 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
7234 Vector4 relativeValue(targetValue - startValue);
7236 animation.AnimateTo(Property(actor, index),
7238 AlphaFunction::LINEAR,
7239 TimePeriod(delay, durationSeconds - delay));
7241 // Start the animation
7244 bool signalReceived(false);
7245 AnimationFinishCheck finishCheck(signalReceived);
7246 animation.FinishedSignal().Connect(&application, finishCheck);
7248 application.SendNotification();
7249 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7251 // We didn't expect the animation to finish yet
7252 application.SendNotification();
7253 finishCheck.CheckSignalNotReceived();
7254 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
7256 application.SendNotification();
7257 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
7259 // We didn't expect the animation to finish yet
7260 application.SendNotification();
7261 finishCheck.CheckSignalNotReceived();
7262 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
7264 application.SendNotification();
7265 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7267 // We did expect the animation to finish
7268 application.SendNotification();
7269 finishCheck.CheckSignalReceived();
7270 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
7274 int UtcDaliAnimationAnimateToActorParentOriginP(void)
7276 TestApplication application;
7278 Actor actor = Actor::New();
7279 application.GetScene().Add(actor);
7280 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
7282 // Build the animation
7283 float durationSeconds(1.0f);
7284 Animation animation = Animation::New(durationSeconds);
7285 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
7287 DALI_TEST_ASSERTION(
7289 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
7291 "Property is not animatable");
7296 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
7298 TestApplication application;
7300 Actor actor = Actor::New();
7301 application.GetScene().Add(actor);
7302 float startValue(0.0f);
7303 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
7304 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
7306 // Build the animation
7307 float durationSeconds(1.0f);
7308 Animation animation = Animation::New(durationSeconds);
7309 float targetX(1.0f);
7311 DALI_TEST_ASSERTION(
7313 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
7315 "Property is not animatable");
7320 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7322 TestApplication application;
7324 Actor actor = Actor::New();
7325 application.GetScene().Add(actor);
7326 float startValue(0.0f);
7327 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
7328 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
7330 // Build the animation
7331 float durationSeconds(1.0f);
7332 Animation animation = Animation::New(durationSeconds);
7333 float targetY(1.0f);
7335 DALI_TEST_ASSERTION(
7337 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
7339 "Property is not animatable");
7344 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7346 TestApplication application;
7348 Actor actor = Actor::New();
7349 application.GetScene().Add(actor);
7350 float startValue(0.5f);
7351 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
7352 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
7354 // Build the animation
7355 float durationSeconds(1.0f);
7356 Animation animation = Animation::New(durationSeconds);
7357 float targetZ(1.0f);
7359 DALI_TEST_ASSERTION(
7361 animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
7363 "Property is not animatable");
7368 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7370 TestApplication application;
7372 Actor actor = Actor::New();
7373 application.GetScene().Add(actor);
7374 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
7376 // Build the animation
7377 float durationSeconds(1.0f);
7378 Animation animation = Animation::New(durationSeconds);
7379 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
7381 DALI_TEST_ASSERTION(
7383 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7385 "Property is not animatable");
7390 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7392 TestApplication application;
7394 Actor actor = Actor::New();
7395 application.GetScene().Add(actor);
7396 float startValue(0.5f);
7397 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
7398 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
7400 // Build the animation
7401 float durationSeconds(1.0f);
7402 Animation animation = Animation::New(durationSeconds);
7403 float targetX(1.0f);
7405 DALI_TEST_ASSERTION(
7407 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
7409 "Property is not animatable");
7414 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7416 TestApplication application;
7418 Actor actor = Actor::New();
7419 application.GetScene().Add(actor);
7420 float startValue(0.5f);
7421 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
7422 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
7424 // Build the animation
7425 float durationSeconds(1.0f);
7426 Animation animation = Animation::New(durationSeconds);
7427 float targetY(0.0f);
7429 DALI_TEST_ASSERTION(
7431 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
7433 "Property is not animatable");
7438 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7440 TestApplication application;
7442 Actor actor = Actor::New();
7443 application.GetScene().Add(actor);
7444 float startValue(0.5f);
7445 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
7446 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
7448 // Build the animation
7449 float durationSeconds(1.0f);
7450 Animation animation = Animation::New(durationSeconds);
7451 float targetZ(100.0f);
7453 DALI_TEST_ASSERTION(
7455 animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
7457 "Property is not animatable");
7462 int UtcDaliAnimationAnimateToActorSizeP(void)
7464 TestApplication application;
7466 Actor actor = Actor::New();
7467 application.GetScene().Add(actor);
7468 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7470 // Build the animation
7471 float durationSeconds(1.0f);
7472 Animation animation = Animation::New(durationSeconds);
7473 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7474 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7476 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7478 // Should return the initial properties before play
7479 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7480 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
7481 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
7482 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
7484 // Start the animation
7487 // Should return the target property after play
7488 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7489 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
7490 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
7491 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
7493 bool signalReceived(false);
7494 AnimationFinishCheck finishCheck(signalReceived);
7495 animation.FinishedSignal().Connect(&application, finishCheck);
7497 application.SendNotification();
7498 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7500 // We didn't expect the animation to finish yet
7501 application.SendNotification();
7502 finishCheck.CheckSignalNotReceived();
7503 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7505 application.SendNotification();
7506 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7508 // We did expect the animation to finish
7509 application.SendNotification();
7510 finishCheck.CheckSignalReceived();
7511 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7514 finishCheck.Reset();
7515 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7516 application.SendNotification();
7517 application.Render(0);
7518 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7520 // Repeat with a different (ease-in) alpha function
7521 animation = Animation::New(durationSeconds);
7522 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7523 animation.FinishedSignal().Connect(&application, finishCheck);
7526 application.SendNotification();
7527 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7529 // We didn't expect the animation to finish yet
7530 application.SendNotification();
7531 finishCheck.CheckSignalNotReceived();
7533 // The size should have travelled less, than with a linear alpha function
7534 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7535 DALI_TEST_CHECK(current.x > 0.0f);
7536 DALI_TEST_CHECK(current.y > 0.0f);
7537 DALI_TEST_CHECK(current.z > 0.0f);
7538 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7539 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7540 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
7542 application.SendNotification();
7543 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7545 // We did expect the animation to finish
7546 application.SendNotification();
7547 finishCheck.CheckSignalReceived();
7548 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7551 finishCheck.Reset();
7552 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7553 application.SendNotification();
7554 application.Render(0);
7555 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7557 // Repeat with a delay
7559 animation = Animation::New(durationSeconds);
7560 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7561 animation.FinishedSignal().Connect(&application, finishCheck);
7564 application.SendNotification();
7565 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7567 // We didn't expect the animation to finish yet
7568 application.SendNotification();
7569 finishCheck.CheckSignalNotReceived();
7570 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7572 application.SendNotification();
7573 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7575 // We did expect the animation to finish
7576 application.SendNotification();
7577 finishCheck.CheckSignalReceived();
7578 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7582 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7584 TestApplication application;
7586 Actor actor = Actor::New();
7587 application.GetScene().Add(actor);
7588 float startValue(0.0f);
7589 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
7590 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7592 // Build the animation
7593 float durationSeconds(1.0f);
7594 Animation animation = Animation::New(durationSeconds);
7595 float targetWidth(10.0f);
7596 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
7598 float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
7600 // Should return the initial properties before play
7601 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7602 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
7604 // Start the animation
7607 // Should return the target property after play
7608 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
7609 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7611 bool signalReceived(false);
7612 AnimationFinishCheck finishCheck(signalReceived);
7613 animation.FinishedSignal().Connect(&application, finishCheck);
7615 application.SendNotification();
7616 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7618 // We didn't expect the animation to finish yet
7619 application.SendNotification();
7620 finishCheck.CheckSignalNotReceived();
7621 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
7623 application.SendNotification();
7624 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7626 // We did expect the animation to finish
7627 application.SendNotification();
7628 finishCheck.CheckSignalReceived();
7629 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
7630 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
7634 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7636 TestApplication application;
7638 Actor actor = Actor::New();
7639 application.GetScene().Add(actor);
7640 float startValue(0.0f);
7641 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
7642 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7644 // Build the animation
7645 float durationSeconds(1.0f);
7646 Animation animation = Animation::New(durationSeconds);
7647 float targetHeight(-10.0f);
7648 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
7650 float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
7652 // Should return the initial properties before play
7653 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7654 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
7656 // Start the animation
7659 // Should return the target property after play
7660 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
7661 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7663 bool signalReceived(false);
7664 AnimationFinishCheck finishCheck(signalReceived);
7665 animation.FinishedSignal().Connect(&application, finishCheck);
7667 application.SendNotification();
7668 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7670 // We didn't expect the animation to finish yet
7671 application.SendNotification();
7672 finishCheck.CheckSignalNotReceived();
7673 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
7675 application.SendNotification();
7676 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7678 // We did expect the animation to finish
7679 application.SendNotification();
7680 finishCheck.CheckSignalReceived();
7681 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
7682 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
7686 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7688 TestApplication application;
7690 Actor actor = Actor::New();
7691 application.GetScene().Add(actor);
7692 float startValue(0.0f);
7693 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
7694 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7696 // Build the animation
7697 float durationSeconds(1.0f);
7698 Animation animation = Animation::New(durationSeconds);
7699 float targetDepth(-10.0f);
7700 animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
7702 float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
7704 // Should return the initial properties before play
7705 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7706 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
7708 // Start the animation
7711 // Should return the target property after play
7712 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
7713 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7715 bool signalReceived(false);
7716 AnimationFinishCheck finishCheck(signalReceived);
7717 animation.FinishedSignal().Connect(&application, finishCheck);
7719 application.SendNotification();
7720 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7722 // We didn't expect the animation to finish yet
7723 application.SendNotification();
7724 finishCheck.CheckSignalNotReceived();
7725 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
7727 application.SendNotification();
7728 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7730 // We did expect the animation to finish
7731 application.SendNotification();
7732 finishCheck.CheckSignalReceived();
7733 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
7734 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
7738 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7740 TestApplication application;
7742 Actor actor = Actor::New();
7743 application.GetScene().Add(actor);
7744 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7746 // Build the animation
7747 float durationSeconds(1.0f);
7748 Animation animation = Animation::New(durationSeconds);
7749 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7750 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
7752 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7754 // Start the animation
7757 bool signalReceived(false);
7758 AnimationFinishCheck finishCheck(signalReceived);
7759 animation.FinishedSignal().Connect(&application, finishCheck);
7761 application.SendNotification();
7762 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7764 // We didn't expect the animation to finish yet
7765 application.SendNotification();
7766 finishCheck.CheckSignalNotReceived();
7767 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
7769 application.SendNotification();
7770 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7772 // We did expect the animation to finish
7773 application.SendNotification();
7774 finishCheck.CheckSignalReceived();
7775 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
7778 finishCheck.Reset();
7779 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7780 application.SendNotification();
7781 application.Render(0);
7782 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7784 // Repeat with a different (ease-in) alpha function
7785 animation = Animation::New(durationSeconds);
7786 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
7787 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
7788 animation.FinishedSignal().Connect(&application, finishCheck);
7791 application.SendNotification();
7792 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
7794 // We didn't expect the animation to finish yet
7795 application.SendNotification();
7796 finishCheck.CheckSignalNotReceived();
7798 // The size should have travelled less, than with a linear alpha function
7799 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
7800 DALI_TEST_CHECK(current.x > 0.0f);
7801 DALI_TEST_CHECK(current.y > 0.0f);
7802 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
7803 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
7805 application.SendNotification();
7806 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
7808 // We did expect the animation to finish
7809 application.SendNotification();
7810 finishCheck.CheckSignalReceived();
7811 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7812 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7815 finishCheck.Reset();
7816 actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
7817 application.SendNotification();
7818 application.Render(0);
7819 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7821 // Repeat with a delay
7823 animation = Animation::New(durationSeconds);
7824 animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7825 animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7826 animation.FinishedSignal().Connect(&application, finishCheck);
7829 application.SendNotification();
7830 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
7832 // We didn't expect the animation to finish yet
7833 application.SendNotification();
7834 finishCheck.CheckSignalNotReceived();
7835 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
7837 application.SendNotification();
7838 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7840 // We did expect the animation to finish
7841 application.SendNotification();
7842 finishCheck.CheckSignalReceived();
7843 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
7844 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
7848 int UtcDaliAnimationAnimateToActorPositionP(void)
7850 TestApplication application;
7852 Actor actor = Actor::New();
7853 application.GetScene().Add(actor);
7854 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7856 // Build the animation
7857 float durationSeconds(1.0f);
7858 Animation animation = Animation::New(durationSeconds);
7859 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7860 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7862 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7864 // Should return the initial properties before play
7865 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7866 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
7867 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
7868 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
7870 // Start the animation
7873 // Should return the target property after play
7874 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7875 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
7876 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
7877 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
7879 bool signalReceived(false);
7880 AnimationFinishCheck finishCheck(signalReceived);
7881 animation.FinishedSignal().Connect(&application, finishCheck);
7883 application.SendNotification();
7884 application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
7886 // We didn't expect the animation to finish yet
7887 application.SendNotification();
7888 finishCheck.CheckSignalNotReceived();
7889 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
7891 application.SendNotification();
7892 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
7894 // We did expect the animation to finish
7895 application.SendNotification();
7896 finishCheck.CheckSignalReceived();
7897 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
7901 int UtcDaliAnimationAnimateToActorPositionXP(void)
7903 TestApplication application;
7905 Actor actor = Actor::New();
7906 application.GetScene().Add(actor);
7907 float startValue(0.0f);
7908 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
7909 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7910 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7911 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7913 // Build the animation
7914 float durationSeconds(1.0f);
7915 Animation animation = Animation::New(durationSeconds);
7916 float targetX(1.0f);
7917 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
7919 float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
7921 // Should return the initial properties before play
7922 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7923 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7925 // Start the animation
7928 // Should return the target property after play
7929 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
7930 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7932 bool signalReceived(false);
7933 AnimationFinishCheck finishCheck(signalReceived);
7934 animation.FinishedSignal().Connect(&application, finishCheck);
7936 application.SendNotification();
7937 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7939 // We didn't expect the animation to finish yet
7940 application.SendNotification();
7941 finishCheck.CheckSignalNotReceived();
7942 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
7944 application.SendNotification();
7945 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
7947 // We did expect the animation to finish
7948 application.SendNotification();
7949 finishCheck.CheckSignalReceived();
7950 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
7951 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
7952 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7953 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7957 int UtcDaliAnimationAnimateToActorPositionYP(void)
7959 TestApplication application;
7961 Actor actor = Actor::New();
7962 application.GetScene().Add(actor);
7963 float startValue(0.0f);
7964 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
7965 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
7966 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7967 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
7969 // Build the animation
7970 float durationSeconds(1.0f);
7971 Animation animation = Animation::New(durationSeconds);
7972 float targetY(10.0f);
7973 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
7975 float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
7977 // Should return the initial properties before play
7978 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
7979 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
7981 // Start the animation
7984 // Should return the target property after play
7985 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
7986 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
7988 bool signalReceived(false);
7989 AnimationFinishCheck finishCheck(signalReceived);
7990 animation.FinishedSignal().Connect(&application, finishCheck);
7992 application.SendNotification();
7993 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
7995 // We didn't expect the animation to finish yet
7996 application.SendNotification();
7997 finishCheck.CheckSignalNotReceived();
7998 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
8000 application.SendNotification();
8001 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8003 // We did expect the animation to finish
8004 application.SendNotification();
8005 finishCheck.CheckSignalReceived();
8006 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
8007 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
8008 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
8009 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
8013 int UtcDaliAnimationAnimateToActorPositionZP(void)
8015 TestApplication application;
8017 Actor actor = Actor::New();
8018 application.GetScene().Add(actor);
8019 float startValue(0.0f);
8020 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
8021 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
8022 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
8023 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
8025 // Build the animation
8026 float durationSeconds(1.0f);
8027 Animation animation = Animation::New(durationSeconds);
8028 float targetZ(-5.0f);
8029 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
8031 float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8033 // Should return the initial properties before play
8034 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8035 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
8037 // Start the animation
8040 // Should return the target property after play
8041 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
8042 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
8044 bool signalReceived(false);
8045 AnimationFinishCheck finishCheck(signalReceived);
8046 animation.FinishedSignal().Connect(&application, finishCheck);
8048 application.SendNotification();
8049 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8051 // We didn't expect the animation to finish yet
8052 application.SendNotification();
8053 finishCheck.CheckSignalNotReceived();
8054 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
8056 application.SendNotification();
8057 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8059 // We did expect the animation to finish
8060 application.SendNotification();
8061 finishCheck.CheckSignalReceived();
8062 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
8063 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
8064 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
8065 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
8069 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
8071 TestApplication application;
8073 Actor actor = Actor::New();
8074 application.GetScene().Add(actor);
8075 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8077 // Build the animation
8078 float durationSeconds(1.0f);
8079 Animation animation = Animation::New(durationSeconds);
8080 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8081 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
8083 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8085 // Start the animation
8088 bool signalReceived(false);
8089 AnimationFinishCheck finishCheck(signalReceived);
8090 animation.FinishedSignal().Connect(&application, finishCheck);
8092 application.SendNotification();
8093 application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
8095 // We didn't expect the animation to finish yet
8096 application.SendNotification();
8097 finishCheck.CheckSignalNotReceived();
8099 // The position should have moved less, than with a linear alpha function
8100 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
8101 DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
8102 DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
8103 DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
8104 DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
8105 DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
8106 DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
8108 application.SendNotification();
8109 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8111 // We did expect the animation to finish
8112 application.SendNotification();
8113 finishCheck.CheckSignalReceived();
8114 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8118 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
8120 TestApplication application;
8122 Actor actor = Actor::New();
8123 application.GetScene().Add(actor);
8124 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8126 // Build the animation
8127 float durationSeconds(1.0f);
8128 Animation animation = Animation::New(durationSeconds);
8129 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8131 animation.AnimateTo(Property(actor, Actor::Property::POSITION),
8133 TimePeriod(delay, durationSeconds - delay));
8135 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8137 // Start the animation
8140 bool signalReceived(false);
8141 AnimationFinishCheck finishCheck(signalReceived);
8142 animation.FinishedSignal().Connect(&application, finishCheck);
8144 application.SendNotification();
8145 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8147 // We didn't expect the animation to finish yet
8148 application.SendNotification();
8149 finishCheck.CheckSignalNotReceived();
8150 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8152 application.SendNotification();
8153 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
8155 // We didn't expect the animation to finish yet
8156 application.SendNotification();
8157 finishCheck.CheckSignalNotReceived();
8158 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
8160 application.SendNotification();
8161 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
8163 // We did expect the animation to finish
8164 application.SendNotification();
8165 finishCheck.CheckSignalReceived();
8166 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8170 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
8172 TestApplication application;
8174 Actor actor = Actor::New();
8175 application.GetScene().Add(actor);
8176 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8178 // Build the animation
8179 float durationSeconds(1.0f);
8180 Animation animation = Animation::New(durationSeconds);
8181 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
8183 animation.AnimateTo(Property(actor, Actor::Property::POSITION),
8185 AlphaFunction::LINEAR,
8186 TimePeriod(delay, durationSeconds - delay));
8188 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
8190 // Start the animation
8193 bool signalReceived(false);
8194 AnimationFinishCheck finishCheck(signalReceived);
8195 animation.FinishedSignal().Connect(&application, finishCheck);
8197 application.SendNotification();
8198 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
8200 // We didn't expect the animation to finish yet
8201 application.SendNotification();
8202 finishCheck.CheckSignalNotReceived();
8203 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
8205 application.SendNotification();
8206 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
8208 // We didn't expect the animation to finish yet
8209 application.SendNotification();
8210 finishCheck.CheckSignalNotReceived();
8211 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
8213 application.SendNotification();
8214 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
8216 // We did expect the animation to finish
8217 application.SendNotification();
8218 finishCheck.CheckSignalReceived();
8219 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
8223 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
8225 TestApplication application;
8227 Actor actor = Actor::New();
8228 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8229 application.GetScene().Add(actor);
8230 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8232 // Build the animation
8233 float durationSeconds(1.0f);
8234 Animation animation = Animation::New(durationSeconds);
8235 Degree targetRotationDegrees(90.0f);
8236 Radian targetRotationRadians(targetRotationDegrees);
8237 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
8239 // Start the animation
8242 // Target value should be retrievable straight away
8243 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8245 bool signalReceived(false);
8246 AnimationFinishCheck finishCheck(signalReceived);
8247 animation.FinishedSignal().Connect(&application, finishCheck);
8249 application.SendNotification();
8250 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8252 // We didn't expect the animation to finish yet
8253 application.SendNotification();
8254 finishCheck.CheckSignalNotReceived();
8255 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8257 application.SendNotification();
8258 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8260 // We didn't expect the animation to finish yet
8261 application.SendNotification();
8262 finishCheck.CheckSignalNotReceived();
8263 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8265 application.SendNotification();
8266 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8268 // We didn't expect the animation to finish yet
8269 application.SendNotification();
8270 finishCheck.CheckSignalNotReceived();
8271 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8273 application.SendNotification();
8274 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8276 // We did expect the animation to finish
8277 application.SendNotification();
8278 finishCheck.CheckSignalReceived();
8279 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8283 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
8285 TestApplication application;
8287 Actor actor = Actor::New();
8288 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8289 application.GetScene().Add(actor);
8290 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8292 // Build the animation
8293 float durationSeconds(1.0f);
8294 Animation animation = Animation::New(durationSeconds);
8295 Degree targetRotationDegrees(90.0f);
8296 Radian targetRotationRadians(targetRotationDegrees);
8297 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
8298 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
8300 // Start the animation
8303 bool signalReceived(false);
8304 AnimationFinishCheck finishCheck(signalReceived);
8305 animation.FinishedSignal().Connect(&application, finishCheck);
8307 application.SendNotification();
8308 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8310 // We didn't expect the animation to finish yet
8311 application.SendNotification();
8312 finishCheck.CheckSignalNotReceived();
8313 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8315 application.SendNotification();
8316 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8318 // We didn't expect the animation to finish yet
8319 application.SendNotification();
8320 finishCheck.CheckSignalNotReceived();
8321 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8323 application.SendNotification();
8324 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8326 // We didn't expect the animation to finish yet
8327 application.SendNotification();
8328 finishCheck.CheckSignalNotReceived();
8329 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8331 application.SendNotification();
8332 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8334 // We did expect the animation to finish
8335 application.SendNotification();
8336 finishCheck.CheckSignalReceived();
8337 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8341 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8343 TestApplication application;
8345 Actor actor = Actor::New();
8346 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8347 application.GetScene().Add(actor);
8348 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8350 // Build the animation
8351 float durationSeconds(1.0f);
8352 Animation animation = Animation::New(durationSeconds);
8353 Degree targetRotationDegrees(90.0f);
8354 Radian targetRotationRadians(targetRotationDegrees);
8355 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8357 // Start the animation
8360 bool signalReceived(false);
8361 AnimationFinishCheck finishCheck(signalReceived);
8362 animation.FinishedSignal().Connect(&application, finishCheck);
8364 application.SendNotification();
8365 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8367 // We didn't expect the animation to finish yet
8368 application.SendNotification();
8369 finishCheck.CheckSignalNotReceived();
8370 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8372 application.SendNotification();
8373 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8375 // We didn't expect the animation to finish yet
8376 application.SendNotification();
8377 finishCheck.CheckSignalNotReceived();
8378 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8380 application.SendNotification();
8381 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8383 // We didn't expect the animation to finish yet
8384 application.SendNotification();
8385 finishCheck.CheckSignalNotReceived();
8386 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8388 application.SendNotification();
8389 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8391 // We did expect the animation to finish
8392 application.SendNotification();
8393 finishCheck.CheckSignalReceived();
8394 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8398 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8400 TestApplication application;
8402 Actor actor = Actor::New();
8403 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8404 application.GetScene().Add(actor);
8405 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8407 // Build the animation
8408 float durationSeconds(1.0f);
8409 Animation animation = Animation::New(durationSeconds);
8410 Degree targetRotationDegrees(90.0f);
8411 Radian targetRotationRadians(targetRotationDegrees);
8413 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8415 // Start the animation
8418 bool signalReceived(false);
8419 AnimationFinishCheck finishCheck(signalReceived);
8420 animation.FinishedSignal().Connect(&application, finishCheck);
8422 application.SendNotification();
8423 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8425 // We didn't expect the animation to finish yet
8426 application.SendNotification();
8427 finishCheck.CheckSignalNotReceived();
8428 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8429 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8431 application.SendNotification();
8432 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8434 // We didn't expect the animation to finish yet
8435 application.SendNotification();
8436 finishCheck.CheckSignalNotReceived();
8437 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8438 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8440 application.SendNotification();
8441 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8443 // We didn't expect the animation to finish yet
8444 application.SendNotification();
8445 finishCheck.CheckSignalNotReceived();
8446 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8447 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8449 application.SendNotification();
8450 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8452 // We did expect the animation to finish
8453 application.SendNotification();
8454 finishCheck.CheckSignalReceived();
8455 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8459 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8461 TestApplication application;
8463 Actor actor = Actor::New();
8464 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
8465 application.GetScene().Add(actor);
8466 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8468 // Build the animation
8469 float durationSeconds(1.0f);
8470 Animation animation = Animation::New(durationSeconds);
8471 Degree targetRotationDegrees(90.0f);
8472 Radian targetRotationRadians(targetRotationDegrees);
8474 animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8476 // Start the animation
8479 bool signalReceived(false);
8480 AnimationFinishCheck finishCheck(signalReceived);
8481 animation.FinishedSignal().Connect(&application, finishCheck);
8483 application.SendNotification();
8484 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
8486 // We didn't expect the animation to finish yet
8487 application.SendNotification();
8488 finishCheck.CheckSignalNotReceived();
8489 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8490 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8492 application.SendNotification();
8493 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
8495 // We didn't expect the animation to finish yet
8496 application.SendNotification();
8497 finishCheck.CheckSignalNotReceived();
8498 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8499 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8501 application.SendNotification();
8502 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
8504 // We didn't expect the animation to finish yet
8505 application.SendNotification();
8506 finishCheck.CheckSignalNotReceived();
8507 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8508 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8510 application.SendNotification();
8511 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
8513 // We did expect the animation to finish
8514 application.SendNotification();
8515 finishCheck.CheckSignalReceived();
8516 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
8520 int UtcDaliAnimationAnimateToActorScaleP(void)
8522 TestApplication application;
8524 Actor actor = Actor::New();
8525 application.GetScene().Add(actor);
8526 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8528 // Build the animation
8529 float durationSeconds(1.0f);
8530 Animation animation = Animation::New(durationSeconds);
8531 Vector3 targetScale(2.0f, 2.0f, 2.0f);
8532 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
8534 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
8536 // Start the animation
8539 // Target value should be retrievable straight away
8540 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8541 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
8542 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
8543 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
8545 bool signalReceived(false);
8546 AnimationFinishCheck finishCheck(signalReceived);
8547 animation.FinishedSignal().Connect(&application, finishCheck);
8549 application.SendNotification();
8550 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8552 // We didn't expect the animation to finish yet
8553 application.SendNotification();
8554 finishCheck.CheckSignalNotReceived();
8555 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
8557 application.SendNotification();
8558 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8560 // We did expect the animation to finish
8561 application.SendNotification();
8562 finishCheck.CheckSignalReceived();
8563 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8566 finishCheck.Reset();
8567 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8568 application.SendNotification();
8569 application.Render(0);
8570 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8572 // Repeat with a different (ease-in) alpha function
8573 animation = Animation::New(durationSeconds);
8574 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8575 animation.FinishedSignal().Connect(&application, finishCheck);
8578 application.SendNotification();
8579 application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
8581 // We didn't expect the animation to finish yet
8582 application.SendNotification();
8583 finishCheck.CheckSignalNotReceived();
8585 // The scale should have grown less, than with a linear alpha function
8586 Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
8587 DALI_TEST_CHECK(current.x > 1.0f);
8588 DALI_TEST_CHECK(current.y > 1.0f);
8589 DALI_TEST_CHECK(current.z > 1.0f);
8590 DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
8591 DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
8592 DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
8594 application.SendNotification();
8595 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
8597 // We did expect the animation to finish
8598 application.SendNotification();
8599 finishCheck.CheckSignalReceived();
8600 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8603 finishCheck.Reset();
8604 actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
8605 application.SendNotification();
8606 application.Render(0);
8607 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
8609 // Repeat with a delay
8611 animation = Animation::New(durationSeconds);
8612 animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8613 animation.FinishedSignal().Connect(&application, finishCheck);
8616 application.SendNotification();
8617 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator 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), Vector3::ONE, TEST_LOCATION);
8624 application.SendNotification();
8625 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8627 // We did expect the animation to finish
8628 application.SendNotification();
8629 finishCheck.CheckSignalReceived();
8630 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
8634 int UtcDaliAnimationAnimateToActorScaleXP(void)
8636 TestApplication application;
8638 Actor actor = Actor::New();
8639 application.GetScene().Add(actor);
8640 float startValue(1.0f);
8641 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
8642 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8643 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8644 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8645 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8646 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8647 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8649 // Build the animation
8650 float durationSeconds(1.0f);
8651 Animation animation = Animation::New(durationSeconds);
8652 float targetX(10.0f);
8653 animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
8655 float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
8657 // Start the animation
8660 // Target value should be retrievable straight away
8661 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
8662 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8664 bool signalReceived(false);
8665 AnimationFinishCheck finishCheck(signalReceived);
8666 animation.FinishedSignal().Connect(&application, finishCheck);
8668 application.SendNotification();
8669 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8671 // We didn't expect the animation to finish yet
8672 application.SendNotification();
8673 finishCheck.CheckSignalNotReceived();
8674 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
8675 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
8676 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8677 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8679 application.SendNotification();
8680 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8682 // We did expect the animation to finish
8683 application.SendNotification();
8684 finishCheck.CheckSignalReceived();
8685 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
8686 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
8687 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8688 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8692 int UtcDaliAnimationAnimateToActorScaleYP(void)
8694 TestApplication application;
8696 Actor actor = Actor::New();
8697 application.GetScene().Add(actor);
8698 float startValue(1.0f);
8699 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
8700 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8701 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8702 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8703 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8704 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8705 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8707 // Build the animation
8708 float durationSeconds(1.0f);
8709 Animation animation = Animation::New(durationSeconds);
8710 float targetY(1000.0f);
8711 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
8713 float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
8715 // Start the animation
8718 // Target value should be retrievable straight away
8719 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
8720 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8722 bool signalReceived(false);
8723 AnimationFinishCheck finishCheck(signalReceived);
8724 animation.FinishedSignal().Connect(&application, finishCheck);
8726 application.SendNotification();
8727 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8729 // We didn't expect the animation to finish yet
8730 application.SendNotification();
8731 finishCheck.CheckSignalNotReceived();
8732 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION);
8733 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8734 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION);
8735 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8737 application.SendNotification();
8738 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8740 // We did expect the animation to finish
8741 application.SendNotification();
8742 finishCheck.CheckSignalReceived();
8743 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
8744 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8745 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
8746 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8750 int UtcDaliAnimationAnimateToActorScaleZP(void)
8752 TestApplication application;
8754 Actor actor = Actor::New();
8755 application.GetScene().Add(actor);
8756 float startValue(1.0f);
8757 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
8758 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8759 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8760 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8761 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8762 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8763 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
8765 // Build the animation
8766 float durationSeconds(1.0f);
8767 Animation animation = Animation::New(durationSeconds);
8768 float targetZ(-1000.0f);
8769 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
8771 float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
8773 // Start the animation
8776 // Target value should be retrievable straight away
8777 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
8778 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8780 bool signalReceived(false);
8781 AnimationFinishCheck finishCheck(signalReceived);
8782 animation.FinishedSignal().Connect(&application, finishCheck);
8784 application.SendNotification();
8785 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8787 // We didn't expect the animation to finish yet
8788 application.SendNotification();
8789 finishCheck.CheckSignalNotReceived();
8790 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION);
8791 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8792 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8793 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION);
8795 application.SendNotification();
8796 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8798 // We did expect the animation to finish
8799 application.SendNotification();
8800 finishCheck.CheckSignalReceived();
8801 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
8802 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
8803 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
8804 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
8808 int UtcDaliAnimationAnimateToActorColorP(void)
8810 TestApplication application;
8812 Actor actor = Actor::New();
8813 application.GetScene().Add(actor);
8814 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8816 // Build the animation
8817 float durationSeconds(1.0f);
8818 Animation animation = Animation::New(durationSeconds);
8819 Vector4 targetColor(Color::RED);
8820 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
8822 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8823 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8825 // Start the animation
8828 // Target value should be retrievable straight away
8829 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8830 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
8831 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
8832 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
8833 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
8834 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
8836 bool signalReceived(false);
8837 AnimationFinishCheck finishCheck(signalReceived);
8838 animation.FinishedSignal().Connect(&application, finishCheck);
8840 application.SendNotification();
8841 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8843 // We didn't expect the animation to finish yet
8844 application.SendNotification();
8845 finishCheck.CheckSignalNotReceived();
8846 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
8848 application.SendNotification();
8849 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8851 // We did expect the animation to finish
8852 application.SendNotification();
8853 finishCheck.CheckSignalReceived();
8854 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8857 finishCheck.Reset();
8858 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8859 application.SendNotification();
8860 application.Render(0);
8861 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8863 // Repeat with a different (ease-in) alpha function
8864 animation = Animation::New(durationSeconds);
8865 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8866 animation.FinishedSignal().Connect(&application, finishCheck);
8869 application.SendNotification();
8870 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
8872 // We didn't expect the animation to finish yet
8873 application.SendNotification();
8874 finishCheck.CheckSignalNotReceived();
8876 // The color should have changed less, than with a linear alpha function
8877 Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
8878 DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
8879 DALI_TEST_CHECK(current.y < 1.0f);
8880 DALI_TEST_CHECK(current.y > tenPercentProgress.y);
8881 DALI_TEST_CHECK(current.z < 1.0f);
8882 DALI_TEST_CHECK(current.z > tenPercentProgress.z);
8883 DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
8885 application.SendNotification();
8886 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
8888 // We did expect the animation to finish
8889 application.SendNotification();
8890 finishCheck.CheckSignalReceived();
8891 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8894 finishCheck.Reset();
8895 actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
8896 application.SendNotification();
8897 application.Render(0);
8898 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
8900 // Repeat with a shorter animator duration
8901 float animatorDuration = 0.5f;
8902 animation = Animation::New(durationSeconds);
8903 animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8904 animation.FinishedSignal().Connect(&application, finishCheck);
8907 application.SendNotification();
8908 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
8910 // We didn't expect the animation to finish yet
8911 application.SendNotification();
8912 finishCheck.CheckSignalNotReceived();
8913 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
8915 application.SendNotification();
8916 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
8918 // We didn't expect the animation to finish yet
8919 application.SendNotification();
8920 finishCheck.CheckSignalNotReceived();
8921 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8923 application.SendNotification();
8924 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8926 // We did expect the animation to finish
8927 application.SendNotification();
8928 finishCheck.CheckSignalReceived();
8929 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
8933 int UtcDaliAnimationAnimateToActorColorRedP(void)
8935 TestApplication application;
8937 Actor actor = Actor::New();
8938 application.GetScene().Add(actor);
8939 float startValue(1.0f);
8940 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
8941 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8942 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8943 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8944 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8945 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
8946 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8947 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8948 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8950 // Build the animation
8951 float durationSeconds(1.0f);
8952 Animation animation = Animation::New(durationSeconds);
8953 float targetRed(0.5f);
8954 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
8956 float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
8958 // Start the animation
8961 // Target value should be retrievable straight away
8962 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
8963 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8965 bool signalReceived(false);
8966 AnimationFinishCheck finishCheck(signalReceived);
8967 animation.FinishedSignal().Connect(&application, finishCheck);
8969 application.SendNotification();
8970 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
8972 // We didn't expect the animation to finish yet
8973 application.SendNotification();
8974 finishCheck.CheckSignalNotReceived();
8975 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
8976 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
8977 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8978 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8979 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8981 application.SendNotification();
8982 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
8984 // We did expect the animation to finish
8985 application.SendNotification();
8986 finishCheck.CheckSignalReceived();
8987 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
8988 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
8989 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
8990 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
8991 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
8995 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8997 TestApplication application;
8999 Actor actor = Actor::New();
9000 application.GetScene().Add(actor);
9001 float startValue(1.0f);
9002 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
9003 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9004 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9005 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9006 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, 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), startValue, TEST_LOCATION);
9012 // Build the animation
9013 float durationSeconds(1.0f);
9014 Animation animation = Animation::New(durationSeconds);
9015 float targetGreen(0.5f);
9016 animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
9018 float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
9020 // Start the animation
9023 // Target value should be retrievable straight away
9024 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
9025 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
9027 bool signalReceived(false);
9028 AnimationFinishCheck finishCheck(signalReceived);
9029 animation.FinishedSignal().Connect(&application, finishCheck);
9031 application.SendNotification();
9032 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
9034 // We didn't expect the animation to finish yet
9035 application.SendNotification();
9036 finishCheck.CheckSignalNotReceived();
9037 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
9038 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9039 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
9040 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9041 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9043 application.SendNotification();
9044 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9046 // We did expect the animation to finish
9047 application.SendNotification();
9048 finishCheck.CheckSignalReceived();
9049 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
9050 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9051 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
9052 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9053 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9057 int UtcDaliAnimationAnimateToActorColorBlueP(void)
9059 TestApplication application;
9061 Actor actor = Actor::New();
9062 application.GetScene().Add(actor);
9063 float startValue(1.0f);
9064 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
9065 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9066 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9067 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9068 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9069 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9070 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9071 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9072 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9074 // Build the animation
9075 float durationSeconds(1.0f);
9076 Animation animation = Animation::New(durationSeconds);
9077 float targetBlue(0.5f);
9078 animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
9080 float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
9082 // Start the animation
9085 // Target value should be retrievable straight away
9086 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
9087 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
9089 bool signalReceived(false);
9090 AnimationFinishCheck finishCheck(signalReceived);
9091 animation.FinishedSignal().Connect(&application, finishCheck);
9093 application.SendNotification();
9094 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
9096 // We didn't expect the animation to finish yet
9097 application.SendNotification();
9098 finishCheck.CheckSignalNotReceived();
9099 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
9100 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9101 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9102 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
9103 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9105 application.SendNotification();
9106 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9108 // We did expect the animation to finish
9109 application.SendNotification();
9110 finishCheck.CheckSignalReceived();
9111 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
9112 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9113 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9114 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
9115 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9119 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
9121 TestApplication application;
9123 Actor actor = Actor::New();
9124 application.GetScene().Add(actor);
9125 float startValue(1.0f);
9126 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9127 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9128 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9129 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9130 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9131 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9132 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9133 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9134 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9136 // Build the animation
9137 float durationSeconds(1.0f);
9138 Animation animation = Animation::New(durationSeconds);
9139 float targetAlpha(0.5f);
9140 animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
9142 float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
9144 // Start the animation
9147 // Target value should be retrievable straight away
9148 DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
9149 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
9150 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
9152 bool signalReceived(false);
9153 AnimationFinishCheck finishCheck(signalReceived);
9154 animation.FinishedSignal().Connect(&application, finishCheck);
9156 application.SendNotification();
9157 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
9159 // We didn't expect the animation to finish yet
9160 application.SendNotification();
9161 finishCheck.CheckSignalNotReceived();
9162 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
9163 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9164 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9165 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9166 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
9168 application.SendNotification();
9169 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
9171 // We did expect the animation to finish
9172 application.SendNotification();
9173 finishCheck.CheckSignalReceived();
9174 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
9175 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9176 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9177 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9178 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
9182 int UtcDaliAnimationKeyFrames01P(void)
9184 TestApplication application;
9186 KeyFrames keyFrames = KeyFrames::New();
9187 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9189 keyFrames.Add(0.0f, 0.1f);
9191 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9193 KeyFrames keyFrames2(keyFrames);
9194 DALI_TEST_CHECK(keyFrames2);
9195 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
9197 KeyFrames keyFrames3 = KeyFrames::New();
9198 keyFrames3.Add(0.6f, true);
9199 DALI_TEST_CHECK(keyFrames3);
9200 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
9202 keyFrames3 = keyFrames;
9203 DALI_TEST_CHECK(keyFrames3);
9204 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
9209 int UtcDaliAnimationKeyFrames02N(void)
9211 TestApplication application;
9213 KeyFrames keyFrames = KeyFrames::New();
9214 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9216 keyFrames.Add(0.0f, 0.1f);
9217 keyFrames.Add(0.2f, 0.5f);
9218 keyFrames.Add(0.4f, 0.0f);
9219 keyFrames.Add(0.6f, 1.0f);
9220 keyFrames.Add(0.8f, 0.7f);
9221 keyFrames.Add(1.0f, 0.9f);
9223 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
9225 DALI_TEST_ASSERTION(
9227 keyFrames.Add(1.9f, false);
9229 "mType == value.GetType()");
9234 int UtcDaliAnimationKeyFrames03N(void)
9236 TestApplication application;
9238 KeyFrames keyFrames = KeyFrames::New();
9239 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9241 keyFrames.Add(0.0f, true);
9242 keyFrames.Add(0.2f, false);
9243 keyFrames.Add(0.4f, false);
9244 keyFrames.Add(0.6f, true);
9245 keyFrames.Add(0.8f, true);
9246 keyFrames.Add(1.0f, false);
9248 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
9250 DALI_TEST_ASSERTION(
9252 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9254 "mType == value.GetType()");
9259 int UtcDaliAnimationKeyFrames04N(void)
9261 TestApplication application;
9263 KeyFrames keyFrames = KeyFrames::New();
9264 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9266 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
9267 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
9268 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
9269 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
9270 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
9271 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
9273 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
9275 DALI_TEST_ASSERTION(
9277 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
9279 "mType == value.GetType()");
9284 int UtcDaliAnimationKeyFrames05N(void)
9286 TestApplication application;
9288 KeyFrames keyFrames = KeyFrames::New();
9289 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9291 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
9292 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
9293 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
9294 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
9295 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
9296 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
9298 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
9300 DALI_TEST_ASSERTION(
9302 keyFrames.Add(0.7f, 1.0f);
9304 "mType == value.GetType()");
9309 int UtcDaliAnimationKeyFrames06N(void)
9311 TestApplication application;
9313 KeyFrames keyFrames = KeyFrames::New();
9314 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9316 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
9317 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9318 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
9319 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
9320 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
9321 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
9323 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
9325 DALI_TEST_ASSERTION(
9327 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9329 "mType == value.GetType()");
9334 int UtcDaliAnimationKeyFrames07N(void)
9336 TestApplication application;
9338 KeyFrames keyFrames = KeyFrames::New();
9339 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9341 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9342 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9343 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9344 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9345 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9346 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9348 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9350 DALI_TEST_ASSERTION(
9352 keyFrames.Add(0.7f, 1.1f);
9354 "mType == value.GetType()");
9359 int UtcDaliAnimationKeyFramesGetKeyFrameCountP(void)
9361 TestApplication application;
9363 KeyFrames keyFrames = KeyFrames::New();
9365 DALI_TEST_EQUALS(DevelKeyFrames::GetKeyFrameCount(keyFrames), 0, TEST_LOCATION);
9367 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9368 keyFrames.Add(0.6f, Vector4(0.0f, 0.0f, 0.0f, 0.3f));
9369 keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9371 DALI_TEST_EQUALS(DevelKeyFrames::GetKeyFrameCount(keyFrames), 3, TEST_LOCATION);
9376 int UtcDaliAnimationKeyFramesGetKeyFrameP(void)
9378 TestApplication application;
9380 float inputTime = 0.6f;
9381 Vector4 inputValue = Vector4(0.0f, 0.0f, 0.0f, 0.3f);
9384 Property::Value outputValue;
9385 KeyFrames keyFrames = KeyFrames::New();
9387 DevelKeyFrames::GetKeyFrame(keyFrames, 0, outputTime, outputValue);
9389 DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9391 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9392 keyFrames.Add(inputTime, inputValue);
9393 keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9395 DevelKeyFrames::GetKeyFrame(keyFrames, 3, outputTime, outputValue);
9397 DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9399 DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9401 DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9402 DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9403 DALI_TEST_EQUALS(outputValue.Get<Vector4>(), inputValue, TEST_LOCATION);
9408 int UtcDaliAnimationKeyFramesSetKeyFrameP(void)
9410 TestApplication application;
9412 float inputTime = 0.6f;
9413 Vector4 inputValue = Vector4(0.0f, 0.0f, 0.0f, 0.3f);
9415 KeyFrames keyFrames = KeyFrames::New();
9416 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
9417 keyFrames.Add(inputTime, inputValue);
9418 keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
9421 Property::Value outputValue;
9423 DevelKeyFrames::GetKeyFrame(keyFrames, 3, outputTime, outputValue);
9425 DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
9427 DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9429 DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9430 DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9431 DALI_TEST_EQUALS(outputValue.Get<Vector4>(), inputValue, TEST_LOCATION);
9433 Vector4 newValue = Vector4(1.0f, 0.2f, 0.6f, 0.9f);
9435 DevelKeyFrames::SetKeyFrameValue(keyFrames, 1, newValue);
9437 DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9439 DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9440 DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9441 DALI_TEST_EQUALS(outputValue.Get<Vector4>(), newValue, TEST_LOCATION);
9443 Vector3 newUnmatchedValue = Vector3(0.0f, 1.0f, 0.2f);
9445 // Check nothing happened if we set unmatched value type.
9446 DevelKeyFrames::SetKeyFrameValue(keyFrames, 1, newUnmatchedValue);
9448 DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
9450 DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
9451 DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
9452 DALI_TEST_EQUALS(outputValue.Get<Vector4>(), newValue, TEST_LOCATION);
9457 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9459 TestApplication application;
9461 float startValue(1.0f);
9462 Actor actor = Actor::New();
9463 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9464 application.GetScene().Add(actor);
9466 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9467 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9468 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9469 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9470 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9471 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9472 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9473 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9474 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9476 // Build the animation
9477 float durationSeconds(1.0f);
9478 Animation animation = Animation::New(durationSeconds);
9480 KeyFrames keyFrames = KeyFrames::New();
9481 keyFrames.Add(0.0f, 0.1f);
9482 keyFrames.Add(0.2f, 0.5f);
9483 keyFrames.Add(0.4f, 0.0f);
9484 keyFrames.Add(0.6f, 1.0f);
9485 keyFrames.Add(0.8f, 0.7f);
9486 keyFrames.Add(1.0f, 0.9f);
9488 animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
9490 // Start the animation
9493 // Final key frame value should be retrievable straight away
9494 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
9496 bool signalReceived(false);
9497 AnimationFinishCheck finishCheck(signalReceived);
9498 animation.FinishedSignal().Connect(&application, finishCheck);
9499 application.SendNotification();
9500 application.Render(0);
9501 application.SendNotification();
9502 finishCheck.CheckSignalNotReceived();
9503 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9505 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9506 application.SendNotification();
9507 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9508 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9509 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9510 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION);
9511 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
9513 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9514 application.SendNotification();
9515 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9516 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9517 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9518 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION);
9519 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
9521 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9522 application.SendNotification();
9523 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9524 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9525 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9526 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9527 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9529 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9530 application.SendNotification();
9531 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9532 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9533 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9534 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9535 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9537 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9538 application.SendNotification();
9539 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9540 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9541 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9542 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
9543 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
9545 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9546 application.SendNotification();
9547 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9548 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9549 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9550 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9551 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9553 // We did expect the animation to finish
9555 finishCheck.CheckSignalReceived();
9559 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9561 TestApplication application;
9563 float startValue(1.0f);
9564 Actor actor = Actor::New();
9565 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9566 application.GetScene().Add(actor);
9568 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9569 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9570 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9571 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9572 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9573 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9574 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9575 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9576 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9578 // Build the animation
9579 float durationSeconds(1.0f);
9580 Animation animation = Animation::New(durationSeconds);
9582 KeyFrames keyFrames = KeyFrames::New();
9583 keyFrames.Add(0.0f, 0.1f);
9584 keyFrames.Add(0.2f, 0.5f);
9585 keyFrames.Add(0.4f, 0.0f);
9586 keyFrames.Add(0.6f, 1.0f);
9587 keyFrames.Add(0.8f, 0.7f);
9588 keyFrames.Add(1.0f, 0.9f);
9590 animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
9592 // Start the animation
9595 bool signalReceived(false);
9596 AnimationFinishCheck finishCheck(signalReceived);
9597 animation.FinishedSignal().Connect(&application, finishCheck);
9598 application.SendNotification();
9599 application.Render(0);
9600 application.SendNotification();
9601 finishCheck.CheckSignalNotReceived();
9602 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
9604 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
9605 application.SendNotification();
9606 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9607 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9608 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9609 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
9610 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
9612 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
9613 application.SendNotification();
9614 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9615 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9616 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9617 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
9618 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
9620 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
9621 application.SendNotification();
9622 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9623 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9624 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9625 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
9626 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
9628 application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
9629 application.SendNotification();
9630 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9631 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9632 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9633 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
9634 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
9636 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
9637 application.SendNotification();
9638 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9639 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9640 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9641 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION);
9642 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
9644 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
9645 application.SendNotification();
9646 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9647 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9648 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9649 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
9650 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
9652 // We did expect the animation to finish
9654 finishCheck.CheckSignalReceived();
9658 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9660 TestApplication application;
9662 float startValue(1.0f);
9663 Actor actor = Actor::New();
9664 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9665 application.GetScene().Add(actor);
9667 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9668 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9669 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9670 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9671 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9672 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9673 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9674 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9675 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9677 // Build the animation
9678 float durationSeconds(1.0f);
9679 Animation animation = Animation::New(durationSeconds);
9681 KeyFrames keyFrames = KeyFrames::New();
9682 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9683 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9684 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9686 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
9688 // Start the animation
9691 bool signalReceived(false);
9692 AnimationFinishCheck finishCheck(signalReceived);
9693 animation.FinishedSignal().Connect(&application, finishCheck);
9694 application.SendNotification();
9695 application.Render(0);
9696 application.SendNotification();
9697 finishCheck.CheckSignalNotReceived();
9698 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9699 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9700 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9701 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9703 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9704 application.SendNotification();
9705 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
9706 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
9707 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
9708 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
9710 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9711 application.SendNotification();
9712 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9713 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9714 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9715 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9717 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9718 application.SendNotification();
9719 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
9720 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
9721 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
9722 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
9724 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9725 application.SendNotification();
9726 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9727 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9728 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9729 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9731 // We did expect the animation to finish
9733 finishCheck.CheckSignalReceived();
9737 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9739 TestApplication application;
9741 float startValue(1.0f);
9742 Actor actor = Actor::New();
9743 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
9744 application.GetScene().Add(actor);
9746 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
9747 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9748 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9749 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9750 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9751 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
9752 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
9753 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
9754 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
9756 // Build the animation
9757 float durationSeconds(1.0f);
9758 Animation animation = Animation::New(durationSeconds);
9760 KeyFrames keyFrames = KeyFrames::New();
9761 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9762 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9763 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9765 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
9767 // Start the animation
9770 bool signalReceived(false);
9771 AnimationFinishCheck finishCheck(signalReceived);
9772 animation.FinishedSignal().Connect(&application, finishCheck);
9773 application.SendNotification();
9774 application.Render(0);
9775 application.SendNotification();
9776 finishCheck.CheckSignalNotReceived();
9777 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
9778 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
9779 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
9780 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
9782 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9783 application.SendNotification();
9784 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
9785 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
9786 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
9787 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
9789 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
9790 application.SendNotification();
9791 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
9792 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
9793 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
9794 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
9796 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
9797 application.SendNotification();
9798 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
9799 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
9800 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
9801 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
9803 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
9804 application.SendNotification();
9805 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
9806 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
9807 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
9808 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
9810 // We did expect the animation to finish
9812 finishCheck.CheckSignalReceived();
9816 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9818 TestApplication application;
9820 Actor actor = Actor::New();
9821 AngleAxis aa(Degree(90), Vector3::XAXIS);
9822 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9823 application.GetScene().Add(actor);
9825 application.SendNotification();
9826 application.Render(0);
9828 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9830 // Build the animation
9831 float durationSeconds(1.0f);
9832 Animation animation = Animation::New(durationSeconds);
9834 KeyFrames keyFrames = KeyFrames::New();
9835 keyFrames.Add(0.0f, false);
9836 keyFrames.Add(0.2f, true);
9837 keyFrames.Add(0.4f, true);
9838 keyFrames.Add(0.8f, false);
9839 keyFrames.Add(1.0f, true);
9841 animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
9843 // Start the animation
9846 // Final key frame value should be retrievable straight away
9847 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9849 bool signalReceived(false);
9850 AnimationFinishCheck finishCheck(signalReceived);
9851 animation.FinishedSignal().Connect(&application, finishCheck);
9852 application.SendNotification();
9853 application.SendNotification();
9854 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9855 application.SendNotification();
9856 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9857 application.SendNotification();
9859 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9860 finishCheck.CheckSignalReceived();
9864 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9866 TestApplication application;
9868 Actor actor = Actor::New();
9869 AngleAxis aa(Degree(90), Vector3::XAXIS);
9870 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9871 application.GetScene().Add(actor);
9873 application.SendNotification();
9874 application.Render(0);
9876 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9878 // Build the animation
9879 float durationSeconds(1.0f);
9880 Animation animation = Animation::New(durationSeconds);
9882 KeyFrames keyFrames = KeyFrames::New();
9883 keyFrames.Add(0.0f, false);
9884 keyFrames.Add(0.2f, true);
9885 keyFrames.Add(0.4f, true);
9886 keyFrames.Add(0.8f, false);
9887 keyFrames.Add(1.0f, true);
9889 //Cubic interpolation for boolean values should be ignored
9890 animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
9892 // Start the animation
9895 bool signalReceived(false);
9896 AnimationFinishCheck finishCheck(signalReceived);
9897 animation.FinishedSignal().Connect(&application, finishCheck);
9898 application.SendNotification();
9899 application.SendNotification();
9900 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9901 application.SendNotification();
9902 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9903 application.SendNotification();
9905 DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
9906 finishCheck.CheckSignalReceived();
9910 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9912 TestApplication application;
9914 Actor actor = Actor::New();
9915 AngleAxis aa(Degree(90), Vector3::XAXIS);
9916 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9917 application.GetScene().Add(actor);
9919 application.SendNotification();
9920 application.Render(0);
9921 Quaternion start(Radian(aa.angle), aa.axis);
9922 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9924 // Build the animation
9925 float durationSeconds(1.0f);
9926 Animation animation = Animation::New(durationSeconds);
9928 KeyFrames keyFrames = KeyFrames::New();
9929 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9931 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9933 // Start the animation
9936 // Final key frame value should be retrievable straight away
9937 DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
9939 bool signalReceived(false);
9940 AnimationFinishCheck finishCheck(signalReceived);
9941 animation.FinishedSignal().Connect(&application, finishCheck);
9942 application.SendNotification();
9943 application.SendNotification();
9944 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
9945 application.SendNotification();
9946 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
9947 application.SendNotification();
9949 Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
9951 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9952 finishCheck.CheckSignalReceived();
9956 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9958 TestApplication application;
9960 Actor actor = Actor::New();
9961 AngleAxis aa(Degree(90), Vector3::XAXIS);
9962 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
9963 application.SendNotification();
9964 application.Render(0);
9965 application.GetScene().Add(actor);
9967 Quaternion start(Radian(aa.angle), aa.axis);
9968 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
9970 // Build the animation
9971 float durationSeconds(1.0f);
9972 Animation animation = Animation::New(durationSeconds);
9974 KeyFrames keyFrames = KeyFrames::New();
9975 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9976 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9977 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9979 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
9981 // Start the animation
9984 bool signalReceived(false);
9985 AnimationFinishCheck finishCheck(signalReceived);
9986 animation.FinishedSignal().Connect(&application, finishCheck);
9987 application.SendNotification();
9988 application.Render(0);
9989 application.SendNotification();
9990 finishCheck.CheckSignalNotReceived();
9992 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9993 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
9995 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
9996 application.SendNotification();
9997 check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
9998 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10000 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10001 application.SendNotification();
10002 check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
10003 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10005 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10006 application.SendNotification();
10007 check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
10008 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10010 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10011 application.SendNotification();
10012 check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
10013 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10015 // We did expect the animation to finish
10017 finishCheck.CheckSignalReceived();
10021 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
10023 TestApplication application;
10025 Actor actor = Actor::New();
10026 AngleAxis aa(Degree(90), Vector3::XAXIS);
10027 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
10028 application.GetScene().Add(actor);
10030 application.SendNotification();
10031 application.Render(0);
10032 Quaternion start(Radian(aa.angle), aa.axis);
10033 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
10035 // Build the animation
10036 float durationSeconds(1.0f);
10037 Animation animation = Animation::New(durationSeconds);
10039 KeyFrames keyFrames = KeyFrames::New();
10040 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
10042 //Cubic interpolation should be ignored for quaternions
10043 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
10045 // Start the animation
10048 bool signalReceived(false);
10049 AnimationFinishCheck finishCheck(signalReceived);
10050 animation.FinishedSignal().Connect(&application, finishCheck);
10051 application.SendNotification();
10052 application.SendNotification();
10053 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
10054 application.SendNotification();
10055 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
10056 application.SendNotification();
10058 Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
10060 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10061 finishCheck.CheckSignalReceived();
10065 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
10067 TestApplication application;
10069 Actor actor = Actor::New();
10070 AngleAxis aa(Degree(90), Vector3::XAXIS);
10071 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
10072 application.SendNotification();
10073 application.Render(0);
10074 application.GetScene().Add(actor);
10076 Quaternion start(Radian(aa.angle), aa.axis);
10077 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
10079 // Build the animation
10080 float durationSeconds(1.0f);
10081 Animation animation = Animation::New(durationSeconds);
10083 KeyFrames keyFrames = KeyFrames::New();
10084 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
10085 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
10086 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
10088 //Cubic interpolation should be ignored for quaternions
10089 animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
10091 // Start the animation
10094 bool signalReceived(false);
10095 AnimationFinishCheck finishCheck(signalReceived);
10096 animation.FinishedSignal().Connect(&application, finishCheck);
10097 application.SendNotification();
10098 application.Render(0);
10099 application.SendNotification();
10100 finishCheck.CheckSignalNotReceived();
10102 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
10103 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10105 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10106 application.SendNotification();
10107 check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
10108 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10110 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10111 application.SendNotification();
10112 check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
10113 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10115 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10116 application.SendNotification();
10117 check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
10118 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10120 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10121 application.SendNotification();
10122 check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
10123 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
10125 // We did expect the animation to finish
10127 finishCheck.CheckSignalReceived();
10131 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
10133 TestApplication application;
10135 float startValue(1.0f);
10136 Actor actor = Actor::New();
10137 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10138 application.GetScene().Add(actor);
10140 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10141 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10142 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10143 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10144 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10145 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10146 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10147 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10148 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10150 // Build the animation
10151 float durationSeconds(1.0f);
10152 Animation animation = Animation::New(durationSeconds);
10154 KeyFrames keyFrames = KeyFrames::New();
10155 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10156 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10157 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10159 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
10161 // Start the animation
10164 bool signalReceived(false);
10165 AnimationFinishCheck finishCheck(signalReceived);
10166 animation.FinishedSignal().Connect(&application, finishCheck);
10167 application.SendNotification();
10168 application.Render(0);
10169 application.SendNotification();
10170 finishCheck.CheckSignalNotReceived();
10171 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10172 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10173 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10174 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10176 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10177 application.SendNotification();
10178 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10179 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10180 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10181 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10183 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10184 application.SendNotification();
10185 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10186 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10187 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10188 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10190 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10191 application.SendNotification();
10192 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10193 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10194 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10195 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10197 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10198 application.SendNotification();
10199 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10200 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10201 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10202 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10204 // We did expect the animation to finish
10206 finishCheck.CheckSignalReceived();
10210 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
10212 TestApplication application;
10214 float startValue(1.0f);
10215 Actor actor = Actor::New();
10216 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10217 application.GetScene().Add(actor);
10219 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10220 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10221 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10222 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10223 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10224 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10225 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10226 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10227 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10229 // Build the animation
10230 float durationSeconds(1.0f);
10231 Animation animation = Animation::New(durationSeconds);
10233 KeyFrames keyFrames = KeyFrames::New();
10234 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10235 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10236 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10238 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
10240 // Start the animation
10243 bool signalReceived(false);
10244 AnimationFinishCheck finishCheck(signalReceived);
10245 animation.FinishedSignal().Connect(&application, finishCheck);
10246 application.SendNotification();
10247 application.Render(0);
10248 application.SendNotification();
10249 finishCheck.CheckSignalNotReceived();
10250 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10251 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10252 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10253 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10255 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10256 application.SendNotification();
10257 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10258 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10259 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10260 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10262 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10263 application.SendNotification();
10264 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10265 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10266 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10267 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10269 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10270 application.SendNotification();
10271 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10272 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10273 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10274 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10276 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10277 application.SendNotification();
10278 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10279 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10280 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10281 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10283 // We did expect the animation to finish
10285 finishCheck.CheckSignalReceived();
10289 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
10291 TestApplication application;
10293 float startValue(1.0f);
10294 Actor actor = Actor::New();
10295 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10296 application.GetScene().Add(actor);
10298 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10299 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10300 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10301 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10302 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10303 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10304 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10305 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10306 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10308 // Build the animation
10309 float durationSeconds(1.0f);
10310 float delay = 0.5f;
10311 Animation animation = Animation::New(durationSeconds);
10313 KeyFrames keyFrames = KeyFrames::New();
10314 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10315 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10316 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10318 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay));
10320 // Start the animation
10323 bool signalReceived(false);
10324 AnimationFinishCheck finishCheck(signalReceived);
10325 animation.FinishedSignal().Connect(&application, finishCheck);
10326 application.SendNotification();
10328 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10329 application.SendNotification();
10330 finishCheck.CheckSignalNotReceived();
10331 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10332 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10333 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10334 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10336 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10337 application.SendNotification();
10338 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10339 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10340 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10341 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10343 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10344 application.SendNotification();
10345 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10346 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10347 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10348 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10350 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10351 application.SendNotification();
10352 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10353 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10354 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10355 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10357 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10358 application.SendNotification();
10359 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10360 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10361 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10362 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10364 // We did expect the animation to finish
10366 finishCheck.CheckSignalReceived();
10370 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
10372 TestApplication application;
10374 float startValue(1.0f);
10375 Actor actor = Actor::New();
10376 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10377 application.GetScene().Add(actor);
10379 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10380 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10381 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10382 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10383 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10384 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10385 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10386 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10387 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10389 // Build the animation
10390 float durationSeconds(1.0f);
10391 float delay = 0.5f;
10392 Animation animation = Animation::New(durationSeconds);
10394 KeyFrames keyFrames = KeyFrames::New();
10395 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10396 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10397 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10399 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10401 // Start the animation
10404 bool signalReceived(false);
10405 AnimationFinishCheck finishCheck(signalReceived);
10406 animation.FinishedSignal().Connect(&application, finishCheck);
10407 application.SendNotification();
10409 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10410 application.SendNotification();
10411 finishCheck.CheckSignalNotReceived();
10412 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10413 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10414 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10415 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10417 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10418 application.SendNotification();
10419 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10420 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10421 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10422 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10424 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10425 application.SendNotification();
10426 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10427 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10428 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10429 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10431 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10432 application.SendNotification();
10433 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10434 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10435 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10436 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10438 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10439 application.SendNotification();
10440 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10441 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10442 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10443 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10445 // We did expect the animation to finish
10447 finishCheck.CheckSignalReceived();
10451 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10453 TestApplication application;
10455 float startValue(1.0f);
10456 float delay = 0.5f;
10457 Actor actor = Actor::New();
10458 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10459 application.GetScene().Add(actor);
10461 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10462 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10463 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10464 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10465 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10466 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10467 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10468 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10469 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10471 // Build the animation
10472 float durationSeconds(1.0f);
10473 Animation animation = Animation::New(durationSeconds);
10475 KeyFrames keyFrames = KeyFrames::New();
10476 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10477 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10478 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10480 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
10482 // Start the animation
10485 bool signalReceived(false);
10486 AnimationFinishCheck finishCheck(signalReceived);
10487 animation.FinishedSignal().Connect(&application, finishCheck);
10488 application.SendNotification();
10490 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10491 application.SendNotification();
10492 finishCheck.CheckSignalNotReceived();
10493 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10494 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10495 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10496 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10498 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10499 application.SendNotification();
10500 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
10501 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
10502 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
10503 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
10505 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10506 application.SendNotification();
10507 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10508 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10509 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10510 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10512 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10513 application.SendNotification();
10514 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
10515 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
10516 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
10517 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
10519 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10520 application.SendNotification();
10521 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10522 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10523 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10524 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10526 // We did expect the animation to finish
10528 finishCheck.CheckSignalReceived();
10532 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10534 TestApplication application;
10536 float startValue(1.0f);
10537 Actor actor = Actor::New();
10538 actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
10539 application.GetScene().Add(actor);
10541 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
10542 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10543 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10544 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10545 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10546 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
10547 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
10548 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
10549 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
10551 // Build the animation
10552 float durationSeconds(1.0f);
10553 float delay = 0.5f;
10554 Animation animation = Animation::New(durationSeconds);
10556 KeyFrames keyFrames = KeyFrames::New();
10557 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10558 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10559 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10561 animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
10563 // Start the animation
10566 bool signalReceived(false);
10567 AnimationFinishCheck finishCheck(signalReceived);
10568 animation.FinishedSignal().Connect(&application, finishCheck);
10569 application.SendNotification();
10571 application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
10572 application.SendNotification();
10573 finishCheck.CheckSignalNotReceived();
10574 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
10575 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
10576 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
10577 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
10579 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
10580 application.SendNotification();
10581 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
10582 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
10583 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
10584 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
10586 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
10587 application.SendNotification();
10588 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
10589 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
10590 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
10591 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
10593 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
10594 application.SendNotification();
10595 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
10596 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
10597 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
10598 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
10600 application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
10601 application.SendNotification();
10602 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
10603 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
10604 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
10605 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
10607 // We did expect the animation to finish
10609 finishCheck.CheckSignalReceived();
10613 int UtcDaliAnimationAnimateP(void)
10615 TestApplication application;
10617 Actor actor = Actor::New();
10618 application.GetScene().Add(actor);
10621 Vector3 position0(30.0, 80.0, 0.0);
10622 Vector3 position1(70.0, 120.0, 0.0);
10623 Vector3 position2(100.0, 100.0, 0.0);
10625 Dali::Path path = Dali::Path::New();
10626 path.AddPoint(position0);
10627 path.AddPoint(position1);
10628 path.AddPoint(position2);
10630 //Control points for first segment
10631 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10632 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10634 //Control points for second segment
10635 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10636 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10638 // Build the animation
10639 float durationSeconds(1.0f);
10640 Animation animation = Animation::New(durationSeconds);
10641 animation.Animate(actor, path, Vector3::XAXIS);
10643 // Start the animation
10646 bool signalReceived(false);
10647 AnimationFinishCheck finishCheck(signalReceived);
10648 animation.FinishedSignal().Connect(&application, finishCheck);
10649 application.SendNotification();
10650 application.Render(0);
10651 application.SendNotification();
10652 finishCheck.CheckSignalNotReceived();
10653 Vector3 position, tangent;
10654 Quaternion rotation;
10655 path.Sample(0.0f, position, tangent);
10656 rotation = Quaternion(Vector3::XAXIS, tangent);
10657 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10658 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10660 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10661 application.SendNotification();
10662 path.Sample(0.25f, position, tangent);
10663 rotation = Quaternion(Vector3::XAXIS, tangent);
10664 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10665 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10667 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10668 application.SendNotification();
10669 path.Sample(0.5f, position, tangent);
10670 rotation = Quaternion(Vector3::XAXIS, tangent);
10671 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10672 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10674 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10675 application.SendNotification();
10676 path.Sample(0.75f, position, tangent);
10677 rotation = Quaternion(Vector3::XAXIS, tangent);
10678 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10679 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10681 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10682 application.SendNotification();
10683 path.Sample(1.0f, position, tangent);
10684 rotation = Quaternion(Vector3::XAXIS, tangent);
10685 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10686 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10688 finishCheck.CheckSignalReceived();
10692 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10694 TestApplication application;
10696 Actor actor = Actor::New();
10697 application.GetScene().Add(actor);
10700 Vector3 position0(30.0, 80.0, 0.0);
10701 Vector3 position1(70.0, 120.0, 0.0);
10702 Vector3 position2(100.0, 100.0, 0.0);
10704 Dali::Path path = Dali::Path::New();
10705 path.AddPoint(position0);
10706 path.AddPoint(position1);
10707 path.AddPoint(position2);
10709 //Control points for first segment
10710 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10711 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10713 //Control points for second segment
10714 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10715 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10717 // Build the animation
10718 float durationSeconds(1.0f);
10719 Animation animation = Animation::New(durationSeconds);
10720 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10722 // Start the animation
10725 bool signalReceived(false);
10726 AnimationFinishCheck finishCheck(signalReceived);
10727 animation.FinishedSignal().Connect(&application, finishCheck);
10728 application.SendNotification();
10729 application.Render(0);
10730 application.SendNotification();
10731 finishCheck.CheckSignalNotReceived();
10732 Vector3 position, tangent;
10733 Quaternion rotation;
10734 path.Sample(0.0f, position, tangent);
10735 rotation = Quaternion(Vector3::XAXIS, tangent);
10736 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10737 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10739 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10740 application.SendNotification();
10741 path.Sample(0.25f, position, tangent);
10742 rotation = Quaternion(Vector3::XAXIS, tangent);
10743 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10744 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10746 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10747 application.SendNotification();
10748 path.Sample(0.5f, position, tangent);
10749 rotation = Quaternion(Vector3::XAXIS, tangent);
10750 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10751 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10753 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10754 application.SendNotification();
10755 path.Sample(0.75f, position, tangent);
10756 rotation = Quaternion(Vector3::XAXIS, tangent);
10757 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10758 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10760 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10761 application.SendNotification();
10762 path.Sample(1.0f, position, tangent);
10763 rotation = Quaternion(Vector3::XAXIS, tangent);
10764 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10765 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10767 finishCheck.CheckSignalReceived();
10771 int UtcDaliAnimationAnimateTimePeriodP(void)
10773 TestApplication application;
10775 Actor actor = Actor::New();
10776 application.GetScene().Add(actor);
10779 Vector3 position0(30.0, 80.0, 0.0);
10780 Vector3 position1(70.0, 120.0, 0.0);
10781 Vector3 position2(100.0, 100.0, 0.0);
10783 Dali::Path path = Dali::Path::New();
10784 path.AddPoint(position0);
10785 path.AddPoint(position1);
10786 path.AddPoint(position2);
10788 //Control points for first segment
10789 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10790 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10792 //Control points for second segment
10793 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10794 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10796 // Build the animation
10797 float durationSeconds(1.0f);
10798 Animation animation = Animation::New(durationSeconds);
10799 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10801 // Start the animation
10804 bool signalReceived(false);
10805 AnimationFinishCheck finishCheck(signalReceived);
10806 animation.FinishedSignal().Connect(&application, finishCheck);
10807 application.SendNotification();
10808 application.Render(0);
10809 application.SendNotification();
10810 finishCheck.CheckSignalNotReceived();
10811 Vector3 position, tangent;
10812 Quaternion rotation;
10813 path.Sample(0.0f, position, tangent);
10814 rotation = Quaternion(Vector3::XAXIS, tangent);
10815 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10816 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10818 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10819 application.SendNotification();
10820 path.Sample(0.25f, position, tangent);
10821 rotation = Quaternion(Vector3::XAXIS, tangent);
10822 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10823 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10825 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10826 application.SendNotification();
10827 path.Sample(0.5f, position, tangent);
10828 rotation = Quaternion(Vector3::XAXIS, tangent);
10829 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10830 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10832 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10833 application.SendNotification();
10834 path.Sample(0.75f, position, tangent);
10835 rotation = Quaternion(Vector3::XAXIS, tangent);
10836 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10837 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10839 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10840 application.SendNotification();
10841 path.Sample(1.0f, position, tangent);
10842 rotation = Quaternion(Vector3::XAXIS, tangent);
10843 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10844 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10846 finishCheck.CheckSignalReceived();
10850 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10852 TestApplication application;
10854 Actor actor = Actor::New();
10855 application.GetScene().Add(actor);
10858 Vector3 position0(30.0, 80.0, 0.0);
10859 Vector3 position1(70.0, 120.0, 0.0);
10860 Vector3 position2(100.0, 100.0, 0.0);
10862 Dali::Path path = Dali::Path::New();
10863 path.AddPoint(position0);
10864 path.AddPoint(position1);
10865 path.AddPoint(position2);
10867 //Control points for first segment
10868 path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
10869 path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
10871 //Control points for second segment
10872 path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
10873 path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
10875 // Build the animation
10876 float durationSeconds(1.0f);
10877 Animation animation = Animation::New(durationSeconds);
10878 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10880 // Start the animation
10883 bool signalReceived(false);
10884 AnimationFinishCheck finishCheck(signalReceived);
10885 animation.FinishedSignal().Connect(&application, finishCheck);
10886 application.SendNotification();
10887 application.Render(0);
10888 application.SendNotification();
10889 finishCheck.CheckSignalNotReceived();
10890 Vector3 position, tangent;
10891 Quaternion rotation;
10892 path.Sample(0.0f, position, tangent);
10893 rotation = Quaternion(Vector3::XAXIS, tangent);
10894 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10895 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10897 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
10898 application.SendNotification();
10899 path.Sample(0.25f, position, tangent);
10900 rotation = Quaternion(Vector3::XAXIS, tangent);
10901 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10902 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10904 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
10905 application.SendNotification();
10906 path.Sample(0.5f, position, tangent);
10907 rotation = Quaternion(Vector3::XAXIS, tangent);
10908 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10909 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10911 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
10912 application.SendNotification();
10913 path.Sample(0.75f, position, tangent);
10914 rotation = Quaternion(Vector3::XAXIS, tangent);
10915 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10916 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10918 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
10919 application.SendNotification();
10920 path.Sample(1.0f, position, tangent);
10921 rotation = Quaternion(Vector3::XAXIS, tangent);
10922 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
10923 DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
10925 finishCheck.CheckSignalReceived();
10929 int UtcDaliAnimationShowP(void)
10931 TestApplication application;
10933 Actor actor = Actor::New();
10934 actor.SetProperty(Actor::Property::VISIBLE, false);
10935 application.SendNotification();
10936 application.Render(0);
10937 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10938 application.GetScene().Add(actor);
10940 // Start the animation
10941 float durationSeconds(10.0f);
10942 Animation animation = Animation::New(durationSeconds);
10943 animation.Show(actor, durationSeconds * 0.5f);
10946 bool signalReceived(false);
10947 AnimationFinishCheck finishCheck(signalReceived);
10948 animation.FinishedSignal().Connect(&application, finishCheck);
10950 application.SendNotification();
10951 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10953 // We didn't expect the animation to finish yet
10954 application.SendNotification();
10955 finishCheck.CheckSignalNotReceived();
10956 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10958 application.SendNotification();
10959 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
10961 // We didn't expect the animation to finish yet
10962 application.SendNotification();
10963 finishCheck.CheckSignalNotReceived();
10964 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10966 application.SendNotification();
10967 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
10969 // We did expect the animation to finish
10970 application.SendNotification();
10971 finishCheck.CheckSignalReceived();
10972 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10976 int UtcDaliAnimationHideP(void)
10978 TestApplication application;
10980 Actor actor = Actor::New();
10981 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
10982 application.GetScene().Add(actor);
10984 // Start the animation
10985 float durationSeconds(10.0f);
10986 Animation animation = Animation::New(durationSeconds);
10987 animation.Hide(actor, durationSeconds * 0.5f);
10990 bool signalReceived(false);
10991 AnimationFinishCheck finishCheck(signalReceived);
10992 animation.FinishedSignal().Connect(&application, finishCheck);
10994 application.SendNotification();
10995 application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
10997 // We didn't expect the animation to finish yet
10998 application.SendNotification();
10999 finishCheck.CheckSignalNotReceived();
11000 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11002 application.SendNotification();
11003 application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
11005 // We didn't expect the animation to finish yet
11006 application.SendNotification();
11007 finishCheck.CheckSignalNotReceived();
11008 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11010 application.SendNotification();
11011 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11013 // We did expect the animation to finish
11014 application.SendNotification();
11015 finishCheck.CheckSignalReceived();
11016 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11020 int UtcDaliAnimationShowHideAtEndP(void)
11022 // Test that show/hide delay can be the same as animation duration
11023 // i.e. to show/hide at the end of the animation
11025 TestApplication application;
11027 Actor actor = Actor::New();
11028 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11029 application.GetScene().Add(actor);
11031 // Start Hide animation
11032 float durationSeconds(10.0f);
11033 Animation animation = Animation::New(durationSeconds);
11034 animation.Hide(actor, durationSeconds /*Hide at end*/);
11037 bool signalReceived(false);
11038 AnimationFinishCheck finishCheck(signalReceived);
11039 animation.FinishedSignal().Connect(&application, finishCheck);
11041 application.SendNotification();
11042 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11044 // We did expect the animation to finish
11045 application.SendNotification();
11046 finishCheck.CheckSignalReceived();
11047 DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11049 // Start Show animation
11050 animation = Animation::New(durationSeconds);
11051 animation.Show(actor, durationSeconds /*Show at end*/);
11052 animation.FinishedSignal().Connect(&application, finishCheck);
11055 application.SendNotification();
11056 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
11058 // We did expect the animation to finish
11059 application.SendNotification();
11060 finishCheck.CheckSignalReceived();
11061 DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
11065 int UtcDaliKeyFramesCreateDestroyP(void)
11067 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
11069 KeyFrames* keyFrames = new KeyFrames;
11071 DALI_TEST_CHECK(true);
11075 int UtcDaliKeyFramesDownCastP(void)
11077 TestApplication application;
11078 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
11080 KeyFrames keyFrames = KeyFrames::New();
11081 BaseHandle object(keyFrames);
11083 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
11084 DALI_TEST_CHECK(keyFrames2);
11086 KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
11087 DALI_TEST_CHECK(keyFrames3);
11089 BaseHandle unInitializedObject;
11090 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
11091 DALI_TEST_CHECK(!keyFrames4);
11093 KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
11094 DALI_TEST_CHECK(!keyFrames5);
11098 int UtcDaliAnimationCreateDestroyP(void)
11100 TestApplication application;
11101 Animation* animation = new Animation;
11102 DALI_TEST_CHECK(animation);
11107 struct UpdateManagerTestConstraint
11109 UpdateManagerTestConstraint(TestApplication& application)
11110 : mApplication(application)
11114 void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
11116 mApplication.SendNotification(); // Process events
11119 TestApplication& mApplication;
11122 int UtcDaliAnimationUpdateManagerP(void)
11124 TestApplication application;
11126 Actor actor = Actor::New();
11127 application.GetScene().Add(actor);
11129 // Build the animation
11130 Animation animation = Animation::New(0.0f);
11132 bool signalReceived = false;
11133 AnimationFinishCheck finishCheck(signalReceived);
11134 animation.FinishedSignal().Connect(&application, finishCheck);
11136 Vector3 startValue(1.0f, 1.0f, 1.0f);
11137 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11138 Constraint constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
11139 constraint.Apply();
11141 // Apply animation to actor
11142 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
11143 animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
11147 application.SendNotification();
11148 application.UpdateOnly(16);
11150 finishCheck.CheckSignalNotReceived();
11152 application.SendNotification(); // Process events
11154 finishCheck.CheckSignalReceived();
11159 int UtcDaliAnimationSignalOrderP(void)
11161 TestApplication application;
11163 Actor actor = Actor::New();
11164 application.GetScene().Add(actor);
11166 // Build the animations
11167 Animation animation1 = Animation::New(0.0f); // finishes first frame
11168 Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
11170 bool signal1Received = false;
11171 animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
11173 bool signal2Received = false;
11174 animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
11176 // Apply animations to actor
11177 animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
11179 animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
11182 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
11183 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
11185 application.SendNotification();
11186 application.UpdateOnly(10); // 10ms progress
11188 // no notifications yet
11189 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
11190 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
11192 application.SendNotification();
11195 DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
11196 DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
11197 signal1Received = false;
11199 // 1st animation is complete now, do another update with no ProcessEvents in between
11200 application.UpdateOnly(20); // 20ms progress
11203 application.SendNotification();
11205 // 2nd should complete now
11206 DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
11207 DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
11212 int UtcDaliAnimationExtendDurationP(void)
11214 TestApplication application;
11216 Actor actor = Actor::New();
11218 // Register a float property
11219 float startValue(10.0f);
11220 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11221 application.GetScene().Add(actor);
11222 DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
11223 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11225 // Build the animation
11226 float initialDurationSeconds(1.0f);
11227 float animatorDelay = 5.0f;
11228 float animatorDurationSeconds(5.0f);
11229 float extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
11230 Animation animation = Animation::New(initialDurationSeconds);
11231 float targetValue(30.0f);
11232 float relativeValue(targetValue - startValue);
11234 animation.AnimateTo(Property(actor, index),
11236 TimePeriod(animatorDelay, animatorDurationSeconds));
11238 // The duration should have been extended
11239 DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
11241 // Start the animation
11244 bool signalReceived(false);
11245 AnimationFinishCheck finishCheck(signalReceived);
11246 animation.FinishedSignal().Connect(&application, finishCheck);
11248 application.SendNotification();
11249 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
11251 // We didn't expect the animation to finish yet, but cached value should be the final one
11252 application.SendNotification();
11253 finishCheck.CheckSignalNotReceived();
11254 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11255 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
11257 application.SendNotification();
11258 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
11260 // We didn't expect the animation to finish yet
11261 application.SendNotification();
11262 finishCheck.CheckSignalNotReceived();
11263 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
11265 application.SendNotification();
11266 application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
11268 // We did expect the animation to finish
11269 application.SendNotification();
11270 finishCheck.CheckSignalReceived();
11271 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
11272 DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
11276 int UtcDaliAnimationCustomIntProperty(void)
11278 TestApplication application;
11280 Actor actor = Actor::New();
11281 application.GetScene().Add(actor);
11282 int startValue(0u);
11284 Property::Index index = actor.RegisterProperty("anIndex", startValue);
11285 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
11286 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11288 // Build the animation
11289 float durationSeconds(1.0f);
11290 Animation animation = Animation::New(durationSeconds);
11291 animation.AnimateTo(Property(actor, index), 20);
11293 // Start the animation
11296 // Target value should be retrievable straight away
11297 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11299 bool signalReceived(false);
11300 AnimationFinishCheck finishCheck(signalReceived);
11301 animation.FinishedSignal().Connect(&application, finishCheck);
11303 application.SendNotification();
11304 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
11306 // We didn't expect the animation to finish yet
11307 application.SendNotification();
11308 finishCheck.CheckSignalNotReceived();
11309 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
11311 application.SendNotification();
11312 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
11314 // We did expect the animation to finish
11315 application.SendNotification();
11316 finishCheck.CheckSignalReceived();
11317 DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
11318 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
11322 int UtcDaliAnimationDuration(void)
11324 TestApplication application;
11326 Actor actor = Actor::New();
11327 application.GetScene().Add(actor);
11329 Animation animation = Animation::New(0.0f);
11330 DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
11332 // The animation duration should automatically increase depending on the animator time period
11334 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
11335 DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
11337 animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
11338 DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
11343 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
11345 TestApplication application;
11347 Actor actor = Actor::New();
11349 // Register an integer property
11351 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11352 application.GetScene().Add(actor);
11353 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11355 DALI_TEST_ASSERTION(
11357 // Build the animation
11358 Animation animation = Animation::New(2.0f);
11359 std::string relativeValue = "relative string";
11360 animation.AnimateBy(Property(actor, index), relativeValue);
11361 tet_result(TET_FAIL);
11363 "Target value is not animatable");
11368 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
11370 TestApplication application;
11372 Actor actor = Actor::New();
11374 // Register an integer property
11376 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11377 application.GetScene().Add(actor);
11378 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11380 DALI_TEST_ASSERTION(
11382 // Build the animation
11383 Animation animation = Animation::New(2.0f);
11384 std::string relativeValue = "relative string";
11385 animation.AnimateTo(Property(actor, index), relativeValue);
11387 "Target value is not animatable");
11392 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
11394 TestApplication application;
11396 Actor actor = Actor::New();
11398 // Register an integer property
11400 Property::Index index = actor.RegisterProperty("testProperty", startValue);
11401 application.GetScene().Add(actor);
11402 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11404 DALI_TEST_ASSERTION(
11406 // Build the animation
11407 KeyFrames keyFrames = KeyFrames::New();
11408 keyFrames.Add(0.0f, std::string("relative string1"));
11409 keyFrames.Add(1.0f, std::string("relative string2"));
11410 // no need to really create the animation as keyframes do the check
11412 "Property type is not animatable");
11417 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
11419 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
11421 TestApplication application;
11423 tet_infoline("Set initial position and set up animation to re-position actor");
11425 Actor actor = Actor::New();
11426 application.GetScene().Add(actor);
11427 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11428 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11430 // Build the animation
11431 Animation animation = Animation::New(2.0f);
11433 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11434 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11435 DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11437 tet_infoline("Set target position in animation without intiating play");
11439 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11440 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11442 application.SendNotification();
11443 application.Render();
11445 tet_infoline("Ensure position of actor is still at intial value");
11447 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11448 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11449 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11451 tet_infoline("Play animation and ensure actor position is now target");
11454 application.SendNotification();
11455 application.Render(1000u);
11457 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11459 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11460 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11461 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11463 tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11465 application.Render(2000u);
11467 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11469 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
11470 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
11471 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
11476 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11478 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11480 TestApplication application;
11482 std::vector<Vector3> targetPositions;
11484 targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
11485 targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11486 targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
11488 tet_infoline("Set initial position and set up animation to re-position actor");
11490 Actor actor = Actor::New();
11491 application.GetScene().Add(actor);
11492 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11493 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11495 // Build the animation
11496 Animation animation = Animation::New(2.0f);
11498 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11499 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
11500 DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
11502 tet_infoline("Set target position in animation without intiating play");
11504 for(unsigned int i = 0; i < targetPositions.size(); i++)
11506 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11509 application.SendNotification();
11510 application.Render();
11512 tet_infoline("Ensure position of actor is still at intial value");
11514 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
11515 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
11516 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
11518 tet_infoline("Play animation and ensure actor position is now target");
11521 application.SendNotification();
11522 application.Render(1000u);
11524 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11526 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11527 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11528 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11530 tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
11532 application.Render(2000u);
11534 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11536 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
11537 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
11538 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
11543 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11545 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");
11547 TestApplication application;
11549 std::vector<Vector3> targetSizes;
11550 std::vector<Vector3> targetPositions;
11552 targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11553 targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
11555 targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
11557 tet_infoline("Set initial position and set up animation to re-position actor");
11559 Actor actor = Actor::New();
11560 application.GetScene().Add(actor);
11561 Vector3 initialSize(10.0f, 10.0f, 10.0f);
11562 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11564 actor.SetProperty(Actor::Property::SIZE, initialSize);
11565 actor.SetProperty(Actor::Property::POSITION, initialPosition);
11567 // Build the animation
11568 Animation animation = Animation::New(2.0f);
11570 tet_infoline("Set target size in animation without intiating play");
11571 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11572 tet_infoline("Set target position in animation without intiating play");
11573 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11574 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11576 application.SendNotification();
11577 application.Render();
11579 tet_infoline("Ensure position of actor is still at intial size and position");
11581 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11582 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11583 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11585 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
11586 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
11587 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
11589 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11592 application.SendNotification();
11593 application.Render(2000u);
11595 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11597 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11598 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11599 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11601 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
11602 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
11603 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
11608 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11610 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11612 TestApplication application;
11614 std::vector<Vector3> targetSizes;
11615 std::vector<float> targetColors;
11617 targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
11618 targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
11620 targetColors.push_back(1.0f);
11622 tet_infoline("Set initial position and set up animation to re-position actor");
11624 Actor actor = Actor::New();
11625 application.GetScene().Add(actor);
11626 Vector3 initialSize(10.0f, 5.0f, 10.0f);
11628 actor.SetProperty(Actor::Property::SIZE, initialSize);
11630 // Build the animation
11631 Animation animation = Animation::New(2.0f);
11633 tet_infoline("Set target size in animation without initiating play");
11634 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11635 tet_infoline("Set target position in animation without intiating play");
11636 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11637 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11639 application.SendNotification();
11640 application.Render();
11642 tet_infoline("Ensure position of actor is still at initial size and position");
11644 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
11645 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
11646 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
11648 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11651 application.SendNotification();
11652 application.Render(2000u);
11654 tet_infoline("Ensure position and size of actor is at target value when animation playing");
11656 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
11657 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
11658 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
11660 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
11665 int UtcDaliAnimationTimePeriodOrder(void)
11667 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
11669 TestApplication application;
11671 Actor actor = Actor::New();
11672 application.GetScene().Add(actor);
11674 application.SendNotification();
11675 application.Render();
11677 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11678 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11679 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11680 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11681 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11683 //////////////////////////////////////////////////////////////////////////////////
11685 tet_infoline("With two AnimateTo calls");
11687 Animation animation = Animation::New(0.0f);
11688 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11689 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11692 tet_infoline("The target position should change instantly");
11693 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11694 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11696 application.SendNotification();
11697 application.Render(5000); // After the animation is complete
11699 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11700 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11701 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11703 //////////////////////////////////////////////////////////////////////////////////
11705 tet_infoline("Same animation again but in a different order - should yield the same result");
11707 actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11708 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11709 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11711 application.SendNotification();
11712 application.Render();
11714 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11715 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11716 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11718 animation = Animation::New(0.0f);
11719 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
11720 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
11723 tet_infoline("The target position should change instantly");
11724 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11725 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11727 application.SendNotification();
11728 application.Render(5000); // After the animation is complete
11730 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11731 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
11732 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
11737 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11739 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");
11741 TestApplication application;
11743 Actor actor = Actor::New();
11744 application.GetScene().Add(actor);
11746 application.SendNotification();
11747 application.Render();
11749 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11750 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11751 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11752 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11753 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11755 //////////////////////////////////////////////////////////////////////////////////
11759 Animation animation = Animation::New(0.0f);
11760 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11761 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11762 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11763 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11764 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11765 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11768 tet_infoline("The target position should change instantly");
11769 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11770 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11772 application.SendNotification();
11773 application.Render(14000); // After the animation is complete
11775 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11776 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11777 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11779 //////////////////////////////////////////////////////////////////////////////////
11781 tet_infoline("Same animation again but in a different order - should end up at the same point");
11783 actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
11785 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11786 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11788 application.SendNotification();
11789 application.Render();
11791 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11792 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
11793 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
11795 animation = Animation::New(0.0f);
11796 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
11797 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
11798 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
11799 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
11800 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
11801 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
11804 tet_infoline("The target position should change instantly");
11805 DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11806 DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11808 application.SendNotification();
11809 application.Render(14000); // After the animation is complete
11811 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11812 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
11813 DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
11818 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11820 TestApplication application;
11823 Actor actor = Actor::New();
11824 const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11825 application.GetScene().Add(actor);
11827 application.Render();
11828 application.SendNotification();
11830 DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
11832 // Build the animation
11833 float durationSeconds(1.0f);
11834 Animation animation = Animation::New(durationSeconds);
11836 KeyFrames keyFrames = KeyFrames::New();
11837 keyFrames.Add(0.0f, 10);
11838 keyFrames.Add(0.2f, 20);
11839 keyFrames.Add(0.4f, 30);
11840 keyFrames.Add(0.6f, 40);
11841 keyFrames.Add(0.8f, 50);
11842 keyFrames.Add(1.0f, 60);
11844 animation.AnimateBetween(Property(actor, index), keyFrames);
11846 // Start the animation
11849 // Target value should change to the last key-frame's value straight away
11850 DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
11855 int UtcDaliAnimationAnimateBetweenVector2P(void)
11857 TestApplication application;
11859 Vector2 startValue(10.0f, 20.0f);
11860 Actor actor = Actor::New();
11861 const Property::Index index = actor.RegisterProperty("customProperty", startValue);
11862 application.GetScene().Add(actor);
11864 application.Render();
11865 application.SendNotification();
11867 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
11869 // Build the animation
11870 float durationSeconds(1.0f);
11871 Animation animation = Animation::New(durationSeconds);
11873 KeyFrames keyFrames = KeyFrames::New();
11874 keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
11875 keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
11876 keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
11877 keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
11878 keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
11879 keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
11881 animation.AnimateBetween(Property(actor, index), keyFrames);
11883 // Start the animation
11886 // Target value should change to the last key-frame's value straight away
11887 DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
11892 int UtcDaliAnimationProgressCallbackP(void)
11894 TestApplication application;
11896 Actor actor = Actor::New();
11897 application.GetScene().Add(actor);
11899 // Build the animation
11900 Animation animation = Animation::New(0.0f);
11903 float durationSeconds(1.0f);
11904 animation.SetDuration(durationSeconds);
11906 bool finishedSignalReceived(false);
11907 bool progressSignalReceived(false);
11909 AnimationFinishCheck finishCheck(finishedSignalReceived);
11910 animation.FinishedSignal().Connect(&application, finishCheck);
11912 AnimationProgressCheck progressCheck(progressSignalReceived);
11913 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
11914 application.SendNotification();
11916 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11917 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11919 tet_infoline("Animation Progress notification set to 30%");
11920 DevelAnimation::SetProgressNotification(animation, 0.3f);
11922 application.SendNotification();
11923 application.Render();
11925 DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
11927 progressCheck.CheckSignalNotReceived();
11929 // Start the animation from 10% progress
11930 animation.SetCurrentProgress(0.1f);
11933 tet_infoline("Animation Playing from 10%");
11935 application.SendNotification();
11936 application.Render(0); // start animation
11937 application.Render(durationSeconds * 100.0f); // 20% progress
11939 tet_infoline("Animation at 20%");
11941 progressCheck.CheckSignalNotReceived();
11943 application.SendNotification();
11944 application.Render(durationSeconds * 200.0f); // 40% progress
11945 application.SendNotification();
11946 tet_infoline("Animation at 40%");
11947 DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
11949 progressCheck.CheckSignalReceived();
11951 tet_infoline("Progress check reset");
11952 progressCheck.Reset();
11954 application.Render(durationSeconds * 100.0f); // 50% progress
11955 tet_infoline("Animation at 50%");
11956 application.SendNotification();
11958 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
11960 progressCheck.CheckSignalNotReceived();
11962 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
11963 application.SendNotification();
11965 tet_infoline("Animation at 60%");
11967 finishCheck.CheckSignalNotReceived();
11969 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
11970 application.SendNotification();
11971 DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
11972 tet_infoline("Animation at 80%");
11974 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
11975 // We did expect the animation to finish
11976 application.SendNotification();
11977 finishCheck.CheckSignalReceived();
11978 tet_infoline("Animation finished");
11979 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
11984 int UtcDaliAnimationPlayAfterP(void)
11986 TestApplication application;
11988 tet_printf("Testing that playing after 2 seconds\n");
11991 Actor actor = Actor::New();
11992 application.GetScene().Add(actor);
11994 // Build the animation
11995 float durationSeconds(1.0f);
11996 Animation animation = Animation::New(durationSeconds);
11998 bool signalReceived(false);
11999 AnimationFinishCheck finishCheck(signalReceived);
12000 animation.FinishedSignal().Connect(&application, finishCheck);
12001 application.SendNotification();
12003 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12004 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12006 // Play animation after the initial delay time
12007 animation.PlayAfter(0.2f);
12008 application.SendNotification();
12009 application.Render(0); // start animation
12011 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
12012 application.SendNotification();
12013 finishCheck.CheckSignalNotReceived();
12014 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
12016 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12018 // We didn't expect the animation to finish yet
12019 application.SendNotification();
12020 finishCheck.CheckSignalNotReceived();
12021 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12023 application.SendNotification();
12024 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12026 application.SendNotification();
12027 finishCheck.CheckSignalNotReceived();
12028 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12030 application.SendNotification();
12031 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
12033 // We did expect the animation to finish
12034 application.SendNotification();
12035 finishCheck.CheckSignalReceived();
12036 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12038 // Check that nothing has changed after a couple of buffer swaps
12039 application.Render(0);
12040 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12043 tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
12046 Actor actor = Actor::New();
12047 application.GetScene().Add(actor);
12049 // Build the animation
12050 float durationSeconds(1.0f);
12051 Animation animation = Animation::New(durationSeconds);
12052 animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0
12054 bool signalReceived(false);
12055 AnimationFinishCheck finishCheck(signalReceived);
12056 animation.FinishedSignal().Connect(&application, finishCheck);
12057 application.SendNotification();
12059 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12060 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12062 // Play animation after the initial delay time
12063 animation.PlayAfter(0.2f);
12064 application.SendNotification();
12065 application.Render(0); // start animation
12067 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
12068 application.SendNotification();
12069 finishCheck.CheckSignalNotReceived();
12070 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
12072 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
12074 // We didn't expect the animation to finish yet
12075 application.SendNotification();
12076 finishCheck.CheckSignalNotReceived();
12077 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12079 application.SendNotification();
12080 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
12082 application.SendNotification();
12083 finishCheck.CheckSignalNotReceived();
12084 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
12086 application.SendNotification();
12087 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
12089 // We did expect the animation to finish
12090 application.SendNotification();
12091 finishCheck.CheckSignalReceived();
12092 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
12094 // Check that nothing has changed after a couple of buffer swaps
12095 application.Render(0);
12096 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
12102 int UtcDaliAnimationPlayAfterP2(void)
12104 TestApplication application;
12106 tet_printf("Testing that playing after 2 seconds before looping\n");
12109 Actor actor = Actor::New();
12110 application.GetScene().Add(actor);
12112 // Build the animation
12113 float durationSeconds(1.0f);
12114 Animation animation = Animation::New(durationSeconds);
12115 animation.SetLooping(true);
12117 bool signalReceived(false);
12118 AnimationFinishCheck finishCheck(signalReceived);
12119 animation.FinishedSignal().Connect(&application, finishCheck);
12120 application.SendNotification();
12122 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12123 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12125 // Play animation after the initial delay time
12126 animation.PlayAfter(0.2f);
12127 application.SendNotification();
12128 application.Render(0); // start animation
12130 for(int iterations = 0; iterations < 3; ++iterations)
12132 // The initial delay time of PlayAfter() applies only once in looping mode.
12133 if(iterations == 0)
12135 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
12136 application.SendNotification();
12137 finishCheck.CheckSignalNotReceived();
12138 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
12141 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12143 // We didn't expect the animation to finish yet
12144 application.SendNotification();
12145 finishCheck.CheckSignalNotReceived();
12146 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12148 application.SendNotification();
12149 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12151 application.SendNotification();
12152 finishCheck.CheckSignalNotReceived();
12153 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12155 application.SendNotification();
12156 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
12158 // We did expect the animation to finish
12159 application.SendNotification();
12160 finishCheck.CheckSignalNotReceived();
12161 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12164 animation.SetLooping(false);
12165 application.SendNotification();
12166 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12168 application.SendNotification();
12169 finishCheck.CheckSignalReceived();
12170 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12173 tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
12176 Actor actor = Actor::New();
12177 application.GetScene().Add(actor);
12179 // Build the animation
12180 float durationSeconds(1.0f);
12181 Animation animation = Animation::New(durationSeconds);
12182 animation.SetLooping(true);
12183 animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0
12185 bool signalReceived(false);
12186 AnimationFinishCheck finishCheck(signalReceived);
12187 animation.FinishedSignal().Connect(&application, finishCheck);
12188 application.SendNotification();
12190 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12191 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12193 // Play animation after the initial delay time
12194 animation.PlayAfter(0.2f);
12195 application.SendNotification();
12196 application.Render(0); // start animation
12198 for(int iterations = 0; iterations < 3; ++iterations)
12200 // The initial delay time of PlayAfter() applies only once in looping mode.
12201 if(iterations == 0)
12203 application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
12204 application.SendNotification();
12205 finishCheck.CheckSignalNotReceived();
12206 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
12209 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
12211 // We didn't expect the animation to finish yet
12212 application.SendNotification();
12213 finishCheck.CheckSignalNotReceived();
12214 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12216 application.SendNotification();
12217 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
12219 application.SendNotification();
12220 finishCheck.CheckSignalNotReceived();
12221 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
12223 application.SendNotification();
12224 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
12226 // We did expect the animation to finish
12227 application.SendNotification();
12228 finishCheck.CheckSignalNotReceived();
12229 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
12232 animation.SetLooping(false);
12233 application.SendNotification();
12234 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12236 application.SendNotification();
12237 finishCheck.CheckSignalReceived();
12238 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
12244 int UtcDaliAnimationPlayAfterP3(void)
12246 TestApplication application;
12248 tet_printf("Testing that PlayAfter with the negative delay seconds\n");
12250 Actor actor = Actor::New();
12251 application.GetScene().Add(actor);
12253 // Build the animation
12254 float durationSeconds(1.0f);
12255 Animation animation = Animation::New(durationSeconds);
12257 bool signalReceived(false);
12258 AnimationFinishCheck finishCheck(signalReceived);
12259 animation.FinishedSignal().Connect(&application, finishCheck);
12260 application.SendNotification();
12262 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12263 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12265 // When the delay time is negative value, it would treat as play immediately.
12266 animation.PlayAfter(-2.0f);
12267 application.SendNotification();
12268 application.Render(0); // start animation
12270 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
12272 // We didn't expect the animation to finish yet
12273 application.SendNotification();
12274 finishCheck.CheckSignalNotReceived();
12275 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12277 application.SendNotification();
12278 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
12280 application.SendNotification();
12281 finishCheck.CheckSignalNotReceived();
12282 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
12284 application.SendNotification();
12285 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
12287 // We did expect the animation to finish
12288 application.SendNotification();
12289 finishCheck.CheckSignalReceived();
12290 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12292 // Check that nothing has changed after a couple of buffer swaps
12293 application.Render(0);
12294 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12298 int UtcDaliAnimationPlayAfterP4(void)
12300 TestApplication application;
12302 tet_printf("Testing that PlayAfter with progress value\n");
12304 Actor actor = Actor::New();
12305 application.GetScene().Add(actor);
12307 // Build the animation
12308 float durationSeconds(1.0f);
12309 Animation animation = Animation::New(durationSeconds);
12311 bool signalReceived(false);
12312 AnimationFinishCheck finishCheck(signalReceived);
12313 animation.FinishedSignal().Connect(&application, finishCheck);
12314 application.SendNotification();
12316 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12317 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
12319 // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
12320 animation.PlayAfter(durationSeconds * 0.3f);
12321 application.SendNotification();
12322 application.Render(0); // start animation
12324 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
12326 // We didn't expect the animation to finish yet
12327 application.SendNotification();
12328 finishCheck.CheckSignalNotReceived();
12329 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
12331 application.SendNotification();
12332 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
12334 application.SendNotification();
12335 finishCheck.CheckSignalNotReceived();
12336 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12338 application.SendNotification();
12339 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
12341 application.SendNotification();
12342 finishCheck.CheckSignalNotReceived();
12343 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
12345 application.SendNotification();
12346 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
12348 application.SendNotification();
12349 finishCheck.CheckSignalNotReceived();
12350 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
12352 application.SendNotification();
12353 application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
12355 application.SendNotification();
12356 finishCheck.CheckSignalNotReceived();
12357 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
12359 application.SendNotification();
12360 application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
12362 // We did expect the animation to finish
12363 application.SendNotification();
12364 finishCheck.CheckSignalReceived();
12365 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12367 // Check that nothing has changed after a couple of buffer swaps
12368 application.Render(0);
12369 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12373 int UtcDaliAnimationSetLoopingModeP(void)
12375 // Test Loop forever and Loop mode being set
12376 TestApplication application;
12377 Integration::Scene stage(application.GetScene());
12379 // Default: LoopingMode::RESTART
12381 Actor actor = Actor::New();
12384 float durationSeconds(1.0f);
12385 Animation animation = Animation::New(durationSeconds);
12386 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12388 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
12389 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12391 // Start the animation
12393 application.SendNotification();
12394 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
12398 application.SendNotification();
12399 application.Render();
12400 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12403 // LoopingMode::AUTO_REVERSE
12405 Actor actor = Actor::New();
12408 float durationSeconds(1.0f);
12409 Animation animation = Animation::New(durationSeconds);
12410 animation.SetLooping(true);
12412 bool signalReceived(false);
12413 AnimationFinishCheck finishCheck(signalReceived);
12414 animation.FinishedSignal().Connect(&application, finishCheck);
12415 application.SendNotification();
12417 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12418 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12420 animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
12421 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12423 // Start the animation
12425 application.SendNotification();
12426 application.Render(0);
12428 for(int iterations = 0; iterations < 3; ++iterations)
12430 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12431 application.SendNotification();
12432 finishCheck.CheckSignalNotReceived();
12434 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12435 // and arrives at the beginning.
12436 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12438 application.SendNotification();
12439 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12441 // We did expect the animation to finish
12442 application.SendNotification();
12443 finishCheck.CheckSignalNotReceived();
12444 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12447 animation.SetLooping(false);
12448 application.SendNotification();
12449 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12451 application.SendNotification();
12452 finishCheck.CheckSignalReceived();
12454 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12457 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12459 Actor actor = Actor::New();
12462 float durationSeconds(1.0f);
12463 Animation animation = Animation::New(durationSeconds);
12464 animation.SetLooping(true);
12466 bool signalReceived(false);
12467 AnimationFinishCheck finishCheck(signalReceived);
12468 animation.FinishedSignal().Connect(&application, finishCheck);
12469 application.SendNotification();
12471 // Specify a negative multiplier to play the animation in reverse
12472 animation.SetSpeedFactor(-1.0f);
12474 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12475 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12477 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12478 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12480 // Start the animation
12482 application.SendNotification();
12483 application.Render(0);
12485 for(int iterations = 0; iterations < 3; ++iterations)
12487 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
12488 application.SendNotification();
12489 finishCheck.CheckSignalNotReceived();
12491 // Setting a negative speed factor is to play the animation in reverse.
12492 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12493 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12494 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12496 application.SendNotification();
12497 application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
12499 // We did expect the animation to finish
12500 application.SendNotification();
12501 finishCheck.CheckSignalNotReceived();
12502 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12505 animation.SetLooping(false);
12506 application.SendNotification();
12507 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
12509 application.SendNotification();
12510 finishCheck.CheckSignalReceived();
12512 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12518 int UtcDaliAnimationSetLoopingModeP2(void)
12520 // Test Loop Count and Loop mode being set
12521 TestApplication application;
12522 Integration::Scene stage(application.GetScene());
12524 // LoopingMode::AUTO_REVERSE
12526 Actor actor = Actor::New();
12529 float durationSeconds(1.0f);
12530 Animation animation = Animation::New(durationSeconds);
12531 animation.SetLoopCount(3);
12532 DALI_TEST_CHECK(animation.IsLooping());
12534 bool signalReceived(false);
12535 AnimationFinishCheck finishCheck(signalReceived);
12536 animation.FinishedSignal().Connect(&application, finishCheck);
12537 application.SendNotification();
12539 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12540 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12542 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12543 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12545 // Start the animation
12548 application.Render(0);
12549 application.SendNotification();
12550 application.Render(0);
12551 application.SendNotification();
12552 application.Render(0);
12553 application.SendNotification();
12554 application.Render(0);
12555 application.SendNotification();
12558 float intervalSeconds = 3.0f;
12560 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12561 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12562 // and arrives at the beginning.
12563 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12565 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12567 application.Render(0);
12568 application.SendNotification();
12569 application.Render(0);
12570 application.SendNotification();
12571 application.Render(0);
12572 application.SendNotification();
12573 application.Render(0);
12574 application.SendNotification();
12575 finishCheck.CheckSignalNotReceived();
12577 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12579 application.SendNotification();
12580 finishCheck.CheckSignalReceived();
12581 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12583 finishCheck.Reset();
12586 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12588 Actor actor = Actor::New();
12591 float durationSeconds(1.0f);
12592 Animation animation = Animation::New(durationSeconds);
12593 animation.SetLoopCount(3);
12594 DALI_TEST_CHECK(animation.IsLooping());
12596 bool signalReceived(false);
12597 AnimationFinishCheck finishCheck(signalReceived);
12598 animation.FinishedSignal().Connect(&application, finishCheck);
12599 application.SendNotification();
12601 // Specify a negative multiplier to play the animation in reverse
12602 animation.SetSpeedFactor(-1.0f);
12604 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12605 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12607 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12608 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12610 // Start the animation
12613 application.Render(0);
12614 application.SendNotification();
12615 application.Render(0);
12616 application.SendNotification();
12617 application.Render(0);
12618 application.SendNotification();
12619 application.Render(0);
12620 application.SendNotification();
12623 float intervalSeconds = 3.0f;
12625 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12626 // Setting a negative speed factor is to play the animation in reverse.
12627 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12628 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12629 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12631 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12633 application.Render(0);
12634 application.SendNotification();
12635 application.Render(0);
12636 application.SendNotification();
12637 application.Render(0);
12638 application.SendNotification();
12639 application.Render(0);
12640 application.SendNotification();
12641 finishCheck.CheckSignalNotReceived();
12643 application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
12645 application.SendNotification();
12646 finishCheck.CheckSignalReceived();
12647 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12649 finishCheck.Reset();
12655 int UtcDaliAnimationSetLoopingModeP3(void)
12657 // Test Loop Count is 1 (== default) and Loop mode being set
12658 TestApplication application;
12659 Integration::Scene stage(application.GetScene());
12661 // LoopingMode::AUTO_REVERSE
12663 Actor actor = Actor::New();
12666 float durationSeconds(1.0f);
12667 Animation animation = Animation::New(durationSeconds);
12668 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12670 bool signalReceived(false);
12671 AnimationFinishCheck finishCheck(signalReceived);
12672 animation.FinishedSignal().Connect(&application, finishCheck);
12673 application.SendNotification();
12675 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12676 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12678 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12679 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12681 // Start the animation
12683 application.Render(0);
12684 application.SendNotification();
12686 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12687 application.SendNotification();
12688 finishCheck.CheckSignalNotReceived();
12690 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12691 // and arrives at the beginning.
12692 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12694 application.SendNotification();
12695 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12697 application.SendNotification();
12698 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12700 application.SendNotification();
12701 application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12703 application.SendNotification();
12704 application.Render(0);
12705 application.SendNotification();
12706 finishCheck.CheckSignalReceived();
12708 // After all animation finished, arrives at the beginning.
12709 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12711 finishCheck.Reset();
12714 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12716 Actor actor = Actor::New();
12719 float durationSeconds(1.0f);
12720 Animation animation = Animation::New(durationSeconds);
12721 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12723 bool signalReceived(false);
12724 AnimationFinishCheck finishCheck(signalReceived);
12725 animation.FinishedSignal().Connect(&application, finishCheck);
12726 application.SendNotification();
12728 // Specify a negative multiplier to play the animation in reverse
12729 animation.SetSpeedFactor(-1.0f);
12731 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12732 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
12734 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12735 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12737 // Start the animation
12739 application.Render(0);
12740 application.SendNotification();
12742 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
12743 application.SendNotification();
12744 finishCheck.CheckSignalNotReceived();
12746 // Setting a negative speed factor is to play the animation in reverse.
12747 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12748 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12749 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
12751 application.SendNotification();
12752 application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
12754 application.SendNotification();
12755 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12757 application.SendNotification();
12758 application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
12760 application.SendNotification();
12761 application.Render(0);
12762 application.SendNotification();
12763 finishCheck.CheckSignalReceived();
12765 // After all animation finished, arrives at the target.
12766 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12768 finishCheck.Reset();
12774 int UtcDaliAnimationGetLoopingModeP(void)
12776 TestApplication application;
12778 Animation animation = Animation::New(1.0f);
12781 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
12783 animation.SetLoopingMode(Animation::AUTO_REVERSE);
12784 DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
12789 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12791 TestApplication application;
12793 tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
12795 Actor actor = Actor::New();
12796 application.GetScene().Add(actor);
12798 // Build the animation
12799 Animation animation = Animation::New(0.0f);
12802 float durationSeconds(1.0f);
12803 animation.SetDuration(durationSeconds);
12805 bool finishedSignalReceived(false);
12806 bool progressSignalReceived(false);
12808 AnimationFinishCheck finishCheck(finishedSignalReceived);
12809 animation.FinishedSignal().Connect(&application, finishCheck);
12811 AnimationProgressCheck progressCheck(progressSignalReceived);
12812 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
12813 application.SendNotification();
12815 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12816 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12818 progressCheck.CheckSignalNotReceived();
12822 application.SendNotification();
12823 application.Render(0); // start animation
12824 application.Render(durationSeconds * 100.0f); // 10% progress
12825 application.SendNotification();
12827 tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
12828 finishCheck.CheckSignalNotReceived();
12829 progressCheck.CheckSignalNotReceived();
12831 application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
12833 application.SendNotification();
12834 finishCheck.CheckSignalReceived();
12835 tet_infoline("Animation finished");
12836 DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
12841 int UtcDaliAnimationMultipleProgressSignalsP(void)
12843 tet_infoline("Multiple animations with different progress markers");
12845 TestApplication application;
12847 Actor actor = Actor::New();
12848 application.GetScene().Add(actor);
12850 // Build the animation
12851 Animation animationAlpha = Animation::New(0.0f);
12852 Animation animationBeta = Animation::New(0.0f);
12855 float durationSeconds(1.0f);
12856 animationAlpha.SetDuration(durationSeconds);
12857 animationBeta.SetDuration(durationSeconds);
12859 bool progressSignalReceivedAlpha(false);
12860 bool progressSignalReceivedBeta(false);
12862 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12863 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12865 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12866 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12867 application.SendNotification();
12869 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12870 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12871 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12873 tet_infoline("AnimationAlpha Progress notification set to 30%");
12874 DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
12876 tet_infoline("AnimationBeta Progress notification set to 50%");
12877 DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
12879 application.SendNotification();
12880 application.Render();
12882 progressCheckAlpha.CheckSignalNotReceived();
12883 progressCheckBeta.CheckSignalNotReceived();
12885 // Start the animations from 10% progress
12886 animationAlpha.SetCurrentProgress(0.1f);
12887 animationBeta.SetCurrentProgress(0.1f);
12888 animationAlpha.Play();
12889 animationBeta.Play();
12891 tet_infoline("Animation Playing from 10%");
12893 application.SendNotification();
12894 application.Render(0); // start animation
12895 application.Render(durationSeconds * 100.0f); // 20% progress
12897 tet_infoline("Animation at 20% - No signals to be received");
12899 progressCheckAlpha.CheckSignalNotReceived();
12900 progressCheckBeta.CheckSignalNotReceived();
12902 application.SendNotification();
12903 application.Render(durationSeconds * 200.0f); // 40% progress
12904 application.SendNotification();
12905 tet_infoline("Animation at 40% - Alpha signal should be received");
12906 DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
12908 progressCheckAlpha.CheckSignalReceived();
12909 progressCheckBeta.CheckSignalNotReceived();
12911 tet_infoline("Progress check reset");
12912 progressCheckAlpha.Reset();
12913 progressCheckBeta.Reset();
12915 application.Render(durationSeconds * 100.0f); // 50% progress
12916 tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
12917 application.SendNotification();
12919 DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
12921 progressCheckAlpha.CheckSignalNotReceived();
12922 progressCheckBeta.CheckSignalReceived();
12923 tet_infoline("Progress check reset");
12924 progressCheckAlpha.Reset();
12925 progressCheckBeta.Reset();
12927 application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
12928 application.SendNotification();
12930 tet_infoline("Animation at 60%");
12932 progressCheckAlpha.CheckSignalNotReceived();
12933 progressCheckBeta.CheckSignalNotReceived();
12935 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
12936 application.SendNotification();
12937 tet_infoline("Animation at 80%");
12939 progressCheckAlpha.CheckSignalNotReceived();
12940 progressCheckBeta.CheckSignalNotReceived();
12942 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
12943 // We did expect the animation to finish
12944 tet_infoline("Animation finished");
12949 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12951 tet_infoline("Multiple animations with different progress markers and big step time");
12953 TestApplication application;
12955 Actor actor = Actor::New();
12956 application.GetScene().Add(actor);
12958 // Build the animation
12959 Animation animationAlpha = Animation::New(0.0f);
12960 Animation animationBeta = Animation::New(0.0f);
12963 const float durationSeconds(1.0f);
12964 animationAlpha.SetDuration(durationSeconds);
12965 animationBeta.SetDuration(durationSeconds);
12967 bool progressSignalReceivedAlpha(false);
12968 bool progressSignalReceivedBeta(false);
12970 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12971 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
12973 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
12974 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
12975 application.SendNotification();
12977 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12978 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12979 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12981 tet_infoline("AnimationAlpha Progress notification set to 1%");
12982 DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
12984 tet_infoline("AnimationBeta Progress notification set to 99%");
12985 DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
12987 application.SendNotification();
12988 application.Render();
12990 progressCheckAlpha.CheckSignalNotReceived();
12991 progressCheckBeta.CheckSignalNotReceived();
12993 // Start the animations unlimited looping
12994 animationAlpha.SetLooping(true);
12995 animationBeta.SetLooping(true);
12996 animationAlpha.Play();
12997 animationBeta.Play();
12999 application.SendNotification();
13000 application.Render(0); // start animation
13001 application.Render(durationSeconds * 20.0f); // 2% progress
13002 application.SendNotification();
13003 DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
13005 tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
13007 progressCheckAlpha.CheckSignalReceived();
13008 progressCheckBeta.CheckSignalNotReceived();
13010 tet_infoline("Progress check reset");
13011 progressCheckAlpha.Reset();
13012 progressCheckBeta.Reset();
13014 application.SendNotification();
13015 application.Render(durationSeconds * 960.0f); // 98% progress
13016 application.SendNotification();
13017 tet_infoline("Animation at 98% - No signal received");
13018 DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
13020 progressCheckAlpha.CheckSignalNotReceived();
13021 progressCheckBeta.CheckSignalNotReceived();
13023 application.SendNotification();
13024 application.Render(durationSeconds * 40.0f); // 2% progress
13025 application.SendNotification();
13026 tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
13027 application.SendNotification();
13029 DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
13031 progressCheckAlpha.CheckSignalReceived();
13032 progressCheckBeta.CheckSignalReceived();
13034 tet_infoline("Progress check reset");
13035 progressCheckAlpha.Reset();
13036 progressCheckBeta.Reset();
13038 application.SendNotification();
13039 application.Render(durationSeconds * 980.0f); // 100% progress
13040 application.SendNotification();
13041 tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
13042 application.SendNotification();
13044 progressCheckAlpha.CheckSignalNotReceived();
13045 progressCheckBeta.CheckSignalReceived();
13047 tet_infoline("Progress check reset");
13048 progressCheckAlpha.Reset();
13049 progressCheckBeta.Reset();
13051 animationAlpha.SetLooping(false);
13052 animationBeta.SetLooping(false);
13054 application.SendNotification();
13055 application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
13056 application.SendNotification();
13058 // We did expect the animation to finish
13059 tet_infoline("Animation finished");
13064 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
13066 tet_infoline("Multiple animations with different progress markers");
13068 TestApplication application;
13070 Actor actor = Actor::New();
13071 application.GetScene().Add(actor);
13073 // Build the animation
13074 Animation animationAlpha = Animation::New(0.0f);
13075 Animation animationBeta = Animation::New(0.0f);
13078 float durationSeconds(1.0f);
13079 float delaySeconds(0.5f);
13080 animationAlpha.SetDuration(durationSeconds);
13081 animationBeta.SetDuration(durationSeconds);
13083 bool progressSignalReceivedAlpha(false);
13084 bool progressSignalReceivedBeta(false);
13086 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
13087 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
13089 DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
13090 DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
13091 application.SendNotification();
13093 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13094 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13095 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13097 tet_infoline("AnimationAlpha Progress notification set to 30%");
13098 DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
13100 tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
13101 DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
13103 application.SendNotification();
13104 application.Render();
13106 progressCheckAlpha.CheckSignalNotReceived();
13107 progressCheckBeta.CheckSignalNotReceived();
13109 // Start the animations from 10% progress
13110 animationAlpha.PlayAfter(delaySeconds);
13111 animationBeta.PlayAfter(delaySeconds);
13113 application.SendNotification();
13114 application.Render(0); // start animation
13115 application.Render(delaySeconds * 500.0f); // 50% wait progress
13117 tet_infoline("Delay at 50% - No signals to be received");
13119 progressCheckAlpha.CheckSignalNotReceived();
13120 progressCheckBeta.CheckSignalNotReceived();
13122 application.SendNotification();
13123 application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
13124 application.SendNotification();
13125 tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
13126 DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
13128 progressCheckBeta.CheckSignalReceived();
13129 progressCheckAlpha.CheckSignalNotReceived();
13131 tet_infoline("Progress check reset");
13132 progressCheckAlpha.Reset();
13133 progressCheckBeta.Reset();
13135 application.Render(durationSeconds * 200.0f); // 25% progress
13136 tet_infoline("Animation at 25% - No signals to be received");
13137 application.SendNotification();
13139 progressCheckAlpha.CheckSignalNotReceived();
13140 progressCheckBeta.CheckSignalNotReceived();
13142 application.Render(durationSeconds * 200.0f); // 45% progress
13143 tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
13144 application.SendNotification();
13146 DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
13148 progressCheckAlpha.CheckSignalReceived();
13149 progressCheckBeta.CheckSignalNotReceived();
13151 tet_infoline("Progress check reset");
13152 progressCheckAlpha.Reset();
13153 progressCheckBeta.Reset();
13155 application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
13156 application.SendNotification();
13158 tet_infoline("Animation at 60%");
13160 progressCheckAlpha.CheckSignalNotReceived();
13161 progressCheckBeta.CheckSignalNotReceived();
13163 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
13164 application.SendNotification();
13165 tet_infoline("Animation at 80%");
13167 progressCheckAlpha.CheckSignalNotReceived();
13168 progressCheckBeta.CheckSignalNotReceived();
13170 application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
13171 // We did expect the animation to finish
13172 tet_infoline("Animation finished");
13177 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
13179 TestApplication application;
13181 Actor actor = Actor::New();
13182 application.GetScene().Add(actor);
13184 // Build the animation
13185 Animation animation = Animation::New(0.0f);
13188 const float durationSeconds(1.0f);
13189 animation.SetDuration(durationSeconds);
13191 // Set Looping Count
13192 const int loopCount(4);
13193 animation.SetLoopCount(loopCount);
13195 bool finishedSignalReceived(false);
13196 bool progressSignalReceived(false);
13198 AnimationFinishCheck finishCheck(finishedSignalReceived);
13199 animation.FinishedSignal().Connect(&application, finishCheck);
13201 AnimationProgressCheck progressCheck(progressSignalReceived);
13202 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13203 application.SendNotification();
13205 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13206 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13208 tet_infoline("Animation Progress notification set to 50% with looping count 4");
13209 DevelAnimation::SetProgressNotification(animation, 0.5f);
13211 application.SendNotification();
13212 application.Render();
13214 progressCheck.CheckSignalNotReceived();
13218 for(int count = 0; count < loopCount; count++)
13220 application.SendNotification();
13221 application.Render(0); // start animation
13222 finishCheck.CheckSignalNotReceived();
13224 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13225 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13227 tet_infoline("Animation at 25%");
13229 progressCheck.CheckSignalNotReceived();
13231 application.SendNotification();
13232 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13233 application.SendNotification();
13234 tet_infoline("Animation at 50%");
13235 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13237 progressCheck.CheckSignalReceived();
13239 tet_infoline("Progress check reset");
13240 progressCheck.Reset();
13242 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13243 tet_infoline("Animation at 75%");
13244 application.SendNotification();
13246 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13248 progressCheck.CheckSignalNotReceived();
13250 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13251 tet_infoline("Animation at 100%");
13252 application.SendNotification();
13254 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13255 application.SendNotification();
13257 application.Render(10u);
13258 application.SendNotification();
13259 application.Render(0u);
13260 application.SendNotification();
13262 finishCheck.CheckSignalReceived();
13267 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
13269 TestApplication application;
13271 Actor actor = Actor::New();
13272 application.GetScene().Add(actor);
13274 // Build the animation
13275 Animation animation = Animation::New(0.0f);
13278 const float durationSeconds(1.0f);
13279 animation.SetDuration(durationSeconds);
13281 // Set Looping Unlmited
13282 animation.SetLooping(true);
13284 bool finishedSignalReceived(false);
13285 bool progressSignalReceived(false);
13287 AnimationFinishCheck finishCheck(finishedSignalReceived);
13288 animation.FinishedSignal().Connect(&application, finishCheck);
13290 AnimationProgressCheck progressCheck(progressSignalReceived);
13291 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13292 application.SendNotification();
13294 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13295 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13297 tet_infoline("Animation Progress notification set to 50% with unlimited looping");
13298 DevelAnimation::SetProgressNotification(animation, 0.5f);
13300 application.SendNotification();
13301 application.Render();
13303 progressCheck.CheckSignalNotReceived();
13307 for(int count = 0; count < 4; count++)
13309 application.SendNotification();
13310 application.Render(0); // start animation
13311 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13312 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13314 tet_infoline("Animation at 25%");
13316 progressCheck.CheckSignalNotReceived();
13318 application.SendNotification();
13319 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13320 application.SendNotification();
13321 tet_infoline("Animation at 50%");
13322 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13324 progressCheck.CheckSignalReceived();
13326 tet_infoline("Progress check reset");
13327 progressCheck.Reset();
13329 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13330 tet_infoline("Animation at 75%");
13331 application.SendNotification();
13333 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13335 progressCheck.CheckSignalNotReceived();
13337 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13338 tet_infoline("Animation at 100%");
13339 application.SendNotification();
13341 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13342 finishCheck.CheckSignalNotReceived();
13343 application.SendNotification();
13345 finishCheck.CheckSignalNotReceived();
13347 animation.SetLooping(false);
13348 application.Render(0u);
13349 application.SendNotification();
13350 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
13351 application.SendNotification();
13352 application.Render(0u);
13353 application.SendNotification();
13355 finishCheck.CheckSignalReceived();
13360 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
13362 TestApplication application;
13364 Actor actor = Actor::New();
13365 application.GetScene().Add(actor);
13367 // Build the animation
13368 Animation animation = Animation::New(0.0f);
13371 const float durationSeconds(1.0f);
13372 animation.SetDuration(durationSeconds);
13374 //Set speed negative
13375 animation.SetSpeedFactor(-1.0f);
13377 // Set Looping Unlmited
13378 animation.SetLooping(true);
13380 bool finishedSignalReceived(false);
13381 bool progressSignalReceived(false);
13383 AnimationFinishCheck finishCheck(finishedSignalReceived);
13384 animation.FinishedSignal().Connect(&application, finishCheck);
13386 AnimationProgressCheck progressCheck(progressSignalReceived);
13387 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13388 application.SendNotification();
13390 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13391 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13393 tet_infoline("Animation Progress notification set to 50%");
13394 DevelAnimation::SetProgressNotification(animation, 0.5f);
13396 application.SendNotification();
13397 application.Render();
13399 progressCheck.CheckSignalNotReceived();
13403 for(int count = 0; count < 4; count++)
13405 application.SendNotification();
13406 application.Render(0); // start animation
13407 progressCheck.CheckSignalNotReceived();
13409 application.SendNotification();
13410 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13411 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13413 tet_infoline("Animation at 25%");
13415 progressCheck.CheckSignalNotReceived();
13417 application.SendNotification();
13418 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13419 application.SendNotification();
13420 tet_infoline("Animation at 50%");
13421 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13423 progressCheck.CheckSignalReceived();
13425 tet_infoline("Progress check reset");
13426 progressCheck.Reset();
13428 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13429 tet_infoline("Animation at 75%");
13430 application.SendNotification();
13432 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13434 progressCheck.CheckSignalNotReceived();
13436 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13437 tet_infoline("Animation at 100%");
13438 application.SendNotification();
13440 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13441 finishCheck.CheckSignalNotReceived();
13442 application.SendNotification();
13444 finishCheck.CheckSignalNotReceived();
13447 animation.SetLooping(false);
13448 animation.SetLoopCount(4);
13450 application.SendNotification(); // Send Stop event into update thread
13451 application.Render(0u); // Send Notification into event thread
13452 application.SendNotification(); // Execute finished signal.
13454 finishCheck.CheckSignalReceived(); // Due to stop called.
13455 finishCheck.Reset();
13457 for(int count = 0; count < 4; count++)
13459 application.SendNotification();
13460 application.Render(0); // start animation
13461 progressCheck.CheckSignalNotReceived();
13462 finishCheck.CheckSignalNotReceived();
13464 application.SendNotification();
13465 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13466 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13468 tet_infoline("Animation at 25%");
13470 progressCheck.CheckSignalNotReceived();
13472 application.SendNotification();
13473 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13474 application.SendNotification();
13475 tet_infoline("Animation at 50%");
13476 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13478 progressCheck.CheckSignalReceived();
13480 tet_infoline("Progress check reset");
13481 progressCheck.Reset();
13483 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13484 tet_infoline("Animation at 75%");
13485 application.SendNotification();
13487 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13489 progressCheck.CheckSignalNotReceived();
13491 application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
13492 tet_infoline("Animation at 100%");
13493 application.SendNotification();
13495 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13496 application.SendNotification();
13498 application.Render(10u);
13499 application.SendNotification();
13500 application.Render(0u);
13501 application.SendNotification();
13503 finishCheck.CheckSignalReceived();
13508 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13510 TestApplication application;
13512 Actor actor = Actor::New();
13513 application.GetScene().Add(actor);
13515 // Build the animation
13516 Animation animation = Animation::New(0.0f);
13519 const float durationSeconds(1.0f);
13520 animation.SetDuration(durationSeconds);
13522 bool finishedSignalReceived(false);
13523 bool progressSignalReceived(false);
13525 AnimationFinishCheck finishCheck(finishedSignalReceived);
13526 animation.FinishedSignal().Connect(&application, finishCheck);
13528 AnimationProgressCheck progressCheck(progressSignalReceived);
13529 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13530 application.SendNotification();
13532 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13533 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13535 tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
13536 animation.SetPlayRange(Vector2(0.1f, 0.9f));
13538 tet_infoline("Animation Progress notification set to >90% that never can notificated");
13539 DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
13541 application.SendNotification();
13542 application.Render();
13544 progressCheck.CheckSignalNotReceived();
13548 application.SendNotification();
13549 application.Render(0); // start animation
13550 application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
13551 DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
13553 tet_infoline("Animation at 35%");
13555 progressCheck.CheckSignalNotReceived();
13557 application.SendNotification();
13558 application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
13559 application.SendNotification();
13560 DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
13562 tet_infoline("Animation at 60%");
13564 progressCheck.CheckSignalNotReceived();
13566 application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
13567 tet_infoline("Animation at 85%");
13568 application.SendNotification();
13569 DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
13571 progressCheck.CheckSignalNotReceived();
13573 application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
13574 tet_infoline("Animation over 90%");
13575 application.SendNotification();
13577 // progress never signaled because playrange is 90%
13578 progressCheck.CheckSignalNotReceived();
13583 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13585 TestApplication application;
13587 Actor actor = Actor::New();
13588 application.GetScene().Add(actor);
13590 // Build the animation
13591 Animation animation = Animation::New(0.0f);
13594 float durationSeconds(5.0f);
13595 animation.SetDuration(durationSeconds);
13597 bool finishedSignalReceived(false);
13598 bool progressSignalReceived(false);
13600 AnimationFinishCheck finishCheck(finishedSignalReceived);
13601 animation.FinishedSignal().Connect(&application, finishCheck);
13603 AnimationProgressCheck progressCheck(progressSignalReceived);
13604 DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
13605 application.SendNotification();
13607 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13608 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13610 tet_infoline("Animation Progress notification set to 50%");
13611 DevelAnimation::SetProgressNotification(animation, 0.5f);
13613 application.SendNotification();
13614 application.Render();
13616 progressCheck.CheckSignalNotReceived();
13620 application.SendNotification();
13621 application.Render(0); // start animation
13622 application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
13623 DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
13625 tet_infoline("Animation at 25%");
13627 progressCheck.CheckSignalNotReceived();
13629 application.SendNotification();
13630 application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
13631 application.SendNotification();
13632 tet_infoline("Animation at 50%");
13633 DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
13635 progressCheck.CheckSignalReceived();
13637 tet_infoline("Progress check reset");
13638 progressCheck.Reset();
13640 application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
13641 tet_infoline("Animation at 75%");
13642 application.SendNotification();
13644 DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
13646 progressCheck.CheckSignalNotReceived();
13651 int UtcDaliAnimationAnimateByInvalidParameters(void)
13653 TestApplication application;
13655 Actor actor = Actor::New();
13656 application.GetScene().Add(actor);
13658 // Create the animation
13659 Animation animation = Animation::New(1.0f);
13661 DALI_TEST_ASSERTION(
13663 // non animateable property (STRING)
13664 animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
13666 "Property type is not animatable");
13668 DALI_TEST_ASSERTION(
13670 // non animateable property (MATRIX)
13671 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
13672 animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
13674 "Property type is not animatable");
13677 DALI_TEST_ASSERTION(
13679 // non animateable target (NONE)
13680 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
13682 "Target value is not animatable");
13684 DALI_TEST_ASSERTION(
13686 // non animateable target (STRING)
13687 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
13689 "Target value is not animatable");
13691 DALI_TEST_ASSERTION(
13693 // not mathing properties (VECTOR3, FLOAT)
13694 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
13696 "Property and target types don't match");
13698 DALI_TEST_ASSERTION(
13700 // not mathing properties (VECTOR3.A, VECTOR2)
13701 animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
13703 "Property and target types don't match");
13705 DALI_TEST_ASSERTION(
13707 // negative duration
13708 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13710 "Duration must be >=0");
13715 int UtcDaliAnimationAnimateToInvalidParameters(void)
13717 TestApplication application;
13719 Actor actor = Actor::New();
13720 application.GetScene().Add(actor);
13722 // Create the animation
13723 Animation animation = Animation::New(1.0f);
13726 DALI_TEST_ASSERTION(
13728 // non animateable property (MAP)
13729 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
13730 animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
13732 "Property type is not animatable");
13734 DALI_TEST_ASSERTION(
13736 // non animateable target (NONE)
13737 animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
13739 "Property type is not animatable");
13741 DALI_TEST_ASSERTION(
13743 // non animateable target (ARRAY)
13744 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
13746 "Target value is not animatable");
13748 DALI_TEST_ASSERTION(
13750 // non animateable target (RECTANGLE)
13751 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
13753 "Target value is not animatable");
13755 DALI_TEST_ASSERTION(
13757 // not mathing properties (FLOAT, INT)
13758 animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
13760 "Property and target types don't match");
13762 DALI_TEST_ASSERTION(
13764 // not mathing properties (VECTOR3, VECTOR2)
13765 animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
13767 "Property and target types don't match");
13769 DALI_TEST_ASSERTION(
13771 // negative duration
13772 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
13774 "Duration must be >=0");
13779 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13781 TestApplication application;
13783 Actor actor = Actor::New();
13784 application.GetScene().Add(actor);
13786 // Create the animation
13787 Animation animation = Animation::New(1.0f);
13790 DALI_TEST_ASSERTION(
13792 // non animateable property (ARRAY)
13793 Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
13794 KeyFrames keyframes = KeyFrames::New();
13795 keyframes.Add(0.5f, Property::Value(Property::ARRAY));
13796 animation.AnimateBetween(Property(actor, index), keyframes);
13798 "Property type is not animatable");
13800 DALI_TEST_ASSERTION(
13802 // non animateable target (NONE)
13803 KeyFrames keyframes = KeyFrames::New();
13804 keyframes.Add(0.5f, Property::Value());
13805 animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
13807 "Property type is not animatable");
13809 DALI_TEST_ASSERTION(
13811 // non animateable target (EXTENTS)
13812 KeyFrames keyframes = KeyFrames::New();
13813 keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
13814 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13816 "Property type is not animatable");
13818 DALI_TEST_ASSERTION(
13820 // non animateable target (RECTANGLE)
13821 KeyFrames keyframes = KeyFrames::New();
13822 keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
13823 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
13825 "Property type is not animatable");
13827 DALI_TEST_ASSERTION(
13829 // not mathing properties (VECTOR2, VECTOR4)
13830 KeyFrames keyframes = KeyFrames::New();
13831 keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
13832 animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
13834 "Property and target types don't match");
13836 DALI_TEST_ASSERTION(
13838 // negative duration
13839 KeyFrames keyframes = KeyFrames::New();
13840 keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
13841 animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
13843 "Duration must be >=0");
13848 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13856 void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
13858 tet_printf("Testing %s\n", testName);
13860 // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13861 // This test checks that that is being done
13863 const float durationSeconds(1.0f);
13864 unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13865 const Vector3 originalPosition(Vector3::ZERO);
13866 const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13867 const Vector3 halfWayToTarget(targetPosition * 0.5f);
13869 struct ExpectedValue
13871 Animation::EndAction endAction;
13872 Vector3 expectedGetPropertyValue;
13875 ExpectedValue expectedValueTable[] =
13877 {Animation::BAKE, halfWayToTarget}, // When baking, the current value is the final value.
13878 {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
13879 {Animation::DISCARD, originalPosition}, // When discarding, we should jump back to the original value when clearing or stopping.
13881 const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
13883 for(auto i = 0u; i < expectedValueTableCount; ++i)
13885 TestApplication application;
13887 Actor actor = Actor::New();
13888 application.GetScene().Add(actor);
13890 // Build the animation
13891 Animation animation = Animation::New(durationSeconds);
13892 animation.SetEndAction(expectedValueTable[i].endAction);
13893 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13895 // Start the animation
13898 application.SendNotification();
13899 application.Render(halfAnimationDuration);
13901 // Stop or Clear the animation early, both have the same effect
13902 if(functionToTest == TestFunction::STOP)
13911 // 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
13912 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13913 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
13915 // After one frame, both values should match regardless of the End Action
13916 application.SendNotification();
13917 application.Render();
13919 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13920 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
13923 } // unnamed namespace
13925 int UtcDaliAnimationStopPropertyValue(void)
13927 CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
13931 int UtcDaliAnimationClearPropertyValue01(void)
13933 CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
13937 int UtcDaliAnimationClearPropertyValue02(void)
13939 TestApplication application;
13941 Actor actor = Actor::New();
13942 application.GetScene().Add(actor);
13944 const float durationSeconds(1.0f);
13945 const Vector3 targetPosition1(10.0f, 10.0f, 10.0f);
13946 const Vector3 targetPosition2(20.0f, 20.0f, 20.0f);
13948 // Build the animation
13949 Animation animation1 = Animation::New(durationSeconds);
13950 animation1.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition1, AlphaFunction::LINEAR);
13953 application.SendNotification();
13954 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13956 // The event side property should be set the current value immediately
13957 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition1, VECTOR3_EPSILON, TEST_LOCATION);
13959 application.SendNotification();
13960 application.Render(2u /*just beyond the animation duration*/);
13962 // Build a new animation
13963 Animation animation2 = Animation::New(durationSeconds);
13964 animation2.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition2, AlphaFunction::LINEAR);
13967 application.SendNotification();
13968 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13970 // The event side property should be set the current value immediately
13971 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13973 // Clear the first animation after finished
13974 animation1.Clear();
13976 application.SendNotification();
13977 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
13979 // The property should not be changed.
13980 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
13985 int UtcDaliAnimationPausePropertyValue(void)
13987 const float durationSeconds(1.0f);
13988 unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
13989 const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
13990 const Vector3 halfWayToTarget(targetPosition * 0.5f);
13992 Animation::EndAction endActions[] =
13995 Animation::BAKE_FINAL,
13996 Animation::DISCARD,
13998 const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
14000 // For all end actions, when pausing, we stay at the current value
14001 for(auto i = 0u; i < endActionCount; ++i)
14003 TestApplication application;
14005 Actor actor = Actor::New();
14006 application.GetScene().Add(actor);
14008 // Build the animation
14009 Animation animation = Animation::New(durationSeconds);
14010 animation.SetEndAction(endActions[i]);
14011 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
14013 // Start the animation
14016 application.SendNotification();
14017 application.Render(halfAnimationDuration);
14019 // Puase the animation early
14022 // The event side property should be set the current value immediately, the update side property will still only be halfway
14023 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
14024 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
14026 // After one frame, both values should match regardless of the End Action
14027 application.SendNotification();
14028 application.Render();
14030 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
14031 DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
14037 int UtcDaliAnimationPlayFromWithLoopCount(void)
14039 TestApplication application;
14041 auto actor = Actor::New();
14042 application.GetScene().Add(actor);
14044 auto animation = Animation::New(1.0f);
14045 animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
14046 animation.SetLoopCount(2);
14049 application.SendNotification();
14050 application.Render(1001);
14052 // One loop completed
14054 application.Render(2005);
14055 application.SendNotification();
14057 // 2 loops should have completed
14058 DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
14060 // Another render needs to occur after all the loops end
14061 application.SendNotification();
14062 application.Render(1000);
14064 // Stop the animation and use PlayFrom, previously we got an Assert here
14066 animation.PlayFrom(0.5f);
14068 application.SendNotification();
14069 application.Render(1000);
14071 DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
14076 int UtcDaliAnimationCombineToAndByWithStop(void)
14078 tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
14080 TestApplication application;
14082 auto actor = Actor::New();
14083 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
14084 application.GetScene().Add(actor);
14086 auto animation = Animation::New(1.0f);
14087 const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
14088 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
14089 animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
14092 application.SendNotification();
14093 application.Render(500);
14095 application.SendNotification();
14096 application.Render(500);
14098 application.SendNotification();
14099 application.Render(500);
14101 // Stop and clear the animation using the current values
14105 // Check the y position, it should be the same as before
14106 DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
14111 int UtcDaliAnimationCountAndGetAnimationAt(void)
14113 tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
14115 TestApplication application;
14117 auto actor = Actor::New();
14118 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
14119 application.GetScene().Add(actor);
14121 auto animation = Animation::New(1.0f);
14122 const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
14123 animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
14126 application.SendNotification();
14127 application.Render(500);
14129 uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
14130 DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
14132 DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
14134 Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
14135 DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
14137 DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
14138 DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
14139 DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
14140 DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
14141 DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
14143 // Stop and clear the animation using the current values
14150 int UtcDaliAnimationSetLoopingNegative(void)
14152 TestApplication application;
14153 Dali::Animation instance;
14157 instance.SetLooping(arg1);
14158 DALI_TEST_CHECK(false); // Should not get here
14162 DALI_TEST_CHECK(true); // We expect an assert
14167 int UtcDaliAnimationSetDurationNegative(void)
14169 TestApplication application;
14170 Dali::Animation instance;
14174 instance.SetDuration(arg1);
14175 DALI_TEST_CHECK(false); // Should not get here
14179 DALI_TEST_CHECK(true); // We expect an assert
14184 int UtcDaliAnimationGetLoopCountNegative(void)
14186 TestApplication application;
14187 Dali::Animation instance;
14190 instance.GetLoopCount();
14191 DALI_TEST_CHECK(false); // Should not get here
14195 DALI_TEST_CHECK(true); // We expect an assert
14200 int UtcDaliAnimationSetEndActionNegative(void)
14202 TestApplication application;
14203 Dali::Animation instance;
14206 Dali::Animation::EndAction arg1(Animation::BAKE);
14207 instance.SetEndAction(arg1);
14208 DALI_TEST_CHECK(false); // Should not get here
14212 DALI_TEST_CHECK(true); // We expect an assert
14217 int UtcDaliAnimationSetLoopCountNegative(void)
14219 TestApplication application;
14220 Dali::Animation instance;
14224 instance.SetLoopCount(arg1);
14225 DALI_TEST_CHECK(false); // Should not get here
14229 DALI_TEST_CHECK(true); // We expect an assert
14234 int UtcDaliAnimationSetPlayRangeNegative(void)
14236 TestApplication application;
14237 Dali::Animation instance;
14240 Dali::Vector2 arg1;
14241 instance.SetPlayRange(arg1);
14242 DALI_TEST_CHECK(false); // Should not get here
14246 DALI_TEST_CHECK(true); // We expect an assert
14251 int UtcDaliAnimationAnimateBetweenNegative01(void)
14253 TestApplication application;
14254 Dali::Animation instance;
14258 Dali::Property arg1(actor, Actor::Property::POSITION);
14259 Dali::KeyFrames arg2;
14260 instance.AnimateBetween(arg1, arg2);
14261 DALI_TEST_CHECK(false); // Should not get here
14265 DALI_TEST_CHECK(true); // We expect an assert
14270 int UtcDaliAnimationAnimateBetweenNegative02(void)
14272 TestApplication application;
14273 Dali::Animation instance;
14277 Dali::Property arg1(actor, Actor::Property::POSITION);
14278 Dali::KeyFrames arg2;
14279 Dali::Animation::Interpolation arg3(Animation::LINEAR);
14280 instance.AnimateBetween(arg1, arg2, arg3);
14281 DALI_TEST_CHECK(false); // Should not get here
14285 DALI_TEST_CHECK(true); // We expect an assert
14290 int UtcDaliAnimationAnimateBetweenNegative03(void)
14292 TestApplication application;
14293 Dali::Animation instance;
14297 Dali::Property arg1(actor, Actor::Property::POSITION);
14298 Dali::KeyFrames arg2;
14299 Dali::TimePeriod arg3(1.0f);
14300 instance.AnimateBetween(arg1, arg2, arg3);
14301 DALI_TEST_CHECK(false); // Should not get here
14305 DALI_TEST_CHECK(true); // We expect an assert
14310 int UtcDaliAnimationAnimateBetweenNegative04(void)
14312 TestApplication application;
14313 Dali::Animation instance;
14317 Dali::Property arg1(actor, Actor::Property::POSITION);
14318 Dali::KeyFrames arg2;
14319 Dali::TimePeriod arg3(1.0f);
14320 Dali::Animation::Interpolation arg4(Animation::LINEAR);
14321 instance.AnimateBetween(arg1, arg2, arg3, arg4);
14322 DALI_TEST_CHECK(false); // Should not get here
14326 DALI_TEST_CHECK(true); // We expect an assert
14331 int UtcDaliAnimationAnimateBetweenNegative05(void)
14333 TestApplication application;
14334 Dali::Animation instance;
14338 Dali::Property arg1(actor, Actor::Property::POSITION);
14339 Dali::KeyFrames arg2;
14340 Dali::AlphaFunction arg3;
14341 instance.AnimateBetween(arg1, arg2, arg3);
14342 DALI_TEST_CHECK(false); // Should not get here
14346 DALI_TEST_CHECK(true); // We expect an assert
14351 int UtcDaliAnimationAnimateBetweenNegative06(void)
14353 TestApplication application;
14354 Dali::Animation instance;
14358 Dali::Property arg1(actor, Actor::Property::POSITION);
14359 Dali::KeyFrames arg2;
14360 Dali::AlphaFunction arg3;
14361 Dali::Animation::Interpolation arg4(Animation::LINEAR);
14362 instance.AnimateBetween(arg1, arg2, arg3, arg4);
14363 DALI_TEST_CHECK(false); // Should not get here
14367 DALI_TEST_CHECK(true); // We expect an assert
14372 int UtcDaliAnimationAnimateBetweenNegative07(void)
14374 TestApplication application;
14375 Dali::Animation instance;
14379 Dali::Property arg1(actor, Actor::Property::POSITION);
14380 Dali::KeyFrames arg2;
14381 Dali::AlphaFunction arg3;
14382 Dali::TimePeriod arg4(1.0f);
14383 instance.AnimateBetween(arg1, arg2, arg3, arg4);
14384 DALI_TEST_CHECK(false); // Should not get here
14388 DALI_TEST_CHECK(true); // We expect an assert
14393 int UtcDaliAnimationAnimateBetweenNegative08(void)
14395 TestApplication application;
14396 Dali::Animation instance;
14400 Dali::Property arg1(actor, Actor::Property::POSITION);
14401 Dali::KeyFrames arg2;
14402 Dali::AlphaFunction arg3;
14403 Dali::TimePeriod arg4(1.0f);
14404 Dali::Animation::Interpolation arg5(Animation::LINEAR);
14405 instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
14406 DALI_TEST_CHECK(false); // Should not get here
14410 DALI_TEST_CHECK(true); // We expect an assert
14415 int UtcDaliAnimationFinishedSignalNegative(void)
14417 TestApplication application;
14418 Dali::Animation instance;
14421 instance.FinishedSignal();
14422 DALI_TEST_CHECK(false); // Should not get here
14426 DALI_TEST_CHECK(true); // We expect an assert
14431 int UtcDaliAnimationGetCurrentLoopNegative(void)
14433 TestApplication application;
14434 Dali::Animation instance;
14437 instance.GetCurrentLoop();
14438 DALI_TEST_CHECK(false); // Should not get here
14442 DALI_TEST_CHECK(true); // We expect an assert
14447 int UtcDaliAnimationSetLoopingModeNegative(void)
14449 TestApplication application;
14450 Dali::Animation instance;
14453 Dali::Animation::LoopingMode arg1(Animation::RESTART);
14454 instance.SetLoopingMode(arg1);
14455 DALI_TEST_CHECK(false); // Should not get here
14459 DALI_TEST_CHECK(true); // We expect an assert
14464 int UtcDaliAnimationSetSpeedFactorNegative(void)
14466 TestApplication application;
14467 Dali::Animation instance;
14471 instance.SetSpeedFactor(arg1);
14472 DALI_TEST_CHECK(false); // Should not get here
14476 DALI_TEST_CHECK(true); // We expect an assert
14481 int UtcDaliAnimationGetCurrentProgressNegative(void)
14483 TestApplication application;
14484 Dali::Animation instance;
14487 instance.GetCurrentProgress();
14488 DALI_TEST_CHECK(false); // Should not get here
14492 DALI_TEST_CHECK(true); // We expect an assert
14497 int UtcDaliAnimationSetCurrentProgressNegative(void)
14499 TestApplication application;
14500 Dali::Animation instance;
14504 instance.SetCurrentProgress(arg1);
14505 DALI_TEST_CHECK(false); // Should not get here
14509 DALI_TEST_CHECK(true); // We expect an assert
14514 int UtcDaliAnimationSetDisconnectActionNegative(void)
14516 TestApplication application;
14517 Dali::Animation instance;
14520 Dali::Animation::EndAction arg1(Animation::BAKE);
14521 instance.SetDisconnectAction(arg1);
14522 DALI_TEST_CHECK(false); // Should not get here
14526 DALI_TEST_CHECK(true); // We expect an assert
14531 int UtcDaliAnimationSetDefaultAlphaFunctionNegative(void)
14533 TestApplication application;
14534 Dali::Animation instance;
14537 Dali::AlphaFunction arg1;
14538 instance.SetDefaultAlphaFunction(arg1);
14539 DALI_TEST_CHECK(false); // Should not get here
14543 DALI_TEST_CHECK(true); // We expect an assert
14548 int UtcDaliAnimationHideNegative(void)
14550 TestApplication application;
14551 Dali::Animation instance;
14556 instance.Hide(arg1, arg2);
14557 DALI_TEST_CHECK(false); // Should not get here
14561 DALI_TEST_CHECK(true); // We expect an assert
14566 int UtcDaliAnimationPlayNegative(void)
14568 TestApplication application;
14569 Dali::Animation instance;
14573 DALI_TEST_CHECK(false); // Should not get here
14577 DALI_TEST_CHECK(true); // We expect an assert
14582 int UtcDaliAnimationShowNegative(void)
14584 TestApplication application;
14585 Dali::Animation instance;
14590 instance.Show(arg1, arg2);
14591 DALI_TEST_CHECK(false); // Should not get here
14595 DALI_TEST_CHECK(true); // We expect an assert
14600 int UtcDaliAnimationStopNegative(void)
14602 TestApplication application;
14603 Dali::Animation instance;
14607 DALI_TEST_CHECK(false); // Should not get here
14611 DALI_TEST_CHECK(true); // We expect an assert
14616 int UtcDaliAnimationClearNegative(void)
14618 TestApplication application;
14619 Dali::Animation instance;
14623 DALI_TEST_CHECK(false); // Should not get here
14627 DALI_TEST_CHECK(true); // We expect an assert
14632 int UtcDaliAnimationPauseNegative(void)
14634 TestApplication application;
14635 Dali::Animation instance;
14639 DALI_TEST_CHECK(false); // Should not get here
14643 DALI_TEST_CHECK(true); // We expect an assert
14648 int UtcDaliAnimationAnimateNegative01(void)
14650 TestApplication application;
14651 Dali::Animation instance;
14656 Dali::Vector3 arg3;
14657 instance.Animate(arg1, arg2, arg3);
14658 DALI_TEST_CHECK(false); // Should not get here
14662 DALI_TEST_CHECK(true); // We expect an assert
14667 int UtcDaliAnimationAnimateNegative02(void)
14669 TestApplication application;
14670 Dali::Animation instance;
14675 Dali::Vector3 arg3;
14676 Dali::TimePeriod arg4(1.0f);
14677 instance.Animate(arg1, arg2, arg3, arg4);
14678 DALI_TEST_CHECK(false); // Should not get here
14682 DALI_TEST_CHECK(true); // We expect an assert
14687 int UtcDaliAnimationAnimateNegative03(void)
14689 TestApplication application;
14690 Dali::Animation instance;
14695 Dali::Vector3 arg3;
14696 Dali::AlphaFunction arg4;
14697 instance.Animate(arg1, arg2, arg3, arg4);
14698 DALI_TEST_CHECK(false); // Should not get here
14702 DALI_TEST_CHECK(true); // We expect an assert
14707 int UtcDaliAnimationAnimateNegative04(void)
14709 TestApplication application;
14710 Dali::Animation instance;
14715 Dali::Vector3 arg3;
14716 Dali::AlphaFunction arg4;
14717 Dali::TimePeriod arg5(1.0f);
14718 instance.Animate(arg1, arg2, arg3, arg4, arg5);
14719 DALI_TEST_CHECK(false); // Should not get here
14723 DALI_TEST_CHECK(true); // We expect an assert
14728 int UtcDaliAnimationPlayFromNegative(void)
14730 TestApplication application;
14731 Dali::Animation instance;
14735 instance.PlayFrom(arg1);
14736 DALI_TEST_CHECK(false); // Should not get here
14740 DALI_TEST_CHECK(true); // We expect an assert
14745 int UtcDaliAnimationAnimateByNegative01(void)
14747 TestApplication application;
14748 Dali::Animation instance;
14752 Dali::Property arg1(actor, Actor::Property::POSITION);
14753 Dali::Property::Value arg2;
14754 instance.AnimateBy(arg1, arg2);
14755 DALI_TEST_CHECK(false); // Should not get here
14759 DALI_TEST_CHECK(true); // We expect an assert
14764 int UtcDaliAnimationAnimateByNegative02(void)
14766 TestApplication application;
14767 Dali::Animation instance;
14771 Dali::Property arg1(actor, Actor::Property::POSITION);
14772 Dali::Property::Value arg2;
14773 Dali::TimePeriod arg3(1.0f);
14774 instance.AnimateBy(arg1, arg2, arg3);
14775 DALI_TEST_CHECK(false); // Should not get here
14779 DALI_TEST_CHECK(true); // We expect an assert
14784 int UtcDaliAnimationAnimateByNegative03(void)
14786 TestApplication application;
14787 Dali::Animation instance;
14791 Dali::Property arg1(actor, Actor::Property::POSITION);
14792 Dali::Property::Value arg2;
14793 Dali::AlphaFunction arg3;
14794 instance.AnimateBy(arg1, arg2, arg3);
14795 DALI_TEST_CHECK(false); // Should not get here
14799 DALI_TEST_CHECK(true); // We expect an assert
14804 int UtcDaliAnimationAnimateByNegative04(void)
14806 TestApplication application;
14807 Dali::Animation instance;
14811 Dali::Property arg1(actor, Actor::Property::POSITION);
14812 Dali::Property::Value arg2;
14813 Dali::AlphaFunction arg3;
14814 Dali::TimePeriod arg4(1.0f);
14815 instance.AnimateBy(arg1, arg2, arg3, arg4);
14816 DALI_TEST_CHECK(false); // Should not get here
14820 DALI_TEST_CHECK(true); // We expect an assert
14825 int UtcDaliAnimationAnimateToNegative01(void)
14827 TestApplication application;
14829 Dali::Animation instance;
14832 Dali::Property arg1(actor, Actor::Property::POSITION);
14833 Dali::Property::Value arg2;
14834 instance.AnimateTo(arg1, arg2);
14835 DALI_TEST_CHECK(false); // Should not get here
14839 DALI_TEST_CHECK(true); // We expect an assert
14844 int UtcDaliAnimationAnimateToNegative02(void)
14846 TestApplication application;
14847 Dali::Animation instance;
14851 Dali::Property arg1(actor, Actor::Property::POSITION);
14852 Dali::Property::Value arg2;
14853 Dali::TimePeriod arg3(1.0f);
14854 instance.AnimateTo(arg1, arg2, arg3);
14855 DALI_TEST_CHECK(false); // Should not get here
14859 DALI_TEST_CHECK(true); // We expect an assert
14864 int UtcDaliAnimationAnimateToNegative03(void)
14866 TestApplication application;
14867 Dali::Animation instance;
14871 Dali::Property arg1(actor, Actor::Property::POSITION);
14872 Dali::Property::Value arg2;
14873 Dali::AlphaFunction arg3;
14874 instance.AnimateTo(arg1, arg2, arg3);
14875 DALI_TEST_CHECK(false); // Should not get here
14879 DALI_TEST_CHECK(true); // We expect an assert
14884 int UtcDaliAnimationAnimateToNegative04(void)
14886 TestApplication application;
14887 Dali::Animation instance;
14891 Dali::Property arg1(actor, Actor::Property::POSITION);
14892 Dali::Property::Value arg2;
14893 Dali::AlphaFunction arg3;
14894 Dali::TimePeriod arg4(1.0f);
14895 instance.AnimateTo(arg1, arg2, arg3, arg4);
14896 DALI_TEST_CHECK(false); // Should not get here
14900 DALI_TEST_CHECK(true); // We expect an assert
14905 int UtcDaliAnimationPlayAfterNegative(void)
14907 TestApplication application;
14908 Dali::Animation instance;
14912 instance.PlayAfter(arg1);
14913 DALI_TEST_CHECK(false); // Should not get here
14917 DALI_TEST_CHECK(true); // We expect an assert
14922 int UtcDaliAnimationGetDurationNegative(void)
14924 TestApplication application;
14925 Dali::Animation instance;
14928 instance.GetDuration();
14929 DALI_TEST_CHECK(false); // Should not get here
14933 DALI_TEST_CHECK(true); // We expect an assert
14938 int UtcDaliAnimationGetEndActionNegative(void)
14940 TestApplication application;
14941 Dali::Animation instance;
14944 instance.GetEndAction();
14945 DALI_TEST_CHECK(false); // Should not get here
14949 DALI_TEST_CHECK(true); // We expect an assert
14954 int UtcDaliAnimationGetPlayRangeNegative(void)
14956 TestApplication application;
14957 Dali::Animation instance;
14960 instance.GetPlayRange();
14961 DALI_TEST_CHECK(false); // Should not get here
14965 DALI_TEST_CHECK(true); // We expect an assert
14970 int UtcDaliAnimationGetLoopingModeNegative(void)
14972 TestApplication application;
14973 Dali::Animation instance;
14976 instance.GetLoopingMode();
14977 DALI_TEST_CHECK(false); // Should not get here
14981 DALI_TEST_CHECK(true); // We expect an assert
14986 int UtcDaliAnimationGetSpeedFactorNegative(void)
14988 TestApplication application;
14989 Dali::Animation instance;
14992 instance.GetSpeedFactor();
14993 DALI_TEST_CHECK(false); // Should not get here
14997 DALI_TEST_CHECK(true); // We expect an assert
15002 int UtcDaliAnimationGetDisconnectActionNegative(void)
15004 TestApplication application;
15005 Dali::Animation instance;
15008 instance.GetDisconnectAction();
15009 DALI_TEST_CHECK(false); // Should not get here
15013 DALI_TEST_CHECK(true); // We expect an assert
15018 int UtcDaliAnimationGetDefaultAlphaFunctionNegative(void)
15020 TestApplication application;
15021 Dali::Animation instance;
15024 instance.GetDefaultAlphaFunction();
15025 DALI_TEST_CHECK(false); // Should not get here
15029 DALI_TEST_CHECK(true); // We expect an assert
15034 int UtcDaliAnimationGetStateNegative(void)
15036 TestApplication application;
15037 Dali::Animation instance;
15040 instance.GetState();
15041 DALI_TEST_CHECK(false); // Should not get here
15045 DALI_TEST_CHECK(true); // We expect an assert
15050 int UtcDaliAnimationIsLoopingNegative(void)
15052 TestApplication application;
15053 Dali::Animation instance;
15056 instance.IsLooping();
15057 DALI_TEST_CHECK(false); // Should not get here
15061 DALI_TEST_CHECK(true); // We expect an assert
15066 int UtcDaliKeyFramesAddNegative01(void)
15068 TestApplication application;
15069 Dali::KeyFrames instance;
15073 Dali::Property::Value arg2;
15074 instance.Add(arg1, arg2);
15075 DALI_TEST_CHECK(false); // Should not get here
15079 DALI_TEST_CHECK(true); // We expect an assert
15084 int UtcDaliKeyFramesAddNegative02(void)
15086 TestApplication application;
15087 Dali::KeyFrames instance;
15091 Dali::Property::Value arg2;
15092 Dali::AlphaFunction arg3;
15093 instance.Add(arg1, arg2, arg3);
15094 DALI_TEST_CHECK(false); // Should not get here
15098 DALI_TEST_CHECK(true); // We expect an assert
15103 int UtcDaliKeyFramesGetTypeNegative(void)
15105 TestApplication application;
15106 Dali::KeyFrames instance;
15109 instance.GetType();
15110 DALI_TEST_CHECK(false); // Should not get here
15114 DALI_TEST_CHECK(true); // We expect an assert
15119 int UtcDaliAnimationSetGetBlendPoint(void)
15121 TestApplication application;
15123 Animation animation = Animation::New(1.0f);
15124 DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.0f, 0.01f, TEST_LOCATION);
15126 animation.SetBlendPoint(0.5f);
15128 DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.5f, 0.01f, TEST_LOCATION);
15130 animation.SetBlendPoint(-0.5f);
15132 DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.5f, 0.01f, TEST_LOCATION);
15134 animation.SetBlendPoint(1.5f);
15136 DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.5f, 0.01f, TEST_LOCATION);
15138 animation.SetBlendPoint(0.7f);
15140 DALI_TEST_EQUALS(animation.GetBlendPoint(), 0.7f, 0.01f, TEST_LOCATION);
15145 int UtcDaliAnimationPlayBlendFloatCubic(void)
15147 TestApplication application;
15149 Actor actor = Actor::New();
15150 application.GetScene().Add(actor);
15151 Property::Index index = actor.RegisterProperty("property", 0.0f);
15153 Animation animation = Animation::New(1.0f);
15154 KeyFrames keyframes = KeyFrames::New();
15155 keyframes.Add(0.0f, 3.0f);
15156 keyframes.Add(0.4f, 1.0f);
15157 keyframes.Add(0.6f, 1.0f);
15158 keyframes.Add(1.0f, 3.0f);
15159 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR, Animation::Interpolation::CUBIC);
15161 application.SendNotification();
15162 application.Render(20);
15164 animation.SetBlendPoint(0.5f);
15167 application.SendNotification();
15168 application.Render(250);
15170 float value = actor.GetCurrentProperty<float>(index);
15171 DALI_TEST_EQUALS(value, 0.989258f, 0.05f, TEST_LOCATION); // original value : 1.603516 (Same value as when progress is 0.75.)
15172 // current value : 0.0f
15173 // value when progress is 0.5 : 0.75
15175 application.SendNotification();
15176 application.Render(250);
15178 value = actor.GetCurrentProperty<float>(index);
15179 DALI_TEST_EQUALS(value, 0.750000f, 0.05f, TEST_LOCATION); // value is less than 1.0f
15181 application.SendNotification();
15182 application.Render(250);
15184 value = actor.GetCurrentProperty<float>(index);
15185 DALI_TEST_EQUALS(value, 1.603516f, 0.05f, TEST_LOCATION);
15187 application.SendNotification();
15188 application.Render(250);
15190 value = actor.GetCurrentProperty<float>(index);
15191 DALI_TEST_EQUALS(value, 3.0f, 0.05f, TEST_LOCATION);
15196 int UtcDaliAnimationPlayBlendFloat1(void)
15198 TestApplication application;
15200 Actor actor = Actor::New();
15201 application.GetScene().Add(actor);
15202 Property::Index index = actor.RegisterProperty("property", 0.0f);
15204 Animation animation = Animation::New(1.0f);
15205 KeyFrames keyframes = KeyFrames::New();
15206 keyframes.Add(0.0f, 1.0f);
15207 keyframes.Add(0.2f, 2.0f);
15208 keyframes.Add(0.4f, 3.0f);
15209 keyframes.Add(0.6f, 4.0f);
15210 keyframes.Add(0.8f, 5.0f);
15211 keyframes.Add(1.0f, 6.0f);
15212 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15214 application.SendNotification();
15215 application.Render(20);
15217 animation.SetBlendPoint(0.9f);
15220 application.SendNotification();
15221 application.Render(250);
15223 float value = actor.GetCurrentProperty<float>(index);
15224 DALI_TEST_EQUALS(value, 1.728395f, 0.05f, TEST_LOCATION);
15226 application.SendNotification();
15227 application.Render(250);
15229 value = actor.GetCurrentProperty<float>(index);
15230 DALI_TEST_EQUALS(value, 3.302469f, 0.05f, TEST_LOCATION);
15232 application.SendNotification();
15233 application.Render(250);
15235 value = actor.GetCurrentProperty<float>(index);
15236 DALI_TEST_EQUALS(value, 4.722222f, 0.05f, TEST_LOCATION);
15238 application.SendNotification();
15239 application.Render(250);
15241 value = actor.GetCurrentProperty<float>(index);
15242 DALI_TEST_EQUALS(value, 6.0f, 0.05f, TEST_LOCATION);
15247 int UtcDaliAnimationPlayBlendFloat2(void)
15249 TestApplication application;
15251 Actor actor = Actor::New();
15252 application.GetScene().Add(actor);
15253 Property::Index index = actor.RegisterProperty("property", 0.0f);
15255 Animation animation = Animation::New(1.0f);
15256 KeyFrames keyframes = KeyFrames::New();
15257 keyframes.Add(0.0f, 0.0f);
15258 keyframes.Add(1.0f, 1.0f);
15259 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15261 application.SendNotification();
15262 application.Render(20);
15264 animation.SetBlendPoint(0.5f);
15267 application.SendNotification();
15268 application.Render(250);
15270 float value = actor.GetCurrentProperty<float>(index);
15271 DALI_TEST_EQUALS(value, 0.25f, 0.05f, TEST_LOCATION);
15273 application.SendNotification();
15274 application.Render(250);
15276 value = actor.GetCurrentProperty<float>(index);
15277 DALI_TEST_EQUALS(value, 0.5f, 0.05f, TEST_LOCATION);
15282 int UtcDaliAnimationPlayBlendFloat3(void)
15284 TestApplication application;
15286 Actor actor = Actor::New();
15287 application.GetScene().Add(actor);
15288 Property::Index index = actor.RegisterProperty("property", 0.0f);
15290 Animation animation = Animation::New(1.0f);
15291 KeyFrames keyframes = KeyFrames::New();
15292 keyframes.Add(0.0f, 1.0f);
15293 keyframes.Add(1.0f, 2.0f);
15294 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15296 application.SendNotification();
15297 application.Render(20);
15299 animation.SetBlendPoint(0.5f);
15302 application.SendNotification();
15303 application.Render(250);
15305 float value = actor.GetCurrentProperty<float>(index);
15306 DALI_TEST_EQUALS(value, 1.0f, 0.05f, TEST_LOCATION);
15308 application.SendNotification();
15309 application.Render(250);
15311 value = actor.GetCurrentProperty<float>(index);
15312 DALI_TEST_EQUALS(value, 1.5f, 0.05f, TEST_LOCATION);
15317 int UtcDaliAnimationPlayBlendFloat4(void)
15319 TestApplication application;
15321 Actor actor = Actor::New();
15322 application.GetScene().Add(actor);
15323 Property::Index index = actor.RegisterProperty("property", 0.0f);
15325 Animation animation = Animation::New(1.0f);
15326 KeyFrames keyframes = KeyFrames::New();
15327 keyframes.Add(0.0f, 1.0f);
15328 keyframes.Add(1.0f, 2.0f);
15329 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15331 application.SendNotification();
15332 application.Render(20);
15334 animation.SetBlendPoint(0.5f);
15337 application.SendNotification();
15338 application.Render(250);
15340 float value = actor.GetCurrentProperty<float>(index);
15341 DALI_TEST_EQUALS(value, 1.0f, 0.05f, TEST_LOCATION);
15343 application.SendNotification();
15344 application.Render(250);
15346 value = actor.GetCurrentProperty<float>(index);
15347 DALI_TEST_EQUALS(value, 1.5f, 0.05f, TEST_LOCATION);
15349 application.SendNotification();
15350 application.Render(550);
15352 actor.SetProperty(index, 0.0f);
15355 application.SendNotification();
15356 application.Render(250);
15358 value = actor.GetCurrentProperty<float>(index);
15359 DALI_TEST_EQUALS(value, 1.0f, 0.05f, TEST_LOCATION);
15361 application.SendNotification();
15362 application.Render(250);
15364 value = actor.GetCurrentProperty<float>(index);
15365 DALI_TEST_EQUALS(value, 1.5f, 0.05f, TEST_LOCATION);
15370 int UtcDaliAnimationPlayBlendInt(void)
15372 TestApplication application;
15374 Actor actor = Actor::New();
15375 application.GetScene().Add(actor);
15376 Property::Index index = actor.RegisterProperty("property", 0);
15378 Animation animation = Animation::New(1.0f);
15379 KeyFrames keyframes = KeyFrames::New();
15380 keyframes.Add(0.0f, 100);
15381 keyframes.Add(1.0f, 200);
15382 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15384 application.SendNotification();
15385 application.Render(20);
15387 animation.SetBlendPoint(0.5f);
15390 application.SendNotification();
15391 application.Render(250);
15393 int32_t value = actor.GetCurrentProperty<int32_t>(index);
15394 DALI_TEST_EQUALS(value, 100, TEST_LOCATION);
15396 application.SendNotification();
15397 application.Render(250);
15399 value = actor.GetCurrentProperty<int32_t>(index);
15400 DALI_TEST_EQUALS(value, 150, TEST_LOCATION);
15405 int UtcDaliAnimationPlayBlendVector2(void)
15407 TestApplication application;
15409 Actor actor = Actor::New();
15410 application.GetScene().Add(actor);
15411 Property::Index index = actor.RegisterProperty("property", Vector2::ZERO);
15413 Animation animation = Animation::New(1.0f);
15414 KeyFrames keyframes = KeyFrames::New();
15415 keyframes.Add(0.0f, Vector2::ONE);
15416 keyframes.Add(1.0f, Vector2::ONE * 2.0f);
15417 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15419 application.SendNotification();
15420 application.Render(20);
15422 animation.SetBlendPoint(0.5f);
15425 application.SendNotification();
15426 application.Render(250);
15428 Vector2 value = actor.GetCurrentProperty<Vector2>(index);
15429 DALI_TEST_EQUALS(value, Vector2::ONE, 0.05f, TEST_LOCATION);
15431 application.SendNotification();
15432 application.Render(250);
15434 value = actor.GetCurrentProperty<Vector2>(index);
15435 DALI_TEST_EQUALS(value, Vector2::ONE * 1.5f, 0.05f, TEST_LOCATION);
15440 int UtcDaliAnimationPlayBlendVector3(void)
15442 TestApplication application;
15444 Actor actor = Actor::New();
15445 application.GetScene().Add(actor);
15446 Property::Index index = actor.RegisterProperty("property", Vector3::ZERO);
15448 Animation animation = Animation::New(1.0f);
15449 KeyFrames keyframes = KeyFrames::New();
15450 keyframes.Add(0.0f, Vector3::ONE);
15451 keyframes.Add(1.0f, Vector3::ONE * 2.0f);
15452 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15454 application.SendNotification();
15455 application.Render(20);
15457 animation.SetBlendPoint(0.5f);
15460 application.SendNotification();
15461 application.Render(250);
15463 Vector3 value = actor.GetCurrentProperty<Vector3>(index);
15464 DALI_TEST_EQUALS(value, Vector3::ONE, 0.05f, TEST_LOCATION);
15466 application.SendNotification();
15467 application.Render(250);
15469 value = actor.GetCurrentProperty<Vector3>(index);
15470 DALI_TEST_EQUALS(value, Vector3::ONE * 1.5f, 0.05f, TEST_LOCATION);
15475 int UtcDaliAnimationPlayBlendVector4(void)
15477 TestApplication application;
15479 Actor actor = Actor::New();
15480 application.GetScene().Add(actor);
15481 Property::Index index = actor.RegisterProperty("property", Vector4::ZERO);
15483 Animation animation = Animation::New(1.0f);
15484 KeyFrames keyframes = KeyFrames::New();
15485 keyframes.Add(0.0f, Vector4::ONE);
15486 keyframes.Add(1.0f, Vector4::ONE * 2.0f);
15487 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15489 application.SendNotification();
15490 application.Render(20);
15492 animation.SetBlendPoint(0.5f);
15495 application.SendNotification();
15496 application.Render(250);
15498 Vector4 value = actor.GetCurrentProperty<Vector4>(index);
15499 DALI_TEST_EQUALS(value, Vector4::ONE, 0.05f, TEST_LOCATION);
15501 application.SendNotification();
15502 application.Render(250);
15504 value = actor.GetCurrentProperty<Vector4>(index);
15505 DALI_TEST_EQUALS(value, Vector4::ONE * 1.5f, 0.05f, TEST_LOCATION);
15510 int UtcDaliAnimationPlayBlendQuaternion(void)
15512 TestApplication application;
15514 Actor actor = Actor::New();
15515 application.GetScene().Add(actor);
15516 Property::Index index = actor.RegisterProperty("property", Quaternion(Dali::Radian(0.0f), Vector3::ZAXIS));
15518 Animation animation = Animation::New(1.0f);
15519 KeyFrames keyframes = KeyFrames::New();
15520 keyframes.Add(0.0f, Quaternion(Dali::Radian(1.0f), Vector3::ZAXIS));
15521 keyframes.Add(1.0f, Quaternion(Dali::Radian(2.0f), Vector3::ZAXIS));
15522 animation.AnimateBetween(Property(actor, index), keyframes, AlphaFunction::LINEAR);
15524 application.SendNotification();
15525 application.Render(20);
15527 animation.SetBlendPoint(0.5f);
15530 application.SendNotification();
15531 application.Render(250);
15533 Quaternion value = actor.GetCurrentProperty<Quaternion>(index);
15535 Dali::Radian angle;
15536 DALI_TEST_EQUALS(value.ToAxisAngle(axis, angle), true, TEST_LOCATION);
15537 DALI_TEST_EQUALS(angle.radian, 1.0f, 0.05f, TEST_LOCATION);
15539 application.SendNotification();
15540 application.Render(250);
15542 value = actor.GetCurrentProperty<Quaternion>(index);
15543 DALI_TEST_EQUALS(value.ToAxisAngle(axis, angle), true, TEST_LOCATION);
15544 DALI_TEST_EQUALS(angle.radian, 1.5f, 0.05f, TEST_LOCATION);