2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <dali/public-api/dali-core.h>
23 #include <dali/devel-api/actors/actor-devel.h>
24 #include <dali-test-suite-utils.h>
25 #include <dali/devel-api/animation/animation-devel.h>
30 void utc_dali_animation_startuP(void)
32 test_return_value = TET_UNDEF;
35 void utc_dali_animation_cleanuP(void)
37 test_return_value = TET_PASS;
43 static const float ROTATION_EPSILON = 0.0001f;
44 static const float VECTOR4_EPSILON = 0.0001f;
46 // Functor to test whether a Finish signal is emitted
47 struct AnimationFinishCheck
49 AnimationFinishCheck(bool& signalReceived)
50 : mSignalReceived(signalReceived)
54 void operator()(Animation& animation)
56 mSignalReceived = true;
61 mSignalReceived = false;
64 void CheckSignalReceived()
68 tet_printf("Expected Finish signal was not received\n");
77 void CheckSignalNotReceived()
81 tet_printf("Unexpected Finish signal was received\n");
90 bool& mSignalReceived; // owned by individual tests
93 // Functor to test whether a Progress signal is emitted
94 struct AnimationProgressCheck
96 AnimationProgressCheck(bool& signalReceived, std::string name = " ")
97 : mSignalReceived(signalReceived),
102 void operator()(Animation& animation)
104 mSignalReceived = true;
109 mSignalReceived = false;
112 void CheckSignalReceived()
114 if (!mSignalReceived)
116 tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str() );
117 tet_result(TET_FAIL);
121 tet_result(TET_PASS);
125 void CheckSignalNotReceived()
129 tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
130 tet_result(TET_FAIL);
134 tet_result(TET_PASS);
138 bool& mSignalReceived; // owned by individual tests
144 int UtcDaliAnimationConstructorP(void)
146 TestApplication application;
150 DALI_TEST_CHECK( !animation );
154 int UtcDaliAnimationNewP(void)
156 TestApplication application;
158 Animation animation = Animation::New( 1.0f );
160 DALI_TEST_CHECK(animation);
164 int UtcDaliAnimationNewN(void)
166 TestApplication application;
168 Animation animation = Animation::New( -1.0f );
170 DALI_TEST_CHECK(animation);
171 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
175 int UtcDaliAnimationDownCastP(void)
177 TestApplication application;
179 tet_infoline("Testing Dali::Animation::DownCast()");
181 float durationSeconds(1.0f);
182 Animation animation = Animation::New(durationSeconds);
184 BaseHandle object(animation);
186 Animation animation2 = Animation::DownCast(object);
187 DALI_TEST_CHECK(animation2);
189 Animation animation3 = DownCast< Animation >(object);
190 DALI_TEST_CHECK(animation3);
194 int UtcDaliAnimationDownCastN(void)
196 TestApplication application;
198 BaseHandle unInitializedObject;
200 Animation animation1 = Animation::DownCast( unInitializedObject );
201 DALI_TEST_CHECK( !animation1 );
203 Animation animation2 = DownCast< Animation >( unInitializedObject );
204 DALI_TEST_CHECK( !animation2 );
208 int UtcDaliAnimationCopyConstructorP(void)
210 TestApplication application;
212 // Initialize an object, ref count == 1
213 Animation animation = Animation::New( 1.0f );
215 Animation copy( animation );
216 DALI_TEST_CHECK( copy );
218 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
222 int UtcDaliAnimationAssignmentOperatorP(void)
224 TestApplication application;
226 Animation animation = Animation::New( 1.0f );
228 Animation copy = animation;
229 DALI_TEST_CHECK( copy );
231 DALI_TEST_CHECK( animation == copy );
233 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
237 int UtcDaliAnimationSetDurationP(void)
239 TestApplication application;
241 Actor actor = Actor::New();
242 Stage::GetCurrent().Add(actor);
244 // Build the animation
245 float durationSeconds(1.0f);
246 Animation animation = Animation::New(durationSeconds);
247 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
249 // Start the animation
250 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
251 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
254 bool signalReceived(false);
255 AnimationFinishCheck finishCheck(signalReceived);
256 animation.FinishedSignal().Connect(&application, finishCheck);
258 application.SendNotification();
259 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
261 // We didn't expect the animation to finish yet
262 application.SendNotification();
263 finishCheck.CheckSignalNotReceived();
265 application.Render(2u/*just beyond the animation duration*/);
267 // We did expect the animation to finish
268 application.SendNotification();
269 finishCheck.CheckSignalReceived();
270 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
272 // Restart the animation, with a different duration
274 actor.SetPosition(Vector3::ZERO);
275 durationSeconds = 3.5f;
276 animation.SetDuration(durationSeconds);
277 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
280 application.SendNotification();
281 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
283 // We didn't expect the animation to finish yet
284 application.SendNotification();
285 finishCheck.CheckSignalNotReceived();
287 application.Render(2u/*just beyond the animation duration*/);
289 // We did expect the animation to finish
290 application.SendNotification();
291 finishCheck.CheckSignalReceived();
292 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
294 // Check that nothing has changed after a couple of buffer swaps
295 application.Render(0);
296 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
297 application.Render(0);
298 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
302 int UtcDaliAnimationSetDurationN(void)
304 TestApplication application;
306 Animation animation = Animation::New( 1.0f );
307 DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
309 animation.SetDuration( -1.0f );
310 DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
314 int UtcDaliAnimationGetDurationP(void)
316 TestApplication application;
318 Animation animation = Animation::New(1.0f);
319 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
321 animation.SetDuration(2.0f);
322 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
326 int UtcDaliAnimationSetLoopingP(void)
328 TestApplication application;
330 Actor actor = Actor::New();
331 Stage::GetCurrent().Add(actor);
333 // Build the animation
334 float durationSeconds(1.0f);
335 Animation animation = Animation::New(durationSeconds);
336 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
337 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
339 // Start the animation
340 animation.SetLooping(true);
341 DALI_TEST_CHECK(animation.IsLooping());
344 bool signalReceived(false);
345 AnimationFinishCheck finishCheck(signalReceived);
346 animation.FinishedSignal().Connect(&application, finishCheck);
348 application.SendNotification();
351 float intervalSeconds = 0.25f;
352 float progress = 0.0f;
353 for (int iterations = 0; iterations < 5;)
355 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
357 progress += intervalSeconds;
358 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
360 if (progress >= 1.0f)
362 progress = progress - 1.0f;
367 // We didn't expect the animation to finish yet
368 application.SendNotification();
369 finishCheck.CheckSignalNotReceived();
371 animation.SetLooping(false);
372 DALI_TEST_CHECK(!animation.IsLooping());
374 application.SendNotification();
375 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
377 // We did expect the animation to finish
378 application.SendNotification();
379 finishCheck.CheckSignalReceived();
380 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
382 // Check that nothing has changed after a couple of buffer swaps
383 application.Render(0);
384 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
385 application.Render(0);
386 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
390 int UtcDaliAnimationSetLoopCountP(void)
392 TestApplication application;
394 Actor actor = Actor::New();
395 Stage::GetCurrent().Add(actor);
397 // Build the animation
398 float durationSeconds(1.0f);
399 Animation animation = Animation::New(durationSeconds);
400 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
401 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
403 // Start the animation
404 animation.SetLoopCount(3);
405 DALI_TEST_CHECK(animation.IsLooping());
408 bool signalReceived(false);
409 AnimationFinishCheck finishCheck(signalReceived);
410 animation.FinishedSignal().Connect(&application, finishCheck);
412 application.Render(0);
413 application.SendNotification();
414 application.Render(0);
415 application.SendNotification();
416 application.Render(0);
417 application.SendNotification();
418 application.Render(0);
419 application.SendNotification();
422 float intervalSeconds = 3.0f;
424 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
425 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
427 application.Render(0);
428 application.SendNotification();
429 application.Render(0);
430 application.SendNotification();
431 application.Render(0);
432 application.SendNotification();
433 application.Render(0);
434 application.SendNotification();
435 finishCheck.CheckSignalNotReceived();
437 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
439 application.SendNotification();
440 finishCheck.CheckSignalReceived();
441 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
445 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
446 application.SendNotification();
447 finishCheck.CheckSignalNotReceived();
449 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
450 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
451 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
452 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
453 application.SendNotification();
454 finishCheck.CheckSignalNotReceived();
459 int UtcDaliAnimationSetLoopCountP2(void)
461 TestApplication application;
464 // switching between forever and loop count
467 Actor actor = Actor::New();
468 Stage::GetCurrent().Add(actor);
470 // Build the animation
471 float durationSeconds(1.0f);
472 Animation animation = Animation::New(durationSeconds);
473 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
474 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
475 animation.SetEndAction(Animation::Discard);
477 // Start the animation
478 animation.SetLoopCount(3);
479 DALI_TEST_CHECK(animation.IsLooping());
482 bool signalReceived(false);
483 AnimationFinishCheck finishCheck(signalReceived);
484 animation.FinishedSignal().Connect(&application, finishCheck);
486 float intervalSeconds = 3.0f;
488 application.SendNotification();
489 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
490 application.SendNotification();
491 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
492 application.SendNotification();
493 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
494 application.SendNotification();
496 application.SendNotification();
497 finishCheck.CheckSignalReceived();
502 animation.SetLooping(true);
503 DALI_TEST_CHECK(animation.IsLooping());
505 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
506 application.SendNotification();
507 finishCheck.CheckSignalNotReceived();
509 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
510 application.SendNotification();
511 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
512 application.SendNotification();
513 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
514 application.SendNotification();
515 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
516 application.SendNotification();
517 application.SendNotification();
518 finishCheck.CheckSignalNotReceived();
523 animation.SetLoopCount(3);
524 DALI_TEST_CHECK(animation.IsLooping());
527 application.SendNotification();
528 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
529 application.SendNotification();
530 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
531 application.SendNotification();
532 finishCheck.CheckSignalNotReceived();
534 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
535 application.SendNotification();
536 finishCheck.CheckSignalReceived();
541 animation.SetLooping(true);
542 DALI_TEST_CHECK(animation.IsLooping());
544 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
545 application.SendNotification();
546 finishCheck.CheckSignalNotReceived();
548 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
549 application.SendNotification();
550 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
551 application.SendNotification();
552 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
553 application.SendNotification();
554 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
555 application.SendNotification();
556 finishCheck.CheckSignalNotReceived();
561 animation.SetLoopCount(3);
562 DALI_TEST_CHECK(animation.IsLooping());
564 application.SendNotification();
565 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
566 application.SendNotification();
567 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
568 application.SendNotification();
569 finishCheck.CheckSignalNotReceived();
571 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
572 application.SendNotification();
573 finishCheck.CheckSignalNotReceived(); // we never hit play
581 int UtcDaliAnimationSetLoopCountP3(void)
583 TestApplication application;
586 // switching between forever and loop count
588 Actor actor = Actor::New();
589 Stage::GetCurrent().Add(actor);
591 // Build the animation
592 float durationSeconds(1.0f);
593 Animation animation = Animation::New(durationSeconds);
594 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
595 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
596 animation.SetEndAction(Animation::Discard);
598 float intervalSeconds = 3.0f;
600 bool signalReceived(false);
601 AnimationFinishCheck finishCheck(signalReceived);
602 animation.FinishedSignal().Connect(&application, finishCheck);
605 animation.SetLooping(true);
606 DALI_TEST_CHECK(animation.IsLooping());
608 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
609 application.SendNotification();
610 finishCheck.CheckSignalNotReceived();
612 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
613 application.SendNotification();
614 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
615 application.SendNotification();
616 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
617 application.SendNotification();
618 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
619 application.SendNotification();
620 finishCheck.CheckSignalNotReceived();
625 animation.SetLoopCount(3);
626 DALI_TEST_CHECK(animation.IsLooping());
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();
635 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
636 application.SendNotification();
637 finishCheck.CheckSignalNotReceived(); // we never hit play
645 int UtcDaliAnimationSetLoopCountP4(void)
647 TestApplication application;
652 Actor actor = Actor::New();
653 Stage::GetCurrent().Add(actor);
655 // Build the animation
656 float durationSeconds(1.0f);
657 Animation animation = Animation::New(durationSeconds);
658 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
659 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
660 animation.SetEndAction(Animation::Bake);
662 float intervalSeconds = 3.0f;
664 bool signalReceived(false);
665 AnimationFinishCheck finishCheck(signalReceived);
666 animation.FinishedSignal().Connect(&application, finishCheck);
668 animation.SetLoopCount(1);
670 DALI_TEST_CHECK(!animation.IsLooping());
672 application.SendNotification();
673 finishCheck.CheckSignalNotReceived();
674 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
675 application.SendNotification();
676 finishCheck.CheckSignalReceived();
678 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
679 actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
683 animation.Play(); // again
684 DALI_TEST_CHECK(!animation.IsLooping());
686 application.SendNotification();
687 finishCheck.CheckSignalNotReceived();
688 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
689 application.SendNotification();
690 finishCheck.CheckSignalReceived();
692 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
697 int UtcDaliAnimationGetLoopCountP(void)
699 TestApplication application;
701 Actor actor = Actor::New();
702 Stage::GetCurrent().Add(actor);
704 // Build the animation
705 float durationSeconds(1.0f);
706 Animation animation = Animation::New(durationSeconds);
707 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
708 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
710 DALI_TEST_CHECK(1 == animation.GetLoopCount());
712 // Start the animation
713 animation.SetLoopCount(3);
714 DALI_TEST_CHECK(animation.IsLooping());
715 DALI_TEST_CHECK(3 == animation.GetLoopCount());
719 application.Render(0);
720 application.SendNotification();
723 float intervalSeconds = 3.0f;
725 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
726 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
728 application.Render(0);
729 application.SendNotification();
731 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
732 application.SendNotification();
734 animation.SetLoopCount(0);
735 DALI_TEST_CHECK(animation.IsLooping());
736 DALI_TEST_CHECK(0 == animation.GetLoopCount());
738 animation.SetLoopCount(1);
739 DALI_TEST_CHECK(!animation.IsLooping());
740 DALI_TEST_CHECK(1 == animation.GetLoopCount());
746 int UtcDaliAnimationGetCurrentLoopP(void)
748 TestApplication application;
750 Actor actor = Actor::New();
751 Stage::GetCurrent().Add(actor);
753 // Build the animation
754 float durationSeconds(1.0f);
755 Animation animation = Animation::New(durationSeconds);
756 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
757 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
759 // Start the animation
760 animation.SetLoopCount(3);
761 DALI_TEST_CHECK(animation.IsLooping());
762 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
765 bool signalReceived(false);
766 AnimationFinishCheck finishCheck(signalReceived);
767 animation.FinishedSignal().Connect(&application, finishCheck);
769 application.SendNotification();
772 float intervalSeconds = 3.0f;
774 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
775 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
777 application.SendNotification();
778 finishCheck.CheckSignalNotReceived();
779 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
781 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
783 application.SendNotification();
784 finishCheck.CheckSignalReceived();
785 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
786 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
790 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
791 application.SendNotification();
792 finishCheck.CheckSignalNotReceived();
793 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
795 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
796 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
797 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
798 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
799 application.SendNotification();
800 finishCheck.CheckSignalNotReceived();
801 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
806 int UtcDaliAnimationIsLoopingP(void)
808 TestApplication application;
810 Animation animation = Animation::New(1.0f);
811 DALI_TEST_CHECK(!animation.IsLooping());
813 animation.SetLooping(true);
814 DALI_TEST_CHECK(animation.IsLooping());
818 int UtcDaliAnimationSetEndActioN(void)
820 TestApplication application;
822 Actor actor = Actor::New();
823 Stage::GetCurrent().Add(actor);
825 // Build the animation
826 float durationSeconds(1.0f);
827 Animation animation = Animation::New(durationSeconds);
828 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
830 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
831 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
833 // Start the animation
836 bool signalReceived(false);
837 AnimationFinishCheck finishCheck(signalReceived);
838 animation.FinishedSignal().Connect(&application, finishCheck);
840 application.SendNotification();
841 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
843 // We did expect the animation to finish
844 application.SendNotification();
845 finishCheck.CheckSignalReceived();
846 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
848 // Go back to the start
849 actor.SetPosition(Vector3::ZERO);
850 application.SendNotification();
851 application.Render(0);
852 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
854 // Test BakeFinal, animate again, for half the duration
856 animation.SetEndAction(Animation::BakeFinal);
857 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
860 application.SendNotification();
861 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
863 // Stop the animation early
866 // We did NOT expect the animation to finish
867 application.SendNotification();
868 finishCheck.CheckSignalNotReceived();
869 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
871 // The position should be same with target position in the next frame
872 application.Render(0);
873 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
875 // Go back to the start
876 actor.SetPosition(Vector3::ZERO);
877 application.SendNotification();
878 application.Render(0);
879 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
881 // Test EndAction::Discard, animate again, but don't bake this time
883 animation.SetEndAction(Animation::Discard);
884 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
887 application.SendNotification();
888 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
890 // We did expect the animation to finish
891 application.SendNotification();
892 finishCheck.CheckSignalReceived();
893 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
895 // The position should be discarded in the next frame
896 application.Render(0);
897 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
899 // Check that nothing has changed after a couple of buffer swaps
900 application.Render(0);
901 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
902 application.Render(0);
903 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
907 int UtcDaliAnimationGetEndActionP(void)
909 TestApplication application;
911 Animation animation = Animation::New(1.0f);
912 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
914 animation.SetEndAction(Animation::Discard);
915 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
917 animation.SetEndAction(Animation::BakeFinal);
918 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
923 int UtcDaliAnimationSetDisconnectActionP(void)
925 TestApplication application;
926 Stage stage( Stage::GetCurrent() );
928 // Default: BakeFinal
930 Actor actor = Actor::New();
933 // Build the animation
934 float durationSeconds(1.0f);
935 Animation animation = Animation::New(durationSeconds);
936 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
938 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
939 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
941 // Start the animation
944 application.SendNotification();
945 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
949 application.SendNotification();
950 application.Render();
952 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
957 Actor actor = Actor::New();
960 // Build the animation
961 float durationSeconds(1.0f);
962 Animation animation = Animation::New(durationSeconds);
963 animation.SetDisconnectAction( Animation::Bake );
965 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
966 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
968 // Start the animation
971 application.SendNotification();
972 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
976 application.SendNotification();
977 application.Render();
979 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
984 Actor actor = Actor::New();
987 // Build the animation
988 float durationSeconds(1.0f);
989 Animation animation = Animation::New(durationSeconds);
990 animation.SetDisconnectAction( Animation::Discard );
992 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
993 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
995 // Start the animation
998 application.SendNotification();
999 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1003 application.SendNotification();
1004 application.Render();
1006 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
1009 // Don't play the animation: disconnect action should not be applied
1011 Actor actor = Actor::New();
1014 // Build the animation
1015 float durationSeconds(1.0f);
1016 Animation animation = Animation::New(durationSeconds);
1018 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1019 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1021 application.SendNotification();
1022 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1026 application.SendNotification();
1027 application.Render();
1029 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
1035 int UtcDaliAnimationGetDisconnectActionP(void)
1037 TestApplication application;
1038 Animation animation = Animation::New(1.0f);
1039 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
1041 animation.SetDisconnectAction(Animation::Discard);
1042 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
1044 animation.SetDisconnectAction(Animation::Bake);
1045 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
1050 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1052 TestApplication application;
1054 Animation animation = Animation::New(1.0f);
1055 AlphaFunction func = animation.GetDefaultAlphaFunction();
1056 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1058 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1059 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1060 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1064 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1066 TestApplication application;
1068 Animation animation = Animation::New(1.0f);
1069 AlphaFunction func = animation.GetDefaultAlphaFunction();
1071 // Test that the default is linear
1072 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1074 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1075 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1076 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1081 int UtcDaliAnimationSetCurrentProgressP(void)
1083 TestApplication application;
1085 Actor actor = Actor::New();
1086 Stage::GetCurrent().Add(actor);
1088 // Build the animation
1089 Animation animation = Animation::New(0.0f);
1092 float durationSeconds(1.0f);
1093 animation.SetDuration(durationSeconds);
1095 bool signalReceived(false);
1096 AnimationFinishCheck finishCheck(signalReceived);
1097 animation.FinishedSignal().Connect(&application, finishCheck);
1098 application.SendNotification();
1100 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1101 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1103 // Start the animation from 40% progress
1104 animation.SetCurrentProgress( 0.4f );
1107 application.SendNotification();
1108 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1110 // We didn't expect the animation to finish yet
1111 application.SendNotification();
1112 finishCheck.CheckSignalNotReceived();
1113 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1114 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1116 animation.Play(); // Test that calling play has no effect, when animation is already playing
1117 application.SendNotification();
1119 //Set the progress to 70%
1120 animation.SetCurrentProgress( 0.7f );
1121 application.SendNotification();
1122 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1123 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1125 application.SendNotification();
1126 finishCheck.CheckSignalNotReceived();
1127 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1128 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1130 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1131 // We did expect the animation to finish
1132 application.SendNotification();
1133 finishCheck.CheckSignalReceived();
1134 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1136 // Check that nothing has changed after a couple of buffer swaps
1137 application.Render(0);
1138 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1139 application.Render(0);
1140 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1144 int UtcDaliAnimationSetCurrentProgressN(void)
1146 TestApplication application;
1148 Actor actor = Actor::New();
1149 Stage::GetCurrent().Add(actor);
1151 // Build the animation
1152 Animation animation = Animation::New(0.0f);
1155 float durationSeconds(1.0f);
1156 animation.SetDuration(durationSeconds);
1158 bool signalReceived(false);
1159 AnimationFinishCheck finishCheck(signalReceived);
1160 animation.FinishedSignal().Connect(&application, finishCheck);
1161 application.SendNotification();
1163 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1164 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1166 //Trying to set the current cursor outside the range [0..1] is ignored
1167 animation.SetCurrentProgress( -1.0f);
1168 application.SendNotification();
1169 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1171 animation.SetCurrentProgress( 100.0f);
1172 application.SendNotification();
1173 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1177 int UtcDaliAnimationGetCurrentProgressP(void)
1179 TestApplication application;
1181 Actor actor = Actor::New();
1182 Stage::GetCurrent().Add(actor);
1184 // Build the animation
1185 Animation animation = Animation::New(0.0f);
1188 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1189 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1191 animation.SetCurrentProgress( 0.5f );
1192 application.SendNotification();
1193 application.Render(static_cast<unsigned int>(100.0f));
1195 //Progress should still be 0.0
1196 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1199 float durationSeconds(1.0f);
1200 animation.SetDuration(durationSeconds);
1201 application.SendNotification();
1203 bool signalReceived(false);
1204 AnimationFinishCheck finishCheck(signalReceived);
1205 animation.FinishedSignal().Connect(&application, finishCheck);
1206 application.SendNotification();
1208 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1209 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1211 // Start the animation from 40% progress
1212 animation.SetCurrentProgress( 0.4f );
1215 application.SendNotification();
1216 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1218 // We didn't expect the animation to finish yet
1219 application.SendNotification();
1220 finishCheck.CheckSignalNotReceived();
1221 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1223 animation.Play(); // Test that calling play has no effect, when animation is already playing
1224 application.SendNotification();
1226 //Set the progress to 70%
1227 animation.SetCurrentProgress( 0.7f );
1228 application.SendNotification();
1229 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1230 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1232 application.SendNotification();
1233 finishCheck.CheckSignalNotReceived();
1234 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1236 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1237 // We did expect the animation to finish
1238 application.SendNotification();
1239 finishCheck.CheckSignalReceived();
1243 int UtcDaliAnimationSetSpeedFactorP1(void)
1245 TestApplication application;
1247 tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1249 Actor actor = Actor::New();
1250 Stage::GetCurrent().Add(actor);
1252 // Build the animation
1253 float durationSeconds(1.0f);
1254 Animation animation = Animation::New(durationSeconds);
1256 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1257 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1259 KeyFrames keyframes = KeyFrames::New();
1260 keyframes.Add( 0.0f, initialPosition);
1261 keyframes.Add( 1.0f, targetPosition );
1262 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1264 //Set speed to be x2
1265 animation.SetSpeedFactor(2.0f);
1267 // Start the animation
1270 bool signalReceived(false);
1271 AnimationFinishCheck finishCheck(signalReceived);
1272 animation.FinishedSignal().Connect(&application, finishCheck);
1274 application.SendNotification();
1275 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1277 // We didn't expect the animation to finish yet
1278 application.SendNotification();
1279 finishCheck.CheckSignalNotReceived();
1280 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1282 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1284 // We didn't expect the animation to finish yet
1285 application.SendNotification();
1286 finishCheck.CheckSignalNotReceived();
1287 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1289 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1291 // We did expect the animation to finish
1292 application.SendNotification();
1293 finishCheck.CheckSignalReceived();
1294 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1296 // Check that nothing has changed after a couple of buffer swaps
1297 application.Render(0);
1298 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1299 application.Render(0);
1300 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1305 int UtcDaliAnimationSetSpeedFactorP2(void)
1307 TestApplication application;
1309 Actor actor = Actor::New();
1310 Stage::GetCurrent().Add(actor);
1312 // Build the animation
1313 float durationSeconds(1.0f);
1314 Animation animation = Animation::New(durationSeconds);
1316 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1317 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1319 KeyFrames keyframes = KeyFrames::New();
1320 keyframes.Add( 0.0f, initialPosition);
1321 keyframes.Add( 1.0f, targetPosition );
1322 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1324 tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1325 animation.SetSpeedFactor( -1.0f );
1327 // Start the animation
1330 bool signalReceived(false);
1331 AnimationFinishCheck finishCheck(signalReceived);
1332 animation.FinishedSignal().Connect(&application, finishCheck);
1334 application.SendNotification();
1335 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1337 // We didn't expect the animation to finish yet
1338 application.SendNotification();
1339 finishCheck.CheckSignalNotReceived();
1340 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1342 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1344 // We didn't expect the animation to finish yet
1345 application.SendNotification();
1346 finishCheck.CheckSignalNotReceived();
1347 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
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.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1356 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1358 // We didn't expect the animation to finish yet
1359 application.SendNotification();
1360 finishCheck.CheckSignalNotReceived();
1361 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1363 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1365 // We did expect the animation to finish
1366 application.SendNotification();
1367 finishCheck.CheckSignalReceived();
1368 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1370 // Check that nothing has changed after a couple of buffer swaps
1371 application.Render(0);
1372 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1373 application.Render(0);
1374 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1379 int UtcDaliAnimationSetSpeedFactorP3(void)
1381 TestApplication application;
1383 Actor actor = Actor::New();
1384 Stage::GetCurrent().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 bool signalReceived(false);
1399 AnimationFinishCheck finishCheck(signalReceived);
1400 animation.FinishedSignal().Connect(&application, finishCheck);
1402 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1404 //Set speed to be half of normal speed
1405 animation.SetSpeedFactor( 0.5f );
1407 // Start the animation
1410 application.SendNotification();
1411 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1413 // We didn't expect the animation to finish yet
1414 application.SendNotification();
1415 finishCheck.CheckSignalNotReceived();
1416 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1418 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1420 // We didn't expect the animation to finish yet
1421 application.SendNotification();
1422 finishCheck.CheckSignalNotReceived();
1423 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1425 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1427 // We didn't expect the animation to finish yet
1428 application.SendNotification();
1429 finishCheck.CheckSignalNotReceived();
1430 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1432 application.SendNotification();
1433 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1435 // We didn't expect the animation to finish yet
1436 application.SendNotification();
1437 finishCheck.CheckSignalNotReceived();
1438 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1440 application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1442 // We did expect the animation to finish
1443 application.SendNotification();
1444 finishCheck.CheckSignalReceived();
1445 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1447 // Check that nothing has changed after a couple of buffer swaps
1448 application.Render(0);
1449 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1450 application.Render(0);
1451 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1456 int UtcDaliAnimationSetSpeedFactorP4(void)
1458 TestApplication application;
1460 Actor actor = Actor::New();
1461 Stage::GetCurrent().Add(actor);
1463 // Build the animation
1464 float durationSeconds(1.0f);
1465 Animation animation = Animation::New(durationSeconds);
1467 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1468 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1470 KeyFrames keyframes = KeyFrames::New();
1471 keyframes.Add( 0.0f, initialPosition);
1472 keyframes.Add( 1.0f, targetPosition );
1473 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1475 bool signalReceived(false);
1476 AnimationFinishCheck finishCheck(signalReceived);
1477 animation.FinishedSignal().Connect(&application, finishCheck);
1479 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1481 tet_printf("Set speed to be half of normal speed\n");
1482 tet_printf("SetSpeedFactor(0.5f)\n");
1483 animation.SetSpeedFactor( 0.5f );
1485 // Start the animation
1488 application.SendNotification();
1489 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1491 // We didn't expect the animation to finish yet
1492 application.SendNotification();
1493 finishCheck.CheckSignalNotReceived();
1494 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1496 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1498 // We didn't expect the animation to finish yet
1499 application.SendNotification();
1500 finishCheck.CheckSignalNotReceived();
1501 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1503 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1505 // We didn't expect the animation to finish yet
1506 application.SendNotification();
1507 finishCheck.CheckSignalNotReceived();
1508 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1510 tet_printf("Reverse direction of animation whilst playing\n");
1511 tet_printf("SetSpeedFactor(-0.5f)\n");
1512 animation.SetSpeedFactor(-0.5f);
1514 application.SendNotification();
1515 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1517 // We didn't expect the animation to finish yet
1518 application.SendNotification();
1519 finishCheck.CheckSignalNotReceived();
1520 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1522 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1524 // We didn't expect the animation to finish yet
1525 application.SendNotification();
1526 finishCheck.CheckSignalNotReceived();
1527 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1529 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1531 // We did expect the animation to finish
1532 application.SendNotification();
1533 finishCheck.CheckSignalReceived();
1534 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1536 // Check that nothing has changed after a couple of buffer swaps
1537 application.Render(0);
1538 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1539 application.Render(0);
1540 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1544 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1546 TestApplication application;
1548 const unsigned int NUM_FRAMES(15);
1556 float expected[NUM_FRAMES];
1559 TestData testData[] = {
1561 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1562 /* |----------PlayRange---------------| */
1564 { 0.0f, 1.0f, // TimePeriod
1565 0.0f, 100.0f, // POS
1566 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1567 /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1578 // ACTOR 1 - Across start of range
1579 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1580 /* |----------PlayRange---------------| */
1582 { 0.2f, 0.5f, // TimePeriod
1583 20.0f, 50.0f, // POS
1584 {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1585 /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1595 // ACTOR 2 - Across end of range
1596 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1597 /* |----------PlayRange---------------| */
1599 {/**/ 0.5f, 0.9f, // TimePeriod
1600 /**/ 50.0f, 90.0f, // POS
1601 { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1602 /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1611 // ACTOR 3 - Before beginning of range
1612 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1613 /* |----------PlayRange---------------| */
1615 {/**/ 0.1f, 0.25f, // TimePeriod
1616 /**/ 10.0f, 25.0f, // POS
1618 /**/ 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f
1623 // ACTOR 4 - After end of range
1624 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1625 /* |----------PlayRange---------------| */
1627 {/**/ 0.85f, 1.0f, // TimePeriod
1628 /**/ 85.0f, 100.0f, // POS
1630 /**/ 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f
1634 // Actor 5 - Middle of range
1635 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1636 /* |----------PlayRange---------------| */
1638 {/**/ 0.4f, 0.65f, // Time Period
1639 /**/ 40.0f, 65.0f, // Position
1640 { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1641 /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1652 const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1654 // Build the animation
1655 float durationSeconds(1.0f);
1656 Animation animation = Animation::New(durationSeconds);
1657 bool signalReceived(false);
1658 AnimationFinishCheck finishCheck(signalReceived);
1659 animation.FinishedSignal().Connect(&application, finishCheck);
1661 std::vector<Dali::Actor> actors;
1663 for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1665 Actor actor = Actor::New();
1666 actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
1667 actors.push_back(actor);
1668 Stage::GetCurrent().Add(actor);
1670 if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1672 KeyFrames keyframes = KeyFrames::New();
1673 keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1674 keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1675 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1679 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1683 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1684 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1685 tet_printf("SetSpeedFactor(0.5f)\n");
1686 animation.SetSpeedFactor( 0.5f );
1687 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1688 animation.SetLooping(true);
1690 // Start the animation
1692 application.SendNotification();
1693 application.Render(0); // Frame 0 tests initial values
1695 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1697 unsigned int actorIndex = 0u;
1698 for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1700 DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1701 if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
1703 tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1709 tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1710 tet_printf("SetSpeedFactor(-0.5f)\n");
1711 animation.SetSpeedFactor(-0.5f);
1712 application.SendNotification();
1714 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1716 // We didn't expect the animation to finish yet
1717 application.SendNotification();
1718 finishCheck.CheckSignalNotReceived();
1724 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1726 TestApplication application;
1728 const unsigned int NUM_FRAMES(15);
1736 float expected[NUM_FRAMES];
1741 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1742 /* |----------PlayRange---------------| */
1743 { 0.0f, 1.0f, // TimePeriod
1744 0.0f, 100.0f, // POS
1745 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1746 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1747 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1753 // Build the animation
1754 float durationSeconds(1.0f);
1755 Animation animation = Animation::New(durationSeconds);
1756 bool signalReceived(false);
1757 AnimationFinishCheck finishCheck(signalReceived);
1758 animation.FinishedSignal().Connect(&application, finishCheck);
1760 std::vector<Dali::Actor> actors;
1762 Actor actor = Actor::New();
1763 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1764 actors.push_back(actor);
1765 Stage::GetCurrent().Add(actor);
1767 KeyFrames keyframes = KeyFrames::New();
1768 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1769 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1770 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1772 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1773 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1774 tet_printf("SetSpeedFactor(0.5f)\n");
1775 tet_printf("SetLoopCount(3)\n");
1776 animation.SetSpeedFactor( 0.5f );
1777 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1778 animation.SetLoopCount(3);
1780 // Start the animation
1782 application.SendNotification();
1783 application.Render(0); // Frame 0 tests initial values
1785 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1787 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1789 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1791 if( frame < NUM_FRAMES-1 )
1793 // We didn't expect the animation to finish yet
1794 application.SendNotification();
1795 finishCheck.CheckSignalNotReceived();
1799 // We did expect the animation to finish
1800 application.SendNotification();
1801 finishCheck.CheckSignalReceived();
1802 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
1807 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1809 TestApplication application;
1811 const unsigned int NUM_FRAMES(15);
1819 float expected[NUM_FRAMES];
1824 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1825 /* |----------PlayRange---------------| */
1826 { 0.0f, 1.0f, // TimePeriod
1827 0.0f, 100.0f, // POS
1828 {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1829 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1830 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1835 // Build the animation
1836 float durationSeconds(1.0f);
1837 Animation animation = Animation::New(durationSeconds);
1838 bool signalReceived(false);
1839 AnimationFinishCheck finishCheck(signalReceived);
1840 animation.FinishedSignal().Connect(&application, finishCheck);
1842 std::vector<Dali::Actor> actors;
1844 Actor actor = Actor::New();
1845 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1846 actors.push_back(actor);
1847 Stage::GetCurrent().Add(actor);
1849 KeyFrames keyframes = KeyFrames::New();
1850 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1851 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1852 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1854 tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1855 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1856 tet_printf("SetSpeedFactor(-0.5f)\n");
1857 tet_printf("SetLoopCount(3)\n");
1858 animation.SetSpeedFactor( -0.5f );
1859 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1860 animation.SetLoopCount(3);
1862 // Start the animation
1864 application.SendNotification();
1865 application.Render(0); // Frame 0 tests initial values
1867 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1869 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1871 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1873 if( frame < NUM_FRAMES-1 )
1875 // We didn't expect the animation to finish yet
1876 application.SendNotification();
1877 finishCheck.CheckSignalNotReceived();
1881 // We did expect the animation to finish
1882 application.SendNotification();
1883 finishCheck.CheckSignalReceived();
1884 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
1890 int UtcDaliAnimationGetSpeedFactorP(void)
1892 TestApplication application;
1894 Animation animation = Animation::New(1.0f);
1895 animation.SetSpeedFactor(0.5f);
1896 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1898 animation.SetSpeedFactor(-2.5f);
1899 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1903 int UtcDaliAnimationSetPlayRangeP(void)
1905 TestApplication application;
1907 Actor actor = Actor::New();
1908 Stage::GetCurrent().Add( actor );
1910 // Build the animation
1911 float durationSeconds( 1.0f );
1912 Animation animation = Animation::New( durationSeconds );
1914 bool signalReceived( false );
1915 AnimationFinishCheck finishCheck( signalReceived );
1916 animation.FinishedSignal().Connect( &application, finishCheck );
1917 application.SendNotification();
1919 // Set range between 0.4 and 0.8
1920 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1921 application.SendNotification();
1922 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1924 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1925 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1927 // Start the animation from 40% progress
1930 application.SendNotification();
1931 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1933 // We didn't expect the animation to finish yet
1934 application.SendNotification();
1935 finishCheck.CheckSignalNotReceived();
1936 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1938 application.SendNotification();
1939 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1941 application.SendNotification();
1942 finishCheck.CheckSignalNotReceived();
1943 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1945 application.SendNotification();
1946 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1948 // We did expect the animation to finish
1949 application.SendNotification();
1950 finishCheck.CheckSignalReceived();
1951 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1955 int UtcDaliAnimationSetPlayRangeN(void)
1957 TestApplication application;
1959 Actor actor = Actor::New();
1960 Stage::GetCurrent().Add(actor);
1962 // Build the animation
1963 Animation animation = Animation::New(0);
1964 application.SendNotification();
1966 //PlayRange out of bounds
1967 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1968 application.SendNotification();
1969 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1970 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1971 application.SendNotification();
1972 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1974 //If playRange is not in the correct order it has to be ordered
1975 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1976 application.SendNotification();
1977 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1982 int UtcDaliAnimationGetPlayRangeP(void)
1984 TestApplication application;
1986 Actor actor = Actor::New();
1987 Stage::GetCurrent().Add( actor );
1989 // Build the animation
1990 Animation animation = Animation::New( 1.0f );
1991 application.SendNotification();
1993 //If PlayRange not specified it should be 0.0-1.0 by default
1994 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1996 // Set range between 0.4 and 0.8
1997 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1998 application.SendNotification();
1999 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
2004 int UtcDaliAnimationPlayP(void)
2006 TestApplication application;
2008 Actor actor = Actor::New();
2009 Stage::GetCurrent().Add(actor);
2011 // Build the animation
2012 float durationSeconds(1.0f);
2013 Animation animation = Animation::New(durationSeconds);
2014 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2015 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2017 // Start the animation
2020 bool signalReceived(false);
2021 AnimationFinishCheck finishCheck(signalReceived);
2022 animation.FinishedSignal().Connect(&application, finishCheck);
2024 application.SendNotification();
2025 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2027 // We didn't expect the animation to finish yet
2028 application.SendNotification();
2029 finishCheck.CheckSignalNotReceived();
2030 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2032 animation.Play(); // Test that calling play has no effect, when animation is already playing
2033 application.SendNotification();
2034 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2036 // We didn't expect the animation to finish yet
2037 application.SendNotification();
2038 finishCheck.CheckSignalNotReceived();
2039 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2041 animation.Play(); // Test that calling play has no effect, when animation is already playing
2042 application.SendNotification();
2043 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2045 // We didn't expect the animation to finish yet
2046 application.SendNotification();
2047 finishCheck.CheckSignalNotReceived();
2048 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2050 animation.Play(); // Test that calling play has no effect, when animation is already playing
2051 application.SendNotification();
2052 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2054 // We didn't expect the animation to finish yet
2055 application.SendNotification();
2056 finishCheck.CheckSignalNotReceived();
2057 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2059 animation.Play(); // Test that calling play has no effect, when animation is already playing
2060 application.SendNotification();
2061 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2063 // We did expect the animation to finish
2064 application.SendNotification();
2065 finishCheck.CheckSignalReceived();
2066 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2068 // Check that nothing has changed after a couple of buffer swaps
2069 application.Render(0);
2070 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2071 application.Render(0);
2072 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2076 int UtcDaliAnimationPlayOffStageDiscardP(void)
2078 // Test that an animation can be played, when the actor is off-stage.
2079 // When the actor is added to the stage, it should appear at the current position
2080 // i.e. where it would have been anyway, if on-stage from the beginning.
2082 TestApplication application;
2084 Actor actor = Actor::New();
2085 Vector3 basePosition(Vector3::ZERO);
2086 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2087 // Not added to the stage yet!
2089 // Build the animation
2090 float durationSeconds(1.0f);
2091 Animation animation = Animation::New(durationSeconds);
2092 animation.SetDisconnectAction( Animation::Discard );
2093 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2094 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2096 // Start the animation
2099 bool signalReceived(false);
2100 AnimationFinishCheck finishCheck(signalReceived);
2101 animation.FinishedSignal().Connect(&application, finishCheck);
2103 application.SendNotification();
2104 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2106 // We didn't expect the animation to finish yet
2107 application.SendNotification();
2108 finishCheck.CheckSignalNotReceived();
2109 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
2112 Stage::GetCurrent().Add(actor);
2114 application.SendNotification();
2115 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2117 // We didn't expect the animation to finish yet
2118 application.SendNotification();
2119 finishCheck.CheckSignalNotReceived();
2120 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2122 // Remove from the stage
2123 Stage::GetCurrent().Remove(actor);
2125 application.SendNotification();
2126 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2128 // We didn't expect the animation to finish yet
2129 application.SendNotification();
2130 finishCheck.CheckSignalNotReceived();
2131 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position as disconnect behaviour is discard*/, TEST_LOCATION );
2132 // Check that nothing has changed after a couple of buffer swaps
2133 application.Render(0);
2134 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
2135 application.Render(0);
2136 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
2137 application.Render(0);
2138 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
2141 Stage::GetCurrent().Add(actor);
2143 application.SendNotification();
2144 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2146 // We didn't expect the animation to finish yet
2147 application.SendNotification();
2148 finishCheck.CheckSignalNotReceived();
2149 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(80,80,80), TEST_LOCATION );
2151 application.SendNotification();
2152 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2154 // We did expect the animation to finish
2155 application.SendNotification();
2156 finishCheck.CheckSignalReceived();
2157 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2159 // Check that nothing has changed after a couple of buffer swaps
2160 application.Render(0);
2161 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2164 application.Render(0);
2165 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2169 int UtcDaliAnimationPlayOffStageBakeFinalP(void)
2171 // Test that an animation can be played, when the actor is off-stage.
2172 // When the actor is added to the stage, it should appear at the current position
2173 // i.e. where it would have been anyway, if on-stage from the beginning.
2175 TestApplication application;
2177 Actor actor = Actor::New();
2178 Vector3 basePosition(Vector3::ZERO);
2179 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2180 // Not added to the stage!
2182 // Build the animation
2183 float durationSeconds(1.0f);
2184 Animation animation = Animation::New(durationSeconds);
2185 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2186 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2188 // Start the animation
2191 bool signalReceived(false);
2192 AnimationFinishCheck finishCheck(signalReceived);
2193 animation.FinishedSignal().Connect(&application, finishCheck);
2195 application.SendNotification();
2196 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2198 // We didn't expect the animation to finish yet
2199 application.SendNotification();
2200 finishCheck.CheckSignalNotReceived();
2201 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
2204 Stage::GetCurrent().Add(actor);
2206 application.SendNotification();
2207 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2209 // We didn't expect the animation to finish yet
2210 application.SendNotification();
2211 finishCheck.CheckSignalNotReceived();
2212 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2214 // Remove from the stage
2215 Stage::GetCurrent().Remove(actor);
2217 application.SendNotification();
2218 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2220 // We didn't expect the animation to finish yet
2221 application.SendNotification();
2222 finishCheck.CheckSignalNotReceived();
2223 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition /*bake final*/, TEST_LOCATION );
2226 Stage::GetCurrent().Add(actor);
2228 application.SendNotification();
2229 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2231 // We didn't expect the animation to finish yet
2232 application.SendNotification();
2233 finishCheck.CheckSignalNotReceived();
2234 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition /*bake final removed the */, TEST_LOCATION );
2236 application.SendNotification();
2237 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2239 // We did expect the animation to finish
2240 application.SendNotification();
2241 finishCheck.CheckSignalReceived();
2242 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2244 // Check that nothing has changed after a couple of buffer swaps
2245 application.Render(0);
2246 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2248 application.Render(0);
2249 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2253 int UtcDaliAnimationPlayOffStageBakeP(void)
2255 // Test that an animation can be played, when the actor is off-stage.
2256 // When the actor is added to the stage, it should appear at the current position
2257 // i.e. where it would have been anyway, if on-stage from the beginning.
2259 TestApplication application;
2261 Actor actor = Actor::New();
2262 Vector3 basePosition(Vector3::ZERO);
2263 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2264 // Not added to the stage!
2266 // Build the animation
2267 float durationSeconds(1.0f);
2268 Animation animation = Animation::New(durationSeconds);
2269 animation.SetDisconnectAction( Animation::Bake );
2270 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2271 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2273 // Start the animation
2276 bool signalReceived(false);
2277 AnimationFinishCheck finishCheck(signalReceived);
2278 animation.FinishedSignal().Connect(&application, finishCheck);
2280 application.SendNotification();
2281 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2283 // We didn't expect the animation to finish yet
2284 application.SendNotification();
2285 finishCheck.CheckSignalNotReceived();
2286 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
2289 Stage::GetCurrent().Add(actor);
2291 application.SendNotification();
2292 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2294 // We didn't expect the animation to finish yet
2295 application.SendNotification();
2296 finishCheck.CheckSignalNotReceived();
2297 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2299 // Remove from the stage
2300 Stage::GetCurrent().Remove(actor); // baked here
2302 application.SendNotification();
2303 // this render is a no-op in this case as animator is disabled while off stage
2304 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2305 // We didn't expect the animation to finish yet
2306 application.SendNotification();
2307 finishCheck.CheckSignalNotReceived();
2308 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40) /*baked value*/, TEST_LOCATION );
2310 // Add back to the stage
2311 Stage::GetCurrent().Add(actor);
2313 application.SendNotification();
2314 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2315 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION );
2316 application.Render(static_cast<unsigned int>(0.0f) );
2317 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2318 application.Render(static_cast<unsigned int>(0.0f) );
2319 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2321 // Remove from the stage
2322 Stage::GetCurrent().Remove(actor); // baked here
2324 application.SendNotification();
2325 // this render is a no-op in this case as animator is disabled while off stage
2326 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2327 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2328 application.Render(static_cast<unsigned int>(0.0f) );
2329 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2330 application.Render(static_cast<unsigned int>(0.0f) );
2331 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2333 // Add back to the stage
2334 Stage::GetCurrent().Add(actor);
2336 // We didn't expect the animation to finish yet
2337 application.SendNotification();
2338 finishCheck.CheckSignalNotReceived();
2339 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) , TEST_LOCATION );
2341 application.SendNotification();
2342 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2344 // We did expect the animation to finish
2345 application.SendNotification();
2346 finishCheck.CheckSignalReceived();
2347 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2349 // Check that nothing has changed after a couple of buffer swaps
2350 application.Render(0);
2351 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2353 application.Render(0);
2354 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2358 int UtcDaliAnimationPlayDiscardHandleP(void)
2360 TestApplication application;
2362 Actor actor = Actor::New();
2363 Stage::GetCurrent().Add(actor);
2365 // Build the animation
2366 float durationSeconds(1.0f);
2367 Animation animation = Animation::New(durationSeconds);
2368 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2369 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2371 bool signalReceived(false);
2372 AnimationFinishCheck finishCheck(signalReceived);
2373 animation.FinishedSignal().Connect(&application, finishCheck);
2375 // Start the animation
2378 // This is a test of the "Fire and Forget" behaviour
2379 // Discard the animation handle!
2381 DALI_TEST_CHECK( !animation );
2383 application.SendNotification();
2384 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2386 // We didn't expect the animation to finish yet
2387 application.SendNotification();
2388 finishCheck.CheckSignalNotReceived();
2389 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2391 application.SendNotification();
2392 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2394 // We didn't expect the animation to finish yet
2395 application.SendNotification();
2396 finishCheck.CheckSignalNotReceived();
2397 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2399 application.SendNotification();
2400 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2402 // We didn't expect the animation to finish yet
2403 application.SendNotification();
2404 finishCheck.CheckSignalNotReceived();
2405 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2407 application.SendNotification();
2408 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2410 // We didn't expect the animation to finish yet
2411 application.SendNotification();
2412 finishCheck.CheckSignalNotReceived();
2413 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2415 application.SendNotification();
2416 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2418 // We did expect the animation to finish
2419 application.SendNotification();
2420 finishCheck.CheckSignalReceived();
2421 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2423 // Check that nothing has changed after a couple of buffer swaps
2424 application.Render(0);
2425 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2426 application.Render(0);
2427 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2431 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2433 TestApplication application;
2435 Actor actor = Actor::New();
2436 Stage::GetCurrent().Add(actor);
2438 // Build the animation
2439 float durationSeconds(1.0f);
2440 Animation animation = Animation::New(durationSeconds);
2441 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2442 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2444 // Start the animation
2447 bool signalReceived(false);
2448 AnimationFinishCheck finishCheck(signalReceived);
2449 animation.FinishedSignal().Connect(&application, finishCheck);
2451 application.SendNotification();
2452 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2454 // We didn't expect the animation to finish yet
2455 application.SendNotification();
2456 finishCheck.CheckSignalNotReceived();
2457 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2459 // This is a test of the "Fire and Forget" behaviour
2460 // Stop the animation, and Discard the animation handle!
2463 DALI_TEST_CHECK( !animation );
2465 application.SendNotification();
2466 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2468 // We expect the animation to finish at 20% progress
2469 application.SendNotification();
2470 finishCheck.CheckSignalReceived();
2471 finishCheck.Reset();
2472 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2474 application.SendNotification();
2475 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2477 // Check that nothing has changed
2478 application.SendNotification();
2479 finishCheck.CheckSignalNotReceived();
2480 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2482 application.SendNotification();
2483 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2485 // Check that nothing has changed
2486 application.SendNotification();
2487 finishCheck.CheckSignalNotReceived();
2488 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2490 application.SendNotification();
2491 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2493 // Check that nothing has changed
2494 application.SendNotification();
2495 finishCheck.CheckSignalNotReceived();
2496 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2500 int UtcDaliAnimationPlayRangeP(void)
2502 TestApplication application;
2504 Actor actor = Actor::New();
2505 Stage::GetCurrent().Add(actor);
2507 // Build the animation
2508 float durationSeconds(1.0f);
2509 Animation animation = Animation::New(durationSeconds);
2510 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2511 KeyFrames keyframes = KeyFrames::New();
2512 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2513 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2515 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2517 // Set range between 0.4 and 0.8
2518 animation.SetPlayRange( Vector2(0.4f,0.8f) );
2521 bool signalReceived(false);
2522 AnimationFinishCheck finishCheck(signalReceived);
2523 animation.FinishedSignal().Connect(&application, finishCheck);
2525 //Test that setting progress outside the range doesn't work
2526 animation.SetCurrentProgress( 0.9f );
2527 application.SendNotification();
2528 application.Render(0);
2529 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2530 animation.SetCurrentProgress( 0.2f );
2531 application.SendNotification();
2532 application.Render(0);
2533 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2535 application.SendNotification();
2536 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2538 // We didn't expect the animation to finish yet
2539 application.SendNotification();
2540 finishCheck.CheckSignalNotReceived();
2541 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2543 animation.Play(); // Test that calling play has no effect, when animation is already playing
2544 application.SendNotification();
2545 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2547 // We did expect the animation to finish
2548 application.SendNotification();
2549 finishCheck.CheckSignalReceived();
2550 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2552 // Check that nothing has changed after a couple of buffer swaps
2553 application.Render(0);
2554 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2555 application.Render(0);
2556 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2559 //Loop inside the range
2560 finishCheck.Reset();
2561 animation.SetLooping( true );
2563 application.SendNotification();
2564 float intervalSeconds = 0.1f;
2565 float progress = 0.4f;
2566 for (int iterations = 0; iterations < 10; ++iterations )
2568 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2570 progress += intervalSeconds;
2571 if (progress > 0.8f)
2573 progress = progress - 0.4f;
2576 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2579 // We didn't expect the animation to finish yet
2580 application.SendNotification();
2581 finishCheck.CheckSignalNotReceived();
2584 //Test change range on the fly
2585 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2586 application.SendNotification();
2588 for (int iterations = 0; iterations < 10; ++iterations )
2590 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2592 progress += intervalSeconds;
2593 if (progress > 0.9f)
2595 progress = progress - 0.7f;
2598 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2604 int UtcDaliAnimationPlayFromP(void)
2606 TestApplication application;
2608 Actor actor = Actor::New();
2609 Stage::GetCurrent().Add(actor);
2611 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2613 // Build the animation
2614 float durationSeconds(1.0f);
2615 Animation animation = Animation::New(durationSeconds);
2616 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2617 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2619 // Start the animation from 40% progress
2620 animation.PlayFrom( 0.4f );
2622 // Target value should be updated straight away
2623 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2625 bool signalReceived(false);
2626 AnimationFinishCheck finishCheck(signalReceived);
2627 animation.FinishedSignal().Connect(&application, finishCheck);
2629 application.SendNotification();
2630 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2632 // We didn't expect the animation to finish yet
2633 application.SendNotification();
2634 finishCheck.CheckSignalNotReceived();
2635 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2637 animation.Play(); // Test that calling play has no effect, when animation is already playing
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.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2646 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2647 // We did expect the animation to finish
2648 application.SendNotification();
2649 finishCheck.CheckSignalReceived();
2650 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2652 // Check that nothing has changed after a couple of buffer swaps
2653 application.Render(0);
2654 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2655 application.Render(0);
2656 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2660 int UtcDaliAnimationPlayFromN(void)
2662 TestApplication application;
2664 Actor actor = Actor::New();
2665 Stage::GetCurrent().Add(actor);
2667 // Build the animation
2668 float durationSeconds(1.0f);
2669 Animation animation = Animation::New(durationSeconds);
2670 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2671 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2673 //PlayFrom with an argument outside the range [0..1] will be ignored
2674 animation.PlayFrom(-1.0f);
2675 application.SendNotification();
2676 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2678 animation.PlayFrom(100.0f);
2679 application.SendNotification();
2680 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2684 int UtcDaliAnimationPauseP(void)
2686 TestApplication application;
2688 Actor actor = Actor::New();
2689 Stage::GetCurrent().Add(actor);
2691 // Build the animation
2692 float durationSeconds(1.0f);
2693 Animation animation = Animation::New(durationSeconds);
2694 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2695 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2697 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2699 // Start the animation
2702 bool signalReceived(false);
2703 AnimationFinishCheck finishCheck(signalReceived);
2704 animation.FinishedSignal().Connect(&application, finishCheck);
2706 application.SendNotification();
2707 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2709 // We didn't expect the animation to finish yet
2710 application.SendNotification();
2711 finishCheck.CheckSignalNotReceived();
2712 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2714 // Pause the animation
2716 application.SendNotification();
2719 for (int i=0; i<5; ++i)
2721 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2723 // We didn't expect the animation to finish yet
2724 application.SendNotification();
2725 finishCheck.CheckSignalNotReceived();
2726 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2731 application.SendNotification();
2732 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2734 // We didn't expect the animation to finish yet
2735 application.SendNotification();
2736 finishCheck.CheckSignalNotReceived();
2738 application.SendNotification();
2739 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2741 // We did expect the animation to finish
2742 application.SendNotification();
2743 finishCheck.CheckSignalReceived();
2744 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2746 // Check that nothing has changed after a couple of buffer swaps
2747 application.Render(0);
2748 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2749 application.Render(0);
2750 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2755 int UtcDaliAnimationGetStateP(void)
2757 TestApplication application;
2759 Actor actor = Actor::New();
2760 Stage::GetCurrent().Add(actor);
2762 // Build the animation
2763 float durationSeconds(1.0f);
2764 Animation animation = Animation::New(durationSeconds);
2765 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2766 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2767 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2769 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2771 // Start the animation
2774 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2776 bool signalReceived(false);
2777 AnimationFinishCheck finishCheck(signalReceived);
2778 animation.FinishedSignal().Connect(&application, finishCheck);
2780 application.SendNotification();
2781 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2783 // We didn't expect the animation to finish yet
2784 application.SendNotification();
2785 finishCheck.CheckSignalNotReceived();
2786 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2787 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2789 // Pause the animation
2791 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2792 application.SendNotification();
2793 application.Render(0.f);
2796 for (int i=0; i<5; ++i)
2798 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2800 // We didn't expect the animation to finish yet
2801 application.SendNotification();
2802 finishCheck.CheckSignalNotReceived();
2803 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2804 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2808 finishCheck.Reset();
2810 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2811 application.SendNotification();
2812 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2813 // We didn't expect the animation to finish yet
2814 application.SendNotification();
2815 finishCheck.CheckSignalNotReceived();
2816 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2818 application.SendNotification();
2819 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2821 // We did expect the animation to finish
2822 application.SendNotification();
2823 finishCheck.CheckSignalReceived();
2824 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2825 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2827 // Check that nothing has changed after a couple of buffer swaps
2828 application.Render(0);
2829 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2830 application.Render(0);
2831 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2832 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2835 finishCheck.Reset();
2837 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2838 application.SendNotification();
2839 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2840 application.SendNotification();
2841 finishCheck.CheckSignalNotReceived();
2842 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2848 int UtcDaliAnimationStopP(void)
2850 TestApplication application;
2852 Actor actor = Actor::New();
2853 Stage::GetCurrent().Add(actor);
2855 // Build the animation
2856 float durationSeconds(1.0f);
2857 Animation animation = Animation::New(durationSeconds);
2858 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2859 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2861 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2863 // Start the animation
2866 bool signalReceived(false);
2867 AnimationFinishCheck finishCheck(signalReceived);
2868 animation.FinishedSignal().Connect(&application, finishCheck);
2870 application.SendNotification();
2871 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2873 // We didn't expect the animation to finish yet
2874 application.SendNotification();
2875 finishCheck.CheckSignalNotReceived();
2876 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2878 // Stop the animation
2880 application.SendNotification();
2883 for (int i=0; i<5; ++i)
2885 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2887 // We did expect the animation to finish
2888 application.SendNotification();
2889 finishCheck.CheckSignalReceived();
2890 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2895 int UtcDaliAnimationStopSetPositionP(void)
2897 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2898 // i.e. to check that the animation does not interfere with the position set.
2900 TestApplication application;
2902 Actor actor = Actor::New();
2903 Stage::GetCurrent().Add(actor);
2905 // Build the animation
2906 float durationSeconds(1.0f);
2907 Animation animation = Animation::New(durationSeconds);
2908 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2909 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2911 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2913 // Start the animation
2916 bool signalReceived(false);
2917 AnimationFinishCheck finishCheck(signalReceived);
2918 animation.FinishedSignal().Connect(&application, finishCheck);
2920 application.SendNotification();
2921 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2923 // We didn't expect the animation to finish yet
2924 application.SendNotification();
2925 finishCheck.CheckSignalNotReceived();
2926 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2928 // Stop the animation
2930 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2931 actor.SetPosition(positionSet);
2932 application.SendNotification();
2935 for (int i=0; i<5; ++i)
2937 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2939 // We did expect the animation to finish
2940 application.SendNotification();
2941 finishCheck.CheckSignalReceived();
2942 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2947 int UtcDaliAnimationClearP(void)
2949 TestApplication application;
2951 Actor actor = Actor::New();
2952 Stage::GetCurrent().Add(actor);
2954 // Build the animation
2955 float durationSeconds(1.0f);
2956 Animation animation = Animation::New(durationSeconds);
2957 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2958 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2960 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2962 // Start the animation
2965 bool signalReceived(false);
2966 AnimationFinishCheck finishCheck(signalReceived);
2967 animation.FinishedSignal().Connect(&application, finishCheck);
2969 application.SendNotification();
2970 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2972 // We didn't expect the animation to finish yet
2973 application.SendNotification();
2974 finishCheck.CheckSignalNotReceived();
2975 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2977 // Clear the animation
2979 application.SendNotification();
2981 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2983 // We don't expect the animation to finish now
2984 application.SendNotification();
2985 finishCheck.CheckSignalNotReceived();
2986 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2988 // Restart as a scale animation; this should not move the actor's position
2989 finishCheck.Reset();
2990 actor.SetPosition(Vector3::ZERO);
2991 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2992 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2995 application.SendNotification();
2996 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2998 // We didn't expect the animation to finish yet
2999 application.SendNotification();
3000 finishCheck.CheckSignalNotReceived();
3001 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3002 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
3004 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3006 // We did expect the animation to finish
3007 application.SendNotification();
3008 finishCheck.CheckSignalReceived();
3009 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3010 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
3014 int UtcDaliAnimationFinishedSignalP(void)
3016 TestApplication application;
3018 // Start the empty animation
3019 float durationSeconds(1.0f);
3020 Animation animation = Animation::New(durationSeconds);
3023 bool signalReceived(false);
3024 AnimationFinishCheck finishCheck(signalReceived);
3025 animation.FinishedSignal().Connect(&application, finishCheck);
3027 application.SendNotification();
3028 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
3030 // We did expect the animation to finish
3031 application.SendNotification();
3032 finishCheck.CheckSignalReceived();
3036 int UtcDaliAnimationAnimateByBooleanP(void)
3038 TestApplication application;
3040 Actor actor = Actor::New();
3042 // Register a boolean property
3043 bool startValue(false);
3044 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3045 Stage::GetCurrent().Add(actor);
3046 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3047 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3049 // Build the animation
3050 float durationSeconds(2.0f);
3051 Animation animation = Animation::New(durationSeconds);
3052 const bool relativeValue(true);
3053 const bool finalValue( false || relativeValue );
3054 animation.AnimateBy(Property(actor, index), relativeValue);
3056 // Start the animation
3059 // Target value should be retrievable straight away
3060 DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
3062 bool signalReceived(false);
3063 AnimationFinishCheck finishCheck(signalReceived);
3064 animation.FinishedSignal().Connect(&application, finishCheck);
3066 application.SendNotification();
3067 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3069 // We didn't expect the animation to finish yet
3070 application.SendNotification();
3071 finishCheck.CheckSignalNotReceived();
3072 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3074 application.SendNotification();
3075 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3077 // We did expect the animation to finish
3078 application.SendNotification();
3079 finishCheck.CheckSignalReceived();
3080 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3082 // Check that nothing has changed after a couple of buffer swaps
3083 application.Render(0);
3084 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3085 application.Render(0);
3086 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3088 // Repeat with relative value "false" - this should be an NOOP
3089 animation = Animation::New(durationSeconds);
3090 bool noOpValue(false);
3091 animation.AnimateBy(Property(actor, index), noOpValue);
3093 // Start the animation
3096 finishCheck.Reset();
3097 animation.FinishedSignal().Connect(&application, finishCheck);
3099 application.SendNotification();
3100 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3102 // We didn't expect the animation to finish yet
3103 application.SendNotification();
3104 finishCheck.CheckSignalNotReceived();
3105 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3107 application.SendNotification();
3108 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3110 // We did expect the animation to finish
3111 application.SendNotification();
3112 finishCheck.CheckSignalReceived();
3113 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3115 // Check that nothing has changed after a couple of buffer swaps
3116 application.Render(0);
3117 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3118 application.Render(0);
3119 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3123 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3125 TestApplication application;
3127 Actor actor = Actor::New();
3129 // Register a boolean property
3130 bool startValue(false);
3131 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3132 Stage::GetCurrent().Add(actor);
3133 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3134 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3136 // Build the animation
3137 float durationSeconds(2.0f);
3138 Animation animation = Animation::New(durationSeconds);
3139 bool relativeValue(true);
3140 bool finalValue( false || relativeValue );
3141 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3143 // Start the animation
3146 bool signalReceived(false);
3147 AnimationFinishCheck finishCheck(signalReceived);
3148 animation.FinishedSignal().Connect(&application, finishCheck);
3150 application.SendNotification();
3151 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3153 // We didn't expect the animation to finish yet
3154 application.SendNotification();
3155 finishCheck.CheckSignalNotReceived();
3156 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3158 application.SendNotification();
3159 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3161 // We did expect the animation to finish
3162 application.SendNotification();
3163 finishCheck.CheckSignalReceived();
3164 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3166 // Check that nothing has changed after a couple of buffer swaps
3167 application.Render(0);
3168 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3169 application.Render(0);
3170 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3172 // Repeat with relative value "false" - this should be an NOOP
3173 animation = Animation::New(durationSeconds);
3174 bool noOpValue(false);
3175 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3177 // Start the animation
3180 finishCheck.Reset();
3181 animation.FinishedSignal().Connect(&application, finishCheck);
3183 application.SendNotification();
3184 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3186 // We didn't expect the animation to finish yet
3187 application.SendNotification();
3188 finishCheck.CheckSignalNotReceived();
3189 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3191 application.SendNotification();
3192 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3194 // We did expect the animation to finish
3195 application.SendNotification();
3196 finishCheck.CheckSignalReceived();
3197 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3201 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3203 TestApplication application;
3205 Actor actor = Actor::New();
3207 // Register a boolean property
3208 bool startValue(false);
3209 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3210 Stage::GetCurrent().Add(actor);
3211 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3212 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3214 // Build the animation
3215 float durationSeconds(2.0f);
3216 Animation animation = Animation::New(durationSeconds);
3217 bool relativeValue(true);
3218 bool finalValue( false || relativeValue );
3219 float animatorDurationSeconds(durationSeconds * 0.5f);
3220 animation.AnimateBy( Property(actor, index),
3222 TimePeriod( animatorDurationSeconds ) );
3224 // Start the animation
3227 bool signalReceived(false);
3228 AnimationFinishCheck finishCheck(signalReceived);
3229 animation.FinishedSignal().Connect(&application, finishCheck);
3231 application.SendNotification();
3232 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3234 // We didn't expect the animation to finish yet
3235 application.SendNotification();
3236 finishCheck.CheckSignalNotReceived();
3237 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3239 application.SendNotification();
3240 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3242 // We didn't expect the animation to finish yet...
3243 application.SendNotification();
3244 finishCheck.CheckSignalNotReceived();
3246 // ...however we should have reached the final value
3247 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3249 application.SendNotification();
3250 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3252 // We did expect the animation to finish
3253 application.SendNotification();
3254 finishCheck.CheckSignalReceived();
3255 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3257 // Check that nothing has changed after a couple of buffer swaps
3258 application.Render(0);
3259 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3260 application.Render(0);
3261 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3265 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3267 TestApplication application;
3269 Actor actor = Actor::New();
3271 // Register a boolean property
3272 bool startValue(false);
3273 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3274 Stage::GetCurrent().Add(actor);
3275 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3276 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3278 // Build the animation
3279 float durationSeconds(2.0f);
3280 Animation animation = Animation::New(durationSeconds);
3281 bool relativeValue(true);
3282 bool finalValue( false || relativeValue );
3283 float animatorDurationSeconds(durationSeconds * 0.5f);
3284 animation.AnimateBy( Property(actor, index),
3286 AlphaFunction::EASE_IN_OUT,
3287 TimePeriod( animatorDurationSeconds ) );
3289 // Start the animation
3292 bool signalReceived(false);
3293 AnimationFinishCheck finishCheck(signalReceived);
3294 animation.FinishedSignal().Connect(&application, finishCheck);
3296 application.SendNotification();
3297 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3299 // We didn't expect the animation to finish yet
3300 application.SendNotification();
3301 finishCheck.CheckSignalNotReceived();
3302 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3304 application.SendNotification();
3305 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3307 // We didn't expect the animation to finish yet...
3308 application.SendNotification();
3309 finishCheck.CheckSignalNotReceived();
3311 // ...however we should have reached the final value
3312 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3314 application.SendNotification();
3315 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3317 // We did expect the animation to finish
3318 application.SendNotification();
3319 finishCheck.CheckSignalReceived();
3320 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3322 // Check that nothing has changed after a couple of buffer swaps
3323 application.Render(0);
3324 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3325 application.Render(0);
3326 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3330 int UtcDaliAnimationAnimateByFloatP(void)
3332 TestApplication application;
3334 Actor actor = Actor::New();
3336 // Register a float property
3337 float startValue(10.0f);
3338 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3339 Stage::GetCurrent().Add(actor);
3340 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3341 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3343 // Build the animation
3344 float durationSeconds(2.0f);
3345 Animation animation = Animation::New(durationSeconds);
3346 float targetValue(50.0f);
3347 float relativeValue(targetValue - startValue);
3348 animation.AnimateBy(Property(actor, index), relativeValue);
3350 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3352 // Start the animation
3355 // Target value should be retrievable straight away
3356 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3358 bool signalReceived(false);
3359 AnimationFinishCheck finishCheck(signalReceived);
3360 animation.FinishedSignal().Connect(&application, finishCheck);
3362 application.SendNotification();
3363 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3365 // We didn't expect the animation to finish yet
3366 application.SendNotification();
3367 finishCheck.CheckSignalNotReceived();
3368 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3370 application.SendNotification();
3371 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3373 // We did expect the animation to finish
3374 application.SendNotification();
3375 finishCheck.CheckSignalReceived();
3376 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3378 // Check that nothing has changed after a couple of buffer swaps
3379 application.Render(0);
3380 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3381 application.Render(0);
3382 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3386 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3388 TestApplication application;
3390 Actor actor = Actor::New();
3392 // Register a float property
3393 float startValue(10.0f);
3394 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3395 Stage::GetCurrent().Add(actor);
3396 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3397 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3399 // Build the animation
3400 float durationSeconds(1.0f);
3401 Animation animation = Animation::New(durationSeconds);
3402 float targetValue(90.0f);
3403 float relativeValue(targetValue - startValue);
3404 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3406 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3408 // Start the animation
3411 bool signalReceived(false);
3412 AnimationFinishCheck finishCheck(signalReceived);
3413 animation.FinishedSignal().Connect(&application, finishCheck);
3415 application.SendNotification();
3416 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3418 // We didn't expect the animation to finish yet
3419 application.SendNotification();
3420 finishCheck.CheckSignalNotReceived();
3422 // The position should have moved more, than with a linear alpha function
3423 float current( actor.GetCurrentProperty< float >( index ) );
3424 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3426 application.SendNotification();
3427 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3429 // We did expect the animation to finish
3430 application.SendNotification();
3431 finishCheck.CheckSignalReceived();
3432 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3434 // Check that nothing has changed after a couple of buffer swaps
3435 application.Render(0);
3436 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3437 application.Render(0);
3438 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3442 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3444 TestApplication application;
3446 Actor actor = Actor::New();
3448 // Register a float property
3449 float startValue(10.0f);
3450 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3451 Stage::GetCurrent().Add(actor);
3452 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3453 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3455 // Build the animation
3456 float durationSeconds(1.0f);
3457 Animation animation = Animation::New(durationSeconds);
3458 float targetValue(30.0f);
3459 float relativeValue(targetValue - startValue);
3461 animation.AnimateBy(Property(actor, index),
3463 TimePeriod(delay, durationSeconds - delay));
3465 // Start the animation
3468 bool signalReceived(false);
3469 AnimationFinishCheck finishCheck(signalReceived);
3470 animation.FinishedSignal().Connect(&application, finishCheck);
3472 application.SendNotification();
3473 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3475 // We didn't expect the animation to finish yet
3476 application.SendNotification();
3477 finishCheck.CheckSignalNotReceived();
3478 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3480 application.SendNotification();
3481 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3483 // We didn't expect the animation to finish yet
3484 application.SendNotification();
3485 finishCheck.CheckSignalNotReceived();
3486 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3488 application.SendNotification();
3489 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3491 // We did expect the animation to finish
3492 application.SendNotification();
3493 finishCheck.CheckSignalReceived();
3494 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3496 // Check that nothing has changed after a couple of buffer swaps
3497 application.Render(0);
3498 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3499 application.Render(0);
3500 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3504 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3506 TestApplication application;
3508 Actor actor = Actor::New();
3510 // Register a float property
3511 float startValue(10.0f);
3512 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3513 Stage::GetCurrent().Add(actor);
3514 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3515 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3517 // Build the animation
3518 float durationSeconds(1.0f);
3519 Animation animation = Animation::New(durationSeconds);
3520 float targetValue(30.0f);
3521 float relativeValue(targetValue - startValue);
3523 animation.AnimateBy(Property(actor, index),
3525 AlphaFunction::LINEAR,
3526 TimePeriod(delay, durationSeconds - delay));
3528 // Start the animation
3531 bool signalReceived(false);
3532 AnimationFinishCheck finishCheck(signalReceived);
3533 animation.FinishedSignal().Connect(&application, finishCheck);
3535 application.SendNotification();
3536 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3538 // We didn't expect the animation to finish yet
3539 application.SendNotification();
3540 finishCheck.CheckSignalNotReceived();
3541 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3543 application.SendNotification();
3544 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3546 // We didn't expect the animation to finish yet
3547 application.SendNotification();
3548 finishCheck.CheckSignalNotReceived();
3549 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3551 application.SendNotification();
3552 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3554 // We did expect the animation to finish
3555 application.SendNotification();
3556 finishCheck.CheckSignalReceived();
3557 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3559 // Check that nothing has changed after a couple of buffer swaps
3560 application.Render(0);
3561 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3562 application.Render(0);
3563 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3567 int UtcDaliAnimationAnimateByIntegerP(void)
3569 TestApplication application;
3571 Actor actor = Actor::New();
3573 // Register an integer property
3575 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3576 Stage::GetCurrent().Add(actor);
3577 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3578 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3580 // Build the animation
3581 float durationSeconds(2.0f);
3582 Animation animation = Animation::New(durationSeconds);
3583 int targetValue(50);
3584 int relativeValue(targetValue - startValue);
3585 animation.AnimateBy(Property(actor, index), relativeValue);
3587 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3589 // Start the animation
3592 // Target value should be retrievable straight away
3593 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3595 bool signalReceived(false);
3596 AnimationFinishCheck finishCheck(signalReceived);
3597 animation.FinishedSignal().Connect(&application, finishCheck);
3599 application.SendNotification();
3600 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3602 // We didn't expect the animation to finish yet
3603 application.SendNotification();
3604 finishCheck.CheckSignalNotReceived();
3605 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3607 application.SendNotification();
3608 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3610 // We did expect the animation to finish
3611 application.SendNotification();
3612 finishCheck.CheckSignalReceived();
3613 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3615 // Check that nothing has changed after a couple of buffer swaps
3616 application.Render(0);
3617 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3618 application.Render(0);
3619 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3623 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3625 TestApplication application;
3627 Actor actor = Actor::New();
3629 // Register an integer property
3631 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3632 Stage::GetCurrent().Add(actor);
3633 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3634 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3636 // Build the animation
3637 float durationSeconds(1.0f);
3638 Animation animation = Animation::New(durationSeconds);
3639 int targetValue(90);
3640 int relativeValue(targetValue - startValue);
3641 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3643 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3645 // Start the animation
3648 bool signalReceived(false);
3649 AnimationFinishCheck finishCheck(signalReceived);
3650 animation.FinishedSignal().Connect(&application, finishCheck);
3652 application.SendNotification();
3653 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3655 // We didn't expect the animation to finish yet
3656 application.SendNotification();
3657 finishCheck.CheckSignalNotReceived();
3659 // The position should have moved more, than with a linear alpha function
3660 int current( actor.GetCurrentProperty< int >( index ) );
3661 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3663 application.SendNotification();
3664 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3666 // We did expect the animation to finish
3667 application.SendNotification();
3668 finishCheck.CheckSignalReceived();
3669 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3671 // Check that nothing has changed after a couple of buffer swaps
3672 application.Render(0);
3673 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3674 application.Render(0);
3675 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3679 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3681 TestApplication application;
3683 Actor actor = Actor::New();
3685 // Register an integer property
3687 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3688 Stage::GetCurrent().Add(actor);
3689 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3690 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3692 // Build the animation
3693 float durationSeconds(1.0f);
3694 Animation animation = Animation::New(durationSeconds);
3695 int targetValue(30);
3696 int relativeValue(targetValue - startValue);
3698 animation.AnimateBy(Property(actor, index),
3700 TimePeriod(delay, durationSeconds - delay));
3702 // Start the animation
3705 bool signalReceived(false);
3706 AnimationFinishCheck finishCheck(signalReceived);
3707 animation.FinishedSignal().Connect(&application, finishCheck);
3709 application.SendNotification();
3710 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3712 // We didn't expect the animation to finish yet
3713 application.SendNotification();
3714 finishCheck.CheckSignalNotReceived();
3715 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3717 application.SendNotification();
3718 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3720 // We didn't expect the animation to finish yet
3721 application.SendNotification();
3722 finishCheck.CheckSignalNotReceived();
3723 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3725 application.SendNotification();
3726 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3728 // We did expect the animation to finish
3729 application.SendNotification();
3730 finishCheck.CheckSignalReceived();
3731 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3733 // Check that nothing has changed after a couple of buffer swaps
3734 application.Render(0);
3735 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3736 application.Render(0);
3737 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3741 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3743 TestApplication application;
3745 Actor actor = Actor::New();
3747 // Register an integer property
3749 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3750 Stage::GetCurrent().Add(actor);
3751 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3752 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3754 // Build the animation
3755 float durationSeconds(1.0f);
3756 Animation animation = Animation::New(durationSeconds);
3757 int targetValue(30);
3758 int relativeValue(targetValue - startValue);
3760 animation.AnimateBy(Property(actor, index),
3762 AlphaFunction::LINEAR,
3763 TimePeriod(delay, durationSeconds - delay));
3765 // Start the animation
3768 bool signalReceived(false);
3769 AnimationFinishCheck finishCheck(signalReceived);
3770 animation.FinishedSignal().Connect(&application, finishCheck);
3772 application.SendNotification();
3773 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3775 // We didn't expect the animation to finish yet
3776 application.SendNotification();
3777 finishCheck.CheckSignalNotReceived();
3778 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3780 application.SendNotification();
3781 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3783 // We didn't expect the animation to finish yet
3784 application.SendNotification();
3785 finishCheck.CheckSignalNotReceived();
3786 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3788 application.SendNotification();
3789 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3791 // We did expect the animation to finish
3792 application.SendNotification();
3793 finishCheck.CheckSignalReceived();
3794 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3796 // Check that nothing has changed after a couple of buffer swaps
3797 application.Render(0);
3798 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3799 application.Render(0);
3800 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3804 int UtcDaliAnimationAnimateByQuaternionP(void)
3806 TestApplication application;
3808 Actor actor = Actor::New();
3810 // Register a quaternion property
3811 const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
3812 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3813 Stage::GetCurrent().Add(actor);
3814 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3815 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3817 // Build the animation
3818 float durationSeconds(2.0f);
3819 Animation animation = Animation::New(durationSeconds);
3820 const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
3821 const Quaternion finalValue( startValue * relativeValue );
3822 animation.AnimateBy(Property(actor, index), relativeValue);
3824 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3825 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3827 // Start the animation
3830 // Target value should be retrievable straight away
3831 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3833 application.SendNotification();
3834 application.Render( 2000 ); // animation complete
3836 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3837 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
3842 int UtcDaliAnimationAnimateByVector2P(void)
3844 TestApplication application;
3846 Actor actor = Actor::New();
3848 // Register a Vector2 property
3849 Vector2 startValue(10.0f, 10.0f);
3850 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3851 Stage::GetCurrent().Add(actor);
3852 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3853 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3855 // Build the animation
3856 float durationSeconds(2.0f);
3857 Animation animation = Animation::New(durationSeconds);
3858 Vector2 targetValue(60.0f, 60.0f);
3859 Vector2 relativeValue(targetValue - startValue);
3860 animation.AnimateBy(Property(actor, index), relativeValue);
3862 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3864 // Start the animation
3867 // Target value should be retrievable straight away
3868 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3870 bool signalReceived(false);
3871 AnimationFinishCheck finishCheck(signalReceived);
3872 animation.FinishedSignal().Connect(&application, finishCheck);
3874 application.SendNotification();
3875 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3877 // We didn't expect the animation to finish yet
3878 application.SendNotification();
3879 finishCheck.CheckSignalNotReceived();
3880 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3882 application.SendNotification();
3883 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3885 // We did expect the animation to finish
3886 application.SendNotification();
3887 finishCheck.CheckSignalReceived();
3888 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3890 // Check that nothing has changed after a couple of buffer swaps
3891 application.Render(0);
3892 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3893 application.Render(0);
3894 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3898 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3900 TestApplication application;
3902 Actor actor = Actor::New();
3904 // Register a Vector2 property
3905 Vector2 startValue(100.0f, 100.0f);
3906 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3907 Stage::GetCurrent().Add(actor);
3908 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3909 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3911 // Build the animation
3912 float durationSeconds(1.0f);
3913 Animation animation = Animation::New(durationSeconds);
3914 Vector2 targetValue(20.0f, 20.0f);
3915 Vector2 relativeValue(targetValue - startValue);
3916 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3918 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3920 // Start the animation
3923 bool signalReceived(false);
3924 AnimationFinishCheck finishCheck(signalReceived);
3925 animation.FinishedSignal().Connect(&application, finishCheck);
3927 application.SendNotification();
3928 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3930 // We didn't expect the animation to finish yet
3931 application.SendNotification();
3932 finishCheck.CheckSignalNotReceived();
3934 // The position should have moved more, than with a linear alpha function
3935 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
3936 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3937 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3939 application.SendNotification();
3940 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3942 // We did expect the animation to finish
3943 application.SendNotification();
3944 finishCheck.CheckSignalReceived();
3945 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3947 // Check that nothing has changed after a couple of buffer swaps
3948 application.Render(0);
3949 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3950 application.Render(0);
3951 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3955 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3957 TestApplication application;
3959 Actor actor = Actor::New();
3961 // Register a Vector2 property
3962 Vector2 startValue(10.0f, 10.0f);
3963 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3964 Stage::GetCurrent().Add(actor);
3965 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3966 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3968 // Build the animation
3969 float durationSeconds(1.0f);
3970 Animation animation = Animation::New(durationSeconds);
3971 Vector2 targetValue(30.0f, 30.0f);
3972 Vector2 relativeValue(targetValue - startValue);
3974 animation.AnimateBy(Property(actor, index),
3976 TimePeriod(delay, durationSeconds - delay));
3978 // Start the animation
3981 bool signalReceived(false);
3982 AnimationFinishCheck finishCheck(signalReceived);
3983 animation.FinishedSignal().Connect(&application, finishCheck);
3985 application.SendNotification();
3986 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3988 // We didn't expect the animation to finish yet
3989 application.SendNotification();
3990 finishCheck.CheckSignalNotReceived();
3991 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3993 application.SendNotification();
3994 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3996 // We didn't expect the animation to finish yet
3997 application.SendNotification();
3998 finishCheck.CheckSignalNotReceived();
3999 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4001 application.SendNotification();
4002 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4004 // We did expect the animation to finish
4005 application.SendNotification();
4006 finishCheck.CheckSignalReceived();
4007 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4009 // Check that nothing has changed after a couple of buffer swaps
4010 application.Render(0);
4011 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4012 application.Render(0);
4013 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4017 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4019 TestApplication application;
4021 Actor actor = Actor::New();
4023 // Register a Vector2 property
4024 Vector2 startValue(5.0f, 5.0f);
4025 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4026 Stage::GetCurrent().Add(actor);
4027 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4028 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4030 // Build the animation
4031 float durationSeconds(1.0f);
4032 Animation animation = Animation::New(durationSeconds);
4033 Vector2 targetValue(10.0f, 10.0f);
4034 Vector2 relativeValue(targetValue - startValue);
4036 animation.AnimateBy(Property(actor, index),
4038 AlphaFunction::LINEAR,
4039 TimePeriod(delay, durationSeconds - delay));
4041 // Start the animation
4044 bool signalReceived(false);
4045 AnimationFinishCheck finishCheck(signalReceived);
4046 animation.FinishedSignal().Connect(&application, finishCheck);
4048 application.SendNotification();
4049 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4051 // We didn't expect the animation to finish yet
4052 application.SendNotification();
4053 finishCheck.CheckSignalNotReceived();
4054 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4056 application.SendNotification();
4057 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4059 // We didn't expect the animation to finish yet
4060 application.SendNotification();
4061 finishCheck.CheckSignalNotReceived();
4062 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4064 application.SendNotification();
4065 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4067 // We did expect the animation to finish
4068 application.SendNotification();
4069 finishCheck.CheckSignalReceived();
4070 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4072 // Check that nothing has changed after a couple of buffer swaps
4073 application.Render(0);
4074 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4075 application.Render(0);
4076 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4080 int UtcDaliAnimationAnimateByVector3P(void)
4082 TestApplication application;
4084 Actor actor = Actor::New();
4086 // Register a Vector3 property
4087 Vector3 startValue(10.0f, 10.0f, 10.0f);
4088 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4089 Stage::GetCurrent().Add(actor);
4090 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4091 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4093 // Build the animation
4094 float durationSeconds(2.0f);
4095 Animation animation = Animation::New(durationSeconds);
4096 Vector3 targetValue(60.0f, 60.0f, 60.0f);
4097 Vector3 relativeValue(targetValue - startValue);
4098 animation.AnimateBy(Property(actor, index), relativeValue);
4100 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4102 // Start the animation
4105 // Target value should be retrievable straight away
4106 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4108 bool signalReceived(false);
4109 AnimationFinishCheck finishCheck(signalReceived);
4110 animation.FinishedSignal().Connect(&application, finishCheck);
4112 application.SendNotification();
4113 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4115 // We didn't expect the animation to finish yet
4116 application.SendNotification();
4117 finishCheck.CheckSignalNotReceived();
4118 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4120 application.SendNotification();
4121 application.Render(static_cast<unsigned int>(durationSeconds*50.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< Vector3 >( 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< Vector3 >( index ), targetValue, TEST_LOCATION );
4131 application.Render(0);
4132 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4136 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4138 TestApplication application;
4140 Actor actor = Actor::New();
4142 // Register a Vector3 property
4143 Vector3 startValue(100.0f, 100.0f, 100.0f);
4144 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4145 Stage::GetCurrent().Add(actor);
4146 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4147 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4149 // Build the animation
4150 float durationSeconds(1.0f);
4151 Animation animation = Animation::New(durationSeconds);
4152 Vector3 targetValue(20.0f, 20.0f, 20.0f);
4153 Vector3 relativeValue(targetValue - startValue);
4154 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4156 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4158 // Start the animation
4161 bool signalReceived(false);
4162 AnimationFinishCheck finishCheck(signalReceived);
4163 animation.FinishedSignal().Connect(&application, finishCheck);
4165 application.SendNotification();
4166 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4168 // We didn't expect the animation to finish yet
4169 application.SendNotification();
4170 finishCheck.CheckSignalNotReceived();
4172 // The position should have moved more, than with a linear alpha function
4173 Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
4174 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4175 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4176 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4178 application.SendNotification();
4179 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4181 // We did expect the animation to finish
4182 application.SendNotification();
4183 finishCheck.CheckSignalReceived();
4184 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4186 // Check that nothing has changed after a couple of buffer swaps
4187 application.Render(0);
4188 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4189 application.Render(0);
4190 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4194 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4196 TestApplication application;
4198 Actor actor = Actor::New();
4200 // Register a Vector3 property
4201 Vector3 startValue(10.0f, 10.0f, 10.0f);
4202 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4203 Stage::GetCurrent().Add(actor);
4204 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4205 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4207 // Build the animation
4208 float durationSeconds(1.0f);
4209 Animation animation = Animation::New(durationSeconds);
4210 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4211 Vector3 relativeValue(targetValue - startValue);
4213 animation.AnimateBy(Property(actor, index),
4215 TimePeriod(delay, durationSeconds - delay));
4217 // Start the animation
4220 bool signalReceived(false);
4221 AnimationFinishCheck finishCheck(signalReceived);
4222 animation.FinishedSignal().Connect(&application, finishCheck);
4224 application.SendNotification();
4225 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4227 // We didn't expect the animation to finish yet
4228 application.SendNotification();
4229 finishCheck.CheckSignalNotReceived();
4230 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4232 application.SendNotification();
4233 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4235 // We didn't expect the animation to finish yet
4236 application.SendNotification();
4237 finishCheck.CheckSignalNotReceived();
4238 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4240 application.SendNotification();
4241 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4243 // We did expect the animation to finish
4244 application.SendNotification();
4245 finishCheck.CheckSignalReceived();
4246 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4248 // Check that nothing has changed after a couple of buffer swaps
4249 application.Render(0);
4250 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4251 application.Render(0);
4252 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4256 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4258 TestApplication application;
4260 Actor actor = Actor::New();
4262 // Register a Vector3 property
4263 Vector3 startValue(5.0f, 5.0f, 5.0f);
4264 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4265 Stage::GetCurrent().Add(actor);
4266 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4267 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4269 // Build the animation
4270 float durationSeconds(1.0f);
4271 Animation animation = Animation::New(durationSeconds);
4272 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4273 Vector3 relativeValue(targetValue - startValue);
4275 animation.AnimateBy(Property(actor, index),
4277 AlphaFunction::LINEAR,
4278 TimePeriod(delay, durationSeconds - delay));
4280 // Start the animation
4283 bool signalReceived(false);
4284 AnimationFinishCheck finishCheck(signalReceived);
4285 animation.FinishedSignal().Connect(&application, finishCheck);
4287 application.SendNotification();
4288 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4290 // We didn't expect the animation to finish yet
4291 application.SendNotification();
4292 finishCheck.CheckSignalNotReceived();
4293 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4295 application.SendNotification();
4296 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4298 // We didn't expect the animation to finish yet
4299 application.SendNotification();
4300 finishCheck.CheckSignalNotReceived();
4301 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4303 application.SendNotification();
4304 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4306 // We did expect the animation to finish
4307 application.SendNotification();
4308 finishCheck.CheckSignalReceived();
4309 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4311 // Check that nothing has changed after a couple of buffer swaps
4312 application.Render(0);
4313 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4314 application.Render(0);
4315 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4319 int UtcDaliAnimationAnimateByVector4P(void)
4321 TestApplication application;
4323 Actor actor = Actor::New();
4325 // Register a Vector4 property
4326 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4327 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4328 Stage::GetCurrent().Add(actor);
4329 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4330 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4332 // Build the animation
4333 float durationSeconds(2.0f);
4334 Animation animation = Animation::New(durationSeconds);
4335 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4336 Vector4 relativeValue(targetValue - startValue);
4337 animation.AnimateBy(Property(actor, index), relativeValue);
4339 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4341 // Start the animation
4344 // Target value should be retrievable straight away
4345 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4347 bool signalReceived(false);
4348 AnimationFinishCheck finishCheck(signalReceived);
4349 animation.FinishedSignal().Connect(&application, finishCheck);
4351 application.SendNotification();
4352 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4354 // We didn't expect the animation to finish yet
4355 application.SendNotification();
4356 finishCheck.CheckSignalNotReceived();
4357 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4359 application.SendNotification();
4360 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4362 // We did expect the animation to finish
4363 application.SendNotification();
4364 finishCheck.CheckSignalReceived();
4365 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4367 // Check that nothing has changed after a couple of buffer swaps
4368 application.Render(0);
4369 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4370 application.Render(0);
4371 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4375 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4377 TestApplication application;
4379 Actor actor = Actor::New();
4381 // Register a Vector4 property
4382 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4383 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4384 Stage::GetCurrent().Add(actor);
4385 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4386 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4388 // Build the animation
4389 float durationSeconds(1.0f);
4390 Animation animation = Animation::New(durationSeconds);
4391 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4392 Vector4 relativeValue(targetValue - startValue);
4393 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4395 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4397 // Start the animation
4400 bool signalReceived(false);
4401 AnimationFinishCheck finishCheck(signalReceived);
4402 animation.FinishedSignal().Connect(&application, finishCheck);
4404 application.SendNotification();
4405 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4407 // We didn't expect the animation to finish yet
4408 application.SendNotification();
4409 finishCheck.CheckSignalNotReceived();
4411 // The position should have moved more, than with a linear alpha function
4412 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4413 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4414 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4415 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4416 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4418 application.SendNotification();
4419 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4421 // We did expect the animation to finish
4422 application.SendNotification();
4423 finishCheck.CheckSignalReceived();
4424 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4426 // Check that nothing has changed after a couple of buffer swaps
4427 application.Render(0);
4428 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4429 application.Render(0);
4430 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4434 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4436 TestApplication application;
4438 Actor actor = Actor::New();
4440 // Register a Vector4 property
4441 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4442 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4443 Stage::GetCurrent().Add(actor);
4444 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4445 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4447 // Build the animation
4448 float durationSeconds(1.0f);
4449 Animation animation = Animation::New(durationSeconds);
4450 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4451 Vector4 relativeValue(targetValue - startValue);
4453 animation.AnimateBy(Property(actor, index),
4455 TimePeriod(delay, durationSeconds - delay));
4457 // Start the animation
4460 bool signalReceived(false);
4461 AnimationFinishCheck finishCheck(signalReceived);
4462 animation.FinishedSignal().Connect(&application, finishCheck);
4464 application.SendNotification();
4465 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4467 // We didn't expect the animation to finish yet
4468 application.SendNotification();
4469 finishCheck.CheckSignalNotReceived();
4470 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4472 application.SendNotification();
4473 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4475 // We didn't expect the animation to finish yet
4476 application.SendNotification();
4477 finishCheck.CheckSignalNotReceived();
4478 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4480 application.SendNotification();
4481 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4483 // We did expect the animation to finish
4484 application.SendNotification();
4485 finishCheck.CheckSignalReceived();
4486 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4488 // Check that nothing has changed after a couple of buffer swaps
4489 application.Render(0);
4490 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4491 application.Render(0);
4492 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4496 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4498 TestApplication application;
4500 Actor actor = Actor::New();
4502 // Register a Vector4 property
4503 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4504 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4505 Stage::GetCurrent().Add(actor);
4506 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4507 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4509 // Build the animation
4510 float durationSeconds(1.0f);
4511 Animation animation = Animation::New(durationSeconds);
4512 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4513 Vector4 relativeValue(targetValue - startValue);
4515 animation.AnimateBy(Property(actor, index),
4517 AlphaFunction::LINEAR,
4518 TimePeriod(delay, durationSeconds - delay));
4520 // Start the animation
4523 bool signalReceived(false);
4524 AnimationFinishCheck finishCheck(signalReceived);
4525 animation.FinishedSignal().Connect(&application, finishCheck);
4527 application.SendNotification();
4528 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4530 // We didn't expect the animation to finish yet
4531 application.SendNotification();
4532 finishCheck.CheckSignalNotReceived();
4533 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4535 application.SendNotification();
4536 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4538 // We didn't expect the animation to finish yet
4539 application.SendNotification();
4540 finishCheck.CheckSignalNotReceived();
4541 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4543 application.SendNotification();
4544 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4546 // We did expect the animation to finish
4547 application.SendNotification();
4548 finishCheck.CheckSignalReceived();
4549 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4551 // Check that nothing has changed after a couple of buffer swaps
4552 application.Render(0);
4553 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4554 application.Render(0);
4555 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4559 int UtcDaliAnimationAnimateByActorPositionP(void)
4561 TestApplication application;
4563 Actor actor = Actor::New();
4564 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4565 actor.SetPosition(startPosition);
4566 Stage::GetCurrent().Add(actor);
4567 application.SendNotification();
4568 application.Render(0);
4569 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4571 // Build the animation
4572 float durationSeconds(1.0f);
4573 Animation animation = Animation::New(durationSeconds);
4574 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4575 Vector3 relativePosition(targetPosition - startPosition);
4576 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4578 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4580 // Start the animation
4583 // Target value should be retrievable straight away
4584 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4586 bool signalReceived(false);
4587 AnimationFinishCheck finishCheck(signalReceived);
4588 animation.FinishedSignal().Connect(&application, finishCheck);
4590 application.SendNotification();
4591 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4593 // We didn't expect the animation to finish yet
4594 application.SendNotification();
4595 finishCheck.CheckSignalNotReceived();
4596 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4598 application.SendNotification();
4599 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4601 // We did expect the animation to finish
4602 application.SendNotification();
4603 finishCheck.CheckSignalReceived();
4604 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4606 // Check that nothing has changed after a couple of buffer swaps
4607 application.Render(0);
4608 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4609 application.Render(0);
4610 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4614 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4616 TestApplication application;
4618 Actor actor = Actor::New();
4619 Stage::GetCurrent().Add(actor);
4620 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4622 // Build the animation
4623 float durationSeconds(1.0f);
4624 Animation animation = Animation::New(durationSeconds);
4625 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4626 Vector3 relativePosition(targetPosition - Vector3::ZERO);
4627 animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
4628 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
4629 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
4631 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4632 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4634 // Start the animation
4637 // Target value should be retrievable straight away
4638 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4639 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
4640 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
4641 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
4643 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
4645 application.SendNotification();
4646 application.Render( 1000 ); // 1 second progress
4648 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4653 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4655 TestApplication application;
4657 Actor actor = Actor::New();
4658 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4659 actor.SetPosition(startPosition);
4660 Stage::GetCurrent().Add(actor);
4661 application.SendNotification();
4662 application.Render(0);
4663 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4665 // Build the animation
4666 float durationSeconds(1.0f);
4667 Animation animation = Animation::New(durationSeconds);
4668 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4669 Vector3 relativePosition(targetPosition - startPosition);
4670 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4672 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4674 // Start the animation
4677 bool signalReceived(false);
4678 AnimationFinishCheck finishCheck(signalReceived);
4679 animation.FinishedSignal().Connect(&application, finishCheck);
4681 application.SendNotification();
4682 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4684 // We didn't expect the animation to finish yet
4685 application.SendNotification();
4686 finishCheck.CheckSignalNotReceived();
4688 // The position should have moved more, than with a linear alpha function
4689 Vector3 current(actor.GetCurrentPosition());
4690 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4691 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4692 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4694 application.SendNotification();
4695 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4697 // We did expect the animation to finish
4698 application.SendNotification();
4699 finishCheck.CheckSignalReceived();
4700 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4702 // Check that nothing has changed after a couple of buffer swaps
4703 application.Render(0);
4704 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4705 application.Render(0);
4706 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4710 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4712 TestApplication application;
4714 Actor actor = Actor::New();
4715 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4716 actor.SetPosition(startPosition);
4717 Stage::GetCurrent().Add(actor);
4718 application.SendNotification();
4719 application.Render(0);
4720 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4722 // Build the animation
4723 float durationSeconds(1.0f);
4724 Animation animation = Animation::New(durationSeconds);
4725 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4726 Vector3 relativePosition(targetPosition - startPosition);
4728 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4730 TimePeriod(delay, durationSeconds - delay));
4732 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4734 // Start the animation
4737 bool signalReceived(false);
4738 AnimationFinishCheck finishCheck(signalReceived);
4739 animation.FinishedSignal().Connect(&application, finishCheck);
4741 application.SendNotification();
4742 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4744 // We didn't expect the animation to finish yet
4745 application.SendNotification();
4746 finishCheck.CheckSignalNotReceived();
4747 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4749 application.SendNotification();
4750 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4752 // We did expect the animation to finish
4753 application.SendNotification();
4754 finishCheck.CheckSignalReceived();
4755 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4757 // Check that nothing has changed after a couple of buffer swaps
4758 application.Render(0);
4759 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4760 application.Render(0);
4761 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4765 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4767 TestApplication application;
4769 Actor actor = Actor::New();
4770 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4771 actor.SetPosition(startPosition);
4772 Stage::GetCurrent().Add(actor);
4773 application.SendNotification();
4774 application.Render(0);
4775 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4777 // Build the animation
4778 float durationSeconds(1.0f);
4779 Animation animation = Animation::New(durationSeconds);
4780 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4781 Vector3 relativePosition(targetPosition - startPosition);
4783 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4785 AlphaFunction::LINEAR,
4786 TimePeriod(delay, durationSeconds - delay));
4788 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4790 // Start the animation
4793 bool signalReceived(false);
4794 AnimationFinishCheck finishCheck(signalReceived);
4795 animation.FinishedSignal().Connect(&application, finishCheck);
4797 application.SendNotification();
4798 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4800 // We didn't expect the animation to finish yet
4801 application.SendNotification();
4802 finishCheck.CheckSignalNotReceived();
4803 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4805 application.SendNotification();
4806 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4808 // We did expect the animation to finish
4809 application.SendNotification();
4810 finishCheck.CheckSignalReceived();
4811 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4813 // Check that nothing has changed after a couple of buffer swaps
4814 application.Render(0);
4815 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4816 application.Render(0);
4817 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4821 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4823 TestApplication application;
4825 Actor actor = Actor::New();
4826 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4827 Stage::GetCurrent().Add(actor);
4828 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4830 // Build the animation
4831 float durationSeconds(1.0f);
4832 Animation animation = Animation::New(durationSeconds);
4833 Degree relativeRotationDegrees(360.0f);
4834 Radian relativeRotationRadians(relativeRotationDegrees);
4835 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4837 // Start the animation
4840 // Target value should be retrievable straight away
4841 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4843 bool signalReceived(false);
4844 AnimationFinishCheck finishCheck(signalReceived);
4845 animation.FinishedSignal().Connect(&application, finishCheck);
4847 application.SendNotification();
4848 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4850 // We didn't expect the animation to finish yet
4851 application.SendNotification();
4852 finishCheck.CheckSignalNotReceived();
4853 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4855 application.SendNotification();
4856 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4858 // We didn't expect the animation to finish yet
4859 application.SendNotification();
4860 finishCheck.CheckSignalNotReceived();
4861 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4863 application.SendNotification();
4864 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4866 // We didn't expect the animation to finish yet
4867 application.SendNotification();
4868 finishCheck.CheckSignalNotReceived();
4869 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4871 application.SendNotification();
4872 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4874 // We did expect the animation to finish
4875 application.SendNotification();
4876 finishCheck.CheckSignalReceived();
4877 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4881 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4883 TestApplication application;
4885 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4887 Actor actor = Actor::New();
4888 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4889 Stage::GetCurrent().Add(actor);
4890 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4892 // Build the animation
4893 float durationSeconds(1.0f);
4894 Animation animation = Animation::New(durationSeconds);
4895 Degree relativeRotationDegrees(710.0f);
4896 Radian relativeRotationRadians(relativeRotationDegrees);
4898 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4900 // Start the animation
4903 bool signalReceived(false);
4904 AnimationFinishCheck finishCheck(signalReceived);
4905 animation.FinishedSignal().Connect(&application, finishCheck);
4907 application.SendNotification();
4908 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4910 // We didn't expect the animation to finish yet
4911 application.SendNotification();
4912 finishCheck.CheckSignalNotReceived();
4913 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4915 application.SendNotification();
4916 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4918 // We didn't expect the animation to finish yet
4919 application.SendNotification();
4920 finishCheck.CheckSignalNotReceived();
4921 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4923 application.SendNotification();
4924 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4926 // We didn't expect the animation to finish yet
4927 application.SendNotification();
4928 finishCheck.CheckSignalNotReceived();
4929 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4931 application.SendNotification();
4932 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4934 // We did expect the animation to finish
4935 application.SendNotification();
4936 finishCheck.CheckSignalReceived();
4937 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4942 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4944 TestApplication application;
4946 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4948 Actor actor = Actor::New();
4949 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4950 Stage::GetCurrent().Add(actor);
4951 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4953 // Build the animation
4954 float durationSeconds(1.0f);
4955 Animation animation = Animation::New(durationSeconds);
4956 Degree relativeRotationDegrees(730.0f);
4957 Radian relativeRotationRadians(relativeRotationDegrees);
4959 Radian actualRotationRadians( Degree(10.0f) );
4961 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4963 // Start the animation
4966 bool signalReceived(false);
4967 AnimationFinishCheck finishCheck(signalReceived);
4968 animation.FinishedSignal().Connect(&application, finishCheck);
4970 application.SendNotification();
4971 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4973 // We didn't expect the animation to finish yet
4974 application.SendNotification();
4975 finishCheck.CheckSignalNotReceived();
4976 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4978 application.SendNotification();
4979 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4981 // We didn't expect the animation to finish yet
4982 application.SendNotification();
4983 finishCheck.CheckSignalNotReceived();
4984 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4986 application.SendNotification();
4987 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4989 // We didn't expect the animation to finish yet
4990 application.SendNotification();
4991 finishCheck.CheckSignalNotReceived();
4992 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4994 application.SendNotification();
4995 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4997 // We did expect the animation to finish
4998 application.SendNotification();
4999 finishCheck.CheckSignalReceived();
5000 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5001 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5006 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5008 TestApplication application;
5010 Actor actor = Actor::New();
5011 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5012 Stage::GetCurrent().Add(actor);
5013 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5015 // Build the animation
5016 float durationSeconds(1.0f);
5017 Animation animation = Animation::New(durationSeconds);
5018 Degree relativeRotationDegrees(360.0f);
5019 Radian relativeRotationRadians(relativeRotationDegrees);
5020 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
5022 // Start the animation
5025 bool signalReceived(false);
5026 AnimationFinishCheck finishCheck(signalReceived);
5027 animation.FinishedSignal().Connect(&application, finishCheck);
5029 application.SendNotification();
5030 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5032 // We didn't expect the animation to finish yet
5033 application.SendNotification();
5034 finishCheck.CheckSignalNotReceived();
5035 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5037 application.SendNotification();
5038 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5040 // We didn't expect the animation to finish yet
5041 application.SendNotification();
5042 finishCheck.CheckSignalNotReceived();
5043 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5045 application.SendNotification();
5046 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5048 // We didn't expect the animation to finish yet
5049 application.SendNotification();
5050 finishCheck.CheckSignalNotReceived();
5051 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5053 application.SendNotification();
5054 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5056 // We did expect the animation to finish
5057 application.SendNotification();
5058 finishCheck.CheckSignalReceived();
5059 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5063 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5065 TestApplication application;
5067 Actor actor = Actor::New();
5068 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5069 Stage::GetCurrent().Add(actor);
5070 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5072 // Build the animation
5073 float durationSeconds(1.0f);
5074 Animation animation = Animation::New(durationSeconds);
5075 Degree relativeRotationDegrees(360.0f);
5076 Radian relativeRotationRadians(relativeRotationDegrees);
5078 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
5079 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
5081 // Start the animation
5084 bool signalReceived(false);
5085 AnimationFinishCheck finishCheck(signalReceived);
5086 animation.FinishedSignal().Connect(&application, finishCheck);
5088 application.SendNotification();
5089 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5091 // We didn't expect the animation to finish yet
5092 application.SendNotification();
5093 finishCheck.CheckSignalNotReceived();
5094 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5095 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5097 application.SendNotification();
5098 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5100 // We didn't expect the animation to finish yet
5101 application.SendNotification();
5102 finishCheck.CheckSignalNotReceived();
5103 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5104 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5106 application.SendNotification();
5107 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5109 // We didn't expect the animation to finish yet
5110 application.SendNotification();
5111 finishCheck.CheckSignalNotReceived();
5112 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5113 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5115 application.SendNotification();
5116 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5118 // We did expect the animation to finish
5119 application.SendNotification();
5120 finishCheck.CheckSignalReceived();
5121 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5125 int UtcDaliAnimationAnimateByActorScaleP(void)
5127 TestApplication application;
5129 Actor actor = Actor::New();
5130 Stage::GetCurrent().Add(actor);
5131 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5133 // Build the animation
5134 float durationSeconds(1.0f);
5135 Animation animation = Animation::New(durationSeconds);
5136 Vector3 targetScale(2.0f, 2.0f, 2.0f);
5137 Vector3 relativeScale(targetScale - Vector3::ONE);
5138 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
5140 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
5142 // Start the animation
5145 // Target value should be retrievable straight away
5146 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5148 bool signalReceived(false);
5149 AnimationFinishCheck finishCheck(signalReceived);
5150 animation.FinishedSignal().Connect(&application, finishCheck);
5152 application.SendNotification();
5153 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5155 // We didn't expect the animation to finish yet
5156 application.SendNotification();
5157 finishCheck.CheckSignalNotReceived();
5158 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
5160 application.SendNotification();
5161 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5163 // We did expect the animation to finish
5164 application.SendNotification();
5165 finishCheck.CheckSignalReceived();
5166 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5169 finishCheck.Reset();
5170 actor.SetScale(Vector3::ONE);
5171 application.SendNotification();
5172 application.Render(0);
5173 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5175 // Repeat with a different (ease-in) alpha function
5176 animation = Animation::New(durationSeconds);
5177 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
5178 animation.FinishedSignal().Connect(&application, finishCheck);
5181 application.SendNotification();
5182 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5184 // We didn't expect the animation to finish yet
5185 application.SendNotification();
5186 finishCheck.CheckSignalNotReceived();
5188 // The scale should have grown less, than with a linear alpha function
5189 Vector3 current(actor.GetCurrentScale());
5190 DALI_TEST_CHECK( current.x > 1.0f );
5191 DALI_TEST_CHECK( current.y > 1.0f );
5192 DALI_TEST_CHECK( current.z > 1.0f );
5193 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5194 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5195 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5197 application.SendNotification();
5198 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5200 // We did expect the animation to finish
5201 application.SendNotification();
5202 finishCheck.CheckSignalReceived();
5203 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5206 finishCheck.Reset();
5207 actor.SetScale(Vector3::ONE);
5208 application.SendNotification();
5209 application.Render(0);
5210 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5212 // Repeat with a delay
5214 animation = Animation::New(durationSeconds);
5215 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
5216 animation.FinishedSignal().Connect(&application, finishCheck);
5219 application.SendNotification();
5220 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5222 // We didn't expect the animation to finish yet
5223 application.SendNotification();
5224 finishCheck.CheckSignalNotReceived();
5225 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5227 application.SendNotification();
5228 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5230 // We did expect the animation to finish
5231 application.SendNotification();
5232 finishCheck.CheckSignalReceived();
5233 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5237 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5239 TestApplication application;
5241 Actor actor = Actor::New();
5242 Stage::GetCurrent().Add(actor);
5243 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5245 // Build the animation
5246 float durationSeconds(1.0f);
5247 Animation animation = Animation::New(durationSeconds);
5248 Vector3 targetScale(2.0f, 3.0f, 4.0f);
5249 Vector3 relativeScale(targetScale - Vector3::ONE);
5250 animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
5251 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
5252 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
5254 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5255 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5257 // Start the animation
5260 // Target value should be retrievable straight away
5261 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5262 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
5263 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
5264 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
5266 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Not changed yet
5268 application.SendNotification();
5269 application.Render( 1000 ); // 1 second progress
5271 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5276 int UtcDaliAnimationAnimateByActorColorP(void)
5278 TestApplication application;
5280 Actor actor = Actor::New();
5281 Stage::GetCurrent().Add(actor);
5282 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5284 // Build the animation
5285 float durationSeconds(1.0f);
5286 Animation animation = Animation::New(durationSeconds);
5287 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5288 Vector4 relativeColor( targetColor - Color::WHITE );
5289 animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
5291 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5292 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5294 // Start the animation
5297 // Target value should be retrievable straight away
5298 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5299 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5300 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5301 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5302 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5304 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5306 application.SendNotification();
5307 application.Render( 1000 ); // 1 second progress
5309 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5314 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5316 TestApplication application;
5318 Actor actor = Actor::New();
5319 Stage::GetCurrent().Add(actor);
5320 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5322 // Build the animation
5323 float durationSeconds(1.0f);
5324 Animation animation = Animation::New(durationSeconds);
5325 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5326 Vector4 relativeColor( targetColor - Color::WHITE );
5327 animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
5328 animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
5329 animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
5330 animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
5332 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5333 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5335 // Start the animation
5338 // Target value should be retrievable straight away
5339 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5340 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5341 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5342 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5343 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5345 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5347 application.SendNotification();
5348 application.Render( 1000 ); // 1 second progress
5350 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5355 int UtcDaliAnimationAnimateByActorSizeP(void)
5357 TestApplication application;
5359 Actor actor = Actor::New();
5360 Stage::GetCurrent().Add(actor);
5361 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5363 // Build the animation
5364 float durationSeconds(1.0f);
5365 Animation animation = Animation::New(durationSeconds);
5366 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5367 Vector3 relativeSize( targetSize - Vector3::ZERO );
5368 animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
5370 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5371 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5373 // Start the animation
5376 // Target value should be retrievable straight away
5377 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5378 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5379 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5380 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5382 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5384 application.SendNotification();
5385 application.Render( 1000 ); // 1 second progress
5387 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5392 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5394 TestApplication application;
5396 Actor actor = Actor::New();
5397 Stage::GetCurrent().Add(actor);
5398 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5400 // Build the animation
5401 float durationSeconds(1.0f);
5402 Animation animation = Animation::New(durationSeconds);
5403 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5404 Vector3 relativeSize( targetSize - Vector3::ZERO );
5405 animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
5406 animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
5407 animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
5409 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5410 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5412 // Start the animation
5415 // Target value should be retrievable straight away
5416 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5417 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5418 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5419 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5421 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5423 application.SendNotification();
5424 application.Render( 1000 ); // 1 second progress
5426 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5431 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5433 TestApplication application;
5435 Actor actor = Actor::New();
5436 Stage::GetCurrent().Add(actor);
5437 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5439 actor.SetVisible( false );
5441 application.SendNotification();
5442 application.Render();
5444 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
5446 // Build the animation
5447 float durationSeconds(1.0f);
5448 Animation animation = Animation::New(durationSeconds);
5449 bool targetVisibility( true );
5450 bool relativeVisibility( targetVisibility );
5451 animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
5453 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5455 // Start the animation
5458 // Target value should be retrievable straight away
5459 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
5460 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION ); // Not changed yet
5462 application.SendNotification();
5463 application.Render( 1000 ); // 1 second progress
5465 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5470 int UtcDaliAnimationAnimateToBooleanP(void)
5472 TestApplication application;
5474 Actor actor = Actor::New();
5476 // Register a boolean property
5477 const bool startValue(false);
5478 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5479 Stage::GetCurrent().Add(actor);
5480 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5481 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5483 // Build the animation
5484 float durationSeconds(2.0f);
5485 Animation animation = Animation::New(durationSeconds);
5486 const bool targetValue( !startValue );
5487 animation.AnimateTo(Property(actor, index), targetValue);
5489 // Start the animation
5492 bool signalReceived(false);
5493 AnimationFinishCheck finishCheck(signalReceived);
5494 animation.FinishedSignal().Connect(&application, finishCheck);
5496 application.SendNotification();
5497 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5499 // We didn't expect the animation to finish yet
5500 application.SendNotification();
5501 finishCheck.CheckSignalNotReceived();
5502 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5504 application.SendNotification();
5505 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5507 // We did expect the animation to finish
5508 application.SendNotification();
5509 finishCheck.CheckSignalReceived();
5510 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5512 // Check that nothing has changed after a couple of buffer swaps
5513 application.Render(0);
5514 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5515 application.Render(0);
5516 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5518 // Repeat with target value "false"
5519 animation = Animation::New(durationSeconds);
5520 const bool finalValue( !targetValue );
5521 animation.AnimateTo(Property(actor, index), finalValue);
5523 // Start the animation
5526 finishCheck.Reset();
5527 animation.FinishedSignal().Connect(&application, finishCheck);
5529 application.SendNotification();
5530 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5532 // We didn't expect the animation to finish yet
5533 application.SendNotification();
5534 finishCheck.CheckSignalNotReceived();
5535 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5537 application.SendNotification();
5538 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5540 // We did expect the animation to finish
5541 application.SendNotification();
5542 finishCheck.CheckSignalReceived();
5543 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5545 // Check that nothing has changed after a couple of buffer swaps
5546 application.Render(0);
5547 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5548 application.Render(0);
5549 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5553 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5555 TestApplication application;
5557 Actor actor = Actor::New();
5559 // Register a boolean property
5560 const bool startValue(false);
5561 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5562 Stage::GetCurrent().Add(actor);
5563 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5564 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5566 // Build the animation
5567 float durationSeconds(2.0f);
5568 Animation animation = Animation::New(durationSeconds);
5569 const bool targetValue( !startValue );
5570 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5572 // Start the animation
5575 bool signalReceived(false);
5576 AnimationFinishCheck finishCheck(signalReceived);
5577 animation.FinishedSignal().Connect(&application, finishCheck);
5579 application.SendNotification();
5580 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5582 // We didn't expect the animation to finish yet
5583 application.SendNotification();
5584 finishCheck.CheckSignalNotReceived();
5585 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5587 application.SendNotification();
5588 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5590 // We did expect the animation to finish
5591 application.SendNotification();
5592 finishCheck.CheckSignalReceived();
5593 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5595 // Check that nothing has changed after a couple of buffer swaps
5596 application.Render(0);
5597 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5598 application.Render(0);
5599 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5601 // Repeat with target value "false"
5602 animation = Animation::New(durationSeconds);
5603 const bool finalValue( !targetValue );
5604 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5606 // Start the animation
5609 finishCheck.Reset();
5610 animation.FinishedSignal().Connect(&application, finishCheck);
5612 application.SendNotification();
5613 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5615 // We didn't expect the animation to finish yet
5616 application.SendNotification();
5617 finishCheck.CheckSignalNotReceived();
5618 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5620 application.SendNotification();
5621 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5623 // We did expect the animation to finish
5624 application.SendNotification();
5625 finishCheck.CheckSignalReceived();
5626 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5628 // Check that nothing has changed after a couple of buffer swaps
5629 application.Render(0);
5630 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5631 application.Render(0);
5632 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5636 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5638 TestApplication application;
5640 Actor actor = Actor::New();
5642 // Register a boolean property
5643 bool startValue(false);
5644 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5645 Stage::GetCurrent().Add(actor);
5646 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5647 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5649 // Build the animation
5650 float durationSeconds(2.0f);
5651 Animation animation = Animation::New(durationSeconds);
5652 bool finalValue( !startValue );
5653 float animatorDurationSeconds(durationSeconds * 0.5f);
5654 animation.AnimateTo( Property(actor, index),
5656 TimePeriod( animatorDurationSeconds ) );
5658 // Start the animation
5661 bool signalReceived(false);
5662 AnimationFinishCheck finishCheck(signalReceived);
5663 animation.FinishedSignal().Connect(&application, finishCheck);
5665 application.SendNotification();
5666 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5668 // We didn't expect the animation to finish yet
5669 application.SendNotification();
5670 finishCheck.CheckSignalNotReceived();
5671 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5673 application.SendNotification();
5674 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5676 // We didn't expect the animation to finish yet...
5677 application.SendNotification();
5678 finishCheck.CheckSignalNotReceived();
5680 // ...however we should have reached the final value
5681 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5683 application.SendNotification();
5684 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5686 // We did expect the animation to finish
5687 application.SendNotification();
5688 finishCheck.CheckSignalReceived();
5689 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5691 // Check that nothing has changed after a couple of buffer swaps
5692 application.Render(0);
5693 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5694 application.Render(0);
5695 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5699 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5701 TestApplication application;
5703 Actor actor = Actor::New();
5705 // Register a boolean property
5706 bool startValue(false);
5707 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5708 Stage::GetCurrent().Add(actor);
5709 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5710 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5712 // Build the animation
5713 float durationSeconds(2.0f);
5714 Animation animation = Animation::New(durationSeconds);
5715 bool finalValue( !startValue );
5716 float animatorDurationSeconds(durationSeconds * 0.5f);
5717 animation.AnimateTo( Property(actor, index),
5719 AlphaFunction::LINEAR,
5720 TimePeriod( animatorDurationSeconds ) );
5722 // Start the animation
5725 bool signalReceived(false);
5726 AnimationFinishCheck finishCheck(signalReceived);
5727 animation.FinishedSignal().Connect(&application, finishCheck);
5729 application.SendNotification();
5730 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5732 // We didn't expect the animation to finish yet
5733 application.SendNotification();
5734 finishCheck.CheckSignalNotReceived();
5735 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5737 application.SendNotification();
5738 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5740 // We didn't expect the animation to finish yet...
5741 application.SendNotification();
5742 finishCheck.CheckSignalNotReceived();
5744 // ...however we should have reached the final value
5745 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5747 application.SendNotification();
5748 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5750 // We did expect the animation to finish
5751 application.SendNotification();
5752 finishCheck.CheckSignalReceived();
5753 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5755 // Check that nothing has changed after a couple of buffer swaps
5756 application.Render(0);
5757 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5758 application.Render(0);
5759 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5763 int UtcDaliAnimationAnimateToFloatP(void)
5765 TestApplication application;
5767 Actor actor = Actor::New();
5769 // Register a float property
5770 float startValue(10.0f);
5771 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5772 Stage::GetCurrent().Add(actor);
5773 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5774 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5776 // Build the animation
5777 float durationSeconds(2.0f);
5778 Animation animation = Animation::New(durationSeconds);
5779 float targetValue(50.0f);
5780 float relativeValue(targetValue - startValue);
5781 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5783 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5785 // Start the animation
5788 bool signalReceived(false);
5789 AnimationFinishCheck finishCheck(signalReceived);
5790 animation.FinishedSignal().Connect(&application, finishCheck);
5792 application.SendNotification();
5793 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5795 // We didn't expect the animation to finish yet
5796 application.SendNotification();
5797 finishCheck.CheckSignalNotReceived();
5798 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5800 application.SendNotification();
5801 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5803 // We did expect the animation to finish
5804 application.SendNotification();
5805 finishCheck.CheckSignalReceived();
5806 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5810 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5812 TestApplication application;
5814 Actor actor = Actor::New();
5816 // Register a float property
5817 float startValue(10.0f);
5818 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5819 Stage::GetCurrent().Add(actor);
5820 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5821 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5823 // Build the animation
5824 float durationSeconds(1.0f);
5825 Animation animation = Animation::New(durationSeconds);
5826 float targetValue(90.0f);
5827 float relativeValue(targetValue - startValue);
5828 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5830 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5832 // Start the animation
5835 bool signalReceived(false);
5836 AnimationFinishCheck finishCheck(signalReceived);
5837 animation.FinishedSignal().Connect(&application, finishCheck);
5839 application.SendNotification();
5840 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5842 // We didn't expect the animation to finish yet
5843 application.SendNotification();
5844 finishCheck.CheckSignalNotReceived();
5846 // The position should have moved more, than with a linear alpha function
5847 float current( actor.GetCurrentProperty< float >( index ) );
5848 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5850 application.SendNotification();
5851 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5853 // We did expect the animation to finish
5854 application.SendNotification();
5855 finishCheck.CheckSignalReceived();
5856 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5860 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5862 TestApplication application;
5864 Actor actor = Actor::New();
5866 // Register a float property
5867 float startValue(10.0f);
5868 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5869 Stage::GetCurrent().Add(actor);
5870 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5871 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5873 // Build the animation
5874 float durationSeconds(1.0f);
5875 Animation animation = Animation::New(durationSeconds);
5876 float targetValue(30.0f);
5877 float relativeValue(targetValue - startValue);
5879 animation.AnimateTo(Property(actor, index),
5881 TimePeriod(delay, durationSeconds - delay));
5883 // Start the animation
5886 bool signalReceived(false);
5887 AnimationFinishCheck finishCheck(signalReceived);
5888 animation.FinishedSignal().Connect(&application, finishCheck);
5890 application.SendNotification();
5891 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5893 // We didn't expect the animation to finish yet
5894 application.SendNotification();
5895 finishCheck.CheckSignalNotReceived();
5896 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5898 application.SendNotification();
5899 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5901 // We didn't expect the animation to finish yet
5902 application.SendNotification();
5903 finishCheck.CheckSignalNotReceived();
5904 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5906 application.SendNotification();
5907 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5909 // We did expect the animation to finish
5910 application.SendNotification();
5911 finishCheck.CheckSignalReceived();
5912 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5916 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5918 TestApplication application;
5920 Actor actor = Actor::New();
5922 // Register a float property
5923 float startValue(10.0f);
5924 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5925 Stage::GetCurrent().Add(actor);
5926 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5927 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5929 // Build the animation
5930 float durationSeconds(1.0f);
5931 Animation animation = Animation::New(durationSeconds);
5932 float targetValue(30.0f);
5933 float relativeValue(targetValue - startValue);
5935 animation.AnimateTo(Property(actor, index),
5937 AlphaFunction::LINEAR,
5938 TimePeriod(delay, durationSeconds - delay));
5940 // Start the animation
5943 bool signalReceived(false);
5944 AnimationFinishCheck finishCheck(signalReceived);
5945 animation.FinishedSignal().Connect(&application, finishCheck);
5947 application.SendNotification();
5948 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5950 // We didn't expect the animation to finish yet
5951 application.SendNotification();
5952 finishCheck.CheckSignalNotReceived();
5953 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5955 application.SendNotification();
5956 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5958 // We didn't expect the animation to finish yet
5959 application.SendNotification();
5960 finishCheck.CheckSignalNotReceived();
5961 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5963 application.SendNotification();
5964 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5966 // We did expect the animation to finish
5967 application.SendNotification();
5968 finishCheck.CheckSignalReceived();
5969 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5973 int UtcDaliAnimationAnimateToIntegerP(void)
5975 TestApplication application;
5977 Actor actor = Actor::New();
5979 // Register an integer property
5981 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5982 Stage::GetCurrent().Add(actor);
5983 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5984 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5986 // Build the animation
5987 float durationSeconds(2.0f);
5988 Animation animation = Animation::New(durationSeconds);
5989 int targetValue(50);
5990 int relativeValue(targetValue - startValue);
5991 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5993 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5995 // Start the animation
5998 bool signalReceived(false);
5999 AnimationFinishCheck finishCheck(signalReceived);
6000 animation.FinishedSignal().Connect(&application, finishCheck);
6002 application.SendNotification();
6003 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6005 // We didn't expect the animation to finish yet
6006 application.SendNotification();
6007 finishCheck.CheckSignalNotReceived();
6008 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6010 application.SendNotification();
6011 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6013 // We did expect the animation to finish
6014 application.SendNotification();
6015 finishCheck.CheckSignalReceived();
6016 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6020 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6022 TestApplication application;
6024 Actor actor = Actor::New();
6026 // Register an integer property
6028 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6029 Stage::GetCurrent().Add(actor);
6030 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6031 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6033 // Build the animation
6034 float durationSeconds(1.0f);
6035 Animation animation = Animation::New(durationSeconds);
6036 int targetValue(90);
6037 int relativeValue(targetValue - startValue);
6038 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6040 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
6042 // Start the animation
6045 bool signalReceived(false);
6046 AnimationFinishCheck finishCheck(signalReceived);
6047 animation.FinishedSignal().Connect(&application, finishCheck);
6049 application.SendNotification();
6050 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6052 // We didn't expect the animation to finish yet
6053 application.SendNotification();
6054 finishCheck.CheckSignalNotReceived();
6056 // The position should have moved more, than with a linear alpha function
6057 int current( actor.GetCurrentProperty< int >( index ) );
6058 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
6060 application.SendNotification();
6061 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6063 // We did expect the animation to finish
6064 application.SendNotification();
6065 finishCheck.CheckSignalReceived();
6066 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6070 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6072 TestApplication application;
6074 Actor actor = Actor::New();
6076 // Register an integer property
6078 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6079 Stage::GetCurrent().Add(actor);
6080 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6081 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6083 // Build the animation
6084 float durationSeconds(1.0f);
6085 Animation animation = Animation::New(durationSeconds);
6086 int targetValue(30);
6087 int relativeValue(targetValue - startValue);
6089 animation.AnimateTo(Property(actor, index),
6091 TimePeriod(delay, durationSeconds - delay));
6093 // Start the animation
6096 bool signalReceived(false);
6097 AnimationFinishCheck finishCheck(signalReceived);
6098 animation.FinishedSignal().Connect(&application, finishCheck);
6100 application.SendNotification();
6101 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6103 // We didn't expect the animation to finish yet
6104 application.SendNotification();
6105 finishCheck.CheckSignalNotReceived();
6106 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6108 application.SendNotification();
6109 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6111 // We didn't expect the animation to finish yet
6112 application.SendNotification();
6113 finishCheck.CheckSignalNotReceived();
6114 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6116 application.SendNotification();
6117 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6119 // We did expect the animation to finish
6120 application.SendNotification();
6121 finishCheck.CheckSignalReceived();
6122 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6126 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6128 TestApplication application;
6130 Actor actor = Actor::New();
6132 // Register an integer property
6134 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6135 Stage::GetCurrent().Add(actor);
6136 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6137 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6139 // Build the animation
6140 float durationSeconds(1.0f);
6141 Animation animation = Animation::New(durationSeconds);
6142 int targetValue(30);
6143 int relativeValue(targetValue - startValue);
6145 animation.AnimateTo(Property(actor, index),
6147 AlphaFunction::LINEAR,
6148 TimePeriod(delay, durationSeconds - delay));
6150 // Start the animation
6153 bool signalReceived(false);
6154 AnimationFinishCheck finishCheck(signalReceived);
6155 animation.FinishedSignal().Connect(&application, finishCheck);
6157 application.SendNotification();
6158 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6160 // We didn't expect the animation to finish yet
6161 application.SendNotification();
6162 finishCheck.CheckSignalNotReceived();
6163 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6165 application.SendNotification();
6166 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6168 // We didn't expect the animation to finish yet
6169 application.SendNotification();
6170 finishCheck.CheckSignalNotReceived();
6171 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6173 application.SendNotification();
6174 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6176 // We did expect the animation to finish
6177 application.SendNotification();
6178 finishCheck.CheckSignalReceived();
6179 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6183 int UtcDaliAnimationAnimateToVector2P(void)
6185 TestApplication application;
6187 Actor actor = Actor::New();
6189 // Register a Vector2 property
6190 Vector2 startValue(-50.0f, -50.0f);
6191 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6192 Stage::GetCurrent().Add(actor);
6193 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6194 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6196 // Build the animation
6197 float durationSeconds(2.0f);
6198 Animation animation = Animation::New(durationSeconds);
6199 Vector2 targetValue(50.0f, 50.0f);
6200 Vector2 relativeValue(targetValue - startValue);
6201 animation.AnimateTo(Property(actor, index), targetValue);
6203 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6205 // Start the animation
6208 bool signalReceived(false);
6209 AnimationFinishCheck finishCheck(signalReceived);
6210 animation.FinishedSignal().Connect(&application, finishCheck);
6212 application.SendNotification();
6213 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6215 // We didn't expect the animation to finish yet
6216 application.SendNotification();
6217 finishCheck.CheckSignalNotReceived();
6218 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6220 application.SendNotification();
6221 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6223 // We did expect the animation to finish
6224 application.SendNotification();
6225 finishCheck.CheckSignalReceived();
6226 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6230 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6232 TestApplication application;
6234 Actor actor = Actor::New();
6236 // Register a Vector2 property
6237 Vector2 startValue(1000.0f, 1000.0f);
6238 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6239 Stage::GetCurrent().Add(actor);
6240 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6241 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6243 // Build the animation
6244 float durationSeconds(1.0f);
6245 Animation animation = Animation::New(durationSeconds);
6246 Vector2 targetValue(9000.0f, 9000.0f);
6247 Vector2 relativeValue(targetValue - startValue);
6248 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6250 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6252 // Start the animation
6255 bool signalReceived(false);
6256 AnimationFinishCheck finishCheck(signalReceived);
6257 animation.FinishedSignal().Connect(&application, finishCheck);
6259 application.SendNotification();
6260 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6262 // We didn't expect the animation to finish yet
6263 application.SendNotification();
6264 finishCheck.CheckSignalNotReceived();
6266 // The position should have moved more, than with a linear alpha function
6267 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
6268 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6269 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6271 application.SendNotification();
6272 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6274 // We did expect the animation to finish
6275 application.SendNotification();
6276 finishCheck.CheckSignalReceived();
6277 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6281 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6283 TestApplication application;
6285 Actor actor = Actor::New();
6287 // Register a Vector2 property
6288 Vector2 startValue(10.0f, 10.0f);
6289 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6290 Stage::GetCurrent().Add(actor);
6291 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6292 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6294 // Build the animation
6295 float durationSeconds(1.0f);
6296 Animation animation = Animation::New(durationSeconds);
6297 Vector2 targetValue(-10.0f, 20.0f);
6298 Vector2 relativeValue(targetValue - startValue);
6300 animation.AnimateTo(Property(actor, index),
6302 TimePeriod(delay, durationSeconds - delay));
6304 // Start the animation
6307 bool signalReceived(false);
6308 AnimationFinishCheck finishCheck(signalReceived);
6309 animation.FinishedSignal().Connect(&application, finishCheck);
6311 application.SendNotification();
6312 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6314 // We didn't expect the animation to finish yet
6315 application.SendNotification();
6316 finishCheck.CheckSignalNotReceived();
6317 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6319 application.SendNotification();
6320 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6322 // We didn't expect the animation to finish yet
6323 application.SendNotification();
6324 finishCheck.CheckSignalNotReceived();
6325 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6327 application.SendNotification();
6328 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6330 // We did expect the animation to finish
6331 application.SendNotification();
6332 finishCheck.CheckSignalReceived();
6333 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6337 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6339 TestApplication application;
6341 Actor actor = Actor::New();
6343 // Register a Vector2 property
6344 Vector2 startValue(10.0f, 10.0f);
6345 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6346 Stage::GetCurrent().Add(actor);
6347 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6348 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6350 // Build the animation
6351 float durationSeconds(1.0f);
6352 Animation animation = Animation::New(durationSeconds);
6353 Vector2 targetValue(30.0f, 30.0f);
6354 Vector2 relativeValue(targetValue - startValue);
6356 animation.AnimateTo(Property(actor, index),
6358 AlphaFunction::LINEAR,
6359 TimePeriod(delay, durationSeconds - delay));
6361 // Start the animation
6364 bool signalReceived(false);
6365 AnimationFinishCheck finishCheck(signalReceived);
6366 animation.FinishedSignal().Connect(&application, finishCheck);
6368 application.SendNotification();
6369 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6371 // We didn't expect the animation to finish yet, but cached value should be the final one
6372 application.SendNotification();
6373 finishCheck.CheckSignalNotReceived();
6374 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6375 DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
6377 application.SendNotification();
6378 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6380 // We didn't expect the animation to finish yet
6381 application.SendNotification();
6382 finishCheck.CheckSignalNotReceived();
6383 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6385 application.SendNotification();
6386 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6388 // We did expect the animation to finish
6389 application.SendNotification();
6390 finishCheck.CheckSignalReceived();
6391 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6392 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6396 int UtcDaliAnimationAnimateToVector3P(void)
6398 TestApplication application;
6400 Actor actor = Actor::New();
6402 // Register a Vector3 property
6403 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6404 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6405 Stage::GetCurrent().Add(actor);
6406 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
6407 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6409 // Build the animation
6410 float durationSeconds(2.0f);
6411 Animation animation = Animation::New(durationSeconds);
6412 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6413 Vector3 relativeValue(targetValue - startValue);
6414 animation.AnimateTo(Property(actor, index), targetValue);
6416 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6418 // Start the animation
6421 bool signalReceived(false);
6422 AnimationFinishCheck finishCheck(signalReceived);
6423 animation.FinishedSignal().Connect(&application, finishCheck);
6425 application.SendNotification();
6426 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6428 // We didn't expect the animation to finish yet
6429 application.SendNotification();
6430 finishCheck.CheckSignalNotReceived();
6431 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6433 application.SendNotification();
6434 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6436 // We did expect the animation to finish
6437 application.SendNotification();
6438 finishCheck.CheckSignalReceived();
6439 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6443 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6445 TestApplication application;
6447 Actor actor = Actor::New();
6449 // Register a Vector3 property
6450 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6451 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6452 Stage::GetCurrent().Add(actor);
6453 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6454 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6456 // Build the animation
6457 float durationSeconds(1.0f);
6458 Animation animation = Animation::New(durationSeconds);
6459 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6460 Vector3 relativeValue(targetValue - startValue);
6461 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6463 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6465 // Start the animation
6468 bool signalReceived(false);
6469 AnimationFinishCheck finishCheck(signalReceived);
6470 animation.FinishedSignal().Connect(&application, finishCheck);
6472 application.SendNotification();
6473 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6475 // We didn't expect the animation to finish yet
6476 application.SendNotification();
6477 finishCheck.CheckSignalNotReceived();
6479 // The position should have moved more, than with a linear alpha function
6480 Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
6481 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6482 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6483 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6485 application.SendNotification();
6486 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6488 // We did expect the animation to finish
6489 application.SendNotification();
6490 finishCheck.CheckSignalReceived();
6491 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6495 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6497 TestApplication application;
6499 Actor actor = Actor::New();
6501 // Register a Vector3 property
6502 Vector3 startValue(10.0f, 10.0f, 10.0f);
6503 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6504 Stage::GetCurrent().Add(actor);
6505 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6506 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6508 // Build the animation
6509 float durationSeconds(1.0f);
6510 Animation animation = Animation::New(durationSeconds);
6511 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6512 Vector3 relativeValue(targetValue - startValue);
6514 animation.AnimateTo(Property(actor, index),
6516 TimePeriod(delay, durationSeconds - delay));
6518 // Start the animation
6521 bool signalReceived(false);
6522 AnimationFinishCheck finishCheck(signalReceived);
6523 animation.FinishedSignal().Connect(&application, finishCheck);
6525 application.SendNotification();
6526 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6528 // We didn't expect the animation to finish yet
6529 application.SendNotification();
6530 finishCheck.CheckSignalNotReceived();
6531 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6533 application.SendNotification();
6534 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6536 // We didn't expect the animation to finish yet
6537 application.SendNotification();
6538 finishCheck.CheckSignalNotReceived();
6539 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6541 application.SendNotification();
6542 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6544 // We did expect the animation to finish
6545 application.SendNotification();
6546 finishCheck.CheckSignalReceived();
6547 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6551 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6553 TestApplication application;
6555 Actor actor = Actor::New();
6557 // Register a Vector3 property
6558 Vector3 startValue(10.0f, 10.0f, 10.0f);
6559 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6560 Stage::GetCurrent().Add(actor);
6561 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6562 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6564 // Build the animation
6565 float durationSeconds(1.0f);
6566 Animation animation = Animation::New(durationSeconds);
6567 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6568 Vector3 relativeValue(targetValue - startValue);
6570 animation.AnimateTo(Property(actor, "testProperty"),
6572 AlphaFunction::LINEAR,
6573 TimePeriod(delay, durationSeconds - delay));
6575 // Start the animation
6578 bool signalReceived(false);
6579 AnimationFinishCheck finishCheck(signalReceived);
6580 animation.FinishedSignal().Connect(&application, finishCheck);
6582 application.SendNotification();
6583 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6585 // We didn't expect the animation to finish yet
6586 application.SendNotification();
6587 finishCheck.CheckSignalNotReceived();
6588 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6590 application.SendNotification();
6591 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6593 // We didn't expect the animation to finish yet
6594 application.SendNotification();
6595 finishCheck.CheckSignalNotReceived();
6596 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6598 application.SendNotification();
6599 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6601 // We did expect the animation to finish
6602 application.SendNotification();
6603 finishCheck.CheckSignalReceived();
6604 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6608 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6610 TestApplication application;
6612 Actor actor = Actor::New();
6614 // Register a Vector3 property
6615 Vector3 startValue(10.0f, 10.0f, 10.0f);
6616 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6617 Stage::GetCurrent().Add(actor);
6618 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6619 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6621 // Build the animation
6622 float durationSeconds(1.0f);
6623 Animation animation = Animation::New(durationSeconds);
6624 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6625 Vector3 relativeValue(targetValue - startValue);
6627 animation.AnimateTo(Property(actor, "testProperty", 0),
6629 AlphaFunction::LINEAR,
6630 TimePeriod(delay, durationSeconds - delay));
6631 animation.AnimateTo(Property(actor, index, 1),
6633 AlphaFunction::LINEAR,
6634 TimePeriod(delay, durationSeconds - delay));
6636 // Start the animation
6639 bool signalReceived(false);
6640 AnimationFinishCheck finishCheck(signalReceived);
6641 animation.FinishedSignal().Connect(&application, finishCheck);
6643 application.SendNotification();
6644 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6646 // We didn't expect the animation to finish yet
6647 application.SendNotification();
6648 finishCheck.CheckSignalNotReceived();
6649 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6651 application.SendNotification();
6652 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6654 // We didn't expect the animation to finish yet
6655 application.SendNotification();
6656 finishCheck.CheckSignalNotReceived();
6657 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6659 application.SendNotification();
6660 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6662 // We did expect the animation to finish
6663 application.SendNotification();
6664 finishCheck.CheckSignalReceived();
6665 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6669 int UtcDaliAnimationAnimateToVector4P(void)
6671 TestApplication application;
6673 Actor actor = Actor::New();
6675 // Register a Vector4 property
6676 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6677 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6678 Stage::GetCurrent().Add(actor);
6679 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6680 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6682 // Build the animation
6683 float durationSeconds(2.0f);
6684 Animation animation = Animation::New(durationSeconds);
6685 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6686 Vector4 relativeValue(targetValue - startValue);
6687 animation.AnimateTo(Property(actor, index), targetValue);
6689 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6691 // Start the animation
6694 bool signalReceived(false);
6695 AnimationFinishCheck finishCheck(signalReceived);
6696 animation.FinishedSignal().Connect(&application, finishCheck);
6698 application.SendNotification();
6699 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6701 // We didn't expect the animation to finish yet
6702 application.SendNotification();
6703 finishCheck.CheckSignalNotReceived();
6704 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6706 application.SendNotification();
6707 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6709 // We did expect the animation to finish
6710 application.SendNotification();
6711 finishCheck.CheckSignalReceived();
6712 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6716 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6718 TestApplication application;
6720 Actor actor = Actor::New();
6722 // Register a Vector4 property
6723 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6724 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6725 Stage::GetCurrent().Add(actor);
6726 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6727 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6729 // Build the animation
6730 float durationSeconds(1.0f);
6731 Animation animation = Animation::New(durationSeconds);
6732 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6733 Vector4 relativeValue(targetValue - startValue);
6734 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6736 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6738 // Start the animation
6741 bool signalReceived(false);
6742 AnimationFinishCheck finishCheck(signalReceived);
6743 animation.FinishedSignal().Connect(&application, finishCheck);
6745 application.SendNotification();
6746 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6748 // We didn't expect the animation to finish yet
6749 application.SendNotification();
6750 finishCheck.CheckSignalNotReceived();
6752 // The position should have moved more, than with a linear alpha function
6753 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6754 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6755 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6756 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6757 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6759 application.SendNotification();
6760 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6762 // We did expect the animation to finish
6763 application.SendNotification();
6764 finishCheck.CheckSignalReceived();
6765 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6769 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6771 TestApplication application;
6773 Actor actor = Actor::New();
6775 // Register a Vector4 property
6776 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6777 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6778 Stage::GetCurrent().Add(actor);
6779 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6780 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6782 // Build the animation
6783 float durationSeconds(1.0f);
6784 Animation animation = Animation::New(durationSeconds);
6785 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6786 Vector4 relativeValue(targetValue - startValue);
6788 animation.AnimateTo(Property(actor, index),
6790 TimePeriod(delay, durationSeconds - delay));
6792 // Start the animation
6795 bool signalReceived(false);
6796 AnimationFinishCheck finishCheck(signalReceived);
6797 animation.FinishedSignal().Connect(&application, finishCheck);
6799 application.SendNotification();
6800 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6802 // We didn't expect the animation to finish yet
6803 application.SendNotification();
6804 finishCheck.CheckSignalNotReceived();
6805 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6807 application.SendNotification();
6808 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6810 // We didn't expect the animation to finish yet
6811 application.SendNotification();
6812 finishCheck.CheckSignalNotReceived();
6813 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6815 application.SendNotification();
6816 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6818 // We did expect the animation to finish
6819 application.SendNotification();
6820 finishCheck.CheckSignalReceived();
6821 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6825 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6827 TestApplication application;
6829 Actor actor = Actor::New();
6831 // Register a Vector4 property
6832 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6833 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6834 Stage::GetCurrent().Add(actor);
6835 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6836 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6838 // Build the animation
6839 float durationSeconds(1.0f);
6840 Animation animation = Animation::New(durationSeconds);
6841 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6842 Vector4 relativeValue(targetValue - startValue);
6844 animation.AnimateTo(Property(actor, index),
6846 AlphaFunction::LINEAR,
6847 TimePeriod(delay, durationSeconds - delay));
6849 // Start the animation
6852 bool signalReceived(false);
6853 AnimationFinishCheck finishCheck(signalReceived);
6854 animation.FinishedSignal().Connect(&application, finishCheck);
6856 application.SendNotification();
6857 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6859 // We didn't expect the animation to finish yet
6860 application.SendNotification();
6861 finishCheck.CheckSignalNotReceived();
6862 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6864 application.SendNotification();
6865 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6867 // We didn't expect the animation to finish yet
6868 application.SendNotification();
6869 finishCheck.CheckSignalNotReceived();
6870 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6872 application.SendNotification();
6873 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6875 // We did expect the animation to finish
6876 application.SendNotification();
6877 finishCheck.CheckSignalReceived();
6878 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6882 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6884 TestApplication application;
6886 Actor actor = Actor::New();
6887 Stage::GetCurrent().Add(actor);
6888 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6890 // Build the animation
6891 float durationSeconds(1.0f);
6892 Animation animation = Animation::New(durationSeconds);
6893 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6895 DALI_TEST_ASSERTION(
6897 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6898 }, "Property is not animatable" );
6903 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
6905 TestApplication application;
6907 Actor actor = Actor::New();
6908 Stage::GetCurrent().Add(actor);
6909 float startValue(0.0f);
6910 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6911 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6913 // Build the animation
6914 float durationSeconds(1.0f);
6915 Animation animation = Animation::New(durationSeconds);
6916 float targetX(1.0f);
6918 DALI_TEST_ASSERTION(
6920 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6921 }, "Property is not animatable" );
6926 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
6928 TestApplication application;
6930 Actor actor = Actor::New();
6931 Stage::GetCurrent().Add(actor);
6932 float startValue(0.0f);
6933 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6934 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6936 // Build the animation
6937 float durationSeconds(1.0f);
6938 Animation animation = Animation::New(durationSeconds);
6939 float targetY(1.0f);
6941 DALI_TEST_ASSERTION(
6943 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6944 }, "Property is not animatable" );
6949 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
6951 TestApplication application;
6953 Actor actor = Actor::New();
6954 Stage::GetCurrent().Add(actor);
6955 float startValue(0.5f);
6956 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6957 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6959 // Build the animation
6960 float durationSeconds(1.0f);
6961 Animation animation = Animation::New(durationSeconds);
6962 float targetZ(1.0f);
6964 DALI_TEST_ASSERTION(
6966 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6967 }, "Property is not animatable" );
6972 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
6974 TestApplication application;
6976 Actor actor = Actor::New();
6977 Stage::GetCurrent().Add(actor);
6978 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6980 // Build the animation
6981 float durationSeconds(1.0f);
6982 Animation animation = Animation::New(durationSeconds);
6983 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6985 DALI_TEST_ASSERTION(
6987 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6988 }, "Property is not animatable" );
6993 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
6995 TestApplication application;
6997 Actor actor = Actor::New();
6998 Stage::GetCurrent().Add(actor);
6999 float startValue(0.5f);
7000 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
7001 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
7003 // Build the animation
7004 float durationSeconds(1.0f);
7005 Animation animation = Animation::New(durationSeconds);
7006 float targetX(1.0f);
7008 DALI_TEST_ASSERTION(
7010 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
7011 }, "Property is not animatable" );
7016 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7018 TestApplication application;
7020 Actor actor = Actor::New();
7021 Stage::GetCurrent().Add(actor);
7022 float startValue(0.5f);
7023 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
7024 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
7026 // Build the animation
7027 float durationSeconds(1.0f);
7028 Animation animation = Animation::New(durationSeconds);
7029 float targetY(0.0f);
7031 DALI_TEST_ASSERTION(
7033 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
7034 }, "Property is not animatable" );
7039 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7041 TestApplication application;
7043 Actor actor = Actor::New();
7044 Stage::GetCurrent().Add(actor);
7045 float startValue(0.5f);
7046 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
7047 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
7049 // Build the animation
7050 float durationSeconds(1.0f);
7051 Animation animation = Animation::New(durationSeconds);
7052 float targetZ(100.0f);
7054 DALI_TEST_ASSERTION(
7056 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
7057 }, "Property is not animatable" );
7062 int UtcDaliAnimationAnimateToActorSizeP(void)
7064 TestApplication application;
7066 Actor actor = Actor::New();
7067 Stage::GetCurrent().Add(actor);
7068 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7070 // Build the animation
7071 float durationSeconds(1.0f);
7072 Animation animation = Animation::New(durationSeconds);
7073 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7074 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
7076 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7078 // Should return the initial properties before play
7079 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7080 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
7081 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
7082 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
7084 // Start the animation
7087 // Should return the target property after play
7088 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7089 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
7090 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
7091 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
7093 bool signalReceived(false);
7094 AnimationFinishCheck finishCheck(signalReceived);
7095 animation.FinishedSignal().Connect(&application, finishCheck);
7097 application.SendNotification();
7098 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7100 // We didn't expect the animation to finish yet
7101 application.SendNotification();
7102 finishCheck.CheckSignalNotReceived();
7103 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
7105 application.SendNotification();
7106 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7108 // We did expect the animation to finish
7109 application.SendNotification();
7110 finishCheck.CheckSignalReceived();
7111 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7114 finishCheck.Reset();
7115 actor.SetSize(Vector3::ZERO);
7116 application.SendNotification();
7117 application.Render(0);
7118 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7120 // Repeat with a different (ease-in) alpha function
7121 animation = Animation::New(durationSeconds);
7122 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7123 animation.FinishedSignal().Connect(&application, finishCheck);
7126 application.SendNotification();
7127 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7129 // We didn't expect the animation to finish yet
7130 application.SendNotification();
7131 finishCheck.CheckSignalNotReceived();
7133 // The size should have travelled less, than with a linear alpha function
7134 Vector3 current(actor.GetCurrentSize());
7135 DALI_TEST_CHECK( current.x > 0.0f );
7136 DALI_TEST_CHECK( current.y > 0.0f );
7137 DALI_TEST_CHECK( current.z > 0.0f );
7138 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7139 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7140 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7142 application.SendNotification();
7143 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7145 // We did expect the animation to finish
7146 application.SendNotification();
7147 finishCheck.CheckSignalReceived();
7148 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7151 finishCheck.Reset();
7152 actor.SetSize(Vector3::ZERO);
7153 application.SendNotification();
7154 application.Render(0);
7155 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7157 // Repeat with a delay
7159 animation = Animation::New(durationSeconds);
7160 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7161 animation.FinishedSignal().Connect(&application, finishCheck);
7164 application.SendNotification();
7165 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7167 // We didn't expect the animation to finish yet
7168 application.SendNotification();
7169 finishCheck.CheckSignalNotReceived();
7170 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7172 application.SendNotification();
7173 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7175 // We did expect the animation to finish
7176 application.SendNotification();
7177 finishCheck.CheckSignalReceived();
7178 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7182 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7184 TestApplication application;
7186 Actor actor = Actor::New();
7187 Stage::GetCurrent().Add(actor);
7188 float startValue(0.0f);
7189 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
7190 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
7192 // Build the animation
7193 float durationSeconds(1.0f);
7194 Animation animation = Animation::New(durationSeconds);
7195 float targetWidth(10.0f);
7196 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
7198 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
7200 // Should return the initial properties before play
7201 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7202 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
7204 // Start the animation
7207 // Should return the target property after play
7208 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
7209 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
7211 bool signalReceived(false);
7212 AnimationFinishCheck finishCheck(signalReceived);
7213 animation.FinishedSignal().Connect(&application, finishCheck);
7215 application.SendNotification();
7216 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7218 // We didn't expect the animation to finish yet
7219 application.SendNotification();
7220 finishCheck.CheckSignalNotReceived();
7221 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
7223 application.SendNotification();
7224 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7226 // We did expect the animation to finish
7227 application.SendNotification();
7228 finishCheck.CheckSignalReceived();
7229 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
7230 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
7234 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7236 TestApplication application;
7238 Actor actor = Actor::New();
7239 Stage::GetCurrent().Add(actor);
7240 float startValue(0.0f);
7241 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
7242 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
7244 // Build the animation
7245 float durationSeconds(1.0f);
7246 Animation animation = Animation::New(durationSeconds);
7247 float targetHeight(-10.0f);
7248 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
7250 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
7252 // Should return the initial properties before play
7253 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7254 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
7256 // Start the animation
7259 // Should return the target property after play
7260 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
7261 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
7263 bool signalReceived(false);
7264 AnimationFinishCheck finishCheck(signalReceived);
7265 animation.FinishedSignal().Connect(&application, finishCheck);
7267 application.SendNotification();
7268 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7270 // We didn't expect the animation to finish yet
7271 application.SendNotification();
7272 finishCheck.CheckSignalNotReceived();
7273 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
7275 application.SendNotification();
7276 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7278 // We did expect the animation to finish
7279 application.SendNotification();
7280 finishCheck.CheckSignalReceived();
7281 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
7282 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
7286 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7288 TestApplication application;
7290 Actor actor = Actor::New();
7291 Stage::GetCurrent().Add(actor);
7292 float startValue(0.0f);
7293 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
7294 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
7296 // Build the animation
7297 float durationSeconds(1.0f);
7298 Animation animation = Animation::New(durationSeconds);
7299 float targetDepth(-10.0f);
7300 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
7302 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
7304 // Should return the initial properties before play
7305 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7306 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
7308 // Start the animation
7311 // Should return the target property after play
7312 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
7313 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
7315 bool signalReceived(false);
7316 AnimationFinishCheck finishCheck(signalReceived);
7317 animation.FinishedSignal().Connect(&application, finishCheck);
7319 application.SendNotification();
7320 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7322 // We didn't expect the animation to finish yet
7323 application.SendNotification();
7324 finishCheck.CheckSignalNotReceived();
7325 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
7327 application.SendNotification();
7328 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7330 // We did expect the animation to finish
7331 application.SendNotification();
7332 finishCheck.CheckSignalReceived();
7333 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
7334 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
7338 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7340 TestApplication application;
7342 Actor actor = Actor::New();
7343 Stage::GetCurrent().Add(actor);
7344 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7346 // Build the animation
7347 float durationSeconds(1.0f);
7348 Animation animation = Animation::New(durationSeconds);
7349 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7350 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
7352 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7354 // Start the animation
7357 bool signalReceived(false);
7358 AnimationFinishCheck finishCheck(signalReceived);
7359 animation.FinishedSignal().Connect(&application, finishCheck);
7361 application.SendNotification();
7362 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7364 // We didn't expect the animation to finish yet
7365 application.SendNotification();
7366 finishCheck.CheckSignalNotReceived();
7367 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
7369 application.SendNotification();
7370 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7372 // We did expect the animation to finish
7373 application.SendNotification();
7374 finishCheck.CheckSignalReceived();
7375 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7378 finishCheck.Reset();
7379 actor.SetSize(Vector3::ZERO);
7380 application.SendNotification();
7381 application.Render(0);
7382 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7384 // Repeat with a different (ease-in) alpha function
7385 animation = Animation::New(durationSeconds);
7386 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
7387 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
7388 animation.FinishedSignal().Connect(&application, finishCheck);
7391 application.SendNotification();
7392 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7394 // We didn't expect the animation to finish yet
7395 application.SendNotification();
7396 finishCheck.CheckSignalNotReceived();
7398 // The size should have travelled less, than with a linear alpha function
7399 Vector3 current(actor.GetCurrentSize());
7400 DALI_TEST_CHECK( current.x > 0.0f );
7401 DALI_TEST_CHECK( current.y > 0.0f );
7402 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7403 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7405 application.SendNotification();
7406 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7408 // We did expect the animation to finish
7409 application.SendNotification();
7410 finishCheck.CheckSignalReceived();
7411 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7412 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7415 finishCheck.Reset();
7416 actor.SetSize(Vector3::ZERO);
7417 application.SendNotification();
7418 application.Render(0);
7419 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7421 // Repeat with a delay
7423 animation = Animation::New(durationSeconds);
7424 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7425 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7426 animation.FinishedSignal().Connect(&application, finishCheck);
7429 application.SendNotification();
7430 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7432 // We didn't expect the animation to finish yet
7433 application.SendNotification();
7434 finishCheck.CheckSignalNotReceived();
7435 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7437 application.SendNotification();
7438 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7440 // We did expect the animation to finish
7441 application.SendNotification();
7442 finishCheck.CheckSignalReceived();
7443 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7444 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7448 int UtcDaliAnimationAnimateToActorPositionP(void)
7450 TestApplication application;
7452 Actor actor = Actor::New();
7453 Stage::GetCurrent().Add(actor);
7454 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7456 // Build the animation
7457 float durationSeconds(1.0f);
7458 Animation animation = Animation::New(durationSeconds);
7459 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7460 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7462 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7464 // Should return the initial properties before play
7465 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7466 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
7467 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
7468 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
7470 // Start the animation
7473 // Should return the target property after play
7474 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7475 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
7476 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
7477 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
7479 bool signalReceived(false);
7480 AnimationFinishCheck finishCheck(signalReceived);
7481 animation.FinishedSignal().Connect(&application, finishCheck);
7483 application.SendNotification();
7484 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7486 // We didn't expect the animation to finish yet
7487 application.SendNotification();
7488 finishCheck.CheckSignalNotReceived();
7489 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7491 application.SendNotification();
7492 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7494 // We did expect the animation to finish
7495 application.SendNotification();
7496 finishCheck.CheckSignalReceived();
7497 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7501 int UtcDaliAnimationAnimateToActorPositionXP(void)
7503 TestApplication application;
7505 Actor actor = Actor::New();
7506 Stage::GetCurrent().Add(actor);
7507 float startValue(0.0f);
7508 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
7509 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7510 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7511 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7513 // Build the animation
7514 float durationSeconds(1.0f);
7515 Animation animation = Animation::New(durationSeconds);
7516 float targetX(1.0f);
7517 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
7519 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7521 // Should return the initial properties before play
7522 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7523 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
7525 // Start the animation
7528 // Should return the target property after play
7529 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7530 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7532 bool signalReceived(false);
7533 AnimationFinishCheck finishCheck(signalReceived);
7534 animation.FinishedSignal().Connect(&application, finishCheck);
7536 application.SendNotification();
7537 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7539 // We didn't expect the animation to finish yet
7540 application.SendNotification();
7541 finishCheck.CheckSignalNotReceived();
7542 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
7544 application.SendNotification();
7545 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7547 // We did expect the animation to finish
7548 application.SendNotification();
7549 finishCheck.CheckSignalReceived();
7550 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
7551 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7552 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7553 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7557 int UtcDaliAnimationAnimateToActorPositionYP(void)
7559 TestApplication application;
7561 Actor actor = Actor::New();
7562 Stage::GetCurrent().Add(actor);
7563 float startValue(0.0f);
7564 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7565 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7566 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7567 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7569 // Build the animation
7570 float durationSeconds(1.0f);
7571 Animation animation = Animation::New(durationSeconds);
7572 float targetY(10.0f);
7573 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7575 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7577 // Should return the initial properties before play
7578 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7579 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7581 // Start the animation
7584 // Should return the target property after play
7585 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7586 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7588 bool signalReceived(false);
7589 AnimationFinishCheck finishCheck(signalReceived);
7590 animation.FinishedSignal().Connect(&application, finishCheck);
7592 application.SendNotification();
7593 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7595 // We didn't expect the animation to finish yet
7596 application.SendNotification();
7597 finishCheck.CheckSignalNotReceived();
7598 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7600 application.SendNotification();
7601 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7603 // We did expect the animation to finish
7604 application.SendNotification();
7605 finishCheck.CheckSignalReceived();
7606 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7607 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7608 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7609 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7613 int UtcDaliAnimationAnimateToActorPositionZP(void)
7615 TestApplication application;
7617 Actor actor = Actor::New();
7618 Stage::GetCurrent().Add(actor);
7619 float startValue(0.0f);
7620 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7621 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7622 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7623 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7625 // Build the animation
7626 float durationSeconds(1.0f);
7627 Animation animation = Animation::New(durationSeconds);
7628 float targetZ(-5.0f);
7629 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7631 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7633 // Should return the initial properties before play
7634 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7635 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7637 // Start the animation
7640 // Should return the target property after play
7641 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7642 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7644 bool signalReceived(false);
7645 AnimationFinishCheck finishCheck(signalReceived);
7646 animation.FinishedSignal().Connect(&application, finishCheck);
7648 application.SendNotification();
7649 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7651 // We didn't expect the animation to finish yet
7652 application.SendNotification();
7653 finishCheck.CheckSignalNotReceived();
7654 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7656 application.SendNotification();
7657 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7659 // We did expect the animation to finish
7660 application.SendNotification();
7661 finishCheck.CheckSignalReceived();
7662 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7663 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7664 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7665 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7669 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7671 TestApplication application;
7673 Actor actor = Actor::New();
7674 Stage::GetCurrent().Add(actor);
7675 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7677 // Build the animation
7678 float durationSeconds(1.0f);
7679 Animation animation = Animation::New(durationSeconds);
7680 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7681 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7683 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7685 // Start the animation
7688 bool signalReceived(false);
7689 AnimationFinishCheck finishCheck(signalReceived);
7690 animation.FinishedSignal().Connect(&application, finishCheck);
7692 application.SendNotification();
7693 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7695 // We didn't expect the animation to finish yet
7696 application.SendNotification();
7697 finishCheck.CheckSignalNotReceived();
7699 // The position should have moved less, than with a linear alpha function
7700 Vector3 current(actor.GetCurrentPosition());
7701 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7702 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7703 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7704 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7705 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7706 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7708 application.SendNotification();
7709 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7711 // We did expect the animation to finish
7712 application.SendNotification();
7713 finishCheck.CheckSignalReceived();
7714 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7718 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7720 TestApplication application;
7722 Actor actor = Actor::New();
7723 Stage::GetCurrent().Add(actor);
7724 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7726 // Build the animation
7727 float durationSeconds(1.0f);
7728 Animation animation = Animation::New(durationSeconds);
7729 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7731 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7733 TimePeriod( delay, durationSeconds - delay ) );
7735 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7737 // Start the animation
7740 bool signalReceived(false);
7741 AnimationFinishCheck finishCheck(signalReceived);
7742 animation.FinishedSignal().Connect(&application, finishCheck);
7744 application.SendNotification();
7745 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7747 // We didn't expect the animation to finish yet
7748 application.SendNotification();
7749 finishCheck.CheckSignalNotReceived();
7750 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7752 application.SendNotification();
7753 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7755 // We didn't expect the animation to finish yet
7756 application.SendNotification();
7757 finishCheck.CheckSignalNotReceived();
7758 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7760 application.SendNotification();
7761 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7763 // We did expect the animation to finish
7764 application.SendNotification();
7765 finishCheck.CheckSignalReceived();
7766 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7770 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7772 TestApplication application;
7774 Actor actor = Actor::New();
7775 Stage::GetCurrent().Add(actor);
7776 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7778 // Build the animation
7779 float durationSeconds(1.0f);
7780 Animation animation = Animation::New(durationSeconds);
7781 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7783 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7785 AlphaFunction::LINEAR,
7786 TimePeriod( delay, durationSeconds - delay ) );
7788 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7790 // Start the animation
7793 bool signalReceived(false);
7794 AnimationFinishCheck finishCheck(signalReceived);
7795 animation.FinishedSignal().Connect(&application, finishCheck);
7797 application.SendNotification();
7798 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7800 // We didn't expect the animation to finish yet
7801 application.SendNotification();
7802 finishCheck.CheckSignalNotReceived();
7803 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7805 application.SendNotification();
7806 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7808 // We didn't expect the animation to finish yet
7809 application.SendNotification();
7810 finishCheck.CheckSignalNotReceived();
7811 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7813 application.SendNotification();
7814 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7816 // We did expect the animation to finish
7817 application.SendNotification();
7818 finishCheck.CheckSignalReceived();
7819 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7823 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7825 TestApplication application;
7827 Actor actor = Actor::New();
7828 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7829 Stage::GetCurrent().Add(actor);
7830 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7832 // Build the animation
7833 float durationSeconds(1.0f);
7834 Animation animation = Animation::New(durationSeconds);
7835 Degree targetRotationDegrees(90.0f);
7836 Radian targetRotationRadians(targetRotationDegrees);
7837 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7839 // Start the animation
7842 // Target value should be retrievable straight away
7843 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7845 bool signalReceived(false);
7846 AnimationFinishCheck finishCheck(signalReceived);
7847 animation.FinishedSignal().Connect(&application, finishCheck);
7849 application.SendNotification();
7850 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7852 // We didn't expect the animation to finish yet
7853 application.SendNotification();
7854 finishCheck.CheckSignalNotReceived();
7855 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7857 application.SendNotification();
7858 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7860 // We didn't expect the animation to finish yet
7861 application.SendNotification();
7862 finishCheck.CheckSignalNotReceived();
7863 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7865 application.SendNotification();
7866 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7868 // We didn't expect the animation to finish yet
7869 application.SendNotification();
7870 finishCheck.CheckSignalNotReceived();
7871 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7873 application.SendNotification();
7874 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7876 // We did expect the animation to finish
7877 application.SendNotification();
7878 finishCheck.CheckSignalReceived();
7879 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7883 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7885 TestApplication application;
7887 Actor actor = Actor::New();
7888 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7889 Stage::GetCurrent().Add(actor);
7890 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7892 // Build the animation
7893 float durationSeconds(1.0f);
7894 Animation animation = Animation::New(durationSeconds);
7895 Degree targetRotationDegrees(90.0f);
7896 Radian targetRotationRadians(targetRotationDegrees);
7897 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7898 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7900 // Start the animation
7903 bool signalReceived(false);
7904 AnimationFinishCheck finishCheck(signalReceived);
7905 animation.FinishedSignal().Connect(&application, finishCheck);
7907 application.SendNotification();
7908 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7910 // We didn't expect the animation to finish yet
7911 application.SendNotification();
7912 finishCheck.CheckSignalNotReceived();
7913 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7915 application.SendNotification();
7916 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7918 // We didn't expect the animation to finish yet
7919 application.SendNotification();
7920 finishCheck.CheckSignalNotReceived();
7921 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7923 application.SendNotification();
7924 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7926 // We didn't expect the animation to finish yet
7927 application.SendNotification();
7928 finishCheck.CheckSignalNotReceived();
7929 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7931 application.SendNotification();
7932 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7934 // We did expect the animation to finish
7935 application.SendNotification();
7936 finishCheck.CheckSignalReceived();
7937 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7941 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7943 TestApplication application;
7945 Actor actor = Actor::New();
7946 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7947 Stage::GetCurrent().Add(actor);
7948 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7950 // Build the animation
7951 float durationSeconds(1.0f);
7952 Animation animation = Animation::New(durationSeconds);
7953 Degree targetRotationDegrees(90.0f);
7954 Radian targetRotationRadians(targetRotationDegrees);
7955 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7957 // Start the animation
7960 bool signalReceived(false);
7961 AnimationFinishCheck finishCheck(signalReceived);
7962 animation.FinishedSignal().Connect(&application, finishCheck);
7964 application.SendNotification();
7965 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7967 // We didn't expect the animation to finish yet
7968 application.SendNotification();
7969 finishCheck.CheckSignalNotReceived();
7970 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7972 application.SendNotification();
7973 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7975 // We didn't expect the animation to finish yet
7976 application.SendNotification();
7977 finishCheck.CheckSignalNotReceived();
7978 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7980 application.SendNotification();
7981 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7983 // We didn't expect the animation to finish yet
7984 application.SendNotification();
7985 finishCheck.CheckSignalNotReceived();
7986 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7988 application.SendNotification();
7989 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7991 // We did expect the animation to finish
7992 application.SendNotification();
7993 finishCheck.CheckSignalReceived();
7994 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7998 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8000 TestApplication application;
8002 Actor actor = Actor::New();
8003 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8004 Stage::GetCurrent().Add(actor);
8005 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8007 // Build the animation
8008 float durationSeconds(1.0f);
8009 Animation animation = Animation::New(durationSeconds);
8010 Degree targetRotationDegrees(90.0f);
8011 Radian targetRotationRadians(targetRotationDegrees);
8013 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8015 // Start the animation
8018 bool signalReceived(false);
8019 AnimationFinishCheck finishCheck(signalReceived);
8020 animation.FinishedSignal().Connect(&application, finishCheck);
8022 application.SendNotification();
8023 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8025 // We didn't expect the animation to finish yet
8026 application.SendNotification();
8027 finishCheck.CheckSignalNotReceived();
8028 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8029 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8031 application.SendNotification();
8032 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8034 // We didn't expect the animation to finish yet
8035 application.SendNotification();
8036 finishCheck.CheckSignalNotReceived();
8037 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8038 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8040 application.SendNotification();
8041 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8043 // We didn't expect the animation to finish yet
8044 application.SendNotification();
8045 finishCheck.CheckSignalNotReceived();
8046 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8047 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8049 application.SendNotification();
8050 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8052 // We did expect the animation to finish
8053 application.SendNotification();
8054 finishCheck.CheckSignalReceived();
8055 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8059 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8061 TestApplication application;
8063 Actor actor = Actor::New();
8064 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8065 Stage::GetCurrent().Add(actor);
8066 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8068 // Build the animation
8069 float durationSeconds(1.0f);
8070 Animation animation = Animation::New(durationSeconds);
8071 Degree targetRotationDegrees(90.0f);
8072 Radian targetRotationRadians(targetRotationDegrees);
8074 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8076 // Start the animation
8079 bool signalReceived(false);
8080 AnimationFinishCheck finishCheck(signalReceived);
8081 animation.FinishedSignal().Connect(&application, finishCheck);
8083 application.SendNotification();
8084 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8086 // We didn't expect the animation to finish yet
8087 application.SendNotification();
8088 finishCheck.CheckSignalNotReceived();
8089 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8090 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8092 application.SendNotification();
8093 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8095 // We didn't expect the animation to finish yet
8096 application.SendNotification();
8097 finishCheck.CheckSignalNotReceived();
8098 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8099 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8101 application.SendNotification();
8102 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8104 // We didn't expect the animation to finish yet
8105 application.SendNotification();
8106 finishCheck.CheckSignalNotReceived();
8107 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8108 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8110 application.SendNotification();
8111 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8113 // We did expect the animation to finish
8114 application.SendNotification();
8115 finishCheck.CheckSignalReceived();
8116 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8120 int UtcDaliAnimationAnimateToActorScaleP(void)
8122 TestApplication application;
8124 Actor actor = Actor::New();
8125 Stage::GetCurrent().Add(actor);
8126 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8128 // Build the animation
8129 float durationSeconds(1.0f);
8130 Animation animation = Animation::New(durationSeconds);
8131 Vector3 targetScale(2.0f, 2.0f, 2.0f);
8132 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
8134 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
8136 // Start the animation
8139 // Target value should be retrievable straight away
8140 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8141 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
8142 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
8143 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
8145 bool signalReceived(false);
8146 AnimationFinishCheck finishCheck(signalReceived);
8147 animation.FinishedSignal().Connect(&application, finishCheck);
8149 application.SendNotification();
8150 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8152 // We didn't expect the animation to finish yet
8153 application.SendNotification();
8154 finishCheck.CheckSignalNotReceived();
8155 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
8157 application.SendNotification();
8158 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8160 // We did expect the animation to finish
8161 application.SendNotification();
8162 finishCheck.CheckSignalReceived();
8163 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8166 finishCheck.Reset();
8167 actor.SetScale(Vector3::ONE);
8168 application.SendNotification();
8169 application.Render(0);
8170 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8172 // Repeat with a different (ease-in) alpha function
8173 animation = Animation::New(durationSeconds);
8174 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8175 animation.FinishedSignal().Connect(&application, finishCheck);
8178 application.SendNotification();
8179 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8181 // We didn't expect the animation to finish yet
8182 application.SendNotification();
8183 finishCheck.CheckSignalNotReceived();
8185 // The scale should have grown less, than with a linear alpha function
8186 Vector3 current(actor.GetCurrentScale());
8187 DALI_TEST_CHECK( current.x > 1.0f );
8188 DALI_TEST_CHECK( current.y > 1.0f );
8189 DALI_TEST_CHECK( current.z > 1.0f );
8190 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8191 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8192 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8194 application.SendNotification();
8195 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8197 // We did expect the animation to finish
8198 application.SendNotification();
8199 finishCheck.CheckSignalReceived();
8200 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8203 finishCheck.Reset();
8204 actor.SetScale(Vector3::ONE);
8205 application.SendNotification();
8206 application.Render(0);
8207 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8209 // Repeat with a delay
8211 animation = Animation::New(durationSeconds);
8212 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8213 animation.FinishedSignal().Connect(&application, finishCheck);
8216 application.SendNotification();
8217 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8219 // We didn't expect the animation to finish yet
8220 application.SendNotification();
8221 finishCheck.CheckSignalNotReceived();
8222 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8224 application.SendNotification();
8225 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8227 // We did expect the animation to finish
8228 application.SendNotification();
8229 finishCheck.CheckSignalReceived();
8230 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8234 int UtcDaliAnimationAnimateToActorScaleXP(void)
8236 TestApplication application;
8238 Actor actor = Actor::New();
8239 Stage::GetCurrent().Add(actor);
8240 float startValue(1.0f);
8241 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
8242 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8243 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8244 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8245 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8246 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8247 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8249 // Build the animation
8250 float durationSeconds(1.0f);
8251 Animation animation = Animation::New(durationSeconds);
8252 float targetX(10.0f);
8253 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
8255 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
8257 // Start the animation
8260 // Target value should be retrievable straight away
8261 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
8262 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8264 bool signalReceived(false);
8265 AnimationFinishCheck finishCheck(signalReceived);
8266 animation.FinishedSignal().Connect(&application, finishCheck);
8268 application.SendNotification();
8269 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8271 // We didn't expect the animation to finish yet
8272 application.SendNotification();
8273 finishCheck.CheckSignalNotReceived();
8274 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
8275 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
8276 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8277 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8279 application.SendNotification();
8280 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8282 // We did expect the animation to finish
8283 application.SendNotification();
8284 finishCheck.CheckSignalReceived();
8285 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
8286 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8287 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8288 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8292 int UtcDaliAnimationAnimateToActorScaleYP(void)
8294 TestApplication application;
8296 Actor actor = Actor::New();
8297 Stage::GetCurrent().Add(actor);
8298 float startValue(1.0f);
8299 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
8300 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8301 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8303 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8304 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8305 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8307 // Build the animation
8308 float durationSeconds(1.0f);
8309 Animation animation = Animation::New(durationSeconds);
8310 float targetY(1000.0f);
8311 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
8313 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
8315 // Start the animation
8318 // Target value should be retrievable straight away
8319 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
8320 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8322 bool signalReceived(false);
8323 AnimationFinishCheck finishCheck(signalReceived);
8324 animation.FinishedSignal().Connect(&application, finishCheck);
8326 application.SendNotification();
8327 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8329 // We didn't expect the animation to finish yet
8330 application.SendNotification();
8331 finishCheck.CheckSignalNotReceived();
8332 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
8333 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8334 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
8335 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8337 application.SendNotification();
8338 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8340 // We did expect the animation to finish
8341 application.SendNotification();
8342 finishCheck.CheckSignalReceived();
8343 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
8344 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8345 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8346 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8350 int UtcDaliAnimationAnimateToActorScaleZP(void)
8352 TestApplication application;
8354 Actor actor = Actor::New();
8355 Stage::GetCurrent().Add(actor);
8356 float startValue(1.0f);
8357 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
8358 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8359 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8360 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8361 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8362 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8363 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8365 // Build the animation
8366 float durationSeconds(1.0f);
8367 Animation animation = Animation::New(durationSeconds);
8368 float targetZ(-1000.0f);
8369 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
8371 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
8373 // Start the animation
8376 // Target value should be retrievable straight away
8377 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
8378 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8380 bool signalReceived(false);
8381 AnimationFinishCheck finishCheck(signalReceived);
8382 animation.FinishedSignal().Connect(&application, finishCheck);
8384 application.SendNotification();
8385 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8387 // We didn't expect the animation to finish yet
8388 application.SendNotification();
8389 finishCheck.CheckSignalNotReceived();
8390 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
8391 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8392 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8393 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
8395 application.SendNotification();
8396 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8398 // We did expect the animation to finish
8399 application.SendNotification();
8400 finishCheck.CheckSignalReceived();
8401 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
8402 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8403 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8404 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8408 int UtcDaliAnimationAnimateToActorColorP(void)
8410 TestApplication application;
8412 Actor actor = Actor::New();
8413 Stage::GetCurrent().Add(actor);
8414 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8416 // Build the animation
8417 float durationSeconds(1.0f);
8418 Animation animation = Animation::New(durationSeconds);
8419 Vector4 targetColor(Color::RED);
8420 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
8422 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8423 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8425 // Start the animation
8428 // Target value should be retrievable straight away
8429 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8430 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
8431 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
8432 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
8433 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
8434 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
8436 bool signalReceived(false);
8437 AnimationFinishCheck finishCheck(signalReceived);
8438 animation.FinishedSignal().Connect(&application, finishCheck);
8440 application.SendNotification();
8441 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8443 // We didn't expect the animation to finish yet
8444 application.SendNotification();
8445 finishCheck.CheckSignalNotReceived();
8446 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
8448 application.SendNotification();
8449 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8451 // We did expect the animation to finish
8452 application.SendNotification();
8453 finishCheck.CheckSignalReceived();
8454 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8457 finishCheck.Reset();
8458 actor.SetColor(Color::WHITE);
8459 application.SendNotification();
8460 application.Render(0);
8461 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8463 // Repeat with a different (ease-in) alpha function
8464 animation = Animation::New(durationSeconds);
8465 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8466 animation.FinishedSignal().Connect(&application, finishCheck);
8469 application.SendNotification();
8470 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8472 // We didn't expect the animation to finish yet
8473 application.SendNotification();
8474 finishCheck.CheckSignalNotReceived();
8476 // The color should have changed less, than with a linear alpha function
8477 Vector4 current(actor.GetCurrentColor());
8478 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
8479 DALI_TEST_CHECK( current.y < 1.0f );
8480 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
8481 DALI_TEST_CHECK( current.z < 1.0f );
8482 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
8483 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8485 application.SendNotification();
8486 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8488 // We did expect the animation to finish
8489 application.SendNotification();
8490 finishCheck.CheckSignalReceived();
8491 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8494 finishCheck.Reset();
8495 actor.SetColor(Color::WHITE);
8496 application.SendNotification();
8497 application.Render(0);
8498 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8500 // Repeat with a shorter animator duration
8501 float animatorDuration = 0.5f;
8502 animation = Animation::New(durationSeconds);
8503 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8504 animation.FinishedSignal().Connect(&application, finishCheck);
8507 application.SendNotification();
8508 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8510 // We didn't expect the animation to finish yet
8511 application.SendNotification();
8512 finishCheck.CheckSignalNotReceived();
8513 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
8515 application.SendNotification();
8516 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8518 // We didn't expect the animation to finish yet
8519 application.SendNotification();
8520 finishCheck.CheckSignalNotReceived();
8521 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8523 application.SendNotification();
8524 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8526 // We did expect the animation to finish
8527 application.SendNotification();
8528 finishCheck.CheckSignalReceived();
8529 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8533 int UtcDaliAnimationAnimateToActorColorRedP(void)
8535 TestApplication application;
8537 Actor actor = Actor::New();
8538 Stage::GetCurrent().Add(actor);
8539 float startValue(1.0f);
8540 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
8541 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8542 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8543 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8544 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8545 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8546 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8547 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8548 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8550 // Build the animation
8551 float durationSeconds(1.0f);
8552 Animation animation = Animation::New(durationSeconds);
8553 float targetRed(0.5f);
8554 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8556 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8558 // Start the animation
8561 // Target value should be retrievable straight away
8562 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8563 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8565 bool signalReceived(false);
8566 AnimationFinishCheck finishCheck(signalReceived);
8567 animation.FinishedSignal().Connect(&application, finishCheck);
8569 application.SendNotification();
8570 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8572 // We didn't expect the animation to finish yet
8573 application.SendNotification();
8574 finishCheck.CheckSignalNotReceived();
8575 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8576 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
8577 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8578 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8579 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8581 application.SendNotification();
8582 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8584 // We did expect the animation to finish
8585 application.SendNotification();
8586 finishCheck.CheckSignalReceived();
8587 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8588 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
8589 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8590 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8591 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8595 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8597 TestApplication application;
8599 Actor actor = Actor::New();
8600 Stage::GetCurrent().Add(actor);
8601 float startValue(1.0f);
8602 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8603 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8604 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8607 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8608 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8609 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8610 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8612 // Build the animation
8613 float durationSeconds(1.0f);
8614 Animation animation = Animation::New(durationSeconds);
8615 float targetGreen(0.5f);
8616 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8618 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8620 // Start the animation
8623 // Target value should be retrievable straight away
8624 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8625 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8627 bool signalReceived(false);
8628 AnimationFinishCheck finishCheck(signalReceived);
8629 animation.FinishedSignal().Connect(&application, finishCheck);
8631 application.SendNotification();
8632 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8634 // We didn't expect the animation to finish yet
8635 application.SendNotification();
8636 finishCheck.CheckSignalNotReceived();
8637 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8638 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8639 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8640 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8641 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8643 application.SendNotification();
8644 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8646 // We did expect the animation to finish
8647 application.SendNotification();
8648 finishCheck.CheckSignalReceived();
8649 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8650 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8651 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8652 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8653 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8657 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8659 TestApplication application;
8661 Actor actor = Actor::New();
8662 Stage::GetCurrent().Add(actor);
8663 float startValue(1.0f);
8664 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8665 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8666 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8667 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8668 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8669 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8670 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8671 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8672 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8674 // Build the animation
8675 float durationSeconds(1.0f);
8676 Animation animation = Animation::New(durationSeconds);
8677 float targetBlue(0.5f);
8678 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8680 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8682 // Start the animation
8685 // Target value should be retrievable straight away
8686 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8687 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8689 bool signalReceived(false);
8690 AnimationFinishCheck finishCheck(signalReceived);
8691 animation.FinishedSignal().Connect(&application, finishCheck);
8693 application.SendNotification();
8694 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8696 // We didn't expect the animation to finish yet
8697 application.SendNotification();
8698 finishCheck.CheckSignalNotReceived();
8699 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8700 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8701 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8702 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8703 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8705 application.SendNotification();
8706 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8708 // We did expect the animation to finish
8709 application.SendNotification();
8710 finishCheck.CheckSignalReceived();
8711 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8712 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8713 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8714 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8715 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8719 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8721 TestApplication application;
8723 Actor actor = Actor::New();
8724 Stage::GetCurrent().Add(actor);
8725 float startValue(1.0f);
8726 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8727 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8728 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8729 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8730 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8731 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8732 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8733 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8734 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8736 // Build the animation
8737 float durationSeconds(1.0f);
8738 Animation animation = Animation::New(durationSeconds);
8739 float targetAlpha(0.5f);
8740 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8742 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8744 // Start the animation
8747 // Target value should be retrievable straight away
8748 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8749 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8750 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8752 bool signalReceived(false);
8753 AnimationFinishCheck finishCheck(signalReceived);
8754 animation.FinishedSignal().Connect(&application, finishCheck);
8756 application.SendNotification();
8757 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8759 // We didn't expect the animation to finish yet
8760 application.SendNotification();
8761 finishCheck.CheckSignalNotReceived();
8762 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8763 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8764 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8765 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8766 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8768 application.SendNotification();
8769 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8771 // We did expect the animation to finish
8772 application.SendNotification();
8773 finishCheck.CheckSignalReceived();
8774 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8776 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8777 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8778 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8782 int UtcDaliAnimationKeyFrames01P(void)
8784 TestApplication application;
8786 KeyFrames keyFrames = KeyFrames::New();
8787 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8789 keyFrames.Add(0.0f, 0.1f);
8791 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8793 KeyFrames keyFrames2( keyFrames);
8794 DALI_TEST_CHECK( keyFrames2 );
8795 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8797 KeyFrames keyFrames3 = KeyFrames::New();
8798 keyFrames3.Add(0.6f, true);
8799 DALI_TEST_CHECK( keyFrames3 );
8800 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8802 keyFrames3 = keyFrames;
8803 DALI_TEST_CHECK( keyFrames3 );
8804 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8809 int UtcDaliAnimationKeyFrames02N(void)
8811 TestApplication application;
8813 KeyFrames keyFrames = KeyFrames::New();
8814 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8816 keyFrames.Add(0.0f, 0.1f);
8817 keyFrames.Add(0.2f, 0.5f);
8818 keyFrames.Add(0.4f, 0.0f);
8819 keyFrames.Add(0.6f, 1.0f);
8820 keyFrames.Add(0.8f, 0.7f);
8821 keyFrames.Add(1.0f, 0.9f);
8823 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8825 DALI_TEST_ASSERTION(
8827 keyFrames.Add(1.9f, false);
8828 }, "mType == value.GetType()" );
8833 int UtcDaliAnimationKeyFrames03N(void)
8835 TestApplication application;
8837 KeyFrames keyFrames = KeyFrames::New();
8838 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8840 keyFrames.Add(0.0f, true);
8841 keyFrames.Add(0.2f, false);
8842 keyFrames.Add(0.4f, false);
8843 keyFrames.Add(0.6f, true);
8844 keyFrames.Add(0.8f, true);
8845 keyFrames.Add(1.0f, false);
8847 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8849 DALI_TEST_ASSERTION(
8851 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8852 }, "mType == value.GetType()" );
8857 int UtcDaliAnimationKeyFrames04N(void)
8859 TestApplication application;
8861 KeyFrames keyFrames = KeyFrames::New();
8862 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8864 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8865 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8866 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8867 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8868 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8869 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8871 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8873 DALI_TEST_ASSERTION(
8875 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8876 }, "mType == value.GetType()" );
8881 int UtcDaliAnimationKeyFrames05N(void)
8883 TestApplication application;
8885 KeyFrames keyFrames = KeyFrames::New();
8886 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8888 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8889 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8890 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8891 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8892 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8893 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8895 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8897 DALI_TEST_ASSERTION(
8899 keyFrames.Add(0.7f, 1.0f);
8900 }, "mType == value.GetType()" );
8905 int UtcDaliAnimationKeyFrames06N(void)
8907 TestApplication application;
8909 KeyFrames keyFrames = KeyFrames::New();
8910 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8912 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8913 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8914 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8915 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8916 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8917 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8919 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8921 DALI_TEST_ASSERTION(
8923 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8924 }, "mType == value.GetType()" );
8929 int UtcDaliAnimationKeyFrames07N(void)
8931 TestApplication application;
8933 KeyFrames keyFrames = KeyFrames::New();
8934 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8936 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8937 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8938 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8939 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8940 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8941 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8943 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8945 DALI_TEST_ASSERTION(
8947 keyFrames.Add(0.7f, 1.1f);
8948 }, "mType == value.GetType()" );
8953 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8955 TestApplication application;
8957 float startValue(1.0f);
8958 Actor actor = Actor::New();
8959 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8960 Stage::GetCurrent().Add(actor);
8962 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8963 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8964 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8965 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8967 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8968 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8969 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8970 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8972 // Build the animation
8973 float durationSeconds(1.0f);
8974 Animation animation = Animation::New(durationSeconds);
8976 KeyFrames keyFrames = KeyFrames::New();
8977 keyFrames.Add(0.0f, 0.1f);
8978 keyFrames.Add(0.2f, 0.5f);
8979 keyFrames.Add(0.4f, 0.0f);
8980 keyFrames.Add(0.6f, 1.0f);
8981 keyFrames.Add(0.8f, 0.7f);
8982 keyFrames.Add(1.0f, 0.9f);
8984 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8986 // Start the animation
8989 // Final key frame value should be retrievable straight away
8990 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
8992 bool signalReceived(false);
8993 AnimationFinishCheck finishCheck(signalReceived);
8994 animation.FinishedSignal().Connect(&application, finishCheck);
8995 application.SendNotification();
8996 application.Render(0);
8997 application.SendNotification();
8998 finishCheck.CheckSignalNotReceived();
8999 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
9001 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9002 application.SendNotification();
9003 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9004 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9005 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9006 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
9007 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
9009 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9010 application.SendNotification();
9011 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9012 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9013 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9014 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
9015 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
9017 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9018 application.SendNotification();
9019 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9020 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9021 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9022 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
9023 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
9025 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9026 application.SendNotification();
9027 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9028 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9029 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9030 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
9031 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
9033 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9034 application.SendNotification();
9035 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9036 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9037 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9038 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
9039 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
9041 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9042 application.SendNotification();
9043 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9044 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9045 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9046 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
9047 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
9049 // We did expect the animation to finish
9051 finishCheck.CheckSignalReceived();
9055 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9057 TestApplication application;
9059 float startValue(1.0f);
9060 Actor actor = Actor::New();
9061 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9062 Stage::GetCurrent().Add(actor);
9064 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 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);
9078 KeyFrames keyFrames = KeyFrames::New();
9079 keyFrames.Add(0.0f, 0.1f);
9080 keyFrames.Add(0.2f, 0.5f);
9081 keyFrames.Add(0.4f, 0.0f);
9082 keyFrames.Add(0.6f, 1.0f);
9083 keyFrames.Add(0.8f, 0.7f);
9084 keyFrames.Add(1.0f, 0.9f);
9086 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
9088 // Start the animation
9091 bool signalReceived(false);
9092 AnimationFinishCheck finishCheck(signalReceived);
9093 animation.FinishedSignal().Connect(&application, finishCheck);
9094 application.SendNotification();
9095 application.Render(0);
9096 application.SendNotification();
9097 finishCheck.CheckSignalNotReceived();
9098 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
9100 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9101 application.SendNotification();
9102 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9103 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9104 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9105 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
9106 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
9108 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9109 application.SendNotification();
9110 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9111 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9112 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9113 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
9114 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
9116 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9117 application.SendNotification();
9118 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9119 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9120 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9121 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
9122 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
9124 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9125 application.SendNotification();
9126 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9127 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9128 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9129 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
9130 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
9132 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9133 application.SendNotification();
9134 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9135 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9136 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9137 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
9138 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
9140 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9141 application.SendNotification();
9142 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9143 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9144 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9145 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
9146 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
9148 // We did expect the animation to finish
9150 finishCheck.CheckSignalReceived();
9154 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9156 TestApplication application;
9158 float startValue(1.0f);
9159 Actor actor = Actor::New();
9160 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9161 Stage::GetCurrent().Add(actor);
9163 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9164 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9165 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9166 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9167 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9168 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9169 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9170 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9171 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9173 // Build the animation
9174 float durationSeconds(1.0f);
9175 Animation animation = Animation::New(durationSeconds);
9177 KeyFrames keyFrames = KeyFrames::New();
9178 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9179 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9180 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9182 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
9184 // Start the animation
9187 bool signalReceived(false);
9188 AnimationFinishCheck finishCheck(signalReceived);
9189 animation.FinishedSignal().Connect(&application, finishCheck);
9190 application.SendNotification();
9191 application.Render(0);
9192 application.SendNotification();
9193 finishCheck.CheckSignalNotReceived();
9194 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9195 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9196 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9197 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9199 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9200 application.SendNotification();
9201 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9202 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9203 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9204 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9206 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9207 application.SendNotification();
9208 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9209 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9210 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9211 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9213 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9214 application.SendNotification();
9215 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9216 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9217 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9218 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9220 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9221 application.SendNotification();
9222 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9223 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9224 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9225 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9227 // We did expect the animation to finish
9229 finishCheck.CheckSignalReceived();
9233 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9235 TestApplication application;
9237 float startValue(1.0f);
9238 Actor actor = Actor::New();
9239 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9240 Stage::GetCurrent().Add(actor);
9242 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9243 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9244 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9245 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9246 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9247 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9248 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9249 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9250 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9252 // Build the animation
9253 float durationSeconds(1.0f);
9254 Animation animation = Animation::New(durationSeconds);
9256 KeyFrames keyFrames = KeyFrames::New();
9257 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9258 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9259 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9261 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
9263 // Start the animation
9266 bool signalReceived(false);
9267 AnimationFinishCheck finishCheck(signalReceived);
9268 animation.FinishedSignal().Connect(&application, finishCheck);
9269 application.SendNotification();
9270 application.Render(0);
9271 application.SendNotification();
9272 finishCheck.CheckSignalNotReceived();
9273 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9274 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9275 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9276 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9278 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9279 application.SendNotification();
9280 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9281 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9282 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9283 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9285 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9286 application.SendNotification();
9287 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9288 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9289 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9290 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9292 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9293 application.SendNotification();
9294 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9295 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9296 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9297 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9299 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9300 application.SendNotification();
9301 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9302 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9303 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9304 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9306 // We did expect the animation to finish
9308 finishCheck.CheckSignalReceived();
9312 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9314 TestApplication application;
9316 Actor actor = Actor::New();
9317 AngleAxis aa(Degree(90), Vector3::XAXIS);
9318 actor.SetOrientation(aa.angle, aa.axis);
9319 Stage::GetCurrent().Add(actor);
9321 application.SendNotification();
9322 application.Render(0);
9324 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9326 // Build the animation
9327 float durationSeconds(1.0f);
9328 Animation animation = Animation::New(durationSeconds);
9330 KeyFrames keyFrames = KeyFrames::New();
9331 keyFrames.Add(0.0f, false);
9332 keyFrames.Add(0.2f, true);
9333 keyFrames.Add(0.4f, true);
9334 keyFrames.Add(0.8f, false);
9335 keyFrames.Add(1.0f, true);
9337 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
9339 // Start the animation
9342 // Final key frame value should be retrievable straight away
9343 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9345 bool signalReceived(false);
9346 AnimationFinishCheck finishCheck(signalReceived);
9347 animation.FinishedSignal().Connect(&application, finishCheck);
9348 application.SendNotification();
9349 application.SendNotification();
9350 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9351 application.SendNotification();
9352 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9353 application.SendNotification();
9355 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9356 finishCheck.CheckSignalReceived();
9360 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9362 TestApplication application;
9364 Actor actor = Actor::New();
9365 AngleAxis aa(Degree(90), Vector3::XAXIS);
9366 actor.SetOrientation(aa.angle, aa.axis);
9367 Stage::GetCurrent().Add(actor);
9369 application.SendNotification();
9370 application.Render(0);
9372 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9374 // Build the animation
9375 float durationSeconds(1.0f);
9376 Animation animation = Animation::New(durationSeconds);
9378 KeyFrames keyFrames = KeyFrames::New();
9379 keyFrames.Add(0.0f, false);
9380 keyFrames.Add(0.2f, true);
9381 keyFrames.Add(0.4f, true);
9382 keyFrames.Add(0.8f, false);
9383 keyFrames.Add(1.0f, true);
9385 //Cubic interpolation for boolean values should be ignored
9386 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
9388 // Start the animation
9391 bool signalReceived(false);
9392 AnimationFinishCheck finishCheck(signalReceived);
9393 animation.FinishedSignal().Connect(&application, finishCheck);
9394 application.SendNotification();
9395 application.SendNotification();
9396 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9397 application.SendNotification();
9398 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9399 application.SendNotification();
9401 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9402 finishCheck.CheckSignalReceived();
9406 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9408 TestApplication application;
9410 Actor actor = Actor::New();
9411 AngleAxis aa(Degree(90), Vector3::XAXIS);
9412 actor.SetOrientation(aa.angle, aa.axis);
9413 Stage::GetCurrent().Add(actor);
9415 application.SendNotification();
9416 application.Render(0);
9417 Quaternion start(Radian(aa.angle), aa.axis);
9418 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9420 // Build the animation
9421 float durationSeconds(1.0f);
9422 Animation animation = Animation::New(durationSeconds);
9424 KeyFrames keyFrames = KeyFrames::New();
9425 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9427 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9429 // Start the animation
9432 // Final key frame value should be retrievable straight away
9433 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
9435 bool signalReceived(false);
9436 AnimationFinishCheck finishCheck(signalReceived);
9437 animation.FinishedSignal().Connect(&application, finishCheck);
9438 application.SendNotification();
9439 application.SendNotification();
9440 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9441 application.SendNotification();
9442 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9443 application.SendNotification();
9445 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9447 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9448 finishCheck.CheckSignalReceived();
9452 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9454 TestApplication application;
9456 Actor actor = Actor::New();
9457 AngleAxis aa(Degree(90), Vector3::XAXIS);
9458 actor.SetOrientation(aa.angle, aa.axis);
9459 application.SendNotification();
9460 application.Render(0);
9461 Stage::GetCurrent().Add(actor);
9463 Quaternion start(Radian(aa.angle), aa.axis);
9464 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9466 // Build the animation
9467 float durationSeconds(1.0f);
9468 Animation animation = Animation::New(durationSeconds);
9470 KeyFrames keyFrames = KeyFrames::New();
9471 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9472 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9473 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9475 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9477 // Start the animation
9480 bool signalReceived(false);
9481 AnimationFinishCheck finishCheck(signalReceived);
9482 animation.FinishedSignal().Connect(&application, finishCheck);
9483 application.SendNotification();
9484 application.Render(0);
9485 application.SendNotification();
9486 finishCheck.CheckSignalNotReceived();
9488 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9489 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9491 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9492 application.SendNotification();
9493 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9494 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9496 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9497 application.SendNotification();
9498 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9499 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9501 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9502 application.SendNotification();
9503 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
9504 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9506 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9507 application.SendNotification();
9508 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9509 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9511 // We did expect the animation to finish
9513 finishCheck.CheckSignalReceived();
9517 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9519 TestApplication application;
9521 Actor actor = Actor::New();
9522 AngleAxis aa(Degree(90), Vector3::XAXIS);
9523 actor.SetOrientation(aa.angle, aa.axis);
9524 Stage::GetCurrent().Add(actor);
9526 application.SendNotification();
9527 application.Render(0);
9528 Quaternion start(Radian(aa.angle), aa.axis);
9529 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9531 // Build the animation
9532 float durationSeconds(1.0f);
9533 Animation animation = Animation::New(durationSeconds);
9535 KeyFrames keyFrames = KeyFrames::New();
9536 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9538 //Cubic interpolation should be ignored for quaternions
9539 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9541 // Start the animation
9544 bool signalReceived(false);
9545 AnimationFinishCheck finishCheck(signalReceived);
9546 animation.FinishedSignal().Connect(&application, finishCheck);
9547 application.SendNotification();
9548 application.SendNotification();
9549 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9550 application.SendNotification();
9551 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9552 application.SendNotification();
9554 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9556 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9557 finishCheck.CheckSignalReceived();
9561 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9563 TestApplication application;
9565 Actor actor = Actor::New();
9566 AngleAxis aa(Degree(90), Vector3::XAXIS);
9567 actor.SetOrientation(aa.angle, aa.axis);
9568 application.SendNotification();
9569 application.Render(0);
9570 Stage::GetCurrent().Add(actor);
9572 Quaternion start(Radian(aa.angle), aa.axis);
9573 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9575 // Build the animation
9576 float durationSeconds(1.0f);
9577 Animation animation = Animation::New(durationSeconds);
9579 KeyFrames keyFrames = KeyFrames::New();
9580 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9581 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9582 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9584 //Cubic interpolation should be ignored for quaternions
9585 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9587 // Start the animation
9590 bool signalReceived(false);
9591 AnimationFinishCheck finishCheck(signalReceived);
9592 animation.FinishedSignal().Connect(&application, finishCheck);
9593 application.SendNotification();
9594 application.Render(0);
9595 application.SendNotification();
9596 finishCheck.CheckSignalNotReceived();
9598 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9599 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9601 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9602 application.SendNotification();
9603 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9604 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9606 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9607 application.SendNotification();
9608 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9609 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9611 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9612 application.SendNotification();
9613 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9614 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9616 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9617 application.SendNotification();
9618 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9619 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9621 // We did expect the animation to finish
9623 finishCheck.CheckSignalReceived();
9627 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9629 TestApplication application;
9631 float startValue(1.0f);
9632 Actor actor = Actor::New();
9633 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9634 Stage::GetCurrent().Add(actor);
9636 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9637 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9638 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9639 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9640 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9641 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9642 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9643 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9644 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9646 // Build the animation
9647 float durationSeconds(1.0f);
9648 Animation animation = Animation::New(durationSeconds);
9650 KeyFrames keyFrames = KeyFrames::New();
9651 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9652 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9653 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9655 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9657 // Start the animation
9660 bool signalReceived(false);
9661 AnimationFinishCheck finishCheck(signalReceived);
9662 animation.FinishedSignal().Connect(&application, finishCheck);
9663 application.SendNotification();
9664 application.Render(0);
9665 application.SendNotification();
9666 finishCheck.CheckSignalNotReceived();
9667 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9668 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9669 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9670 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9672 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9673 application.SendNotification();
9674 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9675 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9676 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9677 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9679 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9680 application.SendNotification();
9681 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9682 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9683 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9684 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9686 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9687 application.SendNotification();
9688 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9689 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9690 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9691 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9693 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9694 application.SendNotification();
9695 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9696 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9697 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9698 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9700 // We did expect the animation to finish
9702 finishCheck.CheckSignalReceived();
9706 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9708 TestApplication application;
9710 float startValue(1.0f);
9711 Actor actor = Actor::New();
9712 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9713 Stage::GetCurrent().Add(actor);
9715 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9716 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9717 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9718 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9719 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9720 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9721 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9722 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9723 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9725 // Build the animation
9726 float durationSeconds(1.0f);
9727 Animation animation = Animation::New(durationSeconds);
9729 KeyFrames keyFrames = KeyFrames::New();
9730 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9731 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9732 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9734 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9736 // Start the animation
9739 bool signalReceived(false);
9740 AnimationFinishCheck finishCheck(signalReceived);
9741 animation.FinishedSignal().Connect(&application, finishCheck);
9742 application.SendNotification();
9743 application.Render(0);
9744 application.SendNotification();
9745 finishCheck.CheckSignalNotReceived();
9746 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9747 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9748 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9749 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9751 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9752 application.SendNotification();
9753 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9754 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9755 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9756 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9758 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9759 application.SendNotification();
9760 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9761 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9762 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9763 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9765 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9766 application.SendNotification();
9767 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9768 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9769 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9770 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9772 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9773 application.SendNotification();
9774 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9776 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9777 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9779 // We did expect the animation to finish
9781 finishCheck.CheckSignalReceived();
9785 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9787 TestApplication application;
9789 float startValue(1.0f);
9790 Actor actor = Actor::New();
9791 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9792 Stage::GetCurrent().Add(actor);
9794 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9795 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9796 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9797 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9798 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9799 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9800 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9801 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9802 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9804 // Build the animation
9805 float durationSeconds(1.0f);
9807 Animation animation = Animation::New(durationSeconds);
9809 KeyFrames keyFrames = KeyFrames::New();
9810 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9811 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9812 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9814 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9816 // Start the animation
9819 bool signalReceived(false);
9820 AnimationFinishCheck finishCheck(signalReceived);
9821 animation.FinishedSignal().Connect(&application, finishCheck);
9822 application.SendNotification();
9824 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9825 application.SendNotification();
9826 finishCheck.CheckSignalNotReceived();
9827 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9828 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9829 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9830 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9832 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9833 application.SendNotification();
9834 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9835 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9836 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9837 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9839 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9840 application.SendNotification();
9841 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9842 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9843 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9844 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9846 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9847 application.SendNotification();
9848 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9849 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9850 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9851 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9853 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9854 application.SendNotification();
9855 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9856 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9857 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9858 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9860 // We did expect the animation to finish
9862 finishCheck.CheckSignalReceived();
9866 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9868 TestApplication application;
9870 float startValue(1.0f);
9871 Actor actor = Actor::New();
9872 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9873 Stage::GetCurrent().Add(actor);
9875 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9876 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9877 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9878 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9879 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9880 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9881 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9882 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9883 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9885 // Build the animation
9886 float durationSeconds(1.0f);
9888 Animation animation = Animation::New(durationSeconds);
9890 KeyFrames keyFrames = KeyFrames::New();
9891 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9892 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9893 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9895 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9897 // Start the animation
9900 bool signalReceived(false);
9901 AnimationFinishCheck finishCheck(signalReceived);
9902 animation.FinishedSignal().Connect(&application, finishCheck);
9903 application.SendNotification();
9905 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9906 application.SendNotification();
9907 finishCheck.CheckSignalNotReceived();
9908 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9909 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9910 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9911 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9913 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9914 application.SendNotification();
9915 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9916 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9917 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9918 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9920 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9921 application.SendNotification();
9922 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9923 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9924 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9925 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9927 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9928 application.SendNotification();
9929 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9930 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9931 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9932 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9934 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9935 application.SendNotification();
9936 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9937 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9938 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9939 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9941 // We did expect the animation to finish
9943 finishCheck.CheckSignalReceived();
9947 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9949 TestApplication application;
9951 float startValue(1.0f);
9953 Actor actor = Actor::New();
9954 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9955 Stage::GetCurrent().Add(actor);
9957 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9958 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9959 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9960 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9961 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9962 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9963 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9964 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9965 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9967 // Build the animation
9968 float durationSeconds(1.0f);
9969 Animation animation = Animation::New(durationSeconds);
9971 KeyFrames keyFrames = KeyFrames::New();
9972 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9973 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9974 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9976 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9978 // Start the animation
9981 bool signalReceived(false);
9982 AnimationFinishCheck finishCheck(signalReceived);
9983 animation.FinishedSignal().Connect(&application, finishCheck);
9984 application.SendNotification();
9986 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9987 application.SendNotification();
9988 finishCheck.CheckSignalNotReceived();
9989 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9990 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9991 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9992 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9994 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9995 application.SendNotification();
9996 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9997 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9998 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9999 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
10001 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10002 application.SendNotification();
10003 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
10004 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10005 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
10006 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10008 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10009 application.SendNotification();
10010 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
10011 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
10012 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
10013 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
10015 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10016 application.SendNotification();
10017 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
10018 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10019 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
10020 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10022 // We did expect the animation to finish
10024 finishCheck.CheckSignalReceived();
10028 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10030 TestApplication application;
10032 float startValue(1.0f);
10033 Actor actor = Actor::New();
10034 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
10035 Stage::GetCurrent().Add(actor);
10037 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
10038 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
10039 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
10040 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
10041 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
10042 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
10043 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
10044 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
10045 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
10048 // Build the animation
10049 float durationSeconds(1.0f);
10050 float delay = 0.5f;
10051 Animation animation = Animation::New(durationSeconds);
10053 KeyFrames keyFrames = KeyFrames::New();
10054 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10055 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10056 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10058 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
10060 // Start the animation
10063 bool signalReceived(false);
10064 AnimationFinishCheck finishCheck(signalReceived);
10065 animation.FinishedSignal().Connect(&application, finishCheck);
10066 application.SendNotification();
10068 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
10069 application.SendNotification();
10070 finishCheck.CheckSignalNotReceived();
10071 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
10072 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
10073 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
10074 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
10076 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
10077 application.SendNotification();
10078 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
10079 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
10080 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
10081 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
10083 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10084 application.SendNotification();
10085 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
10086 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10087 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
10088 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10090 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10091 application.SendNotification();
10092 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
10093 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
10094 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
10095 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
10097 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10098 application.SendNotification();
10099 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
10100 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10101 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
10102 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10104 // We did expect the animation to finish
10106 finishCheck.CheckSignalReceived();
10110 int UtcDaliAnimationAnimateP(void)
10112 TestApplication application;
10114 Actor actor = Actor::New();
10115 Stage::GetCurrent().Add(actor);
10118 Vector3 position0( 30.0, 80.0, 0.0);
10119 Vector3 position1( 70.0, 120.0, 0.0);
10120 Vector3 position2( 100.0, 100.0, 0.0);
10122 Dali::Path path = Dali::Path::New();
10123 path.AddPoint(position0);
10124 path.AddPoint(position1);
10125 path.AddPoint(position2);
10127 //Control points for first segment
10128 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10129 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10131 //Control points for second segment
10132 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10133 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10135 // Build the animation
10136 float durationSeconds( 1.0f );
10137 Animation animation = Animation::New(durationSeconds);
10138 animation.Animate(actor, path, Vector3::XAXIS);
10140 // Start the animation
10143 bool signalReceived(false);
10144 AnimationFinishCheck finishCheck(signalReceived);
10145 animation.FinishedSignal().Connect(&application, finishCheck);
10146 application.SendNotification();
10147 application.Render(0);
10148 application.SendNotification();
10149 finishCheck.CheckSignalNotReceived();
10150 Vector3 position, tangent;
10151 Quaternion rotation;
10152 path.Sample( 0.0f, position, tangent );
10153 rotation = Quaternion( Vector3::XAXIS, tangent );
10154 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10155 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10157 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10158 application.SendNotification();
10159 path.Sample( 0.25f, position, tangent );
10160 rotation = Quaternion( Vector3::XAXIS, tangent );
10161 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10162 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10164 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10165 application.SendNotification();
10166 path.Sample( 0.5f, position, tangent );
10167 rotation = Quaternion( Vector3::XAXIS, tangent );
10168 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10169 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10171 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10172 application.SendNotification();
10173 path.Sample( 0.75f, position, tangent );
10174 rotation = Quaternion( Vector3::XAXIS, tangent );
10175 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10176 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10178 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10179 application.SendNotification();
10180 path.Sample( 1.0f, position, tangent );
10181 rotation = Quaternion( Vector3::XAXIS, tangent );
10182 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10183 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10185 finishCheck.CheckSignalReceived();
10189 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10191 TestApplication application;
10193 Actor actor = Actor::New();
10194 Stage::GetCurrent().Add(actor);
10197 Vector3 position0( 30.0, 80.0, 0.0);
10198 Vector3 position1( 70.0, 120.0, 0.0);
10199 Vector3 position2( 100.0, 100.0, 0.0);
10201 Dali::Path path = Dali::Path::New();
10202 path.AddPoint(position0);
10203 path.AddPoint(position1);
10204 path.AddPoint(position2);
10206 //Control points for first segment
10207 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10208 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10210 //Control points for second segment
10211 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10212 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10214 // Build the animation
10215 float durationSeconds( 1.0f );
10216 Animation animation = Animation::New(durationSeconds);
10217 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10219 // Start the animation
10222 bool signalReceived(false);
10223 AnimationFinishCheck finishCheck(signalReceived);
10224 animation.FinishedSignal().Connect(&application, finishCheck);
10225 application.SendNotification();
10226 application.Render(0);
10227 application.SendNotification();
10228 finishCheck.CheckSignalNotReceived();
10229 Vector3 position, tangent;
10230 Quaternion rotation;
10231 path.Sample( 0.0f, position, tangent );
10232 rotation = Quaternion( Vector3::XAXIS, tangent );
10233 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10234 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10236 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10237 application.SendNotification();
10238 path.Sample( 0.25f, position, tangent );
10239 rotation = Quaternion( Vector3::XAXIS, tangent );
10240 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10241 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10243 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10244 application.SendNotification();
10245 path.Sample( 0.5f, position, tangent );
10246 rotation = Quaternion( Vector3::XAXIS, tangent );
10247 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10248 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10250 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10251 application.SendNotification();
10252 path.Sample( 0.75f, position, tangent );
10253 rotation = Quaternion( Vector3::XAXIS, tangent );
10254 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10255 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10257 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10258 application.SendNotification();
10259 path.Sample( 1.0f, position, tangent );
10260 rotation = Quaternion( Vector3::XAXIS, tangent );
10261 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10262 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10264 finishCheck.CheckSignalReceived();
10268 int UtcDaliAnimationAnimateTimePeriodP(void)
10270 TestApplication application;
10272 Actor actor = Actor::New();
10273 Stage::GetCurrent().Add(actor);
10276 Vector3 position0( 30.0, 80.0, 0.0);
10277 Vector3 position1( 70.0, 120.0, 0.0);
10278 Vector3 position2( 100.0, 100.0, 0.0);
10280 Dali::Path path = Dali::Path::New();
10281 path.AddPoint(position0);
10282 path.AddPoint(position1);
10283 path.AddPoint(position2);
10285 //Control points for first segment
10286 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10287 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10289 //Control points for second segment
10290 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10291 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10293 // Build the animation
10294 float durationSeconds( 1.0f );
10295 Animation animation = Animation::New(durationSeconds);
10296 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10298 // Start the animation
10301 bool signalReceived(false);
10302 AnimationFinishCheck finishCheck(signalReceived);
10303 animation.FinishedSignal().Connect(&application, finishCheck);
10304 application.SendNotification();
10305 application.Render(0);
10306 application.SendNotification();
10307 finishCheck.CheckSignalNotReceived();
10308 Vector3 position, tangent;
10309 Quaternion rotation;
10310 path.Sample( 0.0f, position, tangent );
10311 rotation = Quaternion( Vector3::XAXIS, tangent );
10312 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10313 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10315 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10316 application.SendNotification();
10317 path.Sample( 0.25f, position, tangent );
10318 rotation = Quaternion( Vector3::XAXIS, tangent );
10319 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10320 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10322 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10323 application.SendNotification();
10324 path.Sample( 0.5f, position, tangent );
10325 rotation = Quaternion( Vector3::XAXIS, tangent );
10326 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10327 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10329 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10330 application.SendNotification();
10331 path.Sample( 0.75f, position, tangent );
10332 rotation = Quaternion( Vector3::XAXIS, tangent );
10333 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10334 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10336 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10337 application.SendNotification();
10338 path.Sample( 1.0f, position, tangent );
10339 rotation = Quaternion( Vector3::XAXIS, tangent );
10340 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10341 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10343 finishCheck.CheckSignalReceived();
10347 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10349 TestApplication application;
10351 Actor actor = Actor::New();
10352 Stage::GetCurrent().Add(actor);
10355 Vector3 position0( 30.0, 80.0, 0.0);
10356 Vector3 position1( 70.0, 120.0, 0.0);
10357 Vector3 position2( 100.0, 100.0, 0.0);
10359 Dali::Path path = Dali::Path::New();
10360 path.AddPoint(position0);
10361 path.AddPoint(position1);
10362 path.AddPoint(position2);
10364 //Control points for first segment
10365 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10366 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10368 //Control points for second segment
10369 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10370 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10372 // Build the animation
10373 float durationSeconds( 1.0f );
10374 Animation animation = Animation::New(durationSeconds);
10375 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10377 // Start the animation
10380 bool signalReceived(false);
10381 AnimationFinishCheck finishCheck(signalReceived);
10382 animation.FinishedSignal().Connect(&application, finishCheck);
10383 application.SendNotification();
10384 application.Render(0);
10385 application.SendNotification();
10386 finishCheck.CheckSignalNotReceived();
10387 Vector3 position, tangent;
10388 Quaternion rotation;
10389 path.Sample( 0.0f, position, tangent );
10390 rotation = Quaternion( Vector3::XAXIS, tangent );
10391 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10392 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10394 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10395 application.SendNotification();
10396 path.Sample( 0.25f, position, tangent );
10397 rotation = Quaternion( Vector3::XAXIS, tangent );
10398 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10399 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10401 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10402 application.SendNotification();
10403 path.Sample( 0.5f, position, tangent );
10404 rotation = Quaternion( Vector3::XAXIS, tangent );
10405 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10406 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10408 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10409 application.SendNotification();
10410 path.Sample( 0.75f, position, tangent );
10411 rotation = Quaternion( Vector3::XAXIS, tangent );
10412 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10413 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10415 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10416 application.SendNotification();
10417 path.Sample( 1.0f, position, tangent );
10418 rotation = Quaternion( Vector3::XAXIS, tangent );
10419 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10420 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10422 finishCheck.CheckSignalReceived();
10426 int UtcDaliAnimationShowP(void)
10428 TestApplication application;
10430 Actor actor = Actor::New();
10431 actor.SetVisible(false);
10432 application.SendNotification();
10433 application.Render(0);
10434 DALI_TEST_CHECK( !actor.IsVisible() );
10435 Stage::GetCurrent().Add(actor);
10437 // Start the animation
10438 float durationSeconds(10.0f);
10439 Animation animation = Animation::New(durationSeconds);
10440 animation.Show(actor, durationSeconds*0.5f);
10443 bool signalReceived(false);
10444 AnimationFinishCheck finishCheck(signalReceived);
10445 animation.FinishedSignal().Connect(&application, finishCheck);
10447 application.SendNotification();
10448 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10450 // We didn't expect the animation to finish yet
10451 application.SendNotification();
10452 finishCheck.CheckSignalNotReceived();
10453 DALI_TEST_CHECK( !actor.IsVisible() );
10455 application.SendNotification();
10456 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
10458 // We didn't expect the animation to finish yet
10459 application.SendNotification();
10460 finishCheck.CheckSignalNotReceived();
10461 DALI_TEST_CHECK( actor.IsVisible() );
10463 application.SendNotification();
10464 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10466 // We did expect the animation to finish
10467 application.SendNotification();
10468 finishCheck.CheckSignalReceived();
10469 DALI_TEST_CHECK( actor.IsVisible() );
10473 int UtcDaliAnimationHideP(void)
10475 TestApplication application;
10477 Actor actor = Actor::New();
10478 DALI_TEST_CHECK( actor.IsVisible() );
10479 Stage::GetCurrent().Add(actor);
10481 // Start the animation
10482 float durationSeconds(10.0f);
10483 Animation animation = Animation::New(durationSeconds);
10484 animation.Hide(actor, durationSeconds*0.5f);
10487 bool signalReceived(false);
10488 AnimationFinishCheck finishCheck(signalReceived);
10489 animation.FinishedSignal().Connect(&application, finishCheck);
10491 application.SendNotification();
10492 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10494 // We didn't expect the animation to finish yet
10495 application.SendNotification();
10496 finishCheck.CheckSignalNotReceived();
10497 DALI_TEST_CHECK( actor.IsVisible() );
10499 application.SendNotification();
10500 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
10502 // We didn't expect the animation to finish yet
10503 application.SendNotification();
10504 finishCheck.CheckSignalNotReceived();
10505 DALI_TEST_CHECK( !actor.IsVisible() );
10507 application.SendNotification();
10508 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10510 // We did expect the animation to finish
10511 application.SendNotification();
10512 finishCheck.CheckSignalReceived();
10513 DALI_TEST_CHECK( !actor.IsVisible() );
10517 int UtcDaliAnimationShowHideAtEndP(void)
10519 // Test that show/hide delay can be the same as animation duration
10520 // i.e. to show/hide at the end of the animation
10522 TestApplication application;
10524 Actor actor = Actor::New();
10525 DALI_TEST_CHECK( actor.IsVisible() );
10526 Stage::GetCurrent().Add(actor);
10528 // Start Hide animation
10529 float durationSeconds(10.0f);
10530 Animation animation = Animation::New(durationSeconds);
10531 animation.Hide(actor, durationSeconds/*Hide at end*/);
10534 bool signalReceived(false);
10535 AnimationFinishCheck finishCheck(signalReceived);
10536 animation.FinishedSignal().Connect(&application, finishCheck);
10538 application.SendNotification();
10539 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10541 // We did expect the animation to finish
10542 application.SendNotification();
10543 finishCheck.CheckSignalReceived();
10544 DALI_TEST_CHECK( !actor.IsVisible() );
10546 // Start Show animation
10547 animation = Animation::New(durationSeconds);
10548 animation.Show(actor, durationSeconds/*Show at end*/);
10549 animation.FinishedSignal().Connect(&application, finishCheck);
10552 application.SendNotification();
10553 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10555 // We did expect the animation to finish
10556 application.SendNotification();
10557 finishCheck.CheckSignalReceived();
10558 DALI_TEST_CHECK( actor.IsVisible() );
10562 int UtcDaliKeyFramesCreateDestroyP(void)
10564 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10566 KeyFrames* keyFrames = new KeyFrames;
10568 DALI_TEST_CHECK( true );
10572 int UtcDaliKeyFramesDownCastP(void)
10574 TestApplication application;
10575 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10577 KeyFrames keyFrames = KeyFrames::New();
10578 BaseHandle object(keyFrames);
10580 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10581 DALI_TEST_CHECK(keyFrames2);
10583 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10584 DALI_TEST_CHECK(keyFrames3);
10586 BaseHandle unInitializedObject;
10587 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10588 DALI_TEST_CHECK(!keyFrames4);
10590 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10591 DALI_TEST_CHECK(!keyFrames5);
10595 int UtcDaliAnimationCreateDestroyP(void)
10597 TestApplication application;
10598 Animation* animation = new Animation;
10599 DALI_TEST_CHECK( animation );
10604 struct UpdateManagerTestConstraint
10606 UpdateManagerTestConstraint(TestApplication& application)
10607 : mApplication(application)
10611 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10613 mApplication.SendNotification(); // Process events
10616 TestApplication& mApplication;
10619 int UtcDaliAnimationUpdateManagerP(void)
10621 TestApplication application;
10623 Actor actor = Actor::New();
10624 Stage::GetCurrent().Add( actor );
10626 // Build the animation
10627 Animation animation = Animation::New( 0.0f );
10629 bool signalReceived = false;
10630 AnimationFinishCheck finishCheck( signalReceived );
10631 animation.FinishedSignal().Connect( &application, finishCheck );
10633 Vector3 startValue(1.0f, 1.0f, 1.0f);
10634 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10635 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10636 constraint.Apply();
10638 // Apply animation to actor
10639 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10640 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10644 application.SendNotification();
10645 application.UpdateOnly( 16 );
10647 finishCheck.CheckSignalNotReceived();
10649 application.SendNotification(); // Process events
10651 finishCheck.CheckSignalReceived();
10656 int UtcDaliAnimationSignalOrderP(void)
10658 TestApplication application;
10660 Actor actor = Actor::New();
10661 Stage::GetCurrent().Add( actor );
10663 // Build the animations
10664 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10665 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10667 bool signal1Received = false;
10668 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10670 bool signal2Received = false;
10671 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10673 // Apply animations to actor
10674 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10676 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10679 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10680 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10682 application.SendNotification();
10683 application.UpdateOnly( 10 ); // 10ms progress
10685 // no notifications yet
10686 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10687 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10689 application.SendNotification();
10692 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10693 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10694 signal1Received = false;
10696 // 1st animation is complete now, do another update with no ProcessEvents in between
10697 application.UpdateOnly( 20 ); // 20ms progress
10700 application.SendNotification();
10702 // 2nd should complete now
10703 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10704 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10709 int UtcDaliAnimationExtendDurationP(void)
10711 TestApplication application;
10713 Actor actor = Actor::New();
10715 // Register a float property
10716 float startValue(10.0f);
10717 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10718 Stage::GetCurrent().Add(actor);
10719 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10720 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10722 // Build the animation
10723 float initialDurationSeconds(1.0f);
10724 float animatorDelay = 5.0f;
10725 float animatorDurationSeconds(5.0f);
10726 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10727 Animation animation = Animation::New(initialDurationSeconds);
10728 float targetValue(30.0f);
10729 float relativeValue(targetValue - startValue);
10731 animation.AnimateTo(Property(actor, index),
10733 TimePeriod(animatorDelay, animatorDurationSeconds));
10735 // The duration should have been extended
10736 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10738 // Start the animation
10741 bool signalReceived(false);
10742 AnimationFinishCheck finishCheck(signalReceived);
10743 animation.FinishedSignal().Connect(&application, finishCheck);
10745 application.SendNotification();
10746 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10748 // We didn't expect the animation to finish yet, but cached value should be the final one
10749 application.SendNotification();
10750 finishCheck.CheckSignalNotReceived();
10751 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10752 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10754 application.SendNotification();
10755 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10757 // We didn't expect the animation to finish yet
10758 application.SendNotification();
10759 finishCheck.CheckSignalNotReceived();
10760 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10762 application.SendNotification();
10763 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10765 // We did expect the animation to finish
10766 application.SendNotification();
10767 finishCheck.CheckSignalReceived();
10768 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10769 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10773 int UtcDaliAnimationCustomIntProperty(void)
10775 TestApplication application;
10777 Actor actor = Actor::New();
10778 Stage::GetCurrent().Add(actor);
10779 int startValue(0u);
10781 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10782 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10783 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10785 // Build the animation
10786 float durationSeconds(1.0f);
10787 Animation animation = Animation::New(durationSeconds);
10788 animation.AnimateTo( Property(actor, index), 20 );
10790 // Start the animation
10793 // Target value should be retrievable straight away
10794 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10796 bool signalReceived(false);
10797 AnimationFinishCheck finishCheck(signalReceived);
10798 animation.FinishedSignal().Connect(&application, finishCheck);
10800 application.SendNotification();
10801 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10803 // We didn't expect the animation to finish yet
10804 application.SendNotification();
10805 finishCheck.CheckSignalNotReceived();
10806 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10808 application.SendNotification();
10809 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10811 // We did expect the animation to finish
10812 application.SendNotification();
10813 finishCheck.CheckSignalReceived();
10814 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10815 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10819 int UtcDaliAnimationDuration(void)
10821 TestApplication application;
10823 Actor actor = Actor::New();
10824 Stage::GetCurrent().Add(actor);
10826 Animation animation = Animation::New( 0.0f );
10827 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10829 // The animation duration should automatically increase depending on the animator time period
10831 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10832 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10834 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10835 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10840 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10842 TestApplication application;
10844 Actor actor = Actor::New();
10846 // Register an integer property
10848 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10849 Stage::GetCurrent().Add(actor);
10850 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10852 DALI_TEST_ASSERTION(
10854 // Build the animation
10855 Animation animation = Animation::New( 2.0f );
10856 std::string relativeValue = "relative string";
10857 animation.AnimateBy( Property(actor, index), relativeValue );
10858 tet_result(TET_FAIL);
10859 }, "Target value is not animatable" );
10865 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10867 TestApplication application;
10869 Actor actor = Actor::New();
10871 // Register an integer property
10873 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10874 Stage::GetCurrent().Add(actor);
10875 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10877 DALI_TEST_ASSERTION(
10879 // Build the animation
10880 Animation animation = Animation::New( 2.0f );
10881 std::string relativeValue = "relative string";
10882 animation.AnimateTo( Property(actor, index), relativeValue );
10883 }, "Target value is not animatable" );
10888 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10890 TestApplication application;
10892 Actor actor = Actor::New();
10894 // Register an integer property
10896 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10897 Stage::GetCurrent().Add(actor);
10898 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10900 DALI_TEST_ASSERTION(
10902 // Build the animation
10903 KeyFrames keyFrames = KeyFrames::New();
10904 keyFrames.Add( 0.0f, std::string("relative string1") );
10905 keyFrames.Add( 1.0f, std::string("relative string2") );
10906 // no need to really create the animation as keyframes do the check
10907 }, "Property type is not animatable" );
10912 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10914 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10916 TestApplication application;
10918 tet_infoline("Set initial position and set up animation to re-position actor");
10920 Actor actor = Actor::New();
10921 Stage::GetCurrent().Add(actor);
10922 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10923 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10925 // Build the animation
10926 Animation animation = Animation::New(2.0f);
10928 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10929 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10930 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10932 tet_infoline("Set target position in animation without intiating play");
10934 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10935 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10937 application.SendNotification();
10938 application.Render();
10940 tet_infoline("Ensure position of actor is still at intial value");
10942 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10943 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10944 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10946 tet_infoline("Play animation and ensure actor position is now target");
10949 application.SendNotification();
10950 application.Render(1000u);
10952 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10954 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10955 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10956 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10958 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10960 application.Render(2000u);
10962 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10964 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10965 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10971 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10973 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10975 TestApplication application;
10977 std::vector<Vector3> targetPositions;
10979 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10980 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10981 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10983 tet_infoline("Set initial position and set up animation to re-position actor");
10985 Actor actor = Actor::New();
10986 Stage::GetCurrent().Add(actor);
10987 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10988 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10990 // Build the animation
10991 Animation animation = Animation::New(2.0f);
10993 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10994 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10995 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10997 tet_infoline("Set target position in animation without intiating play");
10999 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
11001 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11004 application.SendNotification();
11005 application.Render();
11007 tet_infoline("Ensure position of actor is still at intial value");
11009 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
11010 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
11011 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
11013 tet_infoline("Play animation and ensure actor position is now target");
11016 application.SendNotification();
11017 application.Render(1000u);
11019 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11021 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11022 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11025 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
11027 application.Render(2000u);
11029 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11031 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11032 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11033 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11038 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11040 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");
11042 TestApplication application;
11044 std::vector<Vector3> targetSizes;
11045 std::vector<Vector3> targetPositions;
11047 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11048 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
11050 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
11052 tet_infoline("Set initial position and set up animation to re-position actor");
11054 Actor actor = Actor::New();
11055 Stage::GetCurrent().Add(actor);
11056 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
11057 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11059 actor.SetProperty( Actor::Property::SIZE, initialSize );
11060 actor.SetProperty( Actor::Property::POSITION, initialPosition );
11062 // Build the animation
11063 Animation animation = Animation::New(2.0f);
11065 tet_infoline("Set target size in animation without intiating play");
11066 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11067 tet_infoline("Set target position in animation without intiating play");
11068 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11069 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11071 application.SendNotification();
11072 application.Render();
11074 tet_infoline("Ensure position of actor is still at intial size and position");
11076 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11077 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
11081 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
11082 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
11084 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11087 application.SendNotification();
11088 application.Render(2000u);
11090 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11092 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11093 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11094 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11096 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
11097 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
11098 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
11103 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11105 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11107 TestApplication application;
11109 std::vector<Vector3> targetSizes;
11110 std::vector<float> targetColors;
11112 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11113 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
11115 targetColors.push_back( 1.0f );
11117 tet_infoline("Set initial position and set up animation to re-position actor");
11119 Actor actor = Actor::New();
11120 Stage::GetCurrent().Add(actor);
11121 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
11123 actor.SetProperty( Actor::Property::SIZE, initialSize );
11125 // Build the animation
11126 Animation animation = Animation::New(2.0f);
11128 tet_infoline("Set target size in animation without initiating play");
11129 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11130 tet_infoline("Set target position in animation without intiating play");
11131 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11132 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11134 application.SendNotification();
11135 application.Render();
11137 tet_infoline("Ensure position of actor is still at initial size and position");
11139 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11140 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11141 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11143 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11146 application.SendNotification();
11147 application.Render(2000u);
11149 tet_infoline("Ensure position and size of actor is at target value when animation playing");
11151 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11152 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11153 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11155 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
11160 int UtcDaliAnimationTimePeriodOrder(void)
11162 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
11164 TestApplication application;
11166 Actor actor = Actor::New();
11167 Stage::GetCurrent().Add( actor );
11169 application.SendNotification();
11170 application.Render();
11172 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11173 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11174 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11175 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11176 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11178 //////////////////////////////////////////////////////////////////////////////////
11180 tet_infoline( "With two AnimateTo calls" );
11182 Animation animation = Animation::New( 0.0f );
11183 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11184 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11187 tet_infoline( "The target position should change instantly" );
11188 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11189 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11191 application.SendNotification();
11192 application.Render(5000); // After the animation is complete
11194 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11195 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11196 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11198 //////////////////////////////////////////////////////////////////////////////////
11200 tet_infoline( "Same animation again but in a different order - should yield the same result" );
11202 actor.SetX( 0.0f );
11203 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11204 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11206 application.SendNotification();
11207 application.Render();
11209 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11210 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11211 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11213 animation = Animation::New( 0.0f );
11214 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11215 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11218 tet_infoline( "The target position should change instantly" );
11219 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11220 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11222 application.SendNotification();
11223 application.Render(5000); // After the animation is complete
11225 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11226 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11227 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11232 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11234 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" );
11236 TestApplication application;
11238 Actor actor = Actor::New();
11239 Stage::GetCurrent().Add( actor );
11241 application.SendNotification();
11242 application.Render();
11244 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11245 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11246 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11247 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11248 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11250 //////////////////////////////////////////////////////////////////////////////////
11252 tet_infoline( "" );
11254 Animation animation = Animation::New( 0.0f );
11255 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11256 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11257 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11258 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11259 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11260 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11263 tet_infoline( "The target position should change instantly" );
11264 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11265 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11267 application.SendNotification();
11268 application.Render(14000); // After the animation is complete
11270 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11271 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11272 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11274 //////////////////////////////////////////////////////////////////////////////////
11276 tet_infoline( "Same animation again but in a different order - should end up at the same point" );
11278 actor.SetX( 0.0f );
11280 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11281 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11283 application.SendNotification();
11284 application.Render();
11286 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11287 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11288 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11290 animation = Animation::New( 0.0f );
11291 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11292 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11293 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11294 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11295 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11296 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11299 tet_infoline( "The target position should change instantly" );
11300 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11301 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11303 application.SendNotification();
11304 application.Render(14000); // After the animation is complete
11306 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11307 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11308 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11313 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11315 TestApplication application;
11318 Actor actor = Actor::New();
11319 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11320 Stage::GetCurrent().Add(actor);
11322 application.Render();
11323 application.SendNotification();
11325 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
11327 // Build the animation
11328 float durationSeconds(1.0f);
11329 Animation animation = Animation::New(durationSeconds);
11331 KeyFrames keyFrames = KeyFrames::New();
11332 keyFrames.Add(0.0f, 10);
11333 keyFrames.Add(0.2f, 20);
11334 keyFrames.Add(0.4f, 30);
11335 keyFrames.Add(0.6f, 40);
11336 keyFrames.Add(0.8f, 50);
11337 keyFrames.Add(1.0f, 60);
11339 animation.AnimateBetween( Property(actor, index ), keyFrames );
11341 // Start the animation
11344 // Target value should change to the last key-frame's value straight away
11345 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
11350 int UtcDaliAnimationAnimateBetweenVector2P(void)
11352 TestApplication application;
11354 Vector2 startValue( 10.0f, 20.0f );
11355 Actor actor = Actor::New();
11356 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11357 Stage::GetCurrent().Add(actor);
11359 application.Render();
11360 application.SendNotification();
11362 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
11364 // Build the animation
11365 float durationSeconds(1.0f);
11366 Animation animation = Animation::New(durationSeconds);
11368 KeyFrames keyFrames = KeyFrames::New();
11369 keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
11370 keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
11371 keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
11372 keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
11373 keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
11374 keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
11376 animation.AnimateBetween( Property(actor, index ), keyFrames );
11378 // Start the animation
11381 // Target value should change to the last key-frame's value straight away
11382 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );
11387 int UtcDaliAnimationProgressCallbackP(void)
11389 TestApplication application;
11391 Actor actor = Actor::New();
11392 Stage::GetCurrent().Add(actor);
11394 // Build the animation
11395 Animation animation = Animation::New(0.0f);
11398 float durationSeconds(1.0f);
11399 animation.SetDuration(durationSeconds);
11401 bool finishedSignalReceived(false);
11402 bool progressSignalReceived(false);
11404 AnimationFinishCheck finishCheck(finishedSignalReceived);
11405 animation.FinishedSignal().Connect(&application, finishCheck);
11407 AnimationProgressCheck progressCheck(progressSignalReceived);
11408 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
11409 application.SendNotification();
11411 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11412 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11414 tet_infoline( "Animation Progress notification set to 30%" );
11415 DevelAnimation::SetProgressNotification( animation, 0.3f );
11417 application.SendNotification();
11418 application.Render( );
11420 DALI_TEST_EQUALS( 0.3f, DevelAnimation::GetProgressNotification( animation ), TEST_LOCATION );
11422 progressCheck.CheckSignalNotReceived();
11424 // Start the animation from 10% progress
11425 animation.SetCurrentProgress( 0.1f );
11428 tet_infoline( "Animation Playing from 10%" );
11430 application.SendNotification();
11431 application.Render(0); // start animation
11432 application.Render(durationSeconds*100.0f ); // 20% progress
11434 tet_infoline( "Animation at 20%" );
11436 progressCheck.CheckSignalNotReceived();
11438 application.SendNotification();
11439 application.Render(durationSeconds*200.0f ); // 40% progress
11440 application.SendNotification();
11441 tet_infoline( "Animation at 40%" );
11442 DALI_TEST_EQUALS( 0.4f, animation.GetCurrentProgress(), TEST_LOCATION );
11444 progressCheck.CheckSignalReceived();
11446 tet_infoline( "Progress check reset" );
11447 progressCheck.Reset();
11449 application.Render(durationSeconds*100.0f ); // 50% progress
11450 tet_infoline( "Animation at 50%" );
11451 application.SendNotification();
11453 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
11455 progressCheck.CheckSignalNotReceived();
11457 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
11458 application.SendNotification();
11460 tet_infoline( "Animation at 60%" );
11462 finishCheck.CheckSignalNotReceived();
11464 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
11465 application.SendNotification();
11466 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
11467 tet_infoline( "Animation at 80%" );
11469 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
11470 // We did expect the animation to finish
11471 application.SendNotification();
11472 finishCheck.CheckSignalReceived();
11473 tet_infoline( "Animation finished" );
11474 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11479 int UtcDaliAnimationPlayAfterP(void)
11481 TestApplication application;
11483 tet_printf("Testing that playing after 2 seconds\n");
11486 Actor actor = Actor::New();
11487 Stage::GetCurrent().Add(actor);
11489 // Build the animation
11490 float durationSeconds(1.0f);
11491 Animation animation = Animation::New(durationSeconds);
11493 bool signalReceived( false );
11494 AnimationFinishCheck finishCheck( signalReceived );
11495 animation.FinishedSignal().Connect( &application, finishCheck );
11496 application.SendNotification();
11498 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11499 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11501 // Play animation after the initial delay time
11502 animation.PlayAfter( 0.2f );
11503 application.SendNotification();
11504 application.Render(0); // start animation
11506 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11507 application.SendNotification();
11508 finishCheck.CheckSignalNotReceived();
11509 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11511 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11513 // We didn't expect the animation to finish yet
11514 application.SendNotification();
11515 finishCheck.CheckSignalNotReceived();
11516 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11518 application.SendNotification();
11519 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11521 application.SendNotification();
11522 finishCheck.CheckSignalNotReceived();
11523 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11525 application.SendNotification();
11526 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11528 // We did expect the animation to finish
11529 application.SendNotification();
11530 finishCheck.CheckSignalReceived();
11531 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11533 // Check that nothing has changed after a couple of buffer swaps
11534 application.Render(0);
11535 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11538 tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11541 Actor actor = Actor::New();
11542 Stage::GetCurrent().Add(actor);
11544 // Build the animation
11545 float durationSeconds(1.0f);
11546 Animation animation = Animation::New(durationSeconds);
11547 animation.SetSpeedFactor( -1.0f ); // Set SpeedFactor as < 0
11549 bool signalReceived( false );
11550 AnimationFinishCheck finishCheck( signalReceived );
11551 animation.FinishedSignal().Connect( &application, finishCheck );
11552 application.SendNotification();
11554 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11555 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11557 // Play animation after the initial delay time
11558 animation.PlayAfter( 0.2f );
11559 application.SendNotification();
11560 application.Render(0); // start animation
11562 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11563 application.SendNotification();
11564 finishCheck.CheckSignalNotReceived();
11565 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11567 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11569 // We didn't expect the animation to finish yet
11570 application.SendNotification();
11571 finishCheck.CheckSignalNotReceived();
11572 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11574 application.SendNotification();
11575 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11577 application.SendNotification();
11578 finishCheck.CheckSignalNotReceived();
11579 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION );
11581 application.SendNotification();
11582 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) + 1u/*just beyond the animation duration*/ );
11584 // We did expect the animation to finish
11585 application.SendNotification();
11586 finishCheck.CheckSignalReceived();
11587 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of Timeperiod in seconds
11589 // Check that nothing has changed after a couple of buffer swaps
11590 application.Render(0);
11591 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11597 int UtcDaliAnimationPlayAfterP2(void)
11599 TestApplication application;
11601 tet_printf("Testing that playing after 2 seconds before looping\n");
11604 Actor actor = Actor::New();
11605 Stage::GetCurrent().Add(actor);
11607 // Build the animation
11608 float durationSeconds(1.0f);
11609 Animation animation = Animation::New(durationSeconds);
11610 animation.SetLooping( true );
11612 bool signalReceived( false );
11613 AnimationFinishCheck finishCheck( signalReceived );
11614 animation.FinishedSignal().Connect( &application, finishCheck );
11615 application.SendNotification();
11617 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11618 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11620 // Play animation after the initial delay time
11621 animation.PlayAfter( 0.2f );
11622 application.SendNotification();
11623 application.Render(0); // start animation
11625 for( int iterations = 0; iterations < 3; ++iterations )
11627 // The initial delay time of PlayAfter() applies only once in looping mode.
11628 if( iterations == 0 )
11630 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11631 application.SendNotification();
11632 finishCheck.CheckSignalNotReceived();
11633 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11636 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11638 // We didn't expect the animation to finish yet
11639 application.SendNotification();
11640 finishCheck.CheckSignalNotReceived();
11641 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11643 application.SendNotification();
11644 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11646 application.SendNotification();
11647 finishCheck.CheckSignalNotReceived();
11648 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11650 application.SendNotification();
11651 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) /* 100% progress */ );
11653 // We did expect the animation to finish
11654 application.SendNotification();
11655 finishCheck.CheckSignalNotReceived();
11656 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11659 animation.SetLooping(false);
11660 application.SendNotification();
11661 application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11663 application.SendNotification();
11664 finishCheck.CheckSignalReceived();
11665 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11668 tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11671 Actor actor = Actor::New();
11672 Stage::GetCurrent().Add(actor);
11674 // Build the animation
11675 float durationSeconds(1.0f);
11676 Animation animation = Animation::New(durationSeconds);
11677 animation.SetLooping( true );
11678 animation.SetSpeedFactor( -1.0f ); //Set SpeedFactor as < 0
11680 bool signalReceived( false );
11681 AnimationFinishCheck finishCheck( signalReceived );
11682 animation.FinishedSignal().Connect( &application, finishCheck );
11683 application.SendNotification();
11685 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11686 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11688 // Play animation after the initial delay time
11689 animation.PlayAfter( 0.2f );
11690 application.SendNotification();
11691 application.Render(0); // start animation
11693 for( int iterations = 0; iterations < 3; ++iterations )
11695 // The initial delay time of PlayAfter() applies only once in looping mode.
11696 if( iterations == 0 )
11698 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11699 application.SendNotification();
11700 finishCheck.CheckSignalNotReceived();
11701 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11704 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11706 // We didn't expect the animation to finish yet
11707 application.SendNotification();
11708 finishCheck.CheckSignalNotReceived();
11709 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11711 application.SendNotification();
11712 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11714 application.SendNotification();
11715 finishCheck.CheckSignalNotReceived();
11716 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION );
11718 application.SendNotification();
11719 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) /* 100% progress */ );
11721 // We did expect the animation to finish
11722 application.SendNotification();
11723 finishCheck.CheckSignalNotReceived();
11724 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in second
11727 animation.SetLooping(false);
11728 application.SendNotification();
11729 application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11731 application.SendNotification();
11732 finishCheck.CheckSignalReceived();
11733 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11739 int UtcDaliAnimationPlayAfterP3(void)
11741 TestApplication application;
11743 tet_printf("Testing that PlayAfter with the negative delay seconds\n");
11745 Actor actor = Actor::New();
11746 Stage::GetCurrent().Add(actor);
11748 // Build the animation
11749 float durationSeconds(1.0f);
11750 Animation animation = Animation::New(durationSeconds);
11752 bool signalReceived( false );
11753 AnimationFinishCheck finishCheck( signalReceived );
11754 animation.FinishedSignal().Connect( &application, finishCheck );
11755 application.SendNotification();
11757 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11758 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11760 // When the delay time is negative value, it would treat as play immediately.
11761 animation.PlayAfter( -2.0f );
11762 application.SendNotification();
11763 application.Render(0); // start animation
11765 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11767 // We didn't expect the animation to finish yet
11768 application.SendNotification();
11769 finishCheck.CheckSignalNotReceived();
11770 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11772 application.SendNotification();
11773 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11775 application.SendNotification();
11776 finishCheck.CheckSignalNotReceived();
11777 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11779 application.SendNotification();
11780 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11782 // We did expect the animation to finish
11783 application.SendNotification();
11784 finishCheck.CheckSignalReceived();
11785 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11787 // Check that nothing has changed after a couple of buffer swaps
11788 application.Render(0);
11789 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11793 int UtcDaliAnimationPlayAfterP4(void)
11795 TestApplication application;
11797 tet_printf("Testing that PlayAfter with progress value\n");
11799 Actor actor = Actor::New();
11800 Stage::GetCurrent().Add(actor);
11802 // Build the animation
11803 float durationSeconds(1.0f);
11804 Animation animation = Animation::New(durationSeconds);
11806 bool signalReceived( false );
11807 AnimationFinishCheck finishCheck( signalReceived );
11808 animation.FinishedSignal().Connect( &application, finishCheck );
11809 application.SendNotification();
11811 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11812 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11814 // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
11815 animation.PlayAfter( durationSeconds * 0.3f );
11816 application.SendNotification();
11817 application.Render(0); // start animation
11819 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 5/6 delay progress, 0% animation progress, 0% animator progress */ );
11821 // We didn't expect the animation to finish yet
11822 application.SendNotification();
11823 finishCheck.CheckSignalNotReceived();
11824 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of PlayAfter
11826 application.SendNotification();
11827 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 20% animation progress, 0% animator progress */ );
11829 application.SendNotification();
11830 finishCheck.CheckSignalNotReceived();
11831 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11833 application.SendNotification();
11834 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 45% animation progress, 0% animator progress */ );
11836 application.SendNotification();
11837 finishCheck.CheckSignalNotReceived();
11838 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11840 application.SendNotification();
11841 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 70% animation progress, 40% animator progress */ );
11843 application.SendNotification();
11844 finishCheck.CheckSignalNotReceived();
11845 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.4f ), TEST_LOCATION ); // 40% of animator progress
11847 application.SendNotification();
11848 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 95% animation progress, 90% animator progress */ );
11850 application.SendNotification();
11851 finishCheck.CheckSignalNotReceived();
11852 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION ); // 90% of animator progress
11854 application.SendNotification();
11855 application.Render( static_cast< unsigned int >( durationSeconds * 50.0f ) + 1u/*just beyond the animation duration*/ );
11857 // We did expect the animation to finish
11858 application.SendNotification();
11859 finishCheck.CheckSignalReceived();
11860 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11862 // Check that nothing has changed after a couple of buffer swaps
11863 application.Render(0);
11864 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11868 int UtcDaliAnimationSetLoopingModeP(void)
11870 // Test Loop forever and Loop mode being set
11871 TestApplication application;
11872 Stage stage( Stage::GetCurrent() );
11874 // Default: LoopingMode::RESTART
11876 Actor actor = Actor::New();
11877 stage.Add( actor );
11879 float durationSeconds( 1.0f );
11880 Animation animation = Animation::New( durationSeconds );
11881 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
11883 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
11884 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11886 // Start the animation
11888 application.SendNotification();
11889 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
11893 application.SendNotification();
11894 application.Render();
11895 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11898 // LoopingMode::AUTO_REVERSE
11900 Actor actor = Actor::New();
11901 stage.Add( actor );
11903 float durationSeconds( 1.0f );
11904 Animation animation = Animation::New( durationSeconds );
11905 animation.SetLooping( true );
11907 bool signalReceived( false );
11908 AnimationFinishCheck finishCheck( signalReceived );
11909 animation.FinishedSignal().Connect( &application, finishCheck );
11910 application.SendNotification();
11912 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11913 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11915 animation.SetLoopingMode( Animation::LoopingMode::AUTO_REVERSE );
11916 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
11918 // Start the animation
11920 application.SendNotification();
11921 application.Render(0);
11923 for( int iterations = 0; iterations < 3; ++iterations )
11925 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
11926 application.SendNotification();
11927 finishCheck.CheckSignalNotReceived();
11929 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
11930 // and arrives at the beginning.
11931 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11933 application.SendNotification();
11934 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
11936 // We did expect the animation to finish
11937 application.SendNotification();
11938 finishCheck.CheckSignalNotReceived();
11939 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
11942 animation.SetLooping( false );
11943 application.SendNotification();
11944 application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
11946 application.SendNotification();
11947 finishCheck.CheckSignalReceived();
11949 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
11952 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
11954 Actor actor = Actor::New();
11955 stage.Add( actor );
11957 float durationSeconds( 1.0f );
11958 Animation animation = Animation::New( durationSeconds );
11959 animation.SetLooping( true );
11961 bool signalReceived( false );
11962 AnimationFinishCheck finishCheck( signalReceived );
11963 animation.FinishedSignal().Connect( &application, finishCheck );
11964 application.SendNotification();
11966 // Specify a negative multiplier to play the animation in reverse
11967 animation.SetSpeedFactor( -1.0f );
11969 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11970 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11972 animation.SetLoopingMode( Animation::AUTO_REVERSE );
11973 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
11975 // Start the animation
11977 application.SendNotification();
11978 application.Render(0);
11980 for( int iterations = 0; iterations < 3; ++iterations )
11982 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
11983 application.SendNotification();
11984 finishCheck.CheckSignalNotReceived();
11986 // Setting a negative speed factor is to play the animation in reverse.
11987 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
11988 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
11989 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
11991 application.SendNotification();
11992 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
11994 // We did expect the animation to finish
11995 application.SendNotification();
11996 finishCheck.CheckSignalNotReceived();
11997 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12000 animation.SetLooping( false );
12001 application.SendNotification();
12002 application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
12004 application.SendNotification();
12005 finishCheck.CheckSignalReceived();
12007 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12013 int UtcDaliAnimationSetLoopingModeP2(void)
12015 // Test Loop Count and Loop mode being set
12016 TestApplication application;
12017 Stage stage( Stage::GetCurrent() );
12019 // LoopingMode::AUTO_REVERSE
12021 Actor actor = Actor::New();
12022 stage.Add( actor );
12024 float durationSeconds( 1.0f );
12025 Animation animation = Animation::New( durationSeconds );
12026 animation.SetLoopCount(3);
12027 DALI_TEST_CHECK(animation.IsLooping());
12029 bool signalReceived( false );
12030 AnimationFinishCheck finishCheck( signalReceived );
12031 animation.FinishedSignal().Connect( &application, finishCheck );
12032 application.SendNotification();
12034 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12035 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12037 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12038 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12040 // Start the animation
12043 application.Render(0);
12044 application.SendNotification();
12045 application.Render(0);
12046 application.SendNotification();
12047 application.Render(0);
12048 application.SendNotification();
12049 application.Render(0);
12050 application.SendNotification();
12053 float intervalSeconds = 3.0f;
12055 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12056 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12057 // and arrives at the beginning.
12058 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12060 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12062 application.Render(0);
12063 application.SendNotification();
12064 application.Render(0);
12065 application.SendNotification();
12066 application.Render(0);
12067 application.SendNotification();
12068 application.Render(0);
12069 application.SendNotification();
12070 finishCheck.CheckSignalNotReceived();
12072 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12074 application.SendNotification();
12075 finishCheck.CheckSignalReceived();
12076 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12078 finishCheck.Reset();
12081 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12083 Actor actor = Actor::New();
12084 stage.Add( actor );
12086 float durationSeconds( 1.0f );
12087 Animation animation = Animation::New( durationSeconds );
12088 animation.SetLoopCount(3);
12089 DALI_TEST_CHECK(animation.IsLooping());
12091 bool signalReceived( false );
12092 AnimationFinishCheck finishCheck( signalReceived );
12093 animation.FinishedSignal().Connect( &application, finishCheck );
12094 application.SendNotification();
12096 // Specify a negative multiplier to play the animation in reverse
12097 animation.SetSpeedFactor( -1.0f );
12099 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12100 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12102 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12103 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12105 // Start the animation
12108 application.Render(0);
12109 application.SendNotification();
12110 application.Render(0);
12111 application.SendNotification();
12112 application.Render(0);
12113 application.SendNotification();
12114 application.Render(0);
12115 application.SendNotification();
12118 float intervalSeconds = 3.0f;
12120 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12121 // Setting a negative speed factor is to play the animation in reverse.
12122 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12123 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12124 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12126 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12128 application.Render(0);
12129 application.SendNotification();
12130 application.Render(0);
12131 application.SendNotification();
12132 application.Render(0);
12133 application.SendNotification();
12134 application.Render(0);
12135 application.SendNotification();
12136 finishCheck.CheckSignalNotReceived();
12138 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12140 application.SendNotification();
12141 finishCheck.CheckSignalReceived();
12142 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12144 finishCheck.Reset();
12150 int UtcDaliAnimationSetLoopingModeP3(void)
12152 // Test Loop Count is 1 (== default) and Loop mode being set
12153 TestApplication application;
12154 Stage stage( Stage::GetCurrent() );
12156 // LoopingMode::AUTO_REVERSE
12158 Actor actor = Actor::New();
12159 stage.Add( actor );
12161 float durationSeconds( 1.0f );
12162 Animation animation = Animation::New( durationSeconds );
12163 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12165 bool signalReceived( false );
12166 AnimationFinishCheck finishCheck( signalReceived );
12167 animation.FinishedSignal().Connect( &application, finishCheck );
12168 application.SendNotification();
12170 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12171 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12173 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12174 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12176 // Start the animation
12178 application.Render(0);
12179 application.SendNotification();
12181 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12182 application.SendNotification();
12183 finishCheck.CheckSignalNotReceived();
12185 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12186 // and arrives at the beginning.
12187 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12189 application.SendNotification();
12190 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12192 application.SendNotification();
12193 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12195 application.SendNotification();
12196 application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12198 application.SendNotification();
12199 application.Render(0);
12200 application.SendNotification();
12201 finishCheck.CheckSignalReceived();
12203 // After all animation finished, arrives at the beginning.
12204 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12206 finishCheck.Reset();
12209 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12211 Actor actor = Actor::New();
12212 stage.Add( actor );
12214 float durationSeconds( 1.0f );
12215 Animation animation = Animation::New( durationSeconds );
12216 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12218 bool signalReceived( false );
12219 AnimationFinishCheck finishCheck( signalReceived );
12220 animation.FinishedSignal().Connect( &application, finishCheck );
12221 application.SendNotification();
12223 // Specify a negative multiplier to play the animation in reverse
12224 animation.SetSpeedFactor( -1.0f );
12226 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12227 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12229 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12230 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12232 // Start the animation
12234 application.Render(0);
12235 application.SendNotification();
12237 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12238 application.SendNotification();
12239 finishCheck.CheckSignalNotReceived();
12241 // Setting a negative speed factor is to play the animation in reverse.
12242 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12243 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12244 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12246 application.SendNotification();
12247 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12249 application.SendNotification();
12250 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12252 application.SendNotification();
12253 application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12255 application.SendNotification();
12256 application.Render(0);
12257 application.SendNotification();
12258 finishCheck.CheckSignalReceived();
12260 // After all animation finished, arrives at the target.
12261 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12263 finishCheck.Reset();
12269 int UtcDaliAnimationGetLoopingModeP(void)
12271 TestApplication application;
12273 Animation animation = Animation::New(1.0f);
12276 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
12278 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12279 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12284 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12286 TestApplication application;
12288 tet_infoline( "Connect to ProgressReachedSignal but do not set a required Progress marker" );
12290 Actor actor = Actor::New();
12291 Stage::GetCurrent().Add(actor);
12293 // Build the animation
12294 Animation animation = Animation::New(0.0f);
12297 float durationSeconds(1.0f);
12298 animation.SetDuration(durationSeconds);
12300 bool finishedSignalReceived(false);
12301 bool progressSignalReceived(false);
12303 AnimationFinishCheck finishCheck(finishedSignalReceived);
12304 animation.FinishedSignal().Connect(&application, finishCheck);
12306 AnimationProgressCheck progressCheck( progressSignalReceived );
12307 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12308 application.SendNotification();
12310 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12311 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12313 progressCheck.CheckSignalNotReceived();
12317 application.SendNotification();
12318 application.Render(0); // start animation
12319 application.Render(durationSeconds*100.0f ); // 10% progress
12320 application.SendNotification();
12322 tet_infoline( "Ensure after animation has started playing that ProgressReachedSignal not emitted" );
12323 progressCheck.CheckSignalNotReceived();
12325 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
12327 application.SendNotification();
12328 finishCheck.CheckSignalReceived();
12329 tet_infoline( "Animation finished" );
12330 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12335 int UtcDaliAnimationMultipleProgressSignalsP(void)
12337 tet_infoline( "Multiple animations with different progress markers" );
12339 TestApplication application;
12341 Actor actor = Actor::New();
12342 Stage::GetCurrent().Add(actor);
12344 // Build the animation
12345 Animation animationAlpha = Animation::New(0.0f);
12346 Animation animationBeta = Animation::New(0.0f);
12349 float durationSeconds(1.0f);
12350 animationAlpha.SetDuration(durationSeconds);
12351 animationBeta.SetDuration(durationSeconds);
12353 bool progressSignalReceivedAlpha(false);
12354 bool progressSignalReceivedBeta(false);
12356 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12357 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12359 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12360 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12361 application.SendNotification();
12363 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12364 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12365 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12367 tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12368 DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12370 tet_infoline( "AnimationBeta Progress notification set to 50%" );
12371 DevelAnimation::SetProgressNotification( animationBeta, 0.5f );
12373 application.SendNotification();
12374 application.Render( );
12376 progressCheckAlpha.CheckSignalNotReceived();
12377 progressCheckBeta.CheckSignalNotReceived();
12379 // Start the animations from 10% progress
12380 animationAlpha.SetCurrentProgress( 0.1f );
12381 animationBeta.SetCurrentProgress( 0.1f );
12382 animationAlpha.Play();
12383 animationBeta.Play();
12385 tet_infoline( "Animation Playing from 10%" );
12387 application.SendNotification();
12388 application.Render(0); // start animation
12389 application.Render(durationSeconds*100.0f ); // 20% progress
12391 tet_infoline( "Animation at 20% - No signals to be received" );
12393 progressCheckAlpha.CheckSignalNotReceived();
12394 progressCheckBeta.CheckSignalNotReceived();
12396 application.SendNotification();
12397 application.Render(durationSeconds*200.0f ); // 40% progress
12398 application.SendNotification();
12399 tet_infoline( "Animation at 40% - Alpha signal should be received" );
12400 DALI_TEST_EQUALS( 0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12402 progressCheckAlpha.CheckSignalReceived();
12403 progressCheckBeta.CheckSignalNotReceived();
12405 tet_infoline( "Progress check reset" );
12406 progressCheckAlpha.Reset();
12407 progressCheckBeta.Reset();
12409 application.Render(durationSeconds*100.0f ); // 50% progress
12410 tet_infoline( "Animation at 50% - Beta should receive signal, Alpha should not" );
12411 application.SendNotification();
12413 DALI_TEST_EQUALS( 0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12415 progressCheckAlpha.CheckSignalNotReceived();
12416 progressCheckBeta.CheckSignalReceived();
12417 tet_infoline( "Progress check reset" );
12418 progressCheckAlpha.Reset();
12419 progressCheckBeta.Reset();
12421 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
12422 application.SendNotification();
12424 tet_infoline( "Animation at 60%" );
12426 progressCheckAlpha.CheckSignalNotReceived();
12427 progressCheckBeta.CheckSignalNotReceived();
12429 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12430 application.SendNotification();
12431 tet_infoline( "Animation at 80%" );
12433 progressCheckAlpha.CheckSignalNotReceived();
12434 progressCheckBeta.CheckSignalNotReceived();
12436 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12437 // We did expect the animation to finish
12438 tet_infoline( "Animation finished" );
12443 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12445 tet_infoline( "Multiple animations with different progress markers and big step time" );
12447 TestApplication application;
12449 Actor actor = Actor::New();
12450 Stage::GetCurrent().Add(actor);
12452 // Build the animation
12453 Animation animationAlpha = Animation::New(0.0f);
12454 Animation animationBeta = Animation::New(0.0f);
12457 const float durationSeconds(1.0f);
12458 animationAlpha.SetDuration(durationSeconds);
12459 animationBeta.SetDuration(durationSeconds);
12461 bool progressSignalReceivedAlpha(false);
12462 bool progressSignalReceivedBeta(false);
12464 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12465 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12467 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12468 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12469 application.SendNotification();
12471 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12472 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12473 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12475 tet_infoline( "AnimationAlpha Progress notification set to 1%" );
12476 DevelAnimation::SetProgressNotification( animationAlpha, 0.01f );
12478 tet_infoline( "AnimationBeta Progress notification set to 99%" );
12479 DevelAnimation::SetProgressNotification( animationBeta, 0.99f );
12481 application.SendNotification();
12482 application.Render( );
12484 progressCheckAlpha.CheckSignalNotReceived();
12485 progressCheckBeta.CheckSignalNotReceived();
12487 // Start the animations unlimited looping
12488 animationAlpha.SetLooping( true );
12489 animationBeta.SetLooping( true );
12490 animationAlpha.Play();
12491 animationBeta.Play();
12493 application.SendNotification();
12494 application.Render(0); // start animation
12495 application.Render(durationSeconds*20.0f ); // 2% progress
12496 application.SendNotification();
12497 DALI_TEST_EQUALS( 0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12499 tet_infoline( "Animation at 2% - Alpha signals should be received, Beta should not." );
12501 progressCheckAlpha.CheckSignalReceived();
12502 progressCheckBeta.CheckSignalNotReceived();
12504 tet_infoline( "Progress check reset" );
12505 progressCheckAlpha.Reset();
12506 progressCheckBeta.Reset();
12508 application.SendNotification();
12509 application.Render(durationSeconds*960.0f ); // 98% progress
12510 application.SendNotification();
12511 tet_infoline( "Animation at 98% - No signal received" );
12512 DALI_TEST_EQUALS( 0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12514 progressCheckAlpha.CheckSignalNotReceived();
12515 progressCheckBeta.CheckSignalNotReceived();
12517 application.SendNotification();
12518 application.Render(durationSeconds*40.0f ); // 2% progress
12519 application.SendNotification();
12520 tet_infoline( "Animation loop once and now 2% - Alpha and Beta should receive signal" );
12521 application.SendNotification();
12523 DALI_TEST_EQUALS( 0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12525 progressCheckAlpha.CheckSignalReceived();
12526 progressCheckBeta.CheckSignalReceived();
12528 tet_infoline( "Progress check reset" );
12529 progressCheckAlpha.Reset();
12530 progressCheckBeta.Reset();
12532 application.SendNotification();
12533 application.Render(durationSeconds*980.0f ); // 100% progress
12534 application.SendNotification();
12535 tet_infoline( "Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not" );
12536 application.SendNotification();
12538 progressCheckAlpha.CheckSignalNotReceived();
12539 progressCheckBeta.CheckSignalReceived();
12541 tet_infoline( "Progress check reset" );
12542 progressCheckAlpha.Reset();
12543 progressCheckBeta.Reset();
12545 animationAlpha.SetLooping( false );
12546 animationBeta.SetLooping( false );
12548 application.SendNotification();
12549 application.Render(static_cast<unsigned int>(durationSeconds*2000.0f) + 1u/*just beyond the animation duration*/);
12550 application.SendNotification();
12552 // We did expect the animation to finish
12553 tet_infoline( "Animation finished" );
12558 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12560 tet_infoline( "Multiple animations with different progress markers" );
12562 TestApplication application;
12564 Actor actor = Actor::New();
12565 Stage::GetCurrent().Add(actor);
12567 // Build the animation
12568 Animation animationAlpha = Animation::New(0.0f);
12569 Animation animationBeta = Animation::New(0.0f);
12572 float durationSeconds(1.0f);
12573 float delaySeconds(0.5f);
12574 animationAlpha.SetDuration(durationSeconds);
12575 animationBeta.SetDuration(durationSeconds);
12577 bool progressSignalReceivedAlpha(false);
12578 bool progressSignalReceivedBeta(false);
12580 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12581 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12583 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12584 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12585 application.SendNotification();
12587 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12588 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12589 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12591 tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12592 DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12594 tet_infoline( "AnimationBeta Progress notification set to ~0% (==Notify when delay is done)" );
12595 DevelAnimation::SetProgressNotification( animationBeta, Math::MACHINE_EPSILON_1 );
12597 application.SendNotification();
12598 application.Render( );
12600 progressCheckAlpha.CheckSignalNotReceived();
12601 progressCheckBeta.CheckSignalNotReceived();
12603 // Start the animations from 10% progress
12604 animationAlpha.PlayAfter(delaySeconds);
12605 animationBeta.PlayAfter(delaySeconds);
12607 application.SendNotification();
12608 application.Render(0); // start animation
12609 application.Render(delaySeconds * 500.0f ); // 50% wait progress
12611 tet_infoline( "Delay at 50% - No signals to be received" );
12613 progressCheckAlpha.CheckSignalNotReceived();
12614 progressCheckBeta.CheckSignalNotReceived();
12616 application.SendNotification();
12617 application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f ); // 100% wait, 5% progress
12618 application.SendNotification();
12619 tet_infoline( "Delay at 100%, Animation at 5% - Beta signal should be received" );
12620 DALI_TEST_EQUALS( 0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12622 progressCheckBeta.CheckSignalReceived();
12623 progressCheckAlpha.CheckSignalNotReceived();
12625 tet_infoline( "Progress check reset" );
12626 progressCheckAlpha.Reset();
12627 progressCheckBeta.Reset();
12629 application.Render(durationSeconds * 200.0f ); // 25% progress
12630 tet_infoline( "Animation at 25% - No signals to be received" );
12631 application.SendNotification();
12633 progressCheckAlpha.CheckSignalNotReceived();
12634 progressCheckBeta.CheckSignalNotReceived();
12636 application.Render(durationSeconds * 200.0f ); // 45% progress
12637 tet_infoline( "Animation at 45% - Alpha should receive signal, Beta should not" );
12638 application.SendNotification();
12640 DALI_TEST_EQUALS( 0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12642 progressCheckAlpha.CheckSignalReceived();
12643 progressCheckBeta.CheckSignalNotReceived();
12645 tet_infoline( "Progress check reset" );
12646 progressCheckAlpha.Reset();
12647 progressCheckBeta.Reset();
12649 application.Render(static_cast<unsigned int>(durationSeconds*150.0f)/* 60% progress */);
12650 application.SendNotification();
12652 tet_infoline( "Animation at 60%" );
12654 progressCheckAlpha.CheckSignalNotReceived();
12655 progressCheckBeta.CheckSignalNotReceived();
12657 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12658 application.SendNotification();
12659 tet_infoline( "Animation at 80%" );
12661 progressCheckAlpha.CheckSignalNotReceived();
12662 progressCheckBeta.CheckSignalNotReceived();
12664 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12665 // We did expect the animation to finish
12666 tet_infoline( "Animation finished" );
12671 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12673 TestApplication application;
12675 Actor actor = Actor::New();
12676 Stage::GetCurrent().Add(actor);
12678 // Build the animation
12679 Animation animation = Animation::New(0.0f);
12682 const float durationSeconds(1.0f);
12683 animation.SetDuration(durationSeconds);
12685 // Set Looping Count
12686 const int loopCount( 4 );
12687 animation.SetLoopCount( loopCount );
12689 bool finishedSignalReceived(false);
12690 bool progressSignalReceived(false);
12692 AnimationFinishCheck finishCheck(finishedSignalReceived);
12693 animation.FinishedSignal().Connect(&application, finishCheck);
12695 AnimationProgressCheck progressCheck(progressSignalReceived);
12696 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12697 application.SendNotification();
12699 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12700 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12702 tet_infoline( "Animation Progress notification set to 50% with looping count 4" );
12703 DevelAnimation::SetProgressNotification( animation, 0.5f );
12705 application.SendNotification();
12706 application.Render( );
12708 progressCheck.CheckSignalNotReceived();
12712 for(int count = 0; count < loopCount; count++)
12714 application.SendNotification();
12715 application.Render(0); // start animation
12716 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12717 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12719 tet_infoline( "Animation at 25%" );
12721 progressCheck.CheckSignalNotReceived();
12723 application.SendNotification();
12724 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12725 application.SendNotification();
12726 tet_infoline( "Animation at 50%" );
12727 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12729 progressCheck.CheckSignalReceived();
12731 tet_infoline( "Progress check reset" );
12732 progressCheck.Reset();
12734 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12735 tet_infoline( "Animation at 75%" );
12736 application.SendNotification();
12738 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12740 progressCheck.CheckSignalNotReceived();
12742 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12743 tet_infoline( "Animation at 100%" );
12744 application.SendNotification();
12746 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12747 application.SendNotification();
12749 application.Render(10u);
12750 application.SendNotification();
12751 application.Render(0u);
12752 application.SendNotification();
12754 finishCheck.CheckSignalReceived();
12759 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
12761 TestApplication application;
12763 Actor actor = Actor::New();
12764 Stage::GetCurrent().Add(actor);
12766 // Build the animation
12767 Animation animation = Animation::New(0.0f);
12770 const float durationSeconds(1.0f);
12771 animation.SetDuration(durationSeconds);
12773 // Set Looping Unlmited
12774 animation.SetLooping( true );
12776 bool finishedSignalReceived(false);
12777 bool progressSignalReceived(false);
12779 AnimationFinishCheck finishCheck(finishedSignalReceived);
12780 animation.FinishedSignal().Connect(&application, finishCheck);
12782 AnimationProgressCheck progressCheck(progressSignalReceived);
12783 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12784 application.SendNotification();
12786 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12787 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12789 tet_infoline( "Animation Progress notification set to 50% with unlimited looping" );
12790 DevelAnimation::SetProgressNotification( animation, 0.5f );
12792 application.SendNotification();
12793 application.Render( );
12795 progressCheck.CheckSignalNotReceived();
12799 for(int count = 0; count < 4; count++)
12801 application.SendNotification();
12802 application.Render(0); // start animation
12803 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12804 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12806 tet_infoline( "Animation at 25%" );
12808 progressCheck.CheckSignalNotReceived();
12810 application.SendNotification();
12811 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12812 application.SendNotification();
12813 tet_infoline( "Animation at 50%" );
12814 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12816 progressCheck.CheckSignalReceived();
12818 tet_infoline( "Progress check reset" );
12819 progressCheck.Reset();
12821 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12822 tet_infoline( "Animation at 75%" );
12823 application.SendNotification();
12825 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12827 progressCheck.CheckSignalNotReceived();
12829 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12830 tet_infoline( "Animation at 100%" );
12831 application.SendNotification();
12833 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12834 finishCheck.CheckSignalNotReceived();
12835 application.SendNotification();
12837 finishCheck.CheckSignalNotReceived();
12839 animation.SetLooping( false );
12840 application.Render(0u);
12841 application.SendNotification();
12842 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
12843 application.SendNotification();
12844 application.Render(0u);
12845 application.SendNotification();
12847 finishCheck.CheckSignalReceived();
12852 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
12854 TestApplication application;
12856 Actor actor = Actor::New();
12857 Stage::GetCurrent().Add(actor);
12859 // Build the animation
12860 Animation animation = Animation::New(0.0f);
12863 const float durationSeconds(1.0f);
12864 animation.SetDuration(durationSeconds);
12866 //Set speed negative
12867 animation.SetSpeedFactor( -1.0f );
12869 // Set Looping Unlmited
12870 animation.SetLooping( true );
12872 bool finishedSignalReceived(false);
12873 bool progressSignalReceived(false);
12875 AnimationFinishCheck finishCheck(finishedSignalReceived);
12876 animation.FinishedSignal().Connect(&application, finishCheck);
12878 AnimationProgressCheck progressCheck(progressSignalReceived);
12879 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12880 application.SendNotification();
12882 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12883 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12885 tet_infoline( "Animation Progress notification set to 50%" );
12886 DevelAnimation::SetProgressNotification( animation, 0.5f );
12888 application.SendNotification();
12889 application.Render( );
12891 progressCheck.CheckSignalNotReceived();
12895 for(int count = 0; count < 4; count++)
12897 application.SendNotification();
12898 application.Render(0); // start animation
12899 progressCheck.CheckSignalNotReceived();
12901 application.SendNotification();
12902 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12903 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12905 tet_infoline( "Animation at 25%" );
12907 progressCheck.CheckSignalNotReceived();
12909 application.SendNotification();
12910 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12911 application.SendNotification();
12912 tet_infoline( "Animation at 50%" );
12913 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12915 progressCheck.CheckSignalReceived();
12917 tet_infoline( "Progress check reset" );
12918 progressCheck.Reset();
12920 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12921 tet_infoline( "Animation at 75%" );
12922 application.SendNotification();
12924 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12926 progressCheck.CheckSignalNotReceived();
12928 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12929 tet_infoline( "Animation at 100%" );
12930 application.SendNotification();
12932 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12933 finishCheck.CheckSignalNotReceived();
12934 application.SendNotification();
12936 finishCheck.CheckSignalNotReceived();
12939 animation.SetLooping( false );
12940 animation.SetLoopCount( 4 );
12942 application.Render(0u);
12943 application.SendNotification();
12945 for(int count = 0; count < 4; count++)
12947 application.SendNotification();
12948 application.Render(0); // start animation
12949 progressCheck.CheckSignalNotReceived();
12951 application.SendNotification();
12952 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12953 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12955 tet_infoline( "Animation at 25%" );
12957 progressCheck.CheckSignalNotReceived();
12959 application.SendNotification();
12960 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12961 application.SendNotification();
12962 tet_infoline( "Animation at 50%" );
12963 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12965 progressCheck.CheckSignalReceived();
12967 tet_infoline( "Progress check reset" );
12968 progressCheck.Reset();
12970 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12971 tet_infoline( "Animation at 75%" );
12972 application.SendNotification();
12974 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12976 progressCheck.CheckSignalNotReceived();
12978 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12979 tet_infoline( "Animation at 100%" );
12980 application.SendNotification();
12982 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12983 application.SendNotification();
12985 application.Render(10u);
12986 application.SendNotification();
12987 application.Render(0u);
12988 application.SendNotification();
12990 finishCheck.CheckSignalReceived();
12995 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
12997 TestApplication application;
12999 Actor actor = Actor::New();
13000 Stage::GetCurrent().Add(actor);
13002 // Build the animation
13003 Animation animation = Animation::New(0.0f);
13006 const float durationSeconds(1.0f);
13007 animation.SetDuration(durationSeconds);
13009 bool finishedSignalReceived(false);
13010 bool progressSignalReceived(false);
13012 AnimationFinishCheck finishCheck(finishedSignalReceived);
13013 animation.FinishedSignal().Connect(&application, finishCheck);
13015 AnimationProgressCheck progressCheck(progressSignalReceived);
13016 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13017 application.SendNotification();
13019 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13020 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13022 tet_infoline( "Animation Progress PlayRange as 10% ~ 90%" );
13023 animation.SetPlayRange( Vector2( 0.1f, 0.9f ) );
13025 tet_infoline( "Animation Progress notification set to >90% that never can notificated" );
13026 DevelAnimation::SetProgressNotification( animation, 0.9f + Math::MACHINE_EPSILON_1 );
13028 application.SendNotification();
13029 application.Render( );
13031 progressCheck.CheckSignalNotReceived();
13035 application.SendNotification();
13036 application.Render(0); // start animation
13037 application.Render(durationSeconds*0.25*1000.0f ); // 35% progress
13038 DALI_TEST_EQUALS( 0.35f, animation.GetCurrentProgress(), TEST_LOCATION );
13040 tet_infoline( "Animation at 35%" );
13042 progressCheck.CheckSignalNotReceived();
13044 application.SendNotification();
13045 application.Render(durationSeconds*0.25*1000.0f ); // 60% progress
13046 application.SendNotification();
13047 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
13049 tet_infoline( "Animation at 60%" );
13051 progressCheck.CheckSignalNotReceived();
13053 application.Render(durationSeconds*0.25*1000.0f ); // 85% progress
13054 tet_infoline( "Animation at 85%" );
13055 application.SendNotification();
13056 DALI_TEST_EQUALS( 0.85f, animation.GetCurrentProgress(), TEST_LOCATION );
13058 progressCheck.CheckSignalNotReceived();
13060 application.Render(durationSeconds*0.25*1000.0f ); // 90% progress
13061 tet_infoline( "Animation over 90%" );
13062 application.SendNotification();
13064 // progress never signaled because playrange is 90%
13065 progressCheck.CheckSignalNotReceived();
13070 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13072 TestApplication application;
13074 Actor actor = Actor::New();
13075 Stage::GetCurrent().Add(actor);
13077 // Build the animation
13078 Animation animation = Animation::New(0.0f);
13081 float durationSeconds(5.0f);
13082 animation.SetDuration(durationSeconds);
13084 bool finishedSignalReceived(false);
13085 bool progressSignalReceived(false);
13087 AnimationFinishCheck finishCheck(finishedSignalReceived);
13088 animation.FinishedSignal().Connect(&application, finishCheck);
13090 AnimationProgressCheck progressCheck(progressSignalReceived);
13091 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13092 application.SendNotification();
13094 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13095 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13097 tet_infoline( "Animation Progress notification set to 50%" );
13098 DevelAnimation::SetProgressNotification( animation, 0.5f );
13100 application.SendNotification();
13101 application.Render( );
13103 progressCheck.CheckSignalNotReceived();
13107 application.SendNotification();
13108 application.Render(0); // start animation
13109 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
13110 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
13112 tet_infoline( "Animation at 25%" );
13114 progressCheck.CheckSignalNotReceived();
13116 application.SendNotification();
13117 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
13118 application.SendNotification();
13119 tet_infoline( "Animation at 50%" );
13120 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
13122 progressCheck.CheckSignalReceived();
13124 tet_infoline( "Progress check reset" );
13125 progressCheck.Reset();
13127 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
13128 tet_infoline( "Animation at 75%" );
13129 application.SendNotification();
13131 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
13133 progressCheck.CheckSignalNotReceived();
13138 int UtcDaliAnimationAnimateByInvalidParameters(void)
13140 TestApplication application;
13142 Actor actor = Actor::New();
13143 Stage::GetCurrent().Add(actor);
13145 // Create the animation
13146 Animation animation = Animation::New(1.0f);
13148 DALI_TEST_ASSERTION(
13150 // non animateable property (STRING)
13151 animation.AnimateBy( Property( actor, Actor::Property::LAYOUT_DIRECTION ), Property::Value( "new direction" ) );
13152 }, "Property type is not animatable" );
13154 DALI_TEST_ASSERTION(
13156 // non animateable property (MATRIX)
13157 Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Dali::Matrix() ), Property::ANIMATABLE );
13158 animation.AnimateBy( Property( actor, index ), Property::Value( Property::MATRIX ) );
13159 }, "Property type is not animatable" );
13162 DALI_TEST_ASSERTION(
13164 // non animateable target (NONE)
13165 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value() );
13166 }, "Target value is not animatable" );
13168 DALI_TEST_ASSERTION(
13170 // non animateable target (STRING)
13171 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value("foo") );
13172 }, "Target value is not animatable" );
13174 DALI_TEST_ASSERTION(
13176 // not mathing properties (VECTOR3, FLOAT)
13177 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( 10.f ) );
13178 }, "Property and target types don't match" );
13180 DALI_TEST_ASSERTION(
13182 // not mathing properties (VECTOR3.A, VECTOR2)
13183 animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), Property::Value( Property::VECTOR2 ) );
13184 }, "Property and target types don't match" );
13186 DALI_TEST_ASSERTION(
13188 // negative duration
13189 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13190 }, "Duration must be >=0" );
13195 int UtcDaliAnimationAnimateToInvalidParameters(void)
13197 TestApplication application;
13199 Actor actor = Actor::New();
13200 Stage::GetCurrent().Add(actor);
13202 // Create the animation
13203 Animation animation = Animation::New(1.0f);
13206 DALI_TEST_ASSERTION(
13208 // non animateable property (MAP)
13209 Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::MAP ), Property::ANIMATABLE );
13210 animation.AnimateTo( Property( actor, index ), Property::Value( Property::MAP ) );
13211 }, "Property type is not animatable" );
13213 DALI_TEST_ASSERTION(
13215 // non animateable target (NONE)
13216 animation.AnimateTo( Property( actor, Actor::Property::CLIPPING_MODE ), Property::Value() );
13217 }, "Property type is not animatable" );
13219 DALI_TEST_ASSERTION(
13221 // non animateable target (ARRAY)
13222 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Property::ARRAY ) );
13223 }, "Target value is not animatable" );
13225 DALI_TEST_ASSERTION(
13227 // non animateable target (RECTANGLE)
13228 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Rect<int32_t>() ) );
13229 }, "Target value is not animatable" );
13231 DALI_TEST_ASSERTION(
13233 // not mathing properties (FLOAT, INT)
13234 animation.AnimateTo( Property( actor, Actor::Property::SCALE_Y ), Property::Value(10) );
13235 }, "Property and target types don't match" );
13237 DALI_TEST_ASSERTION(
13239 // not mathing properties (VECTOR3, VECTOR2)
13240 animation.AnimateTo( Property( actor, Actor::Property::COLOR ), Property::Value( Property::VECTOR2 ) );
13241 }, "Property and target types don't match" );
13243 DALI_TEST_ASSERTION(
13245 // negative duration
13246 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13247 }, "Duration must be >=0" );
13252 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13254 TestApplication application;
13256 Actor actor = Actor::New();
13257 Stage::GetCurrent().Add(actor);
13259 // Create the animation
13260 Animation animation = Animation::New(1.0f);
13263 DALI_TEST_ASSERTION(
13265 // non animateable property (ARRAY)
13266 Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::ARRAY ), Property::ANIMATABLE );
13267 KeyFrames keyframes = KeyFrames::New();
13268 keyframes.Add( 0.5f, Property::Value( Property::ARRAY ) );
13269 animation.AnimateBetween( Property( actor, index ), keyframes );
13270 }, "Property type is not animatable" );
13272 DALI_TEST_ASSERTION(
13274 // non animateable target (NONE)
13275 KeyFrames keyframes = KeyFrames::New();
13276 keyframes.Add( 0.5f, Property::Value() );
13277 animation.AnimateBetween( Property( actor, Actor::Property::CLIPPING_MODE ), keyframes );
13278 }, "Property type is not animatable" );
13280 DALI_TEST_ASSERTION(
13282 // non animateable target (EXTENTS)
13283 KeyFrames keyframes = KeyFrames::New();
13284 keyframes.Add( 0.5f, Property::Value( Property::EXTENTS ) ); // throws
13285 animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13286 }, "Property type is not animatable" );
13288 DALI_TEST_ASSERTION(
13290 // non animateable target (RECTANGLE)
13291 KeyFrames keyframes = KeyFrames::New();
13292 keyframes.Add( 0.5f, Property::Value( Property::MAP ) ); // throws
13293 animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13294 }, "Property type is not animatable" );
13296 DALI_TEST_ASSERTION(
13298 // not mathing properties (VECTOR2, VECTOR4)
13299 KeyFrames keyframes = KeyFrames::New();
13300 keyframes.Add( 0.5f, Property::Value( Vector4( 1, 2, 3, 4 ) ) );
13301 animation.AnimateBetween( Property( actor, Actor::Property::MAXIMUM_SIZE ), keyframes );
13302 }, "Property and target types don't match" );
13304 DALI_TEST_ASSERTION(
13306 // negative duration
13307 KeyFrames keyframes = KeyFrames::New();
13308 keyframes.Add( 0.5f, Property::Value(Vector3( 1, 2, 3 ) ) );
13309 animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes, TimePeriod(-1) );
13310 }, "Duration must be >=0" );