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 UtcDaliAnimationPlayOffStageP(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!
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::ZERO/*off-stage*/, 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 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
2121 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
2123 // Remove from the stage
2124 Stage::GetCurrent().Remove(actor);
2126 application.SendNotification();
2127 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2129 // We didn't expect the animation to finish yet
2130 application.SendNotification();
2131 finishCheck.CheckSignalNotReceived();
2132 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
2135 Stage::GetCurrent().Add(actor);
2137 application.SendNotification();
2138 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2140 // We didn't expect the animation to finish yet
2141 application.SendNotification();
2142 finishCheck.CheckSignalNotReceived();
2143 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
2144 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
2146 application.SendNotification();
2147 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2149 // We did expect the animation to finish
2150 application.SendNotification();
2151 finishCheck.CheckSignalReceived();
2152 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2154 // Check that nothing has changed after a couple of buffer swaps
2155 application.Render(0);
2156 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2157 application.Render(0);
2158 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2162 int UtcDaliAnimationPlayDiscardHandleP(void)
2164 TestApplication application;
2166 Actor actor = Actor::New();
2167 Stage::GetCurrent().Add(actor);
2169 // Build the animation
2170 float durationSeconds(1.0f);
2171 Animation animation = Animation::New(durationSeconds);
2172 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2173 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2175 bool signalReceived(false);
2176 AnimationFinishCheck finishCheck(signalReceived);
2177 animation.FinishedSignal().Connect(&application, finishCheck);
2179 // Start the animation
2182 // This is a test of the "Fire and Forget" behaviour
2183 // Discard the animation handle!
2185 DALI_TEST_CHECK( !animation );
2187 application.SendNotification();
2188 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2190 // We didn't expect the animation to finish yet
2191 application.SendNotification();
2192 finishCheck.CheckSignalNotReceived();
2193 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2195 application.SendNotification();
2196 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2198 // We didn't expect the animation to finish yet
2199 application.SendNotification();
2200 finishCheck.CheckSignalNotReceived();
2201 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2203 application.SendNotification();
2204 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2206 // We didn't expect the animation to finish yet
2207 application.SendNotification();
2208 finishCheck.CheckSignalNotReceived();
2209 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2211 application.SendNotification();
2212 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2214 // We didn't expect the animation to finish yet
2215 application.SendNotification();
2216 finishCheck.CheckSignalNotReceived();
2217 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2219 application.SendNotification();
2220 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2222 // We did expect the animation to finish
2223 application.SendNotification();
2224 finishCheck.CheckSignalReceived();
2225 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2227 // Check that nothing has changed after a couple of buffer swaps
2228 application.Render(0);
2229 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2230 application.Render(0);
2231 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2235 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2237 TestApplication application;
2239 Actor actor = Actor::New();
2240 Stage::GetCurrent().Add(actor);
2242 // Build the animation
2243 float durationSeconds(1.0f);
2244 Animation animation = Animation::New(durationSeconds);
2245 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2246 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2248 // Start the animation
2251 bool signalReceived(false);
2252 AnimationFinishCheck finishCheck(signalReceived);
2253 animation.FinishedSignal().Connect(&application, finishCheck);
2255 application.SendNotification();
2256 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2258 // We didn't expect the animation to finish yet
2259 application.SendNotification();
2260 finishCheck.CheckSignalNotReceived();
2261 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2263 // This is a test of the "Fire and Forget" behaviour
2264 // Stop the animation, and Discard the animation handle!
2267 DALI_TEST_CHECK( !animation );
2269 application.SendNotification();
2270 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2272 // We expect the animation to finish at 20% progress
2273 application.SendNotification();
2274 finishCheck.CheckSignalReceived();
2275 finishCheck.Reset();
2276 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2278 application.SendNotification();
2279 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2281 // Check that nothing has changed
2282 application.SendNotification();
2283 finishCheck.CheckSignalNotReceived();
2284 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2286 application.SendNotification();
2287 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2289 // Check that nothing has changed
2290 application.SendNotification();
2291 finishCheck.CheckSignalNotReceived();
2292 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2294 application.SendNotification();
2295 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2297 // Check that nothing has changed
2298 application.SendNotification();
2299 finishCheck.CheckSignalNotReceived();
2300 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2304 int UtcDaliAnimationPlayRangeP(void)
2306 TestApplication application;
2308 Actor actor = Actor::New();
2309 Stage::GetCurrent().Add(actor);
2311 // Build the animation
2312 float durationSeconds(1.0f);
2313 Animation animation = Animation::New(durationSeconds);
2314 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2315 KeyFrames keyframes = KeyFrames::New();
2316 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2317 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2319 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2321 // Set range between 0.4 and 0.8
2322 animation.SetPlayRange( Vector2(0.4f,0.8f) );
2325 bool signalReceived(false);
2326 AnimationFinishCheck finishCheck(signalReceived);
2327 animation.FinishedSignal().Connect(&application, finishCheck);
2329 //Test that setting progress outside the range doesn't work
2330 animation.SetCurrentProgress( 0.9f );
2331 application.SendNotification();
2332 application.Render(0);
2333 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2334 animation.SetCurrentProgress( 0.2f );
2335 application.SendNotification();
2336 application.Render(0);
2337 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2339 application.SendNotification();
2340 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2342 // We didn't expect the animation to finish yet
2343 application.SendNotification();
2344 finishCheck.CheckSignalNotReceived();
2345 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2347 animation.Play(); // Test that calling play has no effect, when animation is already playing
2348 application.SendNotification();
2349 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2351 // We did expect the animation to finish
2352 application.SendNotification();
2353 finishCheck.CheckSignalReceived();
2354 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2356 // Check that nothing has changed after a couple of buffer swaps
2357 application.Render(0);
2358 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2359 application.Render(0);
2360 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2363 //Loop inside the range
2364 finishCheck.Reset();
2365 animation.SetLooping( true );
2367 application.SendNotification();
2368 float intervalSeconds = 0.1f;
2369 float progress = 0.4f;
2370 for (int iterations = 0; iterations < 10; ++iterations )
2372 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2374 progress += intervalSeconds;
2375 if (progress > 0.8f)
2377 progress = progress - 0.4f;
2380 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2383 // We didn't expect the animation to finish yet
2384 application.SendNotification();
2385 finishCheck.CheckSignalNotReceived();
2388 //Test change range on the fly
2389 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2390 application.SendNotification();
2392 for (int iterations = 0; iterations < 10; ++iterations )
2394 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2396 progress += intervalSeconds;
2397 if (progress > 0.9f)
2399 progress = progress - 0.7f;
2402 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2408 int UtcDaliAnimationPlayFromP(void)
2410 TestApplication application;
2412 Actor actor = Actor::New();
2413 Stage::GetCurrent().Add(actor);
2415 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2417 // Build the animation
2418 float durationSeconds(1.0f);
2419 Animation animation = Animation::New(durationSeconds);
2420 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2421 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2423 // Start the animation from 40% progress
2424 animation.PlayFrom( 0.4f );
2426 // Target value should be updated straight away
2427 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2429 bool signalReceived(false);
2430 AnimationFinishCheck finishCheck(signalReceived);
2431 animation.FinishedSignal().Connect(&application, finishCheck);
2433 application.SendNotification();
2434 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2436 // We didn't expect the animation to finish yet
2437 application.SendNotification();
2438 finishCheck.CheckSignalNotReceived();
2439 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2441 animation.Play(); // Test that calling play has no effect, when animation is already playing
2442 application.SendNotification();
2443 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2445 // We didn't expect the animation to finish yet
2446 application.SendNotification();
2447 finishCheck.CheckSignalNotReceived();
2448 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2450 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2451 // We did expect the animation to finish
2452 application.SendNotification();
2453 finishCheck.CheckSignalReceived();
2454 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2456 // Check that nothing has changed after a couple of buffer swaps
2457 application.Render(0);
2458 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2459 application.Render(0);
2460 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2464 int UtcDaliAnimationPlayFromN(void)
2466 TestApplication application;
2468 Actor actor = Actor::New();
2469 Stage::GetCurrent().Add(actor);
2471 // Build the animation
2472 float durationSeconds(1.0f);
2473 Animation animation = Animation::New(durationSeconds);
2474 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2475 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2477 //PlayFrom with an argument outside the range [0..1] will be ignored
2478 animation.PlayFrom(-1.0f);
2479 application.SendNotification();
2480 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2482 animation.PlayFrom(100.0f);
2483 application.SendNotification();
2484 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2488 int UtcDaliAnimationPauseP(void)
2490 TestApplication application;
2492 Actor actor = Actor::New();
2493 Stage::GetCurrent().Add(actor);
2495 // Build the animation
2496 float durationSeconds(1.0f);
2497 Animation animation = Animation::New(durationSeconds);
2498 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2499 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2501 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2503 // Start the animation
2506 bool signalReceived(false);
2507 AnimationFinishCheck finishCheck(signalReceived);
2508 animation.FinishedSignal().Connect(&application, finishCheck);
2510 application.SendNotification();
2511 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2513 // We didn't expect the animation to finish yet
2514 application.SendNotification();
2515 finishCheck.CheckSignalNotReceived();
2516 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2518 // Pause the animation
2520 application.SendNotification();
2523 for (int i=0; i<5; ++i)
2525 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2527 // We didn't expect the animation to finish yet
2528 application.SendNotification();
2529 finishCheck.CheckSignalNotReceived();
2530 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2535 application.SendNotification();
2536 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2538 // We didn't expect the animation to finish yet
2539 application.SendNotification();
2540 finishCheck.CheckSignalNotReceived();
2542 application.SendNotification();
2543 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2545 // We did expect the animation to finish
2546 application.SendNotification();
2547 finishCheck.CheckSignalReceived();
2548 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2550 // Check that nothing has changed after a couple of buffer swaps
2551 application.Render(0);
2552 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2553 application.Render(0);
2554 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2559 int UtcDaliAnimationGetStateP(void)
2561 TestApplication application;
2563 Actor actor = Actor::New();
2564 Stage::GetCurrent().Add(actor);
2566 // Build the animation
2567 float durationSeconds(1.0f);
2568 Animation animation = Animation::New(durationSeconds);
2569 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2570 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2571 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2573 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2575 // Start the animation
2578 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2580 bool signalReceived(false);
2581 AnimationFinishCheck finishCheck(signalReceived);
2582 animation.FinishedSignal().Connect(&application, finishCheck);
2584 application.SendNotification();
2585 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2587 // We didn't expect the animation to finish yet
2588 application.SendNotification();
2589 finishCheck.CheckSignalNotReceived();
2590 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2591 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2593 // Pause the animation
2595 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2596 application.SendNotification();
2597 application.Render(0.f);
2600 for (int i=0; i<5; ++i)
2602 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2604 // We didn't expect the animation to finish yet
2605 application.SendNotification();
2606 finishCheck.CheckSignalNotReceived();
2607 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2608 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2612 finishCheck.Reset();
2614 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2615 application.SendNotification();
2616 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2617 // We didn't expect the animation to finish yet
2618 application.SendNotification();
2619 finishCheck.CheckSignalNotReceived();
2620 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2622 application.SendNotification();
2623 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2625 // We did expect the animation to finish
2626 application.SendNotification();
2627 finishCheck.CheckSignalReceived();
2628 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2629 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2631 // Check that nothing has changed after a couple of buffer swaps
2632 application.Render(0);
2633 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2634 application.Render(0);
2635 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2636 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2639 finishCheck.Reset();
2641 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2642 application.SendNotification();
2643 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2644 application.SendNotification();
2645 finishCheck.CheckSignalNotReceived();
2646 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2652 int UtcDaliAnimationStopP(void)
2654 TestApplication application;
2656 Actor actor = Actor::New();
2657 Stage::GetCurrent().Add(actor);
2659 // Build the animation
2660 float durationSeconds(1.0f);
2661 Animation animation = Animation::New(durationSeconds);
2662 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2663 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2665 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2667 // Start the animation
2670 bool signalReceived(false);
2671 AnimationFinishCheck finishCheck(signalReceived);
2672 animation.FinishedSignal().Connect(&application, finishCheck);
2674 application.SendNotification();
2675 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2677 // We didn't expect the animation to finish yet
2678 application.SendNotification();
2679 finishCheck.CheckSignalNotReceived();
2680 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2682 // Stop the animation
2684 application.SendNotification();
2687 for (int i=0; i<5; ++i)
2689 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2691 // We did expect the animation to finish
2692 application.SendNotification();
2693 finishCheck.CheckSignalReceived();
2694 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2699 int UtcDaliAnimationStopSetPositionP(void)
2701 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2702 // i.e. to check that the animation does not interfere with the position set.
2704 TestApplication application;
2706 Actor actor = Actor::New();
2707 Stage::GetCurrent().Add(actor);
2709 // Build the animation
2710 float durationSeconds(1.0f);
2711 Animation animation = Animation::New(durationSeconds);
2712 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2713 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2715 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2717 // Start the animation
2720 bool signalReceived(false);
2721 AnimationFinishCheck finishCheck(signalReceived);
2722 animation.FinishedSignal().Connect(&application, finishCheck);
2724 application.SendNotification();
2725 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2727 // We didn't expect the animation to finish yet
2728 application.SendNotification();
2729 finishCheck.CheckSignalNotReceived();
2730 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2732 // Stop the animation
2734 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2735 actor.SetPosition(positionSet);
2736 application.SendNotification();
2739 for (int i=0; i<5; ++i)
2741 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2743 // We did expect the animation to finish
2744 application.SendNotification();
2745 finishCheck.CheckSignalReceived();
2746 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2751 int UtcDaliAnimationClearP(void)
2753 TestApplication application;
2755 Actor actor = Actor::New();
2756 Stage::GetCurrent().Add(actor);
2758 // Build the animation
2759 float durationSeconds(1.0f);
2760 Animation animation = Animation::New(durationSeconds);
2761 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2762 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2764 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2766 // Start the animation
2769 bool signalReceived(false);
2770 AnimationFinishCheck finishCheck(signalReceived);
2771 animation.FinishedSignal().Connect(&application, finishCheck);
2773 application.SendNotification();
2774 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2776 // We didn't expect the animation to finish yet
2777 application.SendNotification();
2778 finishCheck.CheckSignalNotReceived();
2779 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2781 // Clear the animation
2783 application.SendNotification();
2785 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2787 // We don't expect the animation to finish now
2788 application.SendNotification();
2789 finishCheck.CheckSignalNotReceived();
2790 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2792 // Restart as a scale animation; this should not move the actor's position
2793 finishCheck.Reset();
2794 actor.SetPosition(Vector3::ZERO);
2795 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2796 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2799 application.SendNotification();
2800 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2802 // We didn't expect the animation to finish yet
2803 application.SendNotification();
2804 finishCheck.CheckSignalNotReceived();
2805 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2806 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2808 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2810 // We did expect the animation to finish
2811 application.SendNotification();
2812 finishCheck.CheckSignalReceived();
2813 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2814 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2818 int UtcDaliAnimationFinishedSignalP(void)
2820 TestApplication application;
2822 // Start the empty animation
2823 float durationSeconds(1.0f);
2824 Animation animation = Animation::New(durationSeconds);
2827 bool signalReceived(false);
2828 AnimationFinishCheck finishCheck(signalReceived);
2829 animation.FinishedSignal().Connect(&application, finishCheck);
2831 application.SendNotification();
2832 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2834 // We did expect the animation to finish
2835 application.SendNotification();
2836 finishCheck.CheckSignalReceived();
2840 int UtcDaliAnimationAnimateByBooleanP(void)
2842 TestApplication application;
2844 Actor actor = Actor::New();
2846 // Register a boolean property
2847 bool startValue(false);
2848 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2849 Stage::GetCurrent().Add(actor);
2850 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2851 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2853 // Build the animation
2854 float durationSeconds(2.0f);
2855 Animation animation = Animation::New(durationSeconds);
2856 const bool relativeValue(true);
2857 const bool finalValue( false || relativeValue );
2858 animation.AnimateBy(Property(actor, index), relativeValue);
2860 // Start the animation
2863 // Target value should be retrievable straight away
2864 DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
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*950.0f)/* 95% progress */);
2873 // We didn't expect the animation to finish yet
2874 application.SendNotification();
2875 finishCheck.CheckSignalNotReceived();
2876 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2878 application.SendNotification();
2879 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2881 // We did expect the animation to finish
2882 application.SendNotification();
2883 finishCheck.CheckSignalReceived();
2884 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2886 // Check that nothing has changed after a couple of buffer swaps
2887 application.Render(0);
2888 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2889 application.Render(0);
2890 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2892 // Repeat with relative value "false" - this should be an NOOP
2893 animation = Animation::New(durationSeconds);
2894 bool noOpValue(false);
2895 animation.AnimateBy(Property(actor, index), noOpValue);
2897 // Start the animation
2900 finishCheck.Reset();
2901 animation.FinishedSignal().Connect(&application, finishCheck);
2903 application.SendNotification();
2904 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2906 // We didn't expect the animation to finish yet
2907 application.SendNotification();
2908 finishCheck.CheckSignalNotReceived();
2909 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2911 application.SendNotification();
2912 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2914 // We did expect the animation to finish
2915 application.SendNotification();
2916 finishCheck.CheckSignalReceived();
2917 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2919 // Check that nothing has changed after a couple of buffer swaps
2920 application.Render(0);
2921 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2922 application.Render(0);
2923 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2927 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2929 TestApplication application;
2931 Actor actor = Actor::New();
2933 // Register a boolean property
2934 bool startValue(false);
2935 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2936 Stage::GetCurrent().Add(actor);
2937 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2938 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2940 // Build the animation
2941 float durationSeconds(2.0f);
2942 Animation animation = Animation::New(durationSeconds);
2943 bool relativeValue(true);
2944 bool finalValue( false || relativeValue );
2945 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2947 // Start the animation
2950 bool signalReceived(false);
2951 AnimationFinishCheck finishCheck(signalReceived);
2952 animation.FinishedSignal().Connect(&application, finishCheck);
2954 application.SendNotification();
2955 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2957 // We didn't expect the animation to finish yet
2958 application.SendNotification();
2959 finishCheck.CheckSignalNotReceived();
2960 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2962 application.SendNotification();
2963 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2965 // We did expect the animation to finish
2966 application.SendNotification();
2967 finishCheck.CheckSignalReceived();
2968 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2970 // Check that nothing has changed after a couple of buffer swaps
2971 application.Render(0);
2972 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2973 application.Render(0);
2974 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2976 // Repeat with relative value "false" - this should be an NOOP
2977 animation = Animation::New(durationSeconds);
2978 bool noOpValue(false);
2979 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2981 // Start the animation
2984 finishCheck.Reset();
2985 animation.FinishedSignal().Connect(&application, finishCheck);
2987 application.SendNotification();
2988 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2990 // We didn't expect the animation to finish yet
2991 application.SendNotification();
2992 finishCheck.CheckSignalNotReceived();
2993 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2995 application.SendNotification();
2996 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2998 // We did expect the animation to finish
2999 application.SendNotification();
3000 finishCheck.CheckSignalReceived();
3001 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3005 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3007 TestApplication application;
3009 Actor actor = Actor::New();
3011 // Register a boolean property
3012 bool startValue(false);
3013 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3014 Stage::GetCurrent().Add(actor);
3015 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3016 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3018 // Build the animation
3019 float durationSeconds(2.0f);
3020 Animation animation = Animation::New(durationSeconds);
3021 bool relativeValue(true);
3022 bool finalValue( false || relativeValue );
3023 float animatorDurationSeconds(durationSeconds * 0.5f);
3024 animation.AnimateBy( Property(actor, index),
3026 TimePeriod( animatorDurationSeconds ) );
3028 // Start the animation
3031 bool signalReceived(false);
3032 AnimationFinishCheck finishCheck(signalReceived);
3033 animation.FinishedSignal().Connect(&application, finishCheck);
3035 application.SendNotification();
3036 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3038 // We didn't expect the animation to finish yet
3039 application.SendNotification();
3040 finishCheck.CheckSignalNotReceived();
3041 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3043 application.SendNotification();
3044 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3046 // We didn't expect the animation to finish yet...
3047 application.SendNotification();
3048 finishCheck.CheckSignalNotReceived();
3050 // ...however we should have reached the final value
3051 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3053 application.SendNotification();
3054 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3056 // We did expect the animation to finish
3057 application.SendNotification();
3058 finishCheck.CheckSignalReceived();
3059 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3061 // Check that nothing has changed after a couple of buffer swaps
3062 application.Render(0);
3063 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3064 application.Render(0);
3065 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3069 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3071 TestApplication application;
3073 Actor actor = Actor::New();
3075 // Register a boolean property
3076 bool startValue(false);
3077 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3078 Stage::GetCurrent().Add(actor);
3079 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3080 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3082 // Build the animation
3083 float durationSeconds(2.0f);
3084 Animation animation = Animation::New(durationSeconds);
3085 bool relativeValue(true);
3086 bool finalValue( false || relativeValue );
3087 float animatorDurationSeconds(durationSeconds * 0.5f);
3088 animation.AnimateBy( Property(actor, index),
3090 AlphaFunction::EASE_IN_OUT,
3091 TimePeriod( animatorDurationSeconds ) );
3093 // Start the animation
3096 bool signalReceived(false);
3097 AnimationFinishCheck finishCheck(signalReceived);
3098 animation.FinishedSignal().Connect(&application, finishCheck);
3100 application.SendNotification();
3101 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3103 // We didn't expect the animation to finish yet
3104 application.SendNotification();
3105 finishCheck.CheckSignalNotReceived();
3106 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3108 application.SendNotification();
3109 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3111 // We didn't expect the animation to finish yet...
3112 application.SendNotification();
3113 finishCheck.CheckSignalNotReceived();
3115 // ...however we should have reached the final value
3116 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3118 application.SendNotification();
3119 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3121 // We did expect the animation to finish
3122 application.SendNotification();
3123 finishCheck.CheckSignalReceived();
3124 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3126 // Check that nothing has changed after a couple of buffer swaps
3127 application.Render(0);
3128 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3129 application.Render(0);
3130 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3134 int UtcDaliAnimationAnimateByFloatP(void)
3136 TestApplication application;
3138 Actor actor = Actor::New();
3140 // Register a float property
3141 float startValue(10.0f);
3142 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3143 Stage::GetCurrent().Add(actor);
3144 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3145 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3147 // Build the animation
3148 float durationSeconds(2.0f);
3149 Animation animation = Animation::New(durationSeconds);
3150 float targetValue(50.0f);
3151 float relativeValue(targetValue - startValue);
3152 animation.AnimateBy(Property(actor, index), relativeValue);
3154 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3156 // Start the animation
3159 // Target value should be retrievable straight away
3160 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3162 bool signalReceived(false);
3163 AnimationFinishCheck finishCheck(signalReceived);
3164 animation.FinishedSignal().Connect(&application, finishCheck);
3166 application.SendNotification();
3167 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3169 // We didn't expect the animation to finish yet
3170 application.SendNotification();
3171 finishCheck.CheckSignalNotReceived();
3172 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3174 application.SendNotification();
3175 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3177 // We did expect the animation to finish
3178 application.SendNotification();
3179 finishCheck.CheckSignalReceived();
3180 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3182 // Check that nothing has changed after a couple of buffer swaps
3183 application.Render(0);
3184 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3185 application.Render(0);
3186 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3190 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3192 TestApplication application;
3194 Actor actor = Actor::New();
3196 // Register a float property
3197 float startValue(10.0f);
3198 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3199 Stage::GetCurrent().Add(actor);
3200 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3201 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3203 // Build the animation
3204 float durationSeconds(1.0f);
3205 Animation animation = Animation::New(durationSeconds);
3206 float targetValue(90.0f);
3207 float relativeValue(targetValue - startValue);
3208 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3210 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3212 // Start the animation
3215 bool signalReceived(false);
3216 AnimationFinishCheck finishCheck(signalReceived);
3217 animation.FinishedSignal().Connect(&application, finishCheck);
3219 application.SendNotification();
3220 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3222 // We didn't expect the animation to finish yet
3223 application.SendNotification();
3224 finishCheck.CheckSignalNotReceived();
3226 // The position should have moved more, than with a linear alpha function
3227 float current( actor.GetCurrentProperty< float >( index ) );
3228 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3230 application.SendNotification();
3231 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3233 // We did expect the animation to finish
3234 application.SendNotification();
3235 finishCheck.CheckSignalReceived();
3236 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3238 // Check that nothing has changed after a couple of buffer swaps
3239 application.Render(0);
3240 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3241 application.Render(0);
3242 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3246 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3248 TestApplication application;
3250 Actor actor = Actor::New();
3252 // Register a float property
3253 float startValue(10.0f);
3254 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3255 Stage::GetCurrent().Add(actor);
3256 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3257 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3259 // Build the animation
3260 float durationSeconds(1.0f);
3261 Animation animation = Animation::New(durationSeconds);
3262 float targetValue(30.0f);
3263 float relativeValue(targetValue - startValue);
3265 animation.AnimateBy(Property(actor, index),
3267 TimePeriod(delay, durationSeconds - delay));
3269 // Start the animation
3272 bool signalReceived(false);
3273 AnimationFinishCheck finishCheck(signalReceived);
3274 animation.FinishedSignal().Connect(&application, finishCheck);
3276 application.SendNotification();
3277 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3279 // We didn't expect the animation to finish yet
3280 application.SendNotification();
3281 finishCheck.CheckSignalNotReceived();
3282 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3284 application.SendNotification();
3285 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3287 // We didn't expect the animation to finish yet
3288 application.SendNotification();
3289 finishCheck.CheckSignalNotReceived();
3290 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3292 application.SendNotification();
3293 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3295 // We did expect the animation to finish
3296 application.SendNotification();
3297 finishCheck.CheckSignalReceived();
3298 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3300 // Check that nothing has changed after a couple of buffer swaps
3301 application.Render(0);
3302 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3303 application.Render(0);
3304 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3308 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3310 TestApplication application;
3312 Actor actor = Actor::New();
3314 // Register a float property
3315 float startValue(10.0f);
3316 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3317 Stage::GetCurrent().Add(actor);
3318 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3319 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3321 // Build the animation
3322 float durationSeconds(1.0f);
3323 Animation animation = Animation::New(durationSeconds);
3324 float targetValue(30.0f);
3325 float relativeValue(targetValue - startValue);
3327 animation.AnimateBy(Property(actor, index),
3329 AlphaFunction::LINEAR,
3330 TimePeriod(delay, durationSeconds - delay));
3332 // Start the animation
3335 bool signalReceived(false);
3336 AnimationFinishCheck finishCheck(signalReceived);
3337 animation.FinishedSignal().Connect(&application, finishCheck);
3339 application.SendNotification();
3340 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3342 // We didn't expect the animation to finish yet
3343 application.SendNotification();
3344 finishCheck.CheckSignalNotReceived();
3345 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3347 application.SendNotification();
3348 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3350 // We didn't expect the animation to finish yet
3351 application.SendNotification();
3352 finishCheck.CheckSignalNotReceived();
3353 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3355 application.SendNotification();
3356 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3358 // We did expect the animation to finish
3359 application.SendNotification();
3360 finishCheck.CheckSignalReceived();
3361 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3363 // Check that nothing has changed after a couple of buffer swaps
3364 application.Render(0);
3365 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3366 application.Render(0);
3367 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3371 int UtcDaliAnimationAnimateByIntegerP(void)
3373 TestApplication application;
3375 Actor actor = Actor::New();
3377 // Register an integer property
3379 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3380 Stage::GetCurrent().Add(actor);
3381 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3382 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3384 // Build the animation
3385 float durationSeconds(2.0f);
3386 Animation animation = Animation::New(durationSeconds);
3387 int targetValue(50);
3388 int relativeValue(targetValue - startValue);
3389 animation.AnimateBy(Property(actor, index), relativeValue);
3391 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3393 // Start the animation
3396 // Target value should be retrievable straight away
3397 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3399 bool signalReceived(false);
3400 AnimationFinishCheck finishCheck(signalReceived);
3401 animation.FinishedSignal().Connect(&application, finishCheck);
3403 application.SendNotification();
3404 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3406 // We didn't expect the animation to finish yet
3407 application.SendNotification();
3408 finishCheck.CheckSignalNotReceived();
3409 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3411 application.SendNotification();
3412 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3414 // We did expect the animation to finish
3415 application.SendNotification();
3416 finishCheck.CheckSignalReceived();
3417 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3419 // Check that nothing has changed after a couple of buffer swaps
3420 application.Render(0);
3421 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3422 application.Render(0);
3423 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3427 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3429 TestApplication application;
3431 Actor actor = Actor::New();
3433 // Register an integer property
3435 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3436 Stage::GetCurrent().Add(actor);
3437 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3438 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3440 // Build the animation
3441 float durationSeconds(1.0f);
3442 Animation animation = Animation::New(durationSeconds);
3443 int targetValue(90);
3444 int relativeValue(targetValue - startValue);
3445 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3447 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3449 // Start the animation
3452 bool signalReceived(false);
3453 AnimationFinishCheck finishCheck(signalReceived);
3454 animation.FinishedSignal().Connect(&application, finishCheck);
3456 application.SendNotification();
3457 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3459 // We didn't expect the animation to finish yet
3460 application.SendNotification();
3461 finishCheck.CheckSignalNotReceived();
3463 // The position should have moved more, than with a linear alpha function
3464 int current( actor.GetCurrentProperty< int >( index ) );
3465 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3467 application.SendNotification();
3468 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3470 // We did expect the animation to finish
3471 application.SendNotification();
3472 finishCheck.CheckSignalReceived();
3473 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3475 // Check that nothing has changed after a couple of buffer swaps
3476 application.Render(0);
3477 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3478 application.Render(0);
3479 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3483 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3485 TestApplication application;
3487 Actor actor = Actor::New();
3489 // Register an integer property
3491 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3492 Stage::GetCurrent().Add(actor);
3493 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3494 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3496 // Build the animation
3497 float durationSeconds(1.0f);
3498 Animation animation = Animation::New(durationSeconds);
3499 int targetValue(30);
3500 int relativeValue(targetValue - startValue);
3502 animation.AnimateBy(Property(actor, index),
3504 TimePeriod(delay, durationSeconds - delay));
3506 // Start the animation
3509 bool signalReceived(false);
3510 AnimationFinishCheck finishCheck(signalReceived);
3511 animation.FinishedSignal().Connect(&application, finishCheck);
3513 application.SendNotification();
3514 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3516 // We didn't expect the animation to finish yet
3517 application.SendNotification();
3518 finishCheck.CheckSignalNotReceived();
3519 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3521 application.SendNotification();
3522 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3524 // We didn't expect the animation to finish yet
3525 application.SendNotification();
3526 finishCheck.CheckSignalNotReceived();
3527 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3529 application.SendNotification();
3530 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3532 // We did expect the animation to finish
3533 application.SendNotification();
3534 finishCheck.CheckSignalReceived();
3535 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3537 // Check that nothing has changed after a couple of buffer swaps
3538 application.Render(0);
3539 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3540 application.Render(0);
3541 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3545 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3547 TestApplication application;
3549 Actor actor = Actor::New();
3551 // Register an integer property
3553 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3554 Stage::GetCurrent().Add(actor);
3555 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3556 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3558 // Build the animation
3559 float durationSeconds(1.0f);
3560 Animation animation = Animation::New(durationSeconds);
3561 int targetValue(30);
3562 int relativeValue(targetValue - startValue);
3564 animation.AnimateBy(Property(actor, index),
3566 AlphaFunction::LINEAR,
3567 TimePeriod(delay, durationSeconds - delay));
3569 // Start the animation
3572 bool signalReceived(false);
3573 AnimationFinishCheck finishCheck(signalReceived);
3574 animation.FinishedSignal().Connect(&application, finishCheck);
3576 application.SendNotification();
3577 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3579 // We didn't expect the animation to finish yet
3580 application.SendNotification();
3581 finishCheck.CheckSignalNotReceived();
3582 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3584 application.SendNotification();
3585 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3587 // We didn't expect the animation to finish yet
3588 application.SendNotification();
3589 finishCheck.CheckSignalNotReceived();
3590 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3592 application.SendNotification();
3593 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3595 // We did expect the animation to finish
3596 application.SendNotification();
3597 finishCheck.CheckSignalReceived();
3598 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3600 // Check that nothing has changed after a couple of buffer swaps
3601 application.Render(0);
3602 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3603 application.Render(0);
3604 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3608 int UtcDaliAnimationAnimateByQuaternionP(void)
3610 TestApplication application;
3612 Actor actor = Actor::New();
3614 // Register a quaternion property
3615 const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
3616 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3617 Stage::GetCurrent().Add(actor);
3618 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3619 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3621 // Build the animation
3622 float durationSeconds(2.0f);
3623 Animation animation = Animation::New(durationSeconds);
3624 const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
3625 const Quaternion finalValue( startValue * relativeValue );
3626 animation.AnimateBy(Property(actor, index), relativeValue);
3628 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3629 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3631 // Start the animation
3634 // Target value should be retrievable straight away
3635 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3637 application.SendNotification();
3638 application.Render( 2000 ); // animation complete
3640 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3641 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
3646 int UtcDaliAnimationAnimateByVector2P(void)
3648 TestApplication application;
3650 Actor actor = Actor::New();
3652 // Register a Vector2 property
3653 Vector2 startValue(10.0f, 10.0f);
3654 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3655 Stage::GetCurrent().Add(actor);
3656 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3657 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3659 // Build the animation
3660 float durationSeconds(2.0f);
3661 Animation animation = Animation::New(durationSeconds);
3662 Vector2 targetValue(60.0f, 60.0f);
3663 Vector2 relativeValue(targetValue - startValue);
3664 animation.AnimateBy(Property(actor, index), relativeValue);
3666 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3668 // Start the animation
3671 // Target value should be retrievable straight away
3672 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3674 bool signalReceived(false);
3675 AnimationFinishCheck finishCheck(signalReceived);
3676 animation.FinishedSignal().Connect(&application, finishCheck);
3678 application.SendNotification();
3679 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3681 // We didn't expect the animation to finish yet
3682 application.SendNotification();
3683 finishCheck.CheckSignalNotReceived();
3684 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3686 application.SendNotification();
3687 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3689 // We did expect the animation to finish
3690 application.SendNotification();
3691 finishCheck.CheckSignalReceived();
3692 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3694 // Check that nothing has changed after a couple of buffer swaps
3695 application.Render(0);
3696 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3697 application.Render(0);
3698 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3702 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3704 TestApplication application;
3706 Actor actor = Actor::New();
3708 // Register a Vector2 property
3709 Vector2 startValue(100.0f, 100.0f);
3710 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3711 Stage::GetCurrent().Add(actor);
3712 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3713 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3715 // Build the animation
3716 float durationSeconds(1.0f);
3717 Animation animation = Animation::New(durationSeconds);
3718 Vector2 targetValue(20.0f, 20.0f);
3719 Vector2 relativeValue(targetValue - startValue);
3720 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3722 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3724 // Start the animation
3727 bool signalReceived(false);
3728 AnimationFinishCheck finishCheck(signalReceived);
3729 animation.FinishedSignal().Connect(&application, finishCheck);
3731 application.SendNotification();
3732 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3734 // We didn't expect the animation to finish yet
3735 application.SendNotification();
3736 finishCheck.CheckSignalNotReceived();
3738 // The position should have moved more, than with a linear alpha function
3739 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
3740 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3741 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3743 application.SendNotification();
3744 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3746 // We did expect the animation to finish
3747 application.SendNotification();
3748 finishCheck.CheckSignalReceived();
3749 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3751 // Check that nothing has changed after a couple of buffer swaps
3752 application.Render(0);
3753 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3754 application.Render(0);
3755 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3759 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3761 TestApplication application;
3763 Actor actor = Actor::New();
3765 // Register a Vector2 property
3766 Vector2 startValue(10.0f, 10.0f);
3767 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3768 Stage::GetCurrent().Add(actor);
3769 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3770 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3772 // Build the animation
3773 float durationSeconds(1.0f);
3774 Animation animation = Animation::New(durationSeconds);
3775 Vector2 targetValue(30.0f, 30.0f);
3776 Vector2 relativeValue(targetValue - startValue);
3778 animation.AnimateBy(Property(actor, index),
3780 TimePeriod(delay, durationSeconds - delay));
3782 // Start the animation
3785 bool signalReceived(false);
3786 AnimationFinishCheck finishCheck(signalReceived);
3787 animation.FinishedSignal().Connect(&application, finishCheck);
3789 application.SendNotification();
3790 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3792 // We didn't expect the animation to finish yet
3793 application.SendNotification();
3794 finishCheck.CheckSignalNotReceived();
3795 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3797 application.SendNotification();
3798 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3800 // We didn't expect the animation to finish yet
3801 application.SendNotification();
3802 finishCheck.CheckSignalNotReceived();
3803 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3805 application.SendNotification();
3806 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3808 // We did expect the animation to finish
3809 application.SendNotification();
3810 finishCheck.CheckSignalReceived();
3811 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3813 // Check that nothing has changed after a couple of buffer swaps
3814 application.Render(0);
3815 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3816 application.Render(0);
3817 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3821 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3823 TestApplication application;
3825 Actor actor = Actor::New();
3827 // Register a Vector2 property
3828 Vector2 startValue(5.0f, 5.0f);
3829 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3830 Stage::GetCurrent().Add(actor);
3831 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3832 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3834 // Build the animation
3835 float durationSeconds(1.0f);
3836 Animation animation = Animation::New(durationSeconds);
3837 Vector2 targetValue(10.0f, 10.0f);
3838 Vector2 relativeValue(targetValue - startValue);
3840 animation.AnimateBy(Property(actor, index),
3842 AlphaFunction::LINEAR,
3843 TimePeriod(delay, durationSeconds - delay));
3845 // Start the animation
3848 bool signalReceived(false);
3849 AnimationFinishCheck finishCheck(signalReceived);
3850 animation.FinishedSignal().Connect(&application, finishCheck);
3852 application.SendNotification();
3853 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3855 // We didn't expect the animation to finish yet
3856 application.SendNotification();
3857 finishCheck.CheckSignalNotReceived();
3858 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3860 application.SendNotification();
3861 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3863 // We didn't expect the animation to finish yet
3864 application.SendNotification();
3865 finishCheck.CheckSignalNotReceived();
3866 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3868 application.SendNotification();
3869 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3871 // We did expect the animation to finish
3872 application.SendNotification();
3873 finishCheck.CheckSignalReceived();
3874 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3876 // Check that nothing has changed after a couple of buffer swaps
3877 application.Render(0);
3878 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3879 application.Render(0);
3880 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3884 int UtcDaliAnimationAnimateByVector3P(void)
3886 TestApplication application;
3888 Actor actor = Actor::New();
3890 // Register a Vector3 property
3891 Vector3 startValue(10.0f, 10.0f, 10.0f);
3892 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3893 Stage::GetCurrent().Add(actor);
3894 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3895 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3897 // Build the animation
3898 float durationSeconds(2.0f);
3899 Animation animation = Animation::New(durationSeconds);
3900 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3901 Vector3 relativeValue(targetValue - startValue);
3902 animation.AnimateBy(Property(actor, index), relativeValue);
3904 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3906 // Start the animation
3909 // Target value should be retrievable straight away
3910 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3912 bool signalReceived(false);
3913 AnimationFinishCheck finishCheck(signalReceived);
3914 animation.FinishedSignal().Connect(&application, finishCheck);
3916 application.SendNotification();
3917 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3919 // We didn't expect the animation to finish yet
3920 application.SendNotification();
3921 finishCheck.CheckSignalNotReceived();
3922 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3924 application.SendNotification();
3925 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3927 // We did expect the animation to finish
3928 application.SendNotification();
3929 finishCheck.CheckSignalReceived();
3930 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3932 // Check that nothing has changed after a couple of buffer swaps
3933 application.Render(0);
3934 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3935 application.Render(0);
3936 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3940 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3942 TestApplication application;
3944 Actor actor = Actor::New();
3946 // Register a Vector3 property
3947 Vector3 startValue(100.0f, 100.0f, 100.0f);
3948 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3949 Stage::GetCurrent().Add(actor);
3950 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3951 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3953 // Build the animation
3954 float durationSeconds(1.0f);
3955 Animation animation = Animation::New(durationSeconds);
3956 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3957 Vector3 relativeValue(targetValue - startValue);
3958 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3960 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3962 // Start the animation
3965 bool signalReceived(false);
3966 AnimationFinishCheck finishCheck(signalReceived);
3967 animation.FinishedSignal().Connect(&application, finishCheck);
3969 application.SendNotification();
3970 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3972 // We didn't expect the animation to finish yet
3973 application.SendNotification();
3974 finishCheck.CheckSignalNotReceived();
3976 // The position should have moved more, than with a linear alpha function
3977 Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
3978 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3979 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3980 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3982 application.SendNotification();
3983 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3985 // We did expect the animation to finish
3986 application.SendNotification();
3987 finishCheck.CheckSignalReceived();
3988 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3990 // Check that nothing has changed after a couple of buffer swaps
3991 application.Render(0);
3992 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3993 application.Render(0);
3994 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3998 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4000 TestApplication application;
4002 Actor actor = Actor::New();
4004 // Register a Vector3 property
4005 Vector3 startValue(10.0f, 10.0f, 10.0f);
4006 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4007 Stage::GetCurrent().Add(actor);
4008 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4009 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4011 // Build the animation
4012 float durationSeconds(1.0f);
4013 Animation animation = Animation::New(durationSeconds);
4014 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4015 Vector3 relativeValue(targetValue - startValue);
4017 animation.AnimateBy(Property(actor, index),
4019 TimePeriod(delay, durationSeconds - delay));
4021 // Start the animation
4024 bool signalReceived(false);
4025 AnimationFinishCheck finishCheck(signalReceived);
4026 animation.FinishedSignal().Connect(&application, finishCheck);
4028 application.SendNotification();
4029 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4031 // We didn't expect the animation to finish yet
4032 application.SendNotification();
4033 finishCheck.CheckSignalNotReceived();
4034 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4036 application.SendNotification();
4037 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4039 // We didn't expect the animation to finish yet
4040 application.SendNotification();
4041 finishCheck.CheckSignalNotReceived();
4042 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4044 application.SendNotification();
4045 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4047 // We did expect the animation to finish
4048 application.SendNotification();
4049 finishCheck.CheckSignalReceived();
4050 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4052 // Check that nothing has changed after a couple of buffer swaps
4053 application.Render(0);
4054 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4055 application.Render(0);
4056 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4060 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4062 TestApplication application;
4064 Actor actor = Actor::New();
4066 // Register a Vector3 property
4067 Vector3 startValue(5.0f, 5.0f, 5.0f);
4068 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4069 Stage::GetCurrent().Add(actor);
4070 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4071 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4073 // Build the animation
4074 float durationSeconds(1.0f);
4075 Animation animation = Animation::New(durationSeconds);
4076 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4077 Vector3 relativeValue(targetValue - startValue);
4079 animation.AnimateBy(Property(actor, index),
4081 AlphaFunction::LINEAR,
4082 TimePeriod(delay, durationSeconds - delay));
4084 // Start the animation
4087 bool signalReceived(false);
4088 AnimationFinishCheck finishCheck(signalReceived);
4089 animation.FinishedSignal().Connect(&application, finishCheck);
4091 application.SendNotification();
4092 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4094 // We didn't expect the animation to finish yet
4095 application.SendNotification();
4096 finishCheck.CheckSignalNotReceived();
4097 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4099 application.SendNotification();
4100 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4102 // We didn't expect the animation to finish yet
4103 application.SendNotification();
4104 finishCheck.CheckSignalNotReceived();
4105 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4107 application.SendNotification();
4108 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4110 // We did expect the animation to finish
4111 application.SendNotification();
4112 finishCheck.CheckSignalReceived();
4113 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4115 // Check that nothing has changed after a couple of buffer swaps
4116 application.Render(0);
4117 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4118 application.Render(0);
4119 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4123 int UtcDaliAnimationAnimateByVector4P(void)
4125 TestApplication application;
4127 Actor actor = Actor::New();
4129 // Register a Vector4 property
4130 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4131 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4132 Stage::GetCurrent().Add(actor);
4133 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4134 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4136 // Build the animation
4137 float durationSeconds(2.0f);
4138 Animation animation = Animation::New(durationSeconds);
4139 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4140 Vector4 relativeValue(targetValue - startValue);
4141 animation.AnimateBy(Property(actor, index), relativeValue);
4143 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4145 // Start the animation
4148 // Target value should be retrievable straight away
4149 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4151 bool signalReceived(false);
4152 AnimationFinishCheck finishCheck(signalReceived);
4153 animation.FinishedSignal().Connect(&application, finishCheck);
4155 application.SendNotification();
4156 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4158 // We didn't expect the animation to finish yet
4159 application.SendNotification();
4160 finishCheck.CheckSignalNotReceived();
4161 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4163 application.SendNotification();
4164 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4166 // We did expect the animation to finish
4167 application.SendNotification();
4168 finishCheck.CheckSignalReceived();
4169 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4171 // Check that nothing has changed after a couple of buffer swaps
4172 application.Render(0);
4173 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4174 application.Render(0);
4175 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4179 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4181 TestApplication application;
4183 Actor actor = Actor::New();
4185 // Register a Vector4 property
4186 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4187 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4188 Stage::GetCurrent().Add(actor);
4189 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4190 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4192 // Build the animation
4193 float durationSeconds(1.0f);
4194 Animation animation = Animation::New(durationSeconds);
4195 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4196 Vector4 relativeValue(targetValue - startValue);
4197 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4199 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4201 // Start the animation
4204 bool signalReceived(false);
4205 AnimationFinishCheck finishCheck(signalReceived);
4206 animation.FinishedSignal().Connect(&application, finishCheck);
4208 application.SendNotification();
4209 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4211 // We didn't expect the animation to finish yet
4212 application.SendNotification();
4213 finishCheck.CheckSignalNotReceived();
4215 // The position should have moved more, than with a linear alpha function
4216 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4217 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4218 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4219 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4220 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4222 application.SendNotification();
4223 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4225 // We did expect the animation to finish
4226 application.SendNotification();
4227 finishCheck.CheckSignalReceived();
4228 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4230 // Check that nothing has changed after a couple of buffer swaps
4231 application.Render(0);
4232 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4233 application.Render(0);
4234 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4238 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4240 TestApplication application;
4242 Actor actor = Actor::New();
4244 // Register a Vector4 property
4245 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4246 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4247 Stage::GetCurrent().Add(actor);
4248 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4249 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4251 // Build the animation
4252 float durationSeconds(1.0f);
4253 Animation animation = Animation::New(durationSeconds);
4254 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4255 Vector4 relativeValue(targetValue - startValue);
4257 animation.AnimateBy(Property(actor, index),
4259 TimePeriod(delay, durationSeconds - delay));
4261 // Start the animation
4264 bool signalReceived(false);
4265 AnimationFinishCheck finishCheck(signalReceived);
4266 animation.FinishedSignal().Connect(&application, finishCheck);
4268 application.SendNotification();
4269 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4271 // We didn't expect the animation to finish yet
4272 application.SendNotification();
4273 finishCheck.CheckSignalNotReceived();
4274 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4276 application.SendNotification();
4277 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4279 // We didn't expect the animation to finish yet
4280 application.SendNotification();
4281 finishCheck.CheckSignalNotReceived();
4282 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4284 application.SendNotification();
4285 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4287 // We did expect the animation to finish
4288 application.SendNotification();
4289 finishCheck.CheckSignalReceived();
4290 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4292 // Check that nothing has changed after a couple of buffer swaps
4293 application.Render(0);
4294 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4295 application.Render(0);
4296 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4300 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4302 TestApplication application;
4304 Actor actor = Actor::New();
4306 // Register a Vector4 property
4307 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4308 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4309 Stage::GetCurrent().Add(actor);
4310 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4311 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4313 // Build the animation
4314 float durationSeconds(1.0f);
4315 Animation animation = Animation::New(durationSeconds);
4316 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4317 Vector4 relativeValue(targetValue - startValue);
4319 animation.AnimateBy(Property(actor, index),
4321 AlphaFunction::LINEAR,
4322 TimePeriod(delay, durationSeconds - delay));
4324 // Start the animation
4327 bool signalReceived(false);
4328 AnimationFinishCheck finishCheck(signalReceived);
4329 animation.FinishedSignal().Connect(&application, finishCheck);
4331 application.SendNotification();
4332 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4334 // We didn't expect the animation to finish yet
4335 application.SendNotification();
4336 finishCheck.CheckSignalNotReceived();
4337 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4339 application.SendNotification();
4340 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4342 // We didn't expect the animation to finish yet
4343 application.SendNotification();
4344 finishCheck.CheckSignalNotReceived();
4345 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4347 application.SendNotification();
4348 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4350 // We did expect the animation to finish
4351 application.SendNotification();
4352 finishCheck.CheckSignalReceived();
4353 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4355 // Check that nothing has changed after a couple of buffer swaps
4356 application.Render(0);
4357 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4358 application.Render(0);
4359 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4363 int UtcDaliAnimationAnimateByActorPositionP(void)
4365 TestApplication application;
4367 Actor actor = Actor::New();
4368 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4369 actor.SetPosition(startPosition);
4370 Stage::GetCurrent().Add(actor);
4371 application.SendNotification();
4372 application.Render(0);
4373 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4375 // Build the animation
4376 float durationSeconds(1.0f);
4377 Animation animation = Animation::New(durationSeconds);
4378 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4379 Vector3 relativePosition(targetPosition - startPosition);
4380 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4382 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4384 // Start the animation
4387 // Target value should be retrievable straight away
4388 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4390 bool signalReceived(false);
4391 AnimationFinishCheck finishCheck(signalReceived);
4392 animation.FinishedSignal().Connect(&application, finishCheck);
4394 application.SendNotification();
4395 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4397 // We didn't expect the animation to finish yet
4398 application.SendNotification();
4399 finishCheck.CheckSignalNotReceived();
4400 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4402 application.SendNotification();
4403 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4405 // We did expect the animation to finish
4406 application.SendNotification();
4407 finishCheck.CheckSignalReceived();
4408 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4410 // Check that nothing has changed after a couple of buffer swaps
4411 application.Render(0);
4412 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4413 application.Render(0);
4414 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4418 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4420 TestApplication application;
4422 Actor actor = Actor::New();
4423 Stage::GetCurrent().Add(actor);
4424 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4426 // Build the animation
4427 float durationSeconds(1.0f);
4428 Animation animation = Animation::New(durationSeconds);
4429 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4430 Vector3 relativePosition(targetPosition - Vector3::ZERO);
4431 animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
4432 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
4433 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
4435 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4436 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4438 // Start the animation
4441 // Target value should be retrievable straight away
4442 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4443 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
4444 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
4445 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
4447 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
4449 application.SendNotification();
4450 application.Render( 1000 ); // 1 second progress
4452 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4457 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4459 TestApplication application;
4461 Actor actor = Actor::New();
4462 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4463 actor.SetPosition(startPosition);
4464 Stage::GetCurrent().Add(actor);
4465 application.SendNotification();
4466 application.Render(0);
4467 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4469 // Build the animation
4470 float durationSeconds(1.0f);
4471 Animation animation = Animation::New(durationSeconds);
4472 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4473 Vector3 relativePosition(targetPosition - startPosition);
4474 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4476 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4478 // Start the animation
4481 bool signalReceived(false);
4482 AnimationFinishCheck finishCheck(signalReceived);
4483 animation.FinishedSignal().Connect(&application, finishCheck);
4485 application.SendNotification();
4486 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4488 // We didn't expect the animation to finish yet
4489 application.SendNotification();
4490 finishCheck.CheckSignalNotReceived();
4492 // The position should have moved more, than with a linear alpha function
4493 Vector3 current(actor.GetCurrentPosition());
4494 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4495 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4496 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4498 application.SendNotification();
4499 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4501 // We did expect the animation to finish
4502 application.SendNotification();
4503 finishCheck.CheckSignalReceived();
4504 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4506 // Check that nothing has changed after a couple of buffer swaps
4507 application.Render(0);
4508 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4509 application.Render(0);
4510 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4514 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4516 TestApplication application;
4518 Actor actor = Actor::New();
4519 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4520 actor.SetPosition(startPosition);
4521 Stage::GetCurrent().Add(actor);
4522 application.SendNotification();
4523 application.Render(0);
4524 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4526 // Build the animation
4527 float durationSeconds(1.0f);
4528 Animation animation = Animation::New(durationSeconds);
4529 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4530 Vector3 relativePosition(targetPosition - startPosition);
4532 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4534 TimePeriod(delay, durationSeconds - delay));
4536 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4538 // Start the animation
4541 bool signalReceived(false);
4542 AnimationFinishCheck finishCheck(signalReceived);
4543 animation.FinishedSignal().Connect(&application, finishCheck);
4545 application.SendNotification();
4546 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4548 // We didn't expect the animation to finish yet
4549 application.SendNotification();
4550 finishCheck.CheckSignalNotReceived();
4551 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4553 application.SendNotification();
4554 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4556 // We did expect the animation to finish
4557 application.SendNotification();
4558 finishCheck.CheckSignalReceived();
4559 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4561 // Check that nothing has changed after a couple of buffer swaps
4562 application.Render(0);
4563 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4564 application.Render(0);
4565 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4569 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4571 TestApplication application;
4573 Actor actor = Actor::New();
4574 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4575 actor.SetPosition(startPosition);
4576 Stage::GetCurrent().Add(actor);
4577 application.SendNotification();
4578 application.Render(0);
4579 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4581 // Build the animation
4582 float durationSeconds(1.0f);
4583 Animation animation = Animation::New(durationSeconds);
4584 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4585 Vector3 relativePosition(targetPosition - startPosition);
4587 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4589 AlphaFunction::LINEAR,
4590 TimePeriod(delay, durationSeconds - delay));
4592 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4594 // Start the animation
4597 bool signalReceived(false);
4598 AnimationFinishCheck finishCheck(signalReceived);
4599 animation.FinishedSignal().Connect(&application, finishCheck);
4601 application.SendNotification();
4602 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4604 // We didn't expect the animation to finish yet
4605 application.SendNotification();
4606 finishCheck.CheckSignalNotReceived();
4607 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4609 application.SendNotification();
4610 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4612 // We did expect the animation to finish
4613 application.SendNotification();
4614 finishCheck.CheckSignalReceived();
4615 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4617 // Check that nothing has changed after a couple of buffer swaps
4618 application.Render(0);
4619 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4620 application.Render(0);
4621 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4625 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4627 TestApplication application;
4629 Actor actor = Actor::New();
4630 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4631 Stage::GetCurrent().Add(actor);
4632 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4634 // Build the animation
4635 float durationSeconds(1.0f);
4636 Animation animation = Animation::New(durationSeconds);
4637 Degree relativeRotationDegrees(360.0f);
4638 Radian relativeRotationRadians(relativeRotationDegrees);
4639 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4641 // Start the animation
4644 // Target value should be retrievable straight away
4645 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4647 bool signalReceived(false);
4648 AnimationFinishCheck finishCheck(signalReceived);
4649 animation.FinishedSignal().Connect(&application, finishCheck);
4651 application.SendNotification();
4652 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4654 // We didn't expect the animation to finish yet
4655 application.SendNotification();
4656 finishCheck.CheckSignalNotReceived();
4657 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4659 application.SendNotification();
4660 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4662 // We didn't expect the animation to finish yet
4663 application.SendNotification();
4664 finishCheck.CheckSignalNotReceived();
4665 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4667 application.SendNotification();
4668 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4670 // We didn't expect the animation to finish yet
4671 application.SendNotification();
4672 finishCheck.CheckSignalNotReceived();
4673 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4675 application.SendNotification();
4676 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4678 // We did expect the animation to finish
4679 application.SendNotification();
4680 finishCheck.CheckSignalReceived();
4681 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4685 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4687 TestApplication application;
4689 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4691 Actor actor = Actor::New();
4692 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4693 Stage::GetCurrent().Add(actor);
4694 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4696 // Build the animation
4697 float durationSeconds(1.0f);
4698 Animation animation = Animation::New(durationSeconds);
4699 Degree relativeRotationDegrees(710.0f);
4700 Radian relativeRotationRadians(relativeRotationDegrees);
4702 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4704 // Start the animation
4707 bool signalReceived(false);
4708 AnimationFinishCheck finishCheck(signalReceived);
4709 animation.FinishedSignal().Connect(&application, finishCheck);
4711 application.SendNotification();
4712 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4714 // We didn't expect the animation to finish yet
4715 application.SendNotification();
4716 finishCheck.CheckSignalNotReceived();
4717 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4719 application.SendNotification();
4720 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4722 // We didn't expect the animation to finish yet
4723 application.SendNotification();
4724 finishCheck.CheckSignalNotReceived();
4725 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4727 application.SendNotification();
4728 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4730 // We didn't expect the animation to finish yet
4731 application.SendNotification();
4732 finishCheck.CheckSignalNotReceived();
4733 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4735 application.SendNotification();
4736 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4738 // We did expect the animation to finish
4739 application.SendNotification();
4740 finishCheck.CheckSignalReceived();
4741 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4746 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4748 TestApplication application;
4750 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4752 Actor actor = Actor::New();
4753 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4754 Stage::GetCurrent().Add(actor);
4755 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4757 // Build the animation
4758 float durationSeconds(1.0f);
4759 Animation animation = Animation::New(durationSeconds);
4760 Degree relativeRotationDegrees(730.0f);
4761 Radian relativeRotationRadians(relativeRotationDegrees);
4763 Radian actualRotationRadians( Degree(10.0f) );
4765 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4767 // Start the animation
4770 bool signalReceived(false);
4771 AnimationFinishCheck finishCheck(signalReceived);
4772 animation.FinishedSignal().Connect(&application, finishCheck);
4774 application.SendNotification();
4775 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4777 // We didn't expect the animation to finish yet
4778 application.SendNotification();
4779 finishCheck.CheckSignalNotReceived();
4780 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4782 application.SendNotification();
4783 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4785 // We didn't expect the animation to finish yet
4786 application.SendNotification();
4787 finishCheck.CheckSignalNotReceived();
4788 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4790 application.SendNotification();
4791 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4793 // We didn't expect the animation to finish yet
4794 application.SendNotification();
4795 finishCheck.CheckSignalNotReceived();
4796 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4798 application.SendNotification();
4799 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4801 // We did expect the animation to finish
4802 application.SendNotification();
4803 finishCheck.CheckSignalReceived();
4804 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4805 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4810 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4812 TestApplication application;
4814 Actor actor = Actor::New();
4815 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4816 Stage::GetCurrent().Add(actor);
4817 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4819 // Build the animation
4820 float durationSeconds(1.0f);
4821 Animation animation = Animation::New(durationSeconds);
4822 Degree relativeRotationDegrees(360.0f);
4823 Radian relativeRotationRadians(relativeRotationDegrees);
4824 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4826 // Start the animation
4829 bool signalReceived(false);
4830 AnimationFinishCheck finishCheck(signalReceived);
4831 animation.FinishedSignal().Connect(&application, finishCheck);
4833 application.SendNotification();
4834 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4836 // We didn't expect the animation to finish yet
4837 application.SendNotification();
4838 finishCheck.CheckSignalNotReceived();
4839 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4841 application.SendNotification();
4842 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4844 // We didn't expect the animation to finish yet
4845 application.SendNotification();
4846 finishCheck.CheckSignalNotReceived();
4847 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4849 application.SendNotification();
4850 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4852 // We didn't expect the animation to finish yet
4853 application.SendNotification();
4854 finishCheck.CheckSignalNotReceived();
4855 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4857 application.SendNotification();
4858 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4860 // We did expect the animation to finish
4861 application.SendNotification();
4862 finishCheck.CheckSignalReceived();
4863 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4867 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4869 TestApplication application;
4871 Actor actor = Actor::New();
4872 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4873 Stage::GetCurrent().Add(actor);
4874 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4876 // Build the animation
4877 float durationSeconds(1.0f);
4878 Animation animation = Animation::New(durationSeconds);
4879 Degree relativeRotationDegrees(360.0f);
4880 Radian relativeRotationRadians(relativeRotationDegrees);
4882 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4883 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4885 // Start the animation
4888 bool signalReceived(false);
4889 AnimationFinishCheck finishCheck(signalReceived);
4890 animation.FinishedSignal().Connect(&application, finishCheck);
4892 application.SendNotification();
4893 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4895 // We didn't expect the animation to finish yet
4896 application.SendNotification();
4897 finishCheck.CheckSignalNotReceived();
4898 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4899 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4901 application.SendNotification();
4902 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4904 // We didn't expect the animation to finish yet
4905 application.SendNotification();
4906 finishCheck.CheckSignalNotReceived();
4907 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4908 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4910 application.SendNotification();
4911 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4913 // We didn't expect the animation to finish yet
4914 application.SendNotification();
4915 finishCheck.CheckSignalNotReceived();
4916 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4917 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4919 application.SendNotification();
4920 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4922 // We did expect the animation to finish
4923 application.SendNotification();
4924 finishCheck.CheckSignalReceived();
4925 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4929 int UtcDaliAnimationAnimateByActorScaleP(void)
4931 TestApplication application;
4933 Actor actor = Actor::New();
4934 Stage::GetCurrent().Add(actor);
4935 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4937 // Build the animation
4938 float durationSeconds(1.0f);
4939 Animation animation = Animation::New(durationSeconds);
4940 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4941 Vector3 relativeScale(targetScale - Vector3::ONE);
4942 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4944 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4946 // Start the animation
4949 // Target value should be retrievable straight away
4950 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
4952 bool signalReceived(false);
4953 AnimationFinishCheck finishCheck(signalReceived);
4954 animation.FinishedSignal().Connect(&application, finishCheck);
4956 application.SendNotification();
4957 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4959 // We didn't expect the animation to finish yet
4960 application.SendNotification();
4961 finishCheck.CheckSignalNotReceived();
4962 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4964 application.SendNotification();
4965 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4967 // We did expect the animation to finish
4968 application.SendNotification();
4969 finishCheck.CheckSignalReceived();
4970 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4973 finishCheck.Reset();
4974 actor.SetScale(Vector3::ONE);
4975 application.SendNotification();
4976 application.Render(0);
4977 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4979 // Repeat with a different (ease-in) alpha function
4980 animation = Animation::New(durationSeconds);
4981 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4982 animation.FinishedSignal().Connect(&application, finishCheck);
4985 application.SendNotification();
4986 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4988 // We didn't expect the animation to finish yet
4989 application.SendNotification();
4990 finishCheck.CheckSignalNotReceived();
4992 // The scale should have grown less, than with a linear alpha function
4993 Vector3 current(actor.GetCurrentScale());
4994 DALI_TEST_CHECK( current.x > 1.0f );
4995 DALI_TEST_CHECK( current.y > 1.0f );
4996 DALI_TEST_CHECK( current.z > 1.0f );
4997 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4998 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4999 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5001 application.SendNotification();
5002 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5004 // We did expect the animation to finish
5005 application.SendNotification();
5006 finishCheck.CheckSignalReceived();
5007 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5010 finishCheck.Reset();
5011 actor.SetScale(Vector3::ONE);
5012 application.SendNotification();
5013 application.Render(0);
5014 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5016 // Repeat with a delay
5018 animation = Animation::New(durationSeconds);
5019 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
5020 animation.FinishedSignal().Connect(&application, finishCheck);
5023 application.SendNotification();
5024 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5026 // We didn't expect the animation to finish yet
5027 application.SendNotification();
5028 finishCheck.CheckSignalNotReceived();
5029 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5031 application.SendNotification();
5032 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5034 // We did expect the animation to finish
5035 application.SendNotification();
5036 finishCheck.CheckSignalReceived();
5037 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5041 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5043 TestApplication application;
5045 Actor actor = Actor::New();
5046 Stage::GetCurrent().Add(actor);
5047 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5049 // Build the animation
5050 float durationSeconds(1.0f);
5051 Animation animation = Animation::New(durationSeconds);
5052 Vector3 targetScale(2.0f, 3.0f, 4.0f);
5053 Vector3 relativeScale(targetScale - Vector3::ONE);
5054 animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
5055 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
5056 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
5058 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5059 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5061 // Start the animation
5064 // Target value should be retrievable straight away
5065 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5066 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
5067 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
5068 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
5070 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Not changed yet
5072 application.SendNotification();
5073 application.Render( 1000 ); // 1 second progress
5075 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5080 int UtcDaliAnimationAnimateByActorColorP(void)
5082 TestApplication application;
5084 Actor actor = Actor::New();
5085 Stage::GetCurrent().Add(actor);
5086 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5088 // Build the animation
5089 float durationSeconds(1.0f);
5090 Animation animation = Animation::New(durationSeconds);
5091 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5092 Vector4 relativeColor( targetColor - Color::WHITE );
5093 animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
5095 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5096 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5098 // Start the animation
5101 // Target value should be retrievable straight away
5102 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5103 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5104 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5105 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5106 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5108 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5110 application.SendNotification();
5111 application.Render( 1000 ); // 1 second progress
5113 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5118 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5120 TestApplication application;
5122 Actor actor = Actor::New();
5123 Stage::GetCurrent().Add(actor);
5124 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5126 // Build the animation
5127 float durationSeconds(1.0f);
5128 Animation animation = Animation::New(durationSeconds);
5129 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5130 Vector4 relativeColor( targetColor - Color::WHITE );
5131 animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
5132 animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
5133 animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
5134 animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
5136 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5137 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5139 // Start the animation
5142 // Target value should be retrievable straight away
5143 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5144 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5145 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5146 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5147 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5149 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5151 application.SendNotification();
5152 application.Render( 1000 ); // 1 second progress
5154 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5159 int UtcDaliAnimationAnimateByActorSizeP(void)
5161 TestApplication application;
5163 Actor actor = Actor::New();
5164 Stage::GetCurrent().Add(actor);
5165 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5167 // Build the animation
5168 float durationSeconds(1.0f);
5169 Animation animation = Animation::New(durationSeconds);
5170 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5171 Vector3 relativeSize( targetSize - Vector3::ZERO );
5172 animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
5174 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5175 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5177 // Start the animation
5180 // Target value should be retrievable straight away
5181 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5182 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5183 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5184 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5186 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5188 application.SendNotification();
5189 application.Render( 1000 ); // 1 second progress
5191 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5196 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5198 TestApplication application;
5200 Actor actor = Actor::New();
5201 Stage::GetCurrent().Add(actor);
5202 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5204 // Build the animation
5205 float durationSeconds(1.0f);
5206 Animation animation = Animation::New(durationSeconds);
5207 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5208 Vector3 relativeSize( targetSize - Vector3::ZERO );
5209 animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
5210 animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
5211 animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
5213 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5214 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5216 // Start the animation
5219 // Target value should be retrievable straight away
5220 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5221 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5222 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5223 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5225 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5227 application.SendNotification();
5228 application.Render( 1000 ); // 1 second progress
5230 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5235 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5237 TestApplication application;
5239 Actor actor = Actor::New();
5240 Stage::GetCurrent().Add(actor);
5241 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5243 actor.SetVisible( false );
5245 application.SendNotification();
5246 application.Render();
5248 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
5250 // Build the animation
5251 float durationSeconds(1.0f);
5252 Animation animation = Animation::New(durationSeconds);
5253 bool targetVisibility( true );
5254 bool relativeVisibility( targetVisibility );
5255 animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
5257 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5259 // Start the animation
5262 // Target value should be retrievable straight away
5263 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
5264 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION ); // Not changed yet
5266 application.SendNotification();
5267 application.Render( 1000 ); // 1 second progress
5269 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5274 int UtcDaliAnimationAnimateToBooleanP(void)
5276 TestApplication application;
5278 Actor actor = Actor::New();
5280 // Register a boolean property
5281 const bool startValue(false);
5282 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5283 Stage::GetCurrent().Add(actor);
5284 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5285 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5287 // Build the animation
5288 float durationSeconds(2.0f);
5289 Animation animation = Animation::New(durationSeconds);
5290 const bool targetValue( !startValue );
5291 animation.AnimateTo(Property(actor, index), targetValue);
5293 // Start the animation
5296 bool signalReceived(false);
5297 AnimationFinishCheck finishCheck(signalReceived);
5298 animation.FinishedSignal().Connect(&application, finishCheck);
5300 application.SendNotification();
5301 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5303 // We didn't expect the animation to finish yet
5304 application.SendNotification();
5305 finishCheck.CheckSignalNotReceived();
5306 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5308 application.SendNotification();
5309 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5311 // We did expect the animation to finish
5312 application.SendNotification();
5313 finishCheck.CheckSignalReceived();
5314 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5316 // Check that nothing has changed after a couple of buffer swaps
5317 application.Render(0);
5318 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5319 application.Render(0);
5320 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5322 // Repeat with target value "false"
5323 animation = Animation::New(durationSeconds);
5324 const bool finalValue( !targetValue );
5325 animation.AnimateTo(Property(actor, index), finalValue);
5327 // Start the animation
5330 finishCheck.Reset();
5331 animation.FinishedSignal().Connect(&application, finishCheck);
5333 application.SendNotification();
5334 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5336 // We didn't expect the animation to finish yet
5337 application.SendNotification();
5338 finishCheck.CheckSignalNotReceived();
5339 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5341 application.SendNotification();
5342 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5344 // We did expect the animation to finish
5345 application.SendNotification();
5346 finishCheck.CheckSignalReceived();
5347 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5349 // Check that nothing has changed after a couple of buffer swaps
5350 application.Render(0);
5351 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5352 application.Render(0);
5353 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5357 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5359 TestApplication application;
5361 Actor actor = Actor::New();
5363 // Register a boolean property
5364 const bool startValue(false);
5365 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5366 Stage::GetCurrent().Add(actor);
5367 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5368 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5370 // Build the animation
5371 float durationSeconds(2.0f);
5372 Animation animation = Animation::New(durationSeconds);
5373 const bool targetValue( !startValue );
5374 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5376 // Start the animation
5379 bool signalReceived(false);
5380 AnimationFinishCheck finishCheck(signalReceived);
5381 animation.FinishedSignal().Connect(&application, finishCheck);
5383 application.SendNotification();
5384 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5386 // We didn't expect the animation to finish yet
5387 application.SendNotification();
5388 finishCheck.CheckSignalNotReceived();
5389 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5391 application.SendNotification();
5392 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5394 // We did expect the animation to finish
5395 application.SendNotification();
5396 finishCheck.CheckSignalReceived();
5397 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5399 // Check that nothing has changed after a couple of buffer swaps
5400 application.Render(0);
5401 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5402 application.Render(0);
5403 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5405 // Repeat with target value "false"
5406 animation = Animation::New(durationSeconds);
5407 const bool finalValue( !targetValue );
5408 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5410 // Start the animation
5413 finishCheck.Reset();
5414 animation.FinishedSignal().Connect(&application, finishCheck);
5416 application.SendNotification();
5417 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5419 // We didn't expect the animation to finish yet
5420 application.SendNotification();
5421 finishCheck.CheckSignalNotReceived();
5422 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5424 application.SendNotification();
5425 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5427 // We did expect the animation to finish
5428 application.SendNotification();
5429 finishCheck.CheckSignalReceived();
5430 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5432 // Check that nothing has changed after a couple of buffer swaps
5433 application.Render(0);
5434 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5435 application.Render(0);
5436 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5440 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5442 TestApplication application;
5444 Actor actor = Actor::New();
5446 // Register a boolean property
5447 bool startValue(false);
5448 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5449 Stage::GetCurrent().Add(actor);
5450 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5451 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5453 // Build the animation
5454 float durationSeconds(2.0f);
5455 Animation animation = Animation::New(durationSeconds);
5456 bool finalValue( !startValue );
5457 float animatorDurationSeconds(durationSeconds * 0.5f);
5458 animation.AnimateTo( Property(actor, index),
5460 TimePeriod( animatorDurationSeconds ) );
5462 // Start the animation
5465 bool signalReceived(false);
5466 AnimationFinishCheck finishCheck(signalReceived);
5467 animation.FinishedSignal().Connect(&application, finishCheck);
5469 application.SendNotification();
5470 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5472 // We didn't expect the animation to finish yet
5473 application.SendNotification();
5474 finishCheck.CheckSignalNotReceived();
5475 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5477 application.SendNotification();
5478 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5480 // We didn't expect the animation to finish yet...
5481 application.SendNotification();
5482 finishCheck.CheckSignalNotReceived();
5484 // ...however we should have reached the final value
5485 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5487 application.SendNotification();
5488 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5490 // We did expect the animation to finish
5491 application.SendNotification();
5492 finishCheck.CheckSignalReceived();
5493 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5495 // Check that nothing has changed after a couple of buffer swaps
5496 application.Render(0);
5497 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5498 application.Render(0);
5499 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5503 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5505 TestApplication application;
5507 Actor actor = Actor::New();
5509 // Register a boolean property
5510 bool startValue(false);
5511 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5512 Stage::GetCurrent().Add(actor);
5513 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5514 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5516 // Build the animation
5517 float durationSeconds(2.0f);
5518 Animation animation = Animation::New(durationSeconds);
5519 bool finalValue( !startValue );
5520 float animatorDurationSeconds(durationSeconds * 0.5f);
5521 animation.AnimateTo( Property(actor, index),
5523 AlphaFunction::LINEAR,
5524 TimePeriod( animatorDurationSeconds ) );
5526 // Start the animation
5529 bool signalReceived(false);
5530 AnimationFinishCheck finishCheck(signalReceived);
5531 animation.FinishedSignal().Connect(&application, finishCheck);
5533 application.SendNotification();
5534 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5536 // We didn't expect the animation to finish yet
5537 application.SendNotification();
5538 finishCheck.CheckSignalNotReceived();
5539 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5541 application.SendNotification();
5542 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5544 // We didn't expect the animation to finish yet...
5545 application.SendNotification();
5546 finishCheck.CheckSignalNotReceived();
5548 // ...however we should have reached the final value
5549 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5551 application.SendNotification();
5552 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5554 // We did expect the animation to finish
5555 application.SendNotification();
5556 finishCheck.CheckSignalReceived();
5557 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5559 // Check that nothing has changed after a couple of buffer swaps
5560 application.Render(0);
5561 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5562 application.Render(0);
5563 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5567 int UtcDaliAnimationAnimateToFloatP(void)
5569 TestApplication application;
5571 Actor actor = Actor::New();
5573 // Register a float property
5574 float startValue(10.0f);
5575 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5576 Stage::GetCurrent().Add(actor);
5577 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5578 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5580 // Build the animation
5581 float durationSeconds(2.0f);
5582 Animation animation = Animation::New(durationSeconds);
5583 float targetValue(50.0f);
5584 float relativeValue(targetValue - startValue);
5585 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5587 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5589 // Start the animation
5592 bool signalReceived(false);
5593 AnimationFinishCheck finishCheck(signalReceived);
5594 animation.FinishedSignal().Connect(&application, finishCheck);
5596 application.SendNotification();
5597 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5599 // We didn't expect the animation to finish yet
5600 application.SendNotification();
5601 finishCheck.CheckSignalNotReceived();
5602 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5604 application.SendNotification();
5605 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5607 // We did expect the animation to finish
5608 application.SendNotification();
5609 finishCheck.CheckSignalReceived();
5610 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5614 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5616 TestApplication application;
5618 Actor actor = Actor::New();
5620 // Register a float property
5621 float startValue(10.0f);
5622 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5623 Stage::GetCurrent().Add(actor);
5624 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5625 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5627 // Build the animation
5628 float durationSeconds(1.0f);
5629 Animation animation = Animation::New(durationSeconds);
5630 float targetValue(90.0f);
5631 float relativeValue(targetValue - startValue);
5632 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5634 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5636 // Start the animation
5639 bool signalReceived(false);
5640 AnimationFinishCheck finishCheck(signalReceived);
5641 animation.FinishedSignal().Connect(&application, finishCheck);
5643 application.SendNotification();
5644 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5646 // We didn't expect the animation to finish yet
5647 application.SendNotification();
5648 finishCheck.CheckSignalNotReceived();
5650 // The position should have moved more, than with a linear alpha function
5651 float current( actor.GetCurrentProperty< float >( index ) );
5652 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5654 application.SendNotification();
5655 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5657 // We did expect the animation to finish
5658 application.SendNotification();
5659 finishCheck.CheckSignalReceived();
5660 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5664 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5666 TestApplication application;
5668 Actor actor = Actor::New();
5670 // Register a float property
5671 float startValue(10.0f);
5672 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5673 Stage::GetCurrent().Add(actor);
5674 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5675 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5677 // Build the animation
5678 float durationSeconds(1.0f);
5679 Animation animation = Animation::New(durationSeconds);
5680 float targetValue(30.0f);
5681 float relativeValue(targetValue - startValue);
5683 animation.AnimateTo(Property(actor, index),
5685 TimePeriod(delay, durationSeconds - delay));
5687 // Start the animation
5690 bool signalReceived(false);
5691 AnimationFinishCheck finishCheck(signalReceived);
5692 animation.FinishedSignal().Connect(&application, finishCheck);
5694 application.SendNotification();
5695 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5697 // We didn't expect the animation to finish yet
5698 application.SendNotification();
5699 finishCheck.CheckSignalNotReceived();
5700 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5702 application.SendNotification();
5703 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5705 // We didn't expect the animation to finish yet
5706 application.SendNotification();
5707 finishCheck.CheckSignalNotReceived();
5708 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5710 application.SendNotification();
5711 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5713 // We did expect the animation to finish
5714 application.SendNotification();
5715 finishCheck.CheckSignalReceived();
5716 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5720 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5722 TestApplication application;
5724 Actor actor = Actor::New();
5726 // Register a float property
5727 float startValue(10.0f);
5728 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5729 Stage::GetCurrent().Add(actor);
5730 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5731 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5733 // Build the animation
5734 float durationSeconds(1.0f);
5735 Animation animation = Animation::New(durationSeconds);
5736 float targetValue(30.0f);
5737 float relativeValue(targetValue - startValue);
5739 animation.AnimateTo(Property(actor, index),
5741 AlphaFunction::LINEAR,
5742 TimePeriod(delay, durationSeconds - delay));
5744 // Start the animation
5747 bool signalReceived(false);
5748 AnimationFinishCheck finishCheck(signalReceived);
5749 animation.FinishedSignal().Connect(&application, finishCheck);
5751 application.SendNotification();
5752 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5754 // We didn't expect the animation to finish yet
5755 application.SendNotification();
5756 finishCheck.CheckSignalNotReceived();
5757 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5759 application.SendNotification();
5760 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5762 // We didn't expect the animation to finish yet
5763 application.SendNotification();
5764 finishCheck.CheckSignalNotReceived();
5765 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5767 application.SendNotification();
5768 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5770 // We did expect the animation to finish
5771 application.SendNotification();
5772 finishCheck.CheckSignalReceived();
5773 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5777 int UtcDaliAnimationAnimateToIntegerP(void)
5779 TestApplication application;
5781 Actor actor = Actor::New();
5783 // Register an integer property
5785 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5786 Stage::GetCurrent().Add(actor);
5787 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5788 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5790 // Build the animation
5791 float durationSeconds(2.0f);
5792 Animation animation = Animation::New(durationSeconds);
5793 int targetValue(50);
5794 int relativeValue(targetValue - startValue);
5795 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5797 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5799 // Start the animation
5802 bool signalReceived(false);
5803 AnimationFinishCheck finishCheck(signalReceived);
5804 animation.FinishedSignal().Connect(&application, finishCheck);
5806 application.SendNotification();
5807 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5809 // We didn't expect the animation to finish yet
5810 application.SendNotification();
5811 finishCheck.CheckSignalNotReceived();
5812 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5814 application.SendNotification();
5815 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5817 // We did expect the animation to finish
5818 application.SendNotification();
5819 finishCheck.CheckSignalReceived();
5820 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5824 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5826 TestApplication application;
5828 Actor actor = Actor::New();
5830 // Register an integer property
5832 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5833 Stage::GetCurrent().Add(actor);
5834 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5835 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5837 // Build the animation
5838 float durationSeconds(1.0f);
5839 Animation animation = Animation::New(durationSeconds);
5840 int targetValue(90);
5841 int relativeValue(targetValue - startValue);
5842 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5844 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5846 // Start the animation
5849 bool signalReceived(false);
5850 AnimationFinishCheck finishCheck(signalReceived);
5851 animation.FinishedSignal().Connect(&application, finishCheck);
5853 application.SendNotification();
5854 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5856 // We didn't expect the animation to finish yet
5857 application.SendNotification();
5858 finishCheck.CheckSignalNotReceived();
5860 // The position should have moved more, than with a linear alpha function
5861 int current( actor.GetCurrentProperty< int >( index ) );
5862 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5864 application.SendNotification();
5865 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5867 // We did expect the animation to finish
5868 application.SendNotification();
5869 finishCheck.CheckSignalReceived();
5870 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5874 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5876 TestApplication application;
5878 Actor actor = Actor::New();
5880 // Register an integer property
5882 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5883 Stage::GetCurrent().Add(actor);
5884 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5885 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5887 // Build the animation
5888 float durationSeconds(1.0f);
5889 Animation animation = Animation::New(durationSeconds);
5890 int targetValue(30);
5891 int relativeValue(targetValue - startValue);
5893 animation.AnimateTo(Property(actor, index),
5895 TimePeriod(delay, durationSeconds - delay));
5897 // Start the animation
5900 bool signalReceived(false);
5901 AnimationFinishCheck finishCheck(signalReceived);
5902 animation.FinishedSignal().Connect(&application, finishCheck);
5904 application.SendNotification();
5905 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5907 // We didn't expect the animation to finish yet
5908 application.SendNotification();
5909 finishCheck.CheckSignalNotReceived();
5910 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5912 application.SendNotification();
5913 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5915 // We didn't expect the animation to finish yet
5916 application.SendNotification();
5917 finishCheck.CheckSignalNotReceived();
5918 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5920 application.SendNotification();
5921 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5923 // We did expect the animation to finish
5924 application.SendNotification();
5925 finishCheck.CheckSignalReceived();
5926 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5930 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5932 TestApplication application;
5934 Actor actor = Actor::New();
5936 // Register an integer property
5938 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5939 Stage::GetCurrent().Add(actor);
5940 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5941 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5943 // Build the animation
5944 float durationSeconds(1.0f);
5945 Animation animation = Animation::New(durationSeconds);
5946 int targetValue(30);
5947 int relativeValue(targetValue - startValue);
5949 animation.AnimateTo(Property(actor, index),
5951 AlphaFunction::LINEAR,
5952 TimePeriod(delay, durationSeconds - delay));
5954 // Start the animation
5957 bool signalReceived(false);
5958 AnimationFinishCheck finishCheck(signalReceived);
5959 animation.FinishedSignal().Connect(&application, finishCheck);
5961 application.SendNotification();
5962 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5964 // We didn't expect the animation to finish yet
5965 application.SendNotification();
5966 finishCheck.CheckSignalNotReceived();
5967 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5969 application.SendNotification();
5970 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5972 // We didn't expect the animation to finish yet
5973 application.SendNotification();
5974 finishCheck.CheckSignalNotReceived();
5975 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5977 application.SendNotification();
5978 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5980 // We did expect the animation to finish
5981 application.SendNotification();
5982 finishCheck.CheckSignalReceived();
5983 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5987 int UtcDaliAnimationAnimateToVector2P(void)
5989 TestApplication application;
5991 Actor actor = Actor::New();
5993 // Register a Vector2 property
5994 Vector2 startValue(-50.0f, -50.0f);
5995 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5996 Stage::GetCurrent().Add(actor);
5997 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5998 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6000 // Build the animation
6001 float durationSeconds(2.0f);
6002 Animation animation = Animation::New(durationSeconds);
6003 Vector2 targetValue(50.0f, 50.0f);
6004 Vector2 relativeValue(targetValue - startValue);
6005 animation.AnimateTo(Property(actor, index), targetValue);
6007 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6009 // Start the animation
6012 bool signalReceived(false);
6013 AnimationFinishCheck finishCheck(signalReceived);
6014 animation.FinishedSignal().Connect(&application, finishCheck);
6016 application.SendNotification();
6017 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6019 // We didn't expect the animation to finish yet
6020 application.SendNotification();
6021 finishCheck.CheckSignalNotReceived();
6022 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6024 application.SendNotification();
6025 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6027 // We did expect the animation to finish
6028 application.SendNotification();
6029 finishCheck.CheckSignalReceived();
6030 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6034 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6036 TestApplication application;
6038 Actor actor = Actor::New();
6040 // Register a Vector2 property
6041 Vector2 startValue(1000.0f, 1000.0f);
6042 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6043 Stage::GetCurrent().Add(actor);
6044 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6045 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6047 // Build the animation
6048 float durationSeconds(1.0f);
6049 Animation animation = Animation::New(durationSeconds);
6050 Vector2 targetValue(9000.0f, 9000.0f);
6051 Vector2 relativeValue(targetValue - startValue);
6052 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6054 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6056 // Start the animation
6059 bool signalReceived(false);
6060 AnimationFinishCheck finishCheck(signalReceived);
6061 animation.FinishedSignal().Connect(&application, finishCheck);
6063 application.SendNotification();
6064 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6066 // We didn't expect the animation to finish yet
6067 application.SendNotification();
6068 finishCheck.CheckSignalNotReceived();
6070 // The position should have moved more, than with a linear alpha function
6071 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
6072 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6073 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6075 application.SendNotification();
6076 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6078 // We did expect the animation to finish
6079 application.SendNotification();
6080 finishCheck.CheckSignalReceived();
6081 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6085 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6087 TestApplication application;
6089 Actor actor = Actor::New();
6091 // Register a Vector2 property
6092 Vector2 startValue(10.0f, 10.0f);
6093 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6094 Stage::GetCurrent().Add(actor);
6095 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6096 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6098 // Build the animation
6099 float durationSeconds(1.0f);
6100 Animation animation = Animation::New(durationSeconds);
6101 Vector2 targetValue(-10.0f, 20.0f);
6102 Vector2 relativeValue(targetValue - startValue);
6104 animation.AnimateTo(Property(actor, index),
6106 TimePeriod(delay, durationSeconds - delay));
6108 // Start the animation
6111 bool signalReceived(false);
6112 AnimationFinishCheck finishCheck(signalReceived);
6113 animation.FinishedSignal().Connect(&application, finishCheck);
6115 application.SendNotification();
6116 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6118 // We didn't expect the animation to finish yet
6119 application.SendNotification();
6120 finishCheck.CheckSignalNotReceived();
6121 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6123 application.SendNotification();
6124 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6126 // We didn't expect the animation to finish yet
6127 application.SendNotification();
6128 finishCheck.CheckSignalNotReceived();
6129 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6131 application.SendNotification();
6132 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6134 // We did expect the animation to finish
6135 application.SendNotification();
6136 finishCheck.CheckSignalReceived();
6137 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6141 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6143 TestApplication application;
6145 Actor actor = Actor::New();
6147 // Register a Vector2 property
6148 Vector2 startValue(10.0f, 10.0f);
6149 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6150 Stage::GetCurrent().Add(actor);
6151 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6152 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6154 // Build the animation
6155 float durationSeconds(1.0f);
6156 Animation animation = Animation::New(durationSeconds);
6157 Vector2 targetValue(30.0f, 30.0f);
6158 Vector2 relativeValue(targetValue - startValue);
6160 animation.AnimateTo(Property(actor, index),
6162 AlphaFunction::LINEAR,
6163 TimePeriod(delay, durationSeconds - delay));
6165 // Start the animation
6168 bool signalReceived(false);
6169 AnimationFinishCheck finishCheck(signalReceived);
6170 animation.FinishedSignal().Connect(&application, finishCheck);
6172 application.SendNotification();
6173 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6175 // We didn't expect the animation to finish yet, but cached value should be the final one
6176 application.SendNotification();
6177 finishCheck.CheckSignalNotReceived();
6178 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6179 DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
6181 application.SendNotification();
6182 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6184 // We didn't expect the animation to finish yet
6185 application.SendNotification();
6186 finishCheck.CheckSignalNotReceived();
6187 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6189 application.SendNotification();
6190 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6192 // We did expect the animation to finish
6193 application.SendNotification();
6194 finishCheck.CheckSignalReceived();
6195 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6196 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6200 int UtcDaliAnimationAnimateToVector3P(void)
6202 TestApplication application;
6204 Actor actor = Actor::New();
6206 // Register a Vector3 property
6207 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6208 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6209 Stage::GetCurrent().Add(actor);
6210 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
6211 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6213 // Build the animation
6214 float durationSeconds(2.0f);
6215 Animation animation = Animation::New(durationSeconds);
6216 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6217 Vector3 relativeValue(targetValue - startValue);
6218 animation.AnimateTo(Property(actor, index), targetValue);
6220 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6222 // Start the animation
6225 bool signalReceived(false);
6226 AnimationFinishCheck finishCheck(signalReceived);
6227 animation.FinishedSignal().Connect(&application, finishCheck);
6229 application.SendNotification();
6230 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6232 // We didn't expect the animation to finish yet
6233 application.SendNotification();
6234 finishCheck.CheckSignalNotReceived();
6235 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6237 application.SendNotification();
6238 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6240 // We did expect the animation to finish
6241 application.SendNotification();
6242 finishCheck.CheckSignalReceived();
6243 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6247 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6249 TestApplication application;
6251 Actor actor = Actor::New();
6253 // Register a Vector3 property
6254 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6255 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6256 Stage::GetCurrent().Add(actor);
6257 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6258 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6260 // Build the animation
6261 float durationSeconds(1.0f);
6262 Animation animation = Animation::New(durationSeconds);
6263 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6264 Vector3 relativeValue(targetValue - startValue);
6265 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6267 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6269 // Start the animation
6272 bool signalReceived(false);
6273 AnimationFinishCheck finishCheck(signalReceived);
6274 animation.FinishedSignal().Connect(&application, finishCheck);
6276 application.SendNotification();
6277 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6279 // We didn't expect the animation to finish yet
6280 application.SendNotification();
6281 finishCheck.CheckSignalNotReceived();
6283 // The position should have moved more, than with a linear alpha function
6284 Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
6285 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6286 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6287 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6289 application.SendNotification();
6290 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6292 // We did expect the animation to finish
6293 application.SendNotification();
6294 finishCheck.CheckSignalReceived();
6295 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6299 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6301 TestApplication application;
6303 Actor actor = Actor::New();
6305 // Register a Vector3 property
6306 Vector3 startValue(10.0f, 10.0f, 10.0f);
6307 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6308 Stage::GetCurrent().Add(actor);
6309 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6310 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6312 // Build the animation
6313 float durationSeconds(1.0f);
6314 Animation animation = Animation::New(durationSeconds);
6315 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6316 Vector3 relativeValue(targetValue - startValue);
6318 animation.AnimateTo(Property(actor, index),
6320 TimePeriod(delay, durationSeconds - delay));
6322 // Start the animation
6325 bool signalReceived(false);
6326 AnimationFinishCheck finishCheck(signalReceived);
6327 animation.FinishedSignal().Connect(&application, finishCheck);
6329 application.SendNotification();
6330 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6332 // We didn't expect the animation to finish yet
6333 application.SendNotification();
6334 finishCheck.CheckSignalNotReceived();
6335 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6337 application.SendNotification();
6338 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6340 // We didn't expect the animation to finish yet
6341 application.SendNotification();
6342 finishCheck.CheckSignalNotReceived();
6343 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6345 application.SendNotification();
6346 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6348 // We did expect the animation to finish
6349 application.SendNotification();
6350 finishCheck.CheckSignalReceived();
6351 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6355 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6357 TestApplication application;
6359 Actor actor = Actor::New();
6361 // Register a Vector3 property
6362 Vector3 startValue(10.0f, 10.0f, 10.0f);
6363 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6364 Stage::GetCurrent().Add(actor);
6365 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6366 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6368 // Build the animation
6369 float durationSeconds(1.0f);
6370 Animation animation = Animation::New(durationSeconds);
6371 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6372 Vector3 relativeValue(targetValue - startValue);
6374 animation.AnimateTo(Property(actor, "testProperty"),
6376 AlphaFunction::LINEAR,
6377 TimePeriod(delay, durationSeconds - delay));
6379 // Start the animation
6382 bool signalReceived(false);
6383 AnimationFinishCheck finishCheck(signalReceived);
6384 animation.FinishedSignal().Connect(&application, finishCheck);
6386 application.SendNotification();
6387 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6389 // We didn't expect the animation to finish yet
6390 application.SendNotification();
6391 finishCheck.CheckSignalNotReceived();
6392 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6394 application.SendNotification();
6395 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6397 // We didn't expect the animation to finish yet
6398 application.SendNotification();
6399 finishCheck.CheckSignalNotReceived();
6400 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6402 application.SendNotification();
6403 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6405 // We did expect the animation to finish
6406 application.SendNotification();
6407 finishCheck.CheckSignalReceived();
6408 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6412 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6414 TestApplication application;
6416 Actor actor = Actor::New();
6418 // Register a Vector3 property
6419 Vector3 startValue(10.0f, 10.0f, 10.0f);
6420 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6421 Stage::GetCurrent().Add(actor);
6422 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6423 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6425 // Build the animation
6426 float durationSeconds(1.0f);
6427 Animation animation = Animation::New(durationSeconds);
6428 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6429 Vector3 relativeValue(targetValue - startValue);
6431 animation.AnimateTo(Property(actor, "testProperty", 0),
6433 AlphaFunction::LINEAR,
6434 TimePeriod(delay, durationSeconds - delay));
6435 animation.AnimateTo(Property(actor, index, 1),
6437 AlphaFunction::LINEAR,
6438 TimePeriod(delay, durationSeconds - delay));
6440 // Start the animation
6443 bool signalReceived(false);
6444 AnimationFinishCheck finishCheck(signalReceived);
6445 animation.FinishedSignal().Connect(&application, finishCheck);
6447 application.SendNotification();
6448 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6450 // We didn't expect the animation to finish yet
6451 application.SendNotification();
6452 finishCheck.CheckSignalNotReceived();
6453 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6455 application.SendNotification();
6456 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6458 // We didn't expect the animation to finish yet
6459 application.SendNotification();
6460 finishCheck.CheckSignalNotReceived();
6461 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6463 application.SendNotification();
6464 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6466 // We did expect the animation to finish
6467 application.SendNotification();
6468 finishCheck.CheckSignalReceived();
6469 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6473 int UtcDaliAnimationAnimateToVector4P(void)
6475 TestApplication application;
6477 Actor actor = Actor::New();
6479 // Register a Vector4 property
6480 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6481 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6482 Stage::GetCurrent().Add(actor);
6483 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6484 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6486 // Build the animation
6487 float durationSeconds(2.0f);
6488 Animation animation = Animation::New(durationSeconds);
6489 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6490 Vector4 relativeValue(targetValue - startValue);
6491 animation.AnimateTo(Property(actor, index), targetValue);
6493 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6495 // Start the animation
6498 bool signalReceived(false);
6499 AnimationFinishCheck finishCheck(signalReceived);
6500 animation.FinishedSignal().Connect(&application, finishCheck);
6502 application.SendNotification();
6503 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6505 // We didn't expect the animation to finish yet
6506 application.SendNotification();
6507 finishCheck.CheckSignalNotReceived();
6508 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6510 application.SendNotification();
6511 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6513 // We did expect the animation to finish
6514 application.SendNotification();
6515 finishCheck.CheckSignalReceived();
6516 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6520 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6522 TestApplication application;
6524 Actor actor = Actor::New();
6526 // Register a Vector4 property
6527 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6528 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6529 Stage::GetCurrent().Add(actor);
6530 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6531 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6533 // Build the animation
6534 float durationSeconds(1.0f);
6535 Animation animation = Animation::New(durationSeconds);
6536 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6537 Vector4 relativeValue(targetValue - startValue);
6538 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6540 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6542 // Start the animation
6545 bool signalReceived(false);
6546 AnimationFinishCheck finishCheck(signalReceived);
6547 animation.FinishedSignal().Connect(&application, finishCheck);
6549 application.SendNotification();
6550 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6552 // We didn't expect the animation to finish yet
6553 application.SendNotification();
6554 finishCheck.CheckSignalNotReceived();
6556 // The position should have moved more, than with a linear alpha function
6557 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6558 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6559 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6560 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6561 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6563 application.SendNotification();
6564 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6566 // We did expect the animation to finish
6567 application.SendNotification();
6568 finishCheck.CheckSignalReceived();
6569 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6573 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6575 TestApplication application;
6577 Actor actor = Actor::New();
6579 // Register a Vector4 property
6580 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6581 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6582 Stage::GetCurrent().Add(actor);
6583 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6584 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6586 // Build the animation
6587 float durationSeconds(1.0f);
6588 Animation animation = Animation::New(durationSeconds);
6589 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6590 Vector4 relativeValue(targetValue - startValue);
6592 animation.AnimateTo(Property(actor, index),
6594 TimePeriod(delay, durationSeconds - delay));
6596 // Start the animation
6599 bool signalReceived(false);
6600 AnimationFinishCheck finishCheck(signalReceived);
6601 animation.FinishedSignal().Connect(&application, finishCheck);
6603 application.SendNotification();
6604 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6606 // We didn't expect the animation to finish yet
6607 application.SendNotification();
6608 finishCheck.CheckSignalNotReceived();
6609 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6611 application.SendNotification();
6612 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6614 // We didn't expect the animation to finish yet
6615 application.SendNotification();
6616 finishCheck.CheckSignalNotReceived();
6617 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6619 application.SendNotification();
6620 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6622 // We did expect the animation to finish
6623 application.SendNotification();
6624 finishCheck.CheckSignalReceived();
6625 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6629 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6631 TestApplication application;
6633 Actor actor = Actor::New();
6635 // Register a Vector4 property
6636 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6637 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6638 Stage::GetCurrent().Add(actor);
6639 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6640 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6642 // Build the animation
6643 float durationSeconds(1.0f);
6644 Animation animation = Animation::New(durationSeconds);
6645 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6646 Vector4 relativeValue(targetValue - startValue);
6648 animation.AnimateTo(Property(actor, index),
6650 AlphaFunction::LINEAR,
6651 TimePeriod(delay, durationSeconds - delay));
6653 // Start the animation
6656 bool signalReceived(false);
6657 AnimationFinishCheck finishCheck(signalReceived);
6658 animation.FinishedSignal().Connect(&application, finishCheck);
6660 application.SendNotification();
6661 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6663 // We didn't expect the animation to finish yet
6664 application.SendNotification();
6665 finishCheck.CheckSignalNotReceived();
6666 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6668 application.SendNotification();
6669 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6671 // We didn't expect the animation to finish yet
6672 application.SendNotification();
6673 finishCheck.CheckSignalNotReceived();
6674 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6676 application.SendNotification();
6677 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6679 // We did expect the animation to finish
6680 application.SendNotification();
6681 finishCheck.CheckSignalReceived();
6682 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6686 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6688 TestApplication application;
6690 Actor actor = Actor::New();
6691 Stage::GetCurrent().Add(actor);
6692 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6694 // Build the animation
6695 float durationSeconds(1.0f);
6696 Animation animation = Animation::New(durationSeconds);
6697 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6701 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6703 catch (Dali::DaliException& e)
6705 DALI_TEST_PRINT_ASSERT( e );
6706 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6711 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6713 TestApplication application;
6715 Actor actor = Actor::New();
6716 Stage::GetCurrent().Add(actor);
6717 float startValue(0.0f);
6718 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6719 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6721 // Build the animation
6722 float durationSeconds(1.0f);
6723 Animation animation = Animation::New(durationSeconds);
6724 float targetX(1.0f);
6728 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6730 catch (Dali::DaliException& e)
6732 DALI_TEST_PRINT_ASSERT( e );
6733 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6738 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6740 TestApplication application;
6742 Actor actor = Actor::New();
6743 Stage::GetCurrent().Add(actor);
6744 float startValue(0.0f);
6745 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6746 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6748 // Build the animation
6749 float durationSeconds(1.0f);
6750 Animation animation = Animation::New(durationSeconds);
6751 float targetY(1.0f);
6755 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6757 catch (Dali::DaliException& e)
6759 DALI_TEST_PRINT_ASSERT( e );
6760 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6765 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6767 TestApplication application;
6769 Actor actor = Actor::New();
6770 Stage::GetCurrent().Add(actor);
6771 float startValue(0.5f);
6772 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6773 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6775 // Build the animation
6776 float durationSeconds(1.0f);
6777 Animation animation = Animation::New(durationSeconds);
6778 float targetZ(1.0f);
6782 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6784 catch (Dali::DaliException& e)
6786 DALI_TEST_PRINT_ASSERT( e );
6787 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6792 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6794 TestApplication application;
6796 Actor actor = Actor::New();
6797 Stage::GetCurrent().Add(actor);
6798 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6800 // Build the animation
6801 float durationSeconds(1.0f);
6802 Animation animation = Animation::New(durationSeconds);
6803 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6807 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6809 catch (Dali::DaliException& e)
6811 DALI_TEST_PRINT_ASSERT( e );
6812 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6817 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6819 TestApplication application;
6821 Actor actor = Actor::New();
6822 Stage::GetCurrent().Add(actor);
6823 float startValue(0.5f);
6824 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6825 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6827 // Build the animation
6828 float durationSeconds(1.0f);
6829 Animation animation = Animation::New(durationSeconds);
6830 float targetX(1.0f);
6834 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6836 catch (Dali::DaliException& e)
6838 DALI_TEST_PRINT_ASSERT( e );
6839 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6844 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6846 TestApplication application;
6848 Actor actor = Actor::New();
6849 Stage::GetCurrent().Add(actor);
6850 float startValue(0.5f);
6851 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6852 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6854 // Build the animation
6855 float durationSeconds(1.0f);
6856 Animation animation = Animation::New(durationSeconds);
6857 float targetY(0.0f);
6861 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6863 catch (Dali::DaliException& e)
6865 DALI_TEST_PRINT_ASSERT( e );
6866 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6871 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6873 TestApplication application;
6875 Actor actor = Actor::New();
6876 Stage::GetCurrent().Add(actor);
6877 float startValue(0.5f);
6878 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6879 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6881 // Build the animation
6882 float durationSeconds(1.0f);
6883 Animation animation = Animation::New(durationSeconds);
6884 float targetZ(100.0f);
6888 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6890 catch (Dali::DaliException& e)
6892 DALI_TEST_PRINT_ASSERT( e );
6893 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6898 int UtcDaliAnimationAnimateToActorSizeP(void)
6900 TestApplication application;
6902 Actor actor = Actor::New();
6903 Stage::GetCurrent().Add(actor);
6904 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6906 // Build the animation
6907 float durationSeconds(1.0f);
6908 Animation animation = Animation::New(durationSeconds);
6909 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6910 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6912 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6914 // Should return the initial properties before play
6915 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6916 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
6917 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
6918 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
6920 // Start the animation
6923 // Should return the target property after play
6924 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
6925 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
6926 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
6927 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
6929 bool signalReceived(false);
6930 AnimationFinishCheck finishCheck(signalReceived);
6931 animation.FinishedSignal().Connect(&application, finishCheck);
6933 application.SendNotification();
6934 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6936 // We didn't expect the animation to finish yet
6937 application.SendNotification();
6938 finishCheck.CheckSignalNotReceived();
6939 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6941 application.SendNotification();
6942 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6944 // We did expect the animation to finish
6945 application.SendNotification();
6946 finishCheck.CheckSignalReceived();
6947 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6950 finishCheck.Reset();
6951 actor.SetSize(Vector3::ZERO);
6952 application.SendNotification();
6953 application.Render(0);
6954 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6956 // Repeat with a different (ease-in) alpha function
6957 animation = Animation::New(durationSeconds);
6958 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6959 animation.FinishedSignal().Connect(&application, finishCheck);
6962 application.SendNotification();
6963 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6965 // We didn't expect the animation to finish yet
6966 application.SendNotification();
6967 finishCheck.CheckSignalNotReceived();
6969 // The size should have travelled less, than with a linear alpha function
6970 Vector3 current(actor.GetCurrentSize());
6971 DALI_TEST_CHECK( current.x > 0.0f );
6972 DALI_TEST_CHECK( current.y > 0.0f );
6973 DALI_TEST_CHECK( current.z > 0.0f );
6974 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6975 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6976 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6978 application.SendNotification();
6979 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6981 // We did expect the animation to finish
6982 application.SendNotification();
6983 finishCheck.CheckSignalReceived();
6984 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6987 finishCheck.Reset();
6988 actor.SetSize(Vector3::ZERO);
6989 application.SendNotification();
6990 application.Render(0);
6991 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6993 // Repeat with a delay
6995 animation = Animation::New(durationSeconds);
6996 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6997 animation.FinishedSignal().Connect(&application, finishCheck);
7000 application.SendNotification();
7001 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7003 // We didn't expect the animation to finish yet
7004 application.SendNotification();
7005 finishCheck.CheckSignalNotReceived();
7006 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7008 application.SendNotification();
7009 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7011 // We did expect the animation to finish
7012 application.SendNotification();
7013 finishCheck.CheckSignalReceived();
7014 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7018 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7020 TestApplication application;
7022 Actor actor = Actor::New();
7023 Stage::GetCurrent().Add(actor);
7024 float startValue(0.0f);
7025 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
7026 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
7028 // Build the animation
7029 float durationSeconds(1.0f);
7030 Animation animation = Animation::New(durationSeconds);
7031 float targetWidth(10.0f);
7032 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
7034 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
7036 // Should return the initial properties before play
7037 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7038 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
7040 // Start the animation
7043 // Should return the target property after play
7044 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
7045 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
7047 bool signalReceived(false);
7048 AnimationFinishCheck finishCheck(signalReceived);
7049 animation.FinishedSignal().Connect(&application, finishCheck);
7051 application.SendNotification();
7052 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7054 // We didn't expect the animation to finish yet
7055 application.SendNotification();
7056 finishCheck.CheckSignalNotReceived();
7057 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
7059 application.SendNotification();
7060 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7062 // We did expect the animation to finish
7063 application.SendNotification();
7064 finishCheck.CheckSignalReceived();
7065 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
7066 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
7070 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7072 TestApplication application;
7074 Actor actor = Actor::New();
7075 Stage::GetCurrent().Add(actor);
7076 float startValue(0.0f);
7077 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
7078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
7080 // Build the animation
7081 float durationSeconds(1.0f);
7082 Animation animation = Animation::New(durationSeconds);
7083 float targetHeight(-10.0f);
7084 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
7086 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
7088 // Should return the initial properties before play
7089 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7090 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
7092 // Start the animation
7095 // Should return the target property after play
7096 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
7097 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
7099 bool signalReceived(false);
7100 AnimationFinishCheck finishCheck(signalReceived);
7101 animation.FinishedSignal().Connect(&application, finishCheck);
7103 application.SendNotification();
7104 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7106 // We didn't expect the animation to finish yet
7107 application.SendNotification();
7108 finishCheck.CheckSignalNotReceived();
7109 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
7111 application.SendNotification();
7112 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7114 // We did expect the animation to finish
7115 application.SendNotification();
7116 finishCheck.CheckSignalReceived();
7117 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
7118 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
7122 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7124 TestApplication application;
7126 Actor actor = Actor::New();
7127 Stage::GetCurrent().Add(actor);
7128 float startValue(0.0f);
7129 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
7130 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
7132 // Build the animation
7133 float durationSeconds(1.0f);
7134 Animation animation = Animation::New(durationSeconds);
7135 float targetDepth(-10.0f);
7136 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
7138 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
7140 // Should return the initial properties before play
7141 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7142 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
7144 // Start the animation
7147 // Should return the target property after play
7148 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
7149 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
7151 bool signalReceived(false);
7152 AnimationFinishCheck finishCheck(signalReceived);
7153 animation.FinishedSignal().Connect(&application, finishCheck);
7155 application.SendNotification();
7156 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7158 // We didn't expect the animation to finish yet
7159 application.SendNotification();
7160 finishCheck.CheckSignalNotReceived();
7161 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
7163 application.SendNotification();
7164 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7166 // We did expect the animation to finish
7167 application.SendNotification();
7168 finishCheck.CheckSignalReceived();
7169 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
7170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
7174 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7176 TestApplication application;
7178 Actor actor = Actor::New();
7179 Stage::GetCurrent().Add(actor);
7180 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7182 // Build the animation
7183 float durationSeconds(1.0f);
7184 Animation animation = Animation::New(durationSeconds);
7185 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7186 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
7188 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7190 // Start the animation
7193 bool signalReceived(false);
7194 AnimationFinishCheck finishCheck(signalReceived);
7195 animation.FinishedSignal().Connect(&application, finishCheck);
7197 application.SendNotification();
7198 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7200 // We didn't expect the animation to finish yet
7201 application.SendNotification();
7202 finishCheck.CheckSignalNotReceived();
7203 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
7205 application.SendNotification();
7206 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7208 // We did expect the animation to finish
7209 application.SendNotification();
7210 finishCheck.CheckSignalReceived();
7211 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7214 finishCheck.Reset();
7215 actor.SetSize(Vector3::ZERO);
7216 application.SendNotification();
7217 application.Render(0);
7218 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7220 // Repeat with a different (ease-in) alpha function
7221 animation = Animation::New(durationSeconds);
7222 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
7223 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
7224 animation.FinishedSignal().Connect(&application, finishCheck);
7227 application.SendNotification();
7228 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7230 // We didn't expect the animation to finish yet
7231 application.SendNotification();
7232 finishCheck.CheckSignalNotReceived();
7234 // The size should have travelled less, than with a linear alpha function
7235 Vector3 current(actor.GetCurrentSize());
7236 DALI_TEST_CHECK( current.x > 0.0f );
7237 DALI_TEST_CHECK( current.y > 0.0f );
7238 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7239 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7241 application.SendNotification();
7242 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7244 // We did expect the animation to finish
7245 application.SendNotification();
7246 finishCheck.CheckSignalReceived();
7247 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7248 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7251 finishCheck.Reset();
7252 actor.SetSize(Vector3::ZERO);
7253 application.SendNotification();
7254 application.Render(0);
7255 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7257 // Repeat with a delay
7259 animation = Animation::New(durationSeconds);
7260 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7261 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7262 animation.FinishedSignal().Connect(&application, finishCheck);
7265 application.SendNotification();
7266 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7268 // We didn't expect the animation to finish yet
7269 application.SendNotification();
7270 finishCheck.CheckSignalNotReceived();
7271 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7273 application.SendNotification();
7274 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7276 // We did expect the animation to finish
7277 application.SendNotification();
7278 finishCheck.CheckSignalReceived();
7279 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7280 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7284 int UtcDaliAnimationAnimateToActorPositionP(void)
7286 TestApplication application;
7288 Actor actor = Actor::New();
7289 Stage::GetCurrent().Add(actor);
7290 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7292 // Build the animation
7293 float durationSeconds(1.0f);
7294 Animation animation = Animation::New(durationSeconds);
7295 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7296 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7298 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7300 // Should return the initial properties before play
7301 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7302 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
7303 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
7304 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
7306 // Start the animation
7309 // Should return the target property after play
7310 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7311 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
7312 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
7313 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, 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*750.0f)/* 75% progress */);
7322 // We didn't expect the animation to finish yet
7323 application.SendNotification();
7324 finishCheck.CheckSignalNotReceived();
7325 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7327 application.SendNotification();
7328 application.Render(static_cast<unsigned int>(durationSeconds*250.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.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7337 int UtcDaliAnimationAnimateToActorPositionXP(void)
7339 TestApplication application;
7341 Actor actor = Actor::New();
7342 Stage::GetCurrent().Add(actor);
7343 float startValue(0.0f);
7344 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
7345 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7346 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7347 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7349 // Build the animation
7350 float durationSeconds(1.0f);
7351 Animation animation = Animation::New(durationSeconds);
7352 float targetX(1.0f);
7353 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
7355 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7357 // Should return the initial properties before play
7358 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7359 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
7361 // Start the animation
7364 // Should return the target property after play
7365 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7366 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7368 bool signalReceived(false);
7369 AnimationFinishCheck finishCheck(signalReceived);
7370 animation.FinishedSignal().Connect(&application, finishCheck);
7372 application.SendNotification();
7373 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7375 // We didn't expect the animation to finish yet
7376 application.SendNotification();
7377 finishCheck.CheckSignalNotReceived();
7378 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
7380 application.SendNotification();
7381 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7383 // We did expect the animation to finish
7384 application.SendNotification();
7385 finishCheck.CheckSignalReceived();
7386 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
7387 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7388 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7389 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7393 int UtcDaliAnimationAnimateToActorPositionYP(void)
7395 TestApplication application;
7397 Actor actor = Actor::New();
7398 Stage::GetCurrent().Add(actor);
7399 float startValue(0.0f);
7400 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7401 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7402 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7403 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7405 // Build the animation
7406 float durationSeconds(1.0f);
7407 Animation animation = Animation::New(durationSeconds);
7408 float targetY(10.0f);
7409 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7411 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7413 // Should return the initial properties before play
7414 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7415 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7417 // Start the animation
7420 // Should return the target property after play
7421 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7422 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7424 bool signalReceived(false);
7425 AnimationFinishCheck finishCheck(signalReceived);
7426 animation.FinishedSignal().Connect(&application, finishCheck);
7428 application.SendNotification();
7429 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7431 // We didn't expect the animation to finish yet
7432 application.SendNotification();
7433 finishCheck.CheckSignalNotReceived();
7434 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7436 application.SendNotification();
7437 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7439 // We did expect the animation to finish
7440 application.SendNotification();
7441 finishCheck.CheckSignalReceived();
7442 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7443 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7444 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7445 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7449 int UtcDaliAnimationAnimateToActorPositionZP(void)
7451 TestApplication application;
7453 Actor actor = Actor::New();
7454 Stage::GetCurrent().Add(actor);
7455 float startValue(0.0f);
7456 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7457 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7458 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7459 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7461 // Build the animation
7462 float durationSeconds(1.0f);
7463 Animation animation = Animation::New(durationSeconds);
7464 float targetZ(-5.0f);
7465 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7467 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7469 // Should return the initial properties before play
7470 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7471 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7473 // Start the animation
7476 // Should return the target property after play
7477 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7478 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7480 bool signalReceived(false);
7481 AnimationFinishCheck finishCheck(signalReceived);
7482 animation.FinishedSignal().Connect(&application, finishCheck);
7484 application.SendNotification();
7485 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7487 // We didn't expect the animation to finish yet
7488 application.SendNotification();
7489 finishCheck.CheckSignalNotReceived();
7490 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7492 application.SendNotification();
7493 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7495 // We did expect the animation to finish
7496 application.SendNotification();
7497 finishCheck.CheckSignalReceived();
7498 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7499 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7500 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7501 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7505 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7507 TestApplication application;
7509 Actor actor = Actor::New();
7510 Stage::GetCurrent().Add(actor);
7511 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7513 // Build the animation
7514 float durationSeconds(1.0f);
7515 Animation animation = Animation::New(durationSeconds);
7516 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7517 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7519 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7521 // Start the animation
7524 bool signalReceived(false);
7525 AnimationFinishCheck finishCheck(signalReceived);
7526 animation.FinishedSignal().Connect(&application, finishCheck);
7528 application.SendNotification();
7529 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7531 // We didn't expect the animation to finish yet
7532 application.SendNotification();
7533 finishCheck.CheckSignalNotReceived();
7535 // The position should have moved less, than with a linear alpha function
7536 Vector3 current(actor.GetCurrentPosition());
7537 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7538 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7539 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7540 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7541 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7542 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7544 application.SendNotification();
7545 application.Render(static_cast<unsigned int>(durationSeconds*250.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(), targetPosition, TEST_LOCATION );
7554 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7556 TestApplication application;
7558 Actor actor = Actor::New();
7559 Stage::GetCurrent().Add(actor);
7560 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7562 // Build the animation
7563 float durationSeconds(1.0f);
7564 Animation animation = Animation::New(durationSeconds);
7565 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7567 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7569 TimePeriod( delay, durationSeconds - delay ) );
7571 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7573 // Start the animation
7576 bool signalReceived(false);
7577 AnimationFinishCheck finishCheck(signalReceived);
7578 animation.FinishedSignal().Connect(&application, finishCheck);
7580 application.SendNotification();
7581 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7583 // We didn't expect the animation to finish yet
7584 application.SendNotification();
7585 finishCheck.CheckSignalNotReceived();
7586 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7588 application.SendNotification();
7589 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7591 // We didn't expect the animation to finish yet
7592 application.SendNotification();
7593 finishCheck.CheckSignalNotReceived();
7594 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7596 application.SendNotification();
7597 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7599 // We did expect the animation to finish
7600 application.SendNotification();
7601 finishCheck.CheckSignalReceived();
7602 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7606 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7608 TestApplication application;
7610 Actor actor = Actor::New();
7611 Stage::GetCurrent().Add(actor);
7612 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7614 // Build the animation
7615 float durationSeconds(1.0f);
7616 Animation animation = Animation::New(durationSeconds);
7617 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7619 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7621 AlphaFunction::LINEAR,
7622 TimePeriod( delay, durationSeconds - delay ) );
7624 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7626 // Start the animation
7629 bool signalReceived(false);
7630 AnimationFinishCheck finishCheck(signalReceived);
7631 animation.FinishedSignal().Connect(&application, finishCheck);
7633 application.SendNotification();
7634 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7636 // We didn't expect the animation to finish yet
7637 application.SendNotification();
7638 finishCheck.CheckSignalNotReceived();
7639 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7641 application.SendNotification();
7642 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7644 // We didn't expect the animation to finish yet
7645 application.SendNotification();
7646 finishCheck.CheckSignalNotReceived();
7647 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7649 application.SendNotification();
7650 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7652 // We did expect the animation to finish
7653 application.SendNotification();
7654 finishCheck.CheckSignalReceived();
7655 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7659 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7661 TestApplication application;
7663 Actor actor = Actor::New();
7664 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7665 Stage::GetCurrent().Add(actor);
7666 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7668 // Build the animation
7669 float durationSeconds(1.0f);
7670 Animation animation = Animation::New(durationSeconds);
7671 Degree targetRotationDegrees(90.0f);
7672 Radian targetRotationRadians(targetRotationDegrees);
7673 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7675 // Start the animation
7678 // Target value should be retrievable straight away
7679 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7681 bool signalReceived(false);
7682 AnimationFinishCheck finishCheck(signalReceived);
7683 animation.FinishedSignal().Connect(&application, finishCheck);
7685 application.SendNotification();
7686 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7688 // We didn't expect the animation to finish yet
7689 application.SendNotification();
7690 finishCheck.CheckSignalNotReceived();
7691 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7693 application.SendNotification();
7694 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7696 // We didn't expect the animation to finish yet
7697 application.SendNotification();
7698 finishCheck.CheckSignalNotReceived();
7699 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7701 application.SendNotification();
7702 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7704 // We didn't expect the animation to finish yet
7705 application.SendNotification();
7706 finishCheck.CheckSignalNotReceived();
7707 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7709 application.SendNotification();
7710 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7712 // We did expect the animation to finish
7713 application.SendNotification();
7714 finishCheck.CheckSignalReceived();
7715 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7719 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7721 TestApplication application;
7723 Actor actor = Actor::New();
7724 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7725 Stage::GetCurrent().Add(actor);
7726 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7728 // Build the animation
7729 float durationSeconds(1.0f);
7730 Animation animation = Animation::New(durationSeconds);
7731 Degree targetRotationDegrees(90.0f);
7732 Radian targetRotationRadians(targetRotationDegrees);
7733 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7734 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7736 // Start the animation
7739 bool signalReceived(false);
7740 AnimationFinishCheck finishCheck(signalReceived);
7741 animation.FinishedSignal().Connect(&application, finishCheck);
7743 application.SendNotification();
7744 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7746 // We didn't expect the animation to finish yet
7747 application.SendNotification();
7748 finishCheck.CheckSignalNotReceived();
7749 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7751 application.SendNotification();
7752 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7754 // We didn't expect the animation to finish yet
7755 application.SendNotification();
7756 finishCheck.CheckSignalNotReceived();
7757 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7759 application.SendNotification();
7760 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7762 // We didn't expect the animation to finish yet
7763 application.SendNotification();
7764 finishCheck.CheckSignalNotReceived();
7765 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7767 application.SendNotification();
7768 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7770 // We did expect the animation to finish
7771 application.SendNotification();
7772 finishCheck.CheckSignalReceived();
7773 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7777 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7779 TestApplication application;
7781 Actor actor = Actor::New();
7782 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7783 Stage::GetCurrent().Add(actor);
7784 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7786 // Build the animation
7787 float durationSeconds(1.0f);
7788 Animation animation = Animation::New(durationSeconds);
7789 Degree targetRotationDegrees(90.0f);
7790 Radian targetRotationRadians(targetRotationDegrees);
7791 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7793 // Start the animation
7796 bool signalReceived(false);
7797 AnimationFinishCheck finishCheck(signalReceived);
7798 animation.FinishedSignal().Connect(&application, finishCheck);
7800 application.SendNotification();
7801 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7803 // We didn't expect the animation to finish yet
7804 application.SendNotification();
7805 finishCheck.CheckSignalNotReceived();
7806 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7808 application.SendNotification();
7809 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7811 // We didn't expect the animation to finish yet
7812 application.SendNotification();
7813 finishCheck.CheckSignalNotReceived();
7814 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7816 application.SendNotification();
7817 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7819 // We didn't expect the animation to finish yet
7820 application.SendNotification();
7821 finishCheck.CheckSignalNotReceived();
7822 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7824 application.SendNotification();
7825 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7827 // We did expect the animation to finish
7828 application.SendNotification();
7829 finishCheck.CheckSignalReceived();
7830 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7834 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7836 TestApplication application;
7838 Actor actor = Actor::New();
7839 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7840 Stage::GetCurrent().Add(actor);
7841 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7843 // Build the animation
7844 float durationSeconds(1.0f);
7845 Animation animation = Animation::New(durationSeconds);
7846 Degree targetRotationDegrees(90.0f);
7847 Radian targetRotationRadians(targetRotationDegrees);
7849 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7851 // Start the animation
7854 bool signalReceived(false);
7855 AnimationFinishCheck finishCheck(signalReceived);
7856 animation.FinishedSignal().Connect(&application, finishCheck);
7858 application.SendNotification();
7859 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7861 // We didn't expect the animation to finish yet
7862 application.SendNotification();
7863 finishCheck.CheckSignalNotReceived();
7864 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7865 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7867 application.SendNotification();
7868 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7870 // We didn't expect the animation to finish yet
7871 application.SendNotification();
7872 finishCheck.CheckSignalNotReceived();
7873 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7874 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7876 application.SendNotification();
7877 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7879 // We didn't expect the animation to finish yet
7880 application.SendNotification();
7881 finishCheck.CheckSignalNotReceived();
7882 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7883 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7885 application.SendNotification();
7886 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7888 // We did expect the animation to finish
7889 application.SendNotification();
7890 finishCheck.CheckSignalReceived();
7891 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7895 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7897 TestApplication application;
7899 Actor actor = Actor::New();
7900 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7901 Stage::GetCurrent().Add(actor);
7902 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7904 // Build the animation
7905 float durationSeconds(1.0f);
7906 Animation animation = Animation::New(durationSeconds);
7907 Degree targetRotationDegrees(90.0f);
7908 Radian targetRotationRadians(targetRotationDegrees);
7910 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7912 // Start the animation
7915 bool signalReceived(false);
7916 AnimationFinishCheck finishCheck(signalReceived);
7917 animation.FinishedSignal().Connect(&application, finishCheck);
7919 application.SendNotification();
7920 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7922 // We didn't expect the animation to finish yet
7923 application.SendNotification();
7924 finishCheck.CheckSignalNotReceived();
7925 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7926 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7928 application.SendNotification();
7929 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7931 // We didn't expect the animation to finish yet
7932 application.SendNotification();
7933 finishCheck.CheckSignalNotReceived();
7934 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7935 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7937 application.SendNotification();
7938 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7940 // We didn't expect the animation to finish yet
7941 application.SendNotification();
7942 finishCheck.CheckSignalNotReceived();
7943 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7944 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7946 application.SendNotification();
7947 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7949 // We did expect the animation to finish
7950 application.SendNotification();
7951 finishCheck.CheckSignalReceived();
7952 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7956 int UtcDaliAnimationAnimateToActorScaleP(void)
7958 TestApplication application;
7960 Actor actor = Actor::New();
7961 Stage::GetCurrent().Add(actor);
7962 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7964 // Build the animation
7965 float durationSeconds(1.0f);
7966 Animation animation = Animation::New(durationSeconds);
7967 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7968 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7970 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7972 // Start the animation
7975 // Target value should be retrievable straight away
7976 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
7977 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
7978 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
7979 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
7981 bool signalReceived(false);
7982 AnimationFinishCheck finishCheck(signalReceived);
7983 animation.FinishedSignal().Connect(&application, finishCheck);
7985 application.SendNotification();
7986 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7988 // We didn't expect the animation to finish yet
7989 application.SendNotification();
7990 finishCheck.CheckSignalNotReceived();
7991 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7993 application.SendNotification();
7994 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7996 // We did expect the animation to finish
7997 application.SendNotification();
7998 finishCheck.CheckSignalReceived();
7999 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8002 finishCheck.Reset();
8003 actor.SetScale(Vector3::ONE);
8004 application.SendNotification();
8005 application.Render(0);
8006 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8008 // Repeat with a different (ease-in) alpha function
8009 animation = Animation::New(durationSeconds);
8010 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8011 animation.FinishedSignal().Connect(&application, finishCheck);
8014 application.SendNotification();
8015 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8017 // We didn't expect the animation to finish yet
8018 application.SendNotification();
8019 finishCheck.CheckSignalNotReceived();
8021 // The scale should have grown less, than with a linear alpha function
8022 Vector3 current(actor.GetCurrentScale());
8023 DALI_TEST_CHECK( current.x > 1.0f );
8024 DALI_TEST_CHECK( current.y > 1.0f );
8025 DALI_TEST_CHECK( current.z > 1.0f );
8026 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8027 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8028 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8030 application.SendNotification();
8031 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8033 // We did expect the animation to finish
8034 application.SendNotification();
8035 finishCheck.CheckSignalReceived();
8036 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8039 finishCheck.Reset();
8040 actor.SetScale(Vector3::ONE);
8041 application.SendNotification();
8042 application.Render(0);
8043 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8045 // Repeat with a delay
8047 animation = Animation::New(durationSeconds);
8048 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8049 animation.FinishedSignal().Connect(&application, finishCheck);
8052 application.SendNotification();
8053 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8055 // We didn't expect the animation to finish yet
8056 application.SendNotification();
8057 finishCheck.CheckSignalNotReceived();
8058 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8060 application.SendNotification();
8061 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8063 // We did expect the animation to finish
8064 application.SendNotification();
8065 finishCheck.CheckSignalReceived();
8066 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8070 int UtcDaliAnimationAnimateToActorScaleXP(void)
8072 TestApplication application;
8074 Actor actor = Actor::New();
8075 Stage::GetCurrent().Add(actor);
8076 float startValue(1.0f);
8077 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
8078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8079 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8081 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8082 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8083 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8085 // Build the animation
8086 float durationSeconds(1.0f);
8087 Animation animation = Animation::New(durationSeconds);
8088 float targetX(10.0f);
8089 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
8091 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
8093 // Start the animation
8096 // Target value should be retrievable straight away
8097 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
8098 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8100 bool signalReceived(false);
8101 AnimationFinishCheck finishCheck(signalReceived);
8102 animation.FinishedSignal().Connect(&application, finishCheck);
8104 application.SendNotification();
8105 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8107 // We didn't expect the animation to finish yet
8108 application.SendNotification();
8109 finishCheck.CheckSignalNotReceived();
8110 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
8111 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
8112 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8113 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8115 application.SendNotification();
8116 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8118 // We did expect the animation to finish
8119 application.SendNotification();
8120 finishCheck.CheckSignalReceived();
8121 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
8122 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8123 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8124 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8128 int UtcDaliAnimationAnimateToActorScaleYP(void)
8130 TestApplication application;
8132 Actor actor = Actor::New();
8133 Stage::GetCurrent().Add(actor);
8134 float startValue(1.0f);
8135 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
8136 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8137 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8138 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8139 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8140 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8141 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8143 // Build the animation
8144 float durationSeconds(1.0f);
8145 Animation animation = Animation::New(durationSeconds);
8146 float targetY(1000.0f);
8147 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
8149 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
8151 // Start the animation
8154 // Target value should be retrievable straight away
8155 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
8156 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8158 bool signalReceived(false);
8159 AnimationFinishCheck finishCheck(signalReceived);
8160 animation.FinishedSignal().Connect(&application, finishCheck);
8162 application.SendNotification();
8163 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8165 // We didn't expect the animation to finish yet
8166 application.SendNotification();
8167 finishCheck.CheckSignalNotReceived();
8168 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
8169 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8170 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
8171 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8173 application.SendNotification();
8174 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8176 // We did expect the animation to finish
8177 application.SendNotification();
8178 finishCheck.CheckSignalReceived();
8179 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
8180 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8181 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8182 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8186 int UtcDaliAnimationAnimateToActorScaleZP(void)
8188 TestApplication application;
8190 Actor actor = Actor::New();
8191 Stage::GetCurrent().Add(actor);
8192 float startValue(1.0f);
8193 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
8194 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8195 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8196 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8197 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8198 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8199 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8201 // Build the animation
8202 float durationSeconds(1.0f);
8203 Animation animation = Animation::New(durationSeconds);
8204 float targetZ(-1000.0f);
8205 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
8207 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
8209 // Start the animation
8212 // Target value should be retrievable straight away
8213 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
8214 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8216 bool signalReceived(false);
8217 AnimationFinishCheck finishCheck(signalReceived);
8218 animation.FinishedSignal().Connect(&application, finishCheck);
8220 application.SendNotification();
8221 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8223 // We didn't expect the animation to finish yet
8224 application.SendNotification();
8225 finishCheck.CheckSignalNotReceived();
8226 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
8227 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8228 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8229 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
8231 application.SendNotification();
8232 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8234 // We did expect the animation to finish
8235 application.SendNotification();
8236 finishCheck.CheckSignalReceived();
8237 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
8238 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8239 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8240 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8244 int UtcDaliAnimationAnimateToActorColorP(void)
8246 TestApplication application;
8248 Actor actor = Actor::New();
8249 Stage::GetCurrent().Add(actor);
8250 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8252 // Build the animation
8253 float durationSeconds(1.0f);
8254 Animation animation = Animation::New(durationSeconds);
8255 Vector4 targetColor(Color::RED);
8256 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
8258 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8259 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8261 // Start the animation
8264 // Target value should be retrievable straight away
8265 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8266 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
8267 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
8268 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
8269 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
8270 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
8272 bool signalReceived(false);
8273 AnimationFinishCheck finishCheck(signalReceived);
8274 animation.FinishedSignal().Connect(&application, finishCheck);
8276 application.SendNotification();
8277 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8279 // We didn't expect the animation to finish yet
8280 application.SendNotification();
8281 finishCheck.CheckSignalNotReceived();
8282 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
8284 application.SendNotification();
8285 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8287 // We did expect the animation to finish
8288 application.SendNotification();
8289 finishCheck.CheckSignalReceived();
8290 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8293 finishCheck.Reset();
8294 actor.SetColor(Color::WHITE);
8295 application.SendNotification();
8296 application.Render(0);
8297 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8299 // Repeat with a different (ease-in) alpha function
8300 animation = Animation::New(durationSeconds);
8301 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8302 animation.FinishedSignal().Connect(&application, finishCheck);
8305 application.SendNotification();
8306 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8308 // We didn't expect the animation to finish yet
8309 application.SendNotification();
8310 finishCheck.CheckSignalNotReceived();
8312 // The color should have changed less, than with a linear alpha function
8313 Vector4 current(actor.GetCurrentColor());
8314 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
8315 DALI_TEST_CHECK( current.y < 1.0f );
8316 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
8317 DALI_TEST_CHECK( current.z < 1.0f );
8318 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
8319 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8321 application.SendNotification();
8322 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8324 // We did expect the animation to finish
8325 application.SendNotification();
8326 finishCheck.CheckSignalReceived();
8327 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8330 finishCheck.Reset();
8331 actor.SetColor(Color::WHITE);
8332 application.SendNotification();
8333 application.Render(0);
8334 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8336 // Repeat with a shorter animator duration
8337 float animatorDuration = 0.5f;
8338 animation = Animation::New(durationSeconds);
8339 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8340 animation.FinishedSignal().Connect(&application, finishCheck);
8343 application.SendNotification();
8344 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8346 // We didn't expect the animation to finish yet
8347 application.SendNotification();
8348 finishCheck.CheckSignalNotReceived();
8349 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
8351 application.SendNotification();
8352 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8354 // We didn't expect the animation to finish yet
8355 application.SendNotification();
8356 finishCheck.CheckSignalNotReceived();
8357 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8359 application.SendNotification();
8360 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8362 // We did expect the animation to finish
8363 application.SendNotification();
8364 finishCheck.CheckSignalReceived();
8365 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8369 int UtcDaliAnimationAnimateToActorColorRedP(void)
8371 TestApplication application;
8373 Actor actor = Actor::New();
8374 Stage::GetCurrent().Add(actor);
8375 float startValue(1.0f);
8376 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
8377 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8378 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8379 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8380 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8381 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8382 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8383 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8384 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8386 // Build the animation
8387 float durationSeconds(1.0f);
8388 Animation animation = Animation::New(durationSeconds);
8389 float targetRed(0.5f);
8390 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8392 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8394 // Start the animation
8397 // Target value should be retrievable straight away
8398 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8399 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8401 bool signalReceived(false);
8402 AnimationFinishCheck finishCheck(signalReceived);
8403 animation.FinishedSignal().Connect(&application, finishCheck);
8405 application.SendNotification();
8406 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8408 // We didn't expect the animation to finish yet
8409 application.SendNotification();
8410 finishCheck.CheckSignalNotReceived();
8411 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8412 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
8413 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8414 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8415 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8417 application.SendNotification();
8418 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8420 // We did expect the animation to finish
8421 application.SendNotification();
8422 finishCheck.CheckSignalReceived();
8423 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8424 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
8425 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8426 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8427 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8431 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8433 TestApplication application;
8435 Actor actor = Actor::New();
8436 Stage::GetCurrent().Add(actor);
8437 float startValue(1.0f);
8438 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8439 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8440 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8441 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8442 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8443 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8444 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8445 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8446 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8448 // Build the animation
8449 float durationSeconds(1.0f);
8450 Animation animation = Animation::New(durationSeconds);
8451 float targetGreen(0.5f);
8452 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8454 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8456 // Start the animation
8459 // Target value should be retrievable straight away
8460 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8461 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8463 bool signalReceived(false);
8464 AnimationFinishCheck finishCheck(signalReceived);
8465 animation.FinishedSignal().Connect(&application, finishCheck);
8467 application.SendNotification();
8468 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8470 // We didn't expect the animation to finish yet
8471 application.SendNotification();
8472 finishCheck.CheckSignalNotReceived();
8473 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8474 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8475 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8476 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8477 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8479 application.SendNotification();
8480 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8482 // We did expect the animation to finish
8483 application.SendNotification();
8484 finishCheck.CheckSignalReceived();
8485 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8486 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8487 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8488 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8489 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8493 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8495 TestApplication application;
8497 Actor actor = Actor::New();
8498 Stage::GetCurrent().Add(actor);
8499 float startValue(1.0f);
8500 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8501 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8502 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8503 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8504 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8505 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8506 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8507 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8508 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8510 // Build the animation
8511 float durationSeconds(1.0f);
8512 Animation animation = Animation::New(durationSeconds);
8513 float targetBlue(0.5f);
8514 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8516 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8518 // Start the animation
8521 // Target value should be retrievable straight away
8522 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8523 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8525 bool signalReceived(false);
8526 AnimationFinishCheck finishCheck(signalReceived);
8527 animation.FinishedSignal().Connect(&application, finishCheck);
8529 application.SendNotification();
8530 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8532 // We didn't expect the animation to finish yet
8533 application.SendNotification();
8534 finishCheck.CheckSignalNotReceived();
8535 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8536 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8537 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8538 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8539 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8541 application.SendNotification();
8542 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8544 // We did expect the animation to finish
8545 application.SendNotification();
8546 finishCheck.CheckSignalReceived();
8547 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8548 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8549 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8550 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8551 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8555 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8557 TestApplication application;
8559 Actor actor = Actor::New();
8560 Stage::GetCurrent().Add(actor);
8561 float startValue(1.0f);
8562 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8563 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8564 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8565 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8566 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8567 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8568 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8569 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8570 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8572 // Build the animation
8573 float durationSeconds(1.0f);
8574 Animation animation = Animation::New(durationSeconds);
8575 float targetAlpha(0.5f);
8576 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8578 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8580 // Start the animation
8583 // Target value should be retrievable straight away
8584 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8585 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8586 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8588 bool signalReceived(false);
8589 AnimationFinishCheck finishCheck(signalReceived);
8590 animation.FinishedSignal().Connect(&application, finishCheck);
8592 application.SendNotification();
8593 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8595 // We didn't expect the animation to finish yet
8596 application.SendNotification();
8597 finishCheck.CheckSignalNotReceived();
8598 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8599 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8600 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8601 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8602 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8604 application.SendNotification();
8605 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8607 // We did expect the animation to finish
8608 application.SendNotification();
8609 finishCheck.CheckSignalReceived();
8610 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8611 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8612 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8613 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8614 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8618 int UtcDaliAnimationKeyFrames01P(void)
8620 TestApplication application;
8622 KeyFrames keyFrames = KeyFrames::New();
8623 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8625 keyFrames.Add(0.0f, 0.1f);
8627 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8629 KeyFrames keyFrames2( keyFrames);
8630 DALI_TEST_CHECK( keyFrames2 );
8631 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8633 KeyFrames keyFrames3 = KeyFrames::New();
8634 keyFrames3.Add(0.6f, true);
8635 DALI_TEST_CHECK( keyFrames3 );
8636 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8638 keyFrames3 = keyFrames;
8639 DALI_TEST_CHECK( keyFrames3 );
8640 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8645 int UtcDaliAnimationKeyFrames02P(void)
8647 TestApplication application;
8649 KeyFrames keyFrames = KeyFrames::New();
8650 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8652 keyFrames.Add(0.0f, 0.1f);
8653 keyFrames.Add(0.2f, 0.5f);
8654 keyFrames.Add(0.4f, 0.0f);
8655 keyFrames.Add(0.6f, 1.0f);
8656 keyFrames.Add(0.8f, 0.7f);
8657 keyFrames.Add(1.0f, 0.9f);
8659 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8663 keyFrames.Add(1.9f, false);
8665 catch (Dali::DaliException& e)
8667 DALI_TEST_PRINT_ASSERT( e );
8668 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8673 int UtcDaliAnimationKeyFrames03P(void)
8675 TestApplication application;
8677 KeyFrames keyFrames = KeyFrames::New();
8678 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8680 keyFrames.Add(0.0f, true);
8681 keyFrames.Add(0.2f, false);
8682 keyFrames.Add(0.4f, false);
8683 keyFrames.Add(0.6f, true);
8684 keyFrames.Add(0.8f, true);
8685 keyFrames.Add(1.0f, false);
8687 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8691 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8693 catch (Dali::DaliException& e)
8695 DALI_TEST_PRINT_ASSERT( e );
8696 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8701 int UtcDaliAnimationKeyFrames04P(void)
8703 TestApplication application;
8705 KeyFrames keyFrames = KeyFrames::New();
8706 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8708 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8709 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8710 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8711 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8712 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8713 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8715 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8719 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8721 catch (Dali::DaliException& e)
8723 DALI_TEST_PRINT_ASSERT( e );
8724 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8729 int UtcDaliAnimationKeyFrames05P(void)
8731 TestApplication application;
8733 KeyFrames keyFrames = KeyFrames::New();
8734 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8736 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8737 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8738 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8739 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8740 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8741 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8743 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8747 keyFrames.Add(0.7f, 1.0f);
8749 catch (Dali::DaliException& e)
8751 DALI_TEST_PRINT_ASSERT( e );
8752 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8757 int UtcDaliAnimationKeyFrames06P(void)
8759 TestApplication application;
8761 KeyFrames keyFrames = KeyFrames::New();
8762 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8764 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8765 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8766 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8767 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8768 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8769 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8771 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8775 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8777 catch (Dali::DaliException& e)
8779 DALI_TEST_PRINT_ASSERT( e );
8780 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8785 int UtcDaliAnimationKeyFrames07P(void)
8787 TestApplication application;
8789 KeyFrames keyFrames = KeyFrames::New();
8790 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8792 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8793 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8794 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8795 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8796 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8797 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8799 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8803 keyFrames.Add(0.7f, 1.1f);
8805 catch (Dali::DaliException& e)
8807 DALI_TEST_PRINT_ASSERT( e );
8808 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8813 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8815 TestApplication application;
8817 float startValue(1.0f);
8818 Actor actor = Actor::New();
8819 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8820 Stage::GetCurrent().Add(actor);
8822 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8823 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8824 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8825 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8827 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8828 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8829 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8830 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8832 // Build the animation
8833 float durationSeconds(1.0f);
8834 Animation animation = Animation::New(durationSeconds);
8836 KeyFrames keyFrames = KeyFrames::New();
8837 keyFrames.Add(0.0f, 0.1f);
8838 keyFrames.Add(0.2f, 0.5f);
8839 keyFrames.Add(0.4f, 0.0f);
8840 keyFrames.Add(0.6f, 1.0f);
8841 keyFrames.Add(0.8f, 0.7f);
8842 keyFrames.Add(1.0f, 0.9f);
8844 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8846 // Start the animation
8849 // Final key frame value should be retrievable straight away
8850 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
8852 bool signalReceived(false);
8853 AnimationFinishCheck finishCheck(signalReceived);
8854 animation.FinishedSignal().Connect(&application, finishCheck);
8855 application.SendNotification();
8856 application.Render(0);
8857 application.SendNotification();
8858 finishCheck.CheckSignalNotReceived();
8859 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8861 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8862 application.SendNotification();
8863 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8864 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8865 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8866 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8867 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8869 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8870 application.SendNotification();
8871 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8872 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8873 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8874 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8875 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8877 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8878 application.SendNotification();
8879 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8880 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8881 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8882 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8883 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8885 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8886 application.SendNotification();
8887 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8888 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8889 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8890 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8891 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8893 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8894 application.SendNotification();
8895 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8896 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8897 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8898 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8899 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8901 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8902 application.SendNotification();
8903 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8904 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8905 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8906 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8907 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8909 // We did expect the animation to finish
8911 finishCheck.CheckSignalReceived();
8915 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8917 TestApplication application;
8919 float startValue(1.0f);
8920 Actor actor = Actor::New();
8921 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8922 Stage::GetCurrent().Add(actor);
8924 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8925 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8926 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8927 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8928 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8929 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8930 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8931 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8932 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8934 // Build the animation
8935 float durationSeconds(1.0f);
8936 Animation animation = Animation::New(durationSeconds);
8938 KeyFrames keyFrames = KeyFrames::New();
8939 keyFrames.Add(0.0f, 0.1f);
8940 keyFrames.Add(0.2f, 0.5f);
8941 keyFrames.Add(0.4f, 0.0f);
8942 keyFrames.Add(0.6f, 1.0f);
8943 keyFrames.Add(0.8f, 0.7f);
8944 keyFrames.Add(1.0f, 0.9f);
8946 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8948 // Start the animation
8951 bool signalReceived(false);
8952 AnimationFinishCheck finishCheck(signalReceived);
8953 animation.FinishedSignal().Connect(&application, finishCheck);
8954 application.SendNotification();
8955 application.Render(0);
8956 application.SendNotification();
8957 finishCheck.CheckSignalNotReceived();
8958 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8960 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8961 application.SendNotification();
8962 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8963 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8964 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8965 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
8966 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8968 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8969 application.SendNotification();
8970 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8971 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8972 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8973 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
8974 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8976 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8977 application.SendNotification();
8978 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8979 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8980 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8981 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
8982 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8984 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8985 application.SendNotification();
8986 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8987 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8988 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8989 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
8990 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8992 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8993 application.SendNotification();
8994 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8995 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8996 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8997 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
8998 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
9000 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9001 application.SendNotification();
9002 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9003 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9004 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9005 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
9006 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
9008 // We did expect the animation to finish
9010 finishCheck.CheckSignalReceived();
9014 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9016 TestApplication application;
9018 float startValue(1.0f);
9019 Actor actor = Actor::New();
9020 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9021 Stage::GetCurrent().Add(actor);
9023 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9024 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9025 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9026 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9027 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9028 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9029 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9030 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9031 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9033 // Build the animation
9034 float durationSeconds(1.0f);
9035 Animation animation = Animation::New(durationSeconds);
9037 KeyFrames keyFrames = KeyFrames::New();
9038 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9039 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9040 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9042 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
9044 // Start the animation
9047 bool signalReceived(false);
9048 AnimationFinishCheck finishCheck(signalReceived);
9049 animation.FinishedSignal().Connect(&application, finishCheck);
9050 application.SendNotification();
9051 application.Render(0);
9052 application.SendNotification();
9053 finishCheck.CheckSignalNotReceived();
9054 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9055 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9056 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9057 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9059 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9060 application.SendNotification();
9061 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9062 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9063 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9064 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9066 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9067 application.SendNotification();
9068 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9069 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9070 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9071 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9073 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9074 application.SendNotification();
9075 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9076 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9077 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9078 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9080 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9081 application.SendNotification();
9082 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9083 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9084 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9085 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9087 // We did expect the animation to finish
9089 finishCheck.CheckSignalReceived();
9093 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9095 TestApplication application;
9097 float startValue(1.0f);
9098 Actor actor = Actor::New();
9099 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9100 Stage::GetCurrent().Add(actor);
9102 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9103 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9104 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9105 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9106 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9107 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9108 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9109 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9110 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9112 // Build the animation
9113 float durationSeconds(1.0f);
9114 Animation animation = Animation::New(durationSeconds);
9116 KeyFrames keyFrames = KeyFrames::New();
9117 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9118 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9119 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9121 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
9123 // Start the animation
9126 bool signalReceived(false);
9127 AnimationFinishCheck finishCheck(signalReceived);
9128 animation.FinishedSignal().Connect(&application, finishCheck);
9129 application.SendNotification();
9130 application.Render(0);
9131 application.SendNotification();
9132 finishCheck.CheckSignalNotReceived();
9133 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9134 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9135 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9136 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9138 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9139 application.SendNotification();
9140 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9141 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9142 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9143 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9145 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9146 application.SendNotification();
9147 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9148 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9149 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9150 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9152 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9153 application.SendNotification();
9154 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9155 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9156 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9157 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9159 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9160 application.SendNotification();
9161 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9162 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9163 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9164 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9166 // We did expect the animation to finish
9168 finishCheck.CheckSignalReceived();
9172 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9174 TestApplication application;
9176 Actor actor = Actor::New();
9177 AngleAxis aa(Degree(90), Vector3::XAXIS);
9178 actor.SetOrientation(aa.angle, aa.axis);
9179 Stage::GetCurrent().Add(actor);
9181 application.SendNotification();
9182 application.Render(0);
9184 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9186 // Build the animation
9187 float durationSeconds(1.0f);
9188 Animation animation = Animation::New(durationSeconds);
9190 KeyFrames keyFrames = KeyFrames::New();
9191 keyFrames.Add(0.0f, false);
9192 keyFrames.Add(0.2f, true);
9193 keyFrames.Add(0.4f, true);
9194 keyFrames.Add(0.8f, false);
9195 keyFrames.Add(1.0f, true);
9197 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
9199 // Start the animation
9202 // Final key frame value should be retrievable straight away
9203 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9205 bool signalReceived(false);
9206 AnimationFinishCheck finishCheck(signalReceived);
9207 animation.FinishedSignal().Connect(&application, finishCheck);
9208 application.SendNotification();
9209 application.SendNotification();
9210 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9211 application.SendNotification();
9212 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9213 application.SendNotification();
9215 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9216 finishCheck.CheckSignalReceived();
9220 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9222 TestApplication application;
9224 Actor actor = Actor::New();
9225 AngleAxis aa(Degree(90), Vector3::XAXIS);
9226 actor.SetOrientation(aa.angle, aa.axis);
9227 Stage::GetCurrent().Add(actor);
9229 application.SendNotification();
9230 application.Render(0);
9232 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9234 // Build the animation
9235 float durationSeconds(1.0f);
9236 Animation animation = Animation::New(durationSeconds);
9238 KeyFrames keyFrames = KeyFrames::New();
9239 keyFrames.Add(0.0f, false);
9240 keyFrames.Add(0.2f, true);
9241 keyFrames.Add(0.4f, true);
9242 keyFrames.Add(0.8f, false);
9243 keyFrames.Add(1.0f, true);
9245 //Cubic interpolation for boolean values should be ignored
9246 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
9248 // Start the animation
9251 bool signalReceived(false);
9252 AnimationFinishCheck finishCheck(signalReceived);
9253 animation.FinishedSignal().Connect(&application, finishCheck);
9254 application.SendNotification();
9255 application.SendNotification();
9256 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9257 application.SendNotification();
9258 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9259 application.SendNotification();
9261 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9262 finishCheck.CheckSignalReceived();
9266 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9268 TestApplication application;
9270 Actor actor = Actor::New();
9271 AngleAxis aa(Degree(90), Vector3::XAXIS);
9272 actor.SetOrientation(aa.angle, aa.axis);
9273 Stage::GetCurrent().Add(actor);
9275 application.SendNotification();
9276 application.Render(0);
9277 Quaternion start(Radian(aa.angle), aa.axis);
9278 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9280 // Build the animation
9281 float durationSeconds(1.0f);
9282 Animation animation = Animation::New(durationSeconds);
9284 KeyFrames keyFrames = KeyFrames::New();
9285 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9287 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9289 // Start the animation
9292 // Final key frame value should be retrievable straight away
9293 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
9295 bool signalReceived(false);
9296 AnimationFinishCheck finishCheck(signalReceived);
9297 animation.FinishedSignal().Connect(&application, finishCheck);
9298 application.SendNotification();
9299 application.SendNotification();
9300 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9301 application.SendNotification();
9302 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9303 application.SendNotification();
9305 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9307 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9308 finishCheck.CheckSignalReceived();
9312 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9314 TestApplication application;
9316 Actor actor = Actor::New();
9317 AngleAxis aa(Degree(90), Vector3::XAXIS);
9318 actor.SetOrientation(aa.angle, aa.axis);
9319 application.SendNotification();
9320 application.Render(0);
9321 Stage::GetCurrent().Add(actor);
9323 Quaternion start(Radian(aa.angle), aa.axis);
9324 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, 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, AngleAxis(Degree(60), Vector3::XAXIS));
9332 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9333 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9335 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9337 // Start the animation
9340 bool signalReceived(false);
9341 AnimationFinishCheck finishCheck(signalReceived);
9342 animation.FinishedSignal().Connect(&application, finishCheck);
9343 application.SendNotification();
9344 application.Render(0);
9345 application.SendNotification();
9346 finishCheck.CheckSignalNotReceived();
9348 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9349 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9351 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9352 application.SendNotification();
9353 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9354 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9356 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9357 application.SendNotification();
9358 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9359 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9361 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9362 application.SendNotification();
9363 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
9364 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9366 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9367 application.SendNotification();
9368 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9369 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9371 // We did expect the animation to finish
9373 finishCheck.CheckSignalReceived();
9377 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9379 TestApplication application;
9381 Actor actor = Actor::New();
9382 AngleAxis aa(Degree(90), Vector3::XAXIS);
9383 actor.SetOrientation(aa.angle, aa.axis);
9384 Stage::GetCurrent().Add(actor);
9386 application.SendNotification();
9387 application.Render(0);
9388 Quaternion start(Radian(aa.angle), aa.axis);
9389 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9391 // Build the animation
9392 float durationSeconds(1.0f);
9393 Animation animation = Animation::New(durationSeconds);
9395 KeyFrames keyFrames = KeyFrames::New();
9396 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9398 //Cubic interpolation should be ignored for quaternions
9399 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9401 // Start the animation
9404 bool signalReceived(false);
9405 AnimationFinishCheck finishCheck(signalReceived);
9406 animation.FinishedSignal().Connect(&application, finishCheck);
9407 application.SendNotification();
9408 application.SendNotification();
9409 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9410 application.SendNotification();
9411 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9412 application.SendNotification();
9414 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9416 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9417 finishCheck.CheckSignalReceived();
9421 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9423 TestApplication application;
9425 Actor actor = Actor::New();
9426 AngleAxis aa(Degree(90), Vector3::XAXIS);
9427 actor.SetOrientation(aa.angle, aa.axis);
9428 application.SendNotification();
9429 application.Render(0);
9430 Stage::GetCurrent().Add(actor);
9432 Quaternion start(Radian(aa.angle), aa.axis);
9433 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9435 // Build the animation
9436 float durationSeconds(1.0f);
9437 Animation animation = Animation::New(durationSeconds);
9439 KeyFrames keyFrames = KeyFrames::New();
9440 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9441 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9442 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9444 //Cubic interpolation should be ignored for quaternions
9445 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9447 // Start the animation
9450 bool signalReceived(false);
9451 AnimationFinishCheck finishCheck(signalReceived);
9452 animation.FinishedSignal().Connect(&application, finishCheck);
9453 application.SendNotification();
9454 application.Render(0);
9455 application.SendNotification();
9456 finishCheck.CheckSignalNotReceived();
9458 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9459 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9461 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9462 application.SendNotification();
9463 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9464 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9466 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9467 application.SendNotification();
9468 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9469 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9471 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9472 application.SendNotification();
9473 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9474 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9476 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9477 application.SendNotification();
9478 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9479 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9481 // We did expect the animation to finish
9483 finishCheck.CheckSignalReceived();
9487 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9489 TestApplication application;
9491 float startValue(1.0f);
9492 Actor actor = Actor::New();
9493 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9494 Stage::GetCurrent().Add(actor);
9496 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9497 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9498 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9499 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9500 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9501 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9502 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9503 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9504 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9506 // Build the animation
9507 float durationSeconds(1.0f);
9508 Animation animation = Animation::New(durationSeconds);
9510 KeyFrames keyFrames = KeyFrames::New();
9511 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9512 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9513 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9515 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9517 // Start the animation
9520 bool signalReceived(false);
9521 AnimationFinishCheck finishCheck(signalReceived);
9522 animation.FinishedSignal().Connect(&application, finishCheck);
9523 application.SendNotification();
9524 application.Render(0);
9525 application.SendNotification();
9526 finishCheck.CheckSignalNotReceived();
9527 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9528 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9529 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9530 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9532 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9533 application.SendNotification();
9534 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9535 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9536 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9537 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9539 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9540 application.SendNotification();
9541 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9542 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9543 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9544 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9546 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9547 application.SendNotification();
9548 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9549 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9550 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9551 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9553 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9554 application.SendNotification();
9555 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9556 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9557 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9558 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9560 // We did expect the animation to finish
9562 finishCheck.CheckSignalReceived();
9566 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9568 TestApplication application;
9570 float startValue(1.0f);
9571 Actor actor = Actor::New();
9572 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9573 Stage::GetCurrent().Add(actor);
9575 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9576 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9577 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9578 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9579 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9580 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9581 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9582 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9583 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9585 // Build the animation
9586 float durationSeconds(1.0f);
9587 Animation animation = Animation::New(durationSeconds);
9589 KeyFrames keyFrames = KeyFrames::New();
9590 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9591 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9592 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9594 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9596 // Start the animation
9599 bool signalReceived(false);
9600 AnimationFinishCheck finishCheck(signalReceived);
9601 animation.FinishedSignal().Connect(&application, finishCheck);
9602 application.SendNotification();
9603 application.Render(0);
9604 application.SendNotification();
9605 finishCheck.CheckSignalNotReceived();
9606 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9607 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9608 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9609 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9611 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9612 application.SendNotification();
9613 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9614 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9615 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9616 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9618 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9619 application.SendNotification();
9620 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9621 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9622 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9623 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9625 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9626 application.SendNotification();
9627 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9628 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9629 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9630 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9632 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9633 application.SendNotification();
9634 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9635 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9636 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9637 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9639 // We did expect the animation to finish
9641 finishCheck.CheckSignalReceived();
9645 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9647 TestApplication application;
9649 float startValue(1.0f);
9650 Actor actor = Actor::New();
9651 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9652 Stage::GetCurrent().Add(actor);
9654 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9655 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9656 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9657 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9659 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9660 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9661 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9662 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9664 // Build the animation
9665 float durationSeconds(1.0f);
9667 Animation animation = Animation::New(durationSeconds);
9669 KeyFrames keyFrames = KeyFrames::New();
9670 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9671 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9672 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9674 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9676 // Start the animation
9679 bool signalReceived(false);
9680 AnimationFinishCheck finishCheck(signalReceived);
9681 animation.FinishedSignal().Connect(&application, finishCheck);
9682 application.SendNotification();
9684 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9685 application.SendNotification();
9686 finishCheck.CheckSignalNotReceived();
9687 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9688 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9689 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9690 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9692 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9693 application.SendNotification();
9694 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9695 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9696 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9697 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9699 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9700 application.SendNotification();
9701 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9702 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9703 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9704 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9706 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9707 application.SendNotification();
9708 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9709 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9710 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9711 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9713 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9714 application.SendNotification();
9715 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9716 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9717 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9718 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9720 // We did expect the animation to finish
9722 finishCheck.CheckSignalReceived();
9726 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9728 TestApplication application;
9730 float startValue(1.0f);
9731 Actor actor = Actor::New();
9732 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9733 Stage::GetCurrent().Add(actor);
9735 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9736 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9737 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9738 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9739 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9740 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9741 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9742 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9743 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9745 // Build the animation
9746 float durationSeconds(1.0f);
9748 Animation animation = Animation::New(durationSeconds);
9750 KeyFrames keyFrames = KeyFrames::New();
9751 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9752 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9753 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9755 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9757 // Start the animation
9760 bool signalReceived(false);
9761 AnimationFinishCheck finishCheck(signalReceived);
9762 animation.FinishedSignal().Connect(&application, finishCheck);
9763 application.SendNotification();
9765 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9766 application.SendNotification();
9767 finishCheck.CheckSignalNotReceived();
9768 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9769 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9770 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9771 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9773 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9774 application.SendNotification();
9775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9776 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9777 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9778 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9780 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9781 application.SendNotification();
9782 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9783 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9784 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9785 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9787 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9788 application.SendNotification();
9789 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9790 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9791 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9792 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9794 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9795 application.SendNotification();
9796 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9797 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9798 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9799 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9801 // We did expect the animation to finish
9803 finishCheck.CheckSignalReceived();
9807 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9809 TestApplication application;
9811 float startValue(1.0f);
9813 Actor actor = Actor::New();
9814 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9815 Stage::GetCurrent().Add(actor);
9817 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9818 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9819 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9820 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9821 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9822 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9823 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9824 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9825 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9827 // Build the animation
9828 float durationSeconds(1.0f);
9829 Animation animation = Animation::New(durationSeconds);
9831 KeyFrames keyFrames = KeyFrames::New();
9832 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9833 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9834 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9836 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9838 // Start the animation
9841 bool signalReceived(false);
9842 AnimationFinishCheck finishCheck(signalReceived);
9843 animation.FinishedSignal().Connect(&application, finishCheck);
9844 application.SendNotification();
9846 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9847 application.SendNotification();
9848 finishCheck.CheckSignalNotReceived();
9849 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9850 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9851 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9852 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9854 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9855 application.SendNotification();
9856 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9857 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9858 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9859 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9861 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9862 application.SendNotification();
9863 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9864 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9865 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9866 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9868 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9869 application.SendNotification();
9870 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9871 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9872 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9873 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9875 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9876 application.SendNotification();
9877 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9878 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9879 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9880 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9882 // We did expect the animation to finish
9884 finishCheck.CheckSignalReceived();
9888 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9890 TestApplication application;
9892 float startValue(1.0f);
9893 Actor actor = Actor::New();
9894 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9895 Stage::GetCurrent().Add(actor);
9897 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9898 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9899 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9900 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9901 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9902 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9903 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9904 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9905 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9908 // Build the animation
9909 float durationSeconds(1.0f);
9911 Animation animation = Animation::New(durationSeconds);
9913 KeyFrames keyFrames = KeyFrames::New();
9914 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9915 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9916 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9918 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9920 // Start the animation
9923 bool signalReceived(false);
9924 AnimationFinishCheck finishCheck(signalReceived);
9925 animation.FinishedSignal().Connect(&application, finishCheck);
9926 application.SendNotification();
9928 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9929 application.SendNotification();
9930 finishCheck.CheckSignalNotReceived();
9931 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9932 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9933 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9934 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9936 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9937 application.SendNotification();
9938 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9939 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9940 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9941 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9943 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9944 application.SendNotification();
9945 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9946 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9947 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9948 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9950 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9951 application.SendNotification();
9952 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9953 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9954 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9955 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9957 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9958 application.SendNotification();
9959 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9960 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9961 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9962 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9964 // We did expect the animation to finish
9966 finishCheck.CheckSignalReceived();
9970 int UtcDaliAnimationAnimateP(void)
9972 TestApplication application;
9974 Actor actor = Actor::New();
9975 Stage::GetCurrent().Add(actor);
9978 Vector3 position0( 30.0, 80.0, 0.0);
9979 Vector3 position1( 70.0, 120.0, 0.0);
9980 Vector3 position2( 100.0, 100.0, 0.0);
9982 Dali::Path path = Dali::Path::New();
9983 path.AddPoint(position0);
9984 path.AddPoint(position1);
9985 path.AddPoint(position2);
9987 //Control points for first segment
9988 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9989 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9991 //Control points for second segment
9992 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9993 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9995 // Build the animation
9996 float durationSeconds( 1.0f );
9997 Animation animation = Animation::New(durationSeconds);
9998 animation.Animate(actor, path, Vector3::XAXIS);
10000 // Start the animation
10003 bool signalReceived(false);
10004 AnimationFinishCheck finishCheck(signalReceived);
10005 animation.FinishedSignal().Connect(&application, finishCheck);
10006 application.SendNotification();
10007 application.Render(0);
10008 application.SendNotification();
10009 finishCheck.CheckSignalNotReceived();
10010 Vector3 position, tangent;
10011 Quaternion rotation;
10012 path.Sample( 0.0f, position, tangent );
10013 rotation = Quaternion( Vector3::XAXIS, tangent );
10014 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10015 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10017 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10018 application.SendNotification();
10019 path.Sample( 0.25f, position, tangent );
10020 rotation = Quaternion( Vector3::XAXIS, tangent );
10021 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10022 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10024 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10025 application.SendNotification();
10026 path.Sample( 0.5f, position, tangent );
10027 rotation = Quaternion( Vector3::XAXIS, tangent );
10028 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10029 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10031 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10032 application.SendNotification();
10033 path.Sample( 0.75f, position, tangent );
10034 rotation = Quaternion( Vector3::XAXIS, tangent );
10035 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10036 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10038 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10039 application.SendNotification();
10040 path.Sample( 1.0f, position, tangent );
10041 rotation = Quaternion( Vector3::XAXIS, tangent );
10042 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10043 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10045 finishCheck.CheckSignalReceived();
10049 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10051 TestApplication application;
10053 Actor actor = Actor::New();
10054 Stage::GetCurrent().Add(actor);
10057 Vector3 position0( 30.0, 80.0, 0.0);
10058 Vector3 position1( 70.0, 120.0, 0.0);
10059 Vector3 position2( 100.0, 100.0, 0.0);
10061 Dali::Path path = Dali::Path::New();
10062 path.AddPoint(position0);
10063 path.AddPoint(position1);
10064 path.AddPoint(position2);
10066 //Control points for first segment
10067 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10068 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10070 //Control points for second segment
10071 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10072 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10074 // Build the animation
10075 float durationSeconds( 1.0f );
10076 Animation animation = Animation::New(durationSeconds);
10077 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10079 // Start the animation
10082 bool signalReceived(false);
10083 AnimationFinishCheck finishCheck(signalReceived);
10084 animation.FinishedSignal().Connect(&application, finishCheck);
10085 application.SendNotification();
10086 application.Render(0);
10087 application.SendNotification();
10088 finishCheck.CheckSignalNotReceived();
10089 Vector3 position, tangent;
10090 Quaternion rotation;
10091 path.Sample( 0.0f, position, tangent );
10092 rotation = Quaternion( Vector3::XAXIS, tangent );
10093 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10094 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10096 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10097 application.SendNotification();
10098 path.Sample( 0.25f, position, tangent );
10099 rotation = Quaternion( Vector3::XAXIS, tangent );
10100 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10101 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10103 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10104 application.SendNotification();
10105 path.Sample( 0.5f, position, tangent );
10106 rotation = Quaternion( Vector3::XAXIS, tangent );
10107 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10108 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10110 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10111 application.SendNotification();
10112 path.Sample( 0.75f, position, tangent );
10113 rotation = Quaternion( Vector3::XAXIS, tangent );
10114 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10115 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10117 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10118 application.SendNotification();
10119 path.Sample( 1.0f, position, tangent );
10120 rotation = Quaternion( Vector3::XAXIS, tangent );
10121 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10122 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10124 finishCheck.CheckSignalReceived();
10128 int UtcDaliAnimationAnimateTimePeriodP(void)
10130 TestApplication application;
10132 Actor actor = Actor::New();
10133 Stage::GetCurrent().Add(actor);
10136 Vector3 position0( 30.0, 80.0, 0.0);
10137 Vector3 position1( 70.0, 120.0, 0.0);
10138 Vector3 position2( 100.0, 100.0, 0.0);
10140 Dali::Path path = Dali::Path::New();
10141 path.AddPoint(position0);
10142 path.AddPoint(position1);
10143 path.AddPoint(position2);
10145 //Control points for first segment
10146 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10147 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10149 //Control points for second segment
10150 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10151 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10153 // Build the animation
10154 float durationSeconds( 1.0f );
10155 Animation animation = Animation::New(durationSeconds);
10156 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10158 // Start the animation
10161 bool signalReceived(false);
10162 AnimationFinishCheck finishCheck(signalReceived);
10163 animation.FinishedSignal().Connect(&application, finishCheck);
10164 application.SendNotification();
10165 application.Render(0);
10166 application.SendNotification();
10167 finishCheck.CheckSignalNotReceived();
10168 Vector3 position, tangent;
10169 Quaternion rotation;
10170 path.Sample( 0.0f, position, tangent );
10171 rotation = Quaternion( Vector3::XAXIS, tangent );
10172 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10173 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10175 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10176 application.SendNotification();
10177 path.Sample( 0.25f, position, tangent );
10178 rotation = Quaternion( Vector3::XAXIS, tangent );
10179 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10180 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10182 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10183 application.SendNotification();
10184 path.Sample( 0.5f, position, tangent );
10185 rotation = Quaternion( Vector3::XAXIS, tangent );
10186 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10187 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10189 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10190 application.SendNotification();
10191 path.Sample( 0.75f, position, tangent );
10192 rotation = Quaternion( Vector3::XAXIS, tangent );
10193 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10194 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10196 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10197 application.SendNotification();
10198 path.Sample( 1.0f, position, tangent );
10199 rotation = Quaternion( Vector3::XAXIS, tangent );
10200 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10201 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10203 finishCheck.CheckSignalReceived();
10207 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10209 TestApplication application;
10211 Actor actor = Actor::New();
10212 Stage::GetCurrent().Add(actor);
10215 Vector3 position0( 30.0, 80.0, 0.0);
10216 Vector3 position1( 70.0, 120.0, 0.0);
10217 Vector3 position2( 100.0, 100.0, 0.0);
10219 Dali::Path path = Dali::Path::New();
10220 path.AddPoint(position0);
10221 path.AddPoint(position1);
10222 path.AddPoint(position2);
10224 //Control points for first segment
10225 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10226 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10228 //Control points for second segment
10229 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10230 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10232 // Build the animation
10233 float durationSeconds( 1.0f );
10234 Animation animation = Animation::New(durationSeconds);
10235 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10237 // Start the animation
10240 bool signalReceived(false);
10241 AnimationFinishCheck finishCheck(signalReceived);
10242 animation.FinishedSignal().Connect(&application, finishCheck);
10243 application.SendNotification();
10244 application.Render(0);
10245 application.SendNotification();
10246 finishCheck.CheckSignalNotReceived();
10247 Vector3 position, tangent;
10248 Quaternion rotation;
10249 path.Sample( 0.0f, position, tangent );
10250 rotation = Quaternion( Vector3::XAXIS, tangent );
10251 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10252 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10254 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10255 application.SendNotification();
10256 path.Sample( 0.25f, position, tangent );
10257 rotation = Quaternion( Vector3::XAXIS, tangent );
10258 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10259 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10261 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10262 application.SendNotification();
10263 path.Sample( 0.5f, position, tangent );
10264 rotation = Quaternion( Vector3::XAXIS, tangent );
10265 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10266 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10268 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10269 application.SendNotification();
10270 path.Sample( 0.75f, position, tangent );
10271 rotation = Quaternion( Vector3::XAXIS, tangent );
10272 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10273 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10275 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10276 application.SendNotification();
10277 path.Sample( 1.0f, position, tangent );
10278 rotation = Quaternion( Vector3::XAXIS, tangent );
10279 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10280 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10282 finishCheck.CheckSignalReceived();
10286 int UtcDaliAnimationShowP(void)
10288 TestApplication application;
10290 Actor actor = Actor::New();
10291 actor.SetVisible(false);
10292 application.SendNotification();
10293 application.Render(0);
10294 DALI_TEST_CHECK( !actor.IsVisible() );
10295 Stage::GetCurrent().Add(actor);
10297 // Start the animation
10298 float durationSeconds(10.0f);
10299 Animation animation = Animation::New(durationSeconds);
10300 animation.Show(actor, durationSeconds*0.5f);
10303 bool signalReceived(false);
10304 AnimationFinishCheck finishCheck(signalReceived);
10305 animation.FinishedSignal().Connect(&application, finishCheck);
10307 application.SendNotification();
10308 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10310 // We didn't expect the animation to finish yet
10311 application.SendNotification();
10312 finishCheck.CheckSignalNotReceived();
10313 DALI_TEST_CHECK( !actor.IsVisible() );
10315 application.SendNotification();
10316 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
10318 // We didn't expect the animation to finish yet
10319 application.SendNotification();
10320 finishCheck.CheckSignalNotReceived();
10321 DALI_TEST_CHECK( actor.IsVisible() );
10323 application.SendNotification();
10324 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10326 // We did expect the animation to finish
10327 application.SendNotification();
10328 finishCheck.CheckSignalReceived();
10329 DALI_TEST_CHECK( actor.IsVisible() );
10333 int UtcDaliAnimationHideP(void)
10335 TestApplication application;
10337 Actor actor = Actor::New();
10338 DALI_TEST_CHECK( actor.IsVisible() );
10339 Stage::GetCurrent().Add(actor);
10341 // Start the animation
10342 float durationSeconds(10.0f);
10343 Animation animation = Animation::New(durationSeconds);
10344 animation.Hide(actor, durationSeconds*0.5f);
10347 bool signalReceived(false);
10348 AnimationFinishCheck finishCheck(signalReceived);
10349 animation.FinishedSignal().Connect(&application, finishCheck);
10351 application.SendNotification();
10352 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10354 // We didn't expect the animation to finish yet
10355 application.SendNotification();
10356 finishCheck.CheckSignalNotReceived();
10357 DALI_TEST_CHECK( actor.IsVisible() );
10359 application.SendNotification();
10360 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
10362 // We didn't expect the animation to finish yet
10363 application.SendNotification();
10364 finishCheck.CheckSignalNotReceived();
10365 DALI_TEST_CHECK( !actor.IsVisible() );
10367 application.SendNotification();
10368 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10370 // We did expect the animation to finish
10371 application.SendNotification();
10372 finishCheck.CheckSignalReceived();
10373 DALI_TEST_CHECK( !actor.IsVisible() );
10377 int UtcDaliAnimationShowHideAtEndP(void)
10379 // Test that show/hide delay can be the same as animation duration
10380 // i.e. to show/hide at the end of the animation
10382 TestApplication application;
10384 Actor actor = Actor::New();
10385 DALI_TEST_CHECK( actor.IsVisible() );
10386 Stage::GetCurrent().Add(actor);
10388 // Start Hide animation
10389 float durationSeconds(10.0f);
10390 Animation animation = Animation::New(durationSeconds);
10391 animation.Hide(actor, durationSeconds/*Hide at end*/);
10394 bool signalReceived(false);
10395 AnimationFinishCheck finishCheck(signalReceived);
10396 animation.FinishedSignal().Connect(&application, finishCheck);
10398 application.SendNotification();
10399 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10401 // We did expect the animation to finish
10402 application.SendNotification();
10403 finishCheck.CheckSignalReceived();
10404 DALI_TEST_CHECK( !actor.IsVisible() );
10406 // Start Show animation
10407 animation = Animation::New(durationSeconds);
10408 animation.Show(actor, durationSeconds/*Show at end*/);
10409 animation.FinishedSignal().Connect(&application, finishCheck);
10412 application.SendNotification();
10413 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10415 // We did expect the animation to finish
10416 application.SendNotification();
10417 finishCheck.CheckSignalReceived();
10418 DALI_TEST_CHECK( actor.IsVisible() );
10422 int UtcDaliKeyFramesCreateDestroyP(void)
10424 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10426 KeyFrames* keyFrames = new KeyFrames;
10428 DALI_TEST_CHECK( true );
10432 int UtcDaliKeyFramesDownCastP(void)
10434 TestApplication application;
10435 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10437 KeyFrames keyFrames = KeyFrames::New();
10438 BaseHandle object(keyFrames);
10440 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10441 DALI_TEST_CHECK(keyFrames2);
10443 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10444 DALI_TEST_CHECK(keyFrames3);
10446 BaseHandle unInitializedObject;
10447 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10448 DALI_TEST_CHECK(!keyFrames4);
10450 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10451 DALI_TEST_CHECK(!keyFrames5);
10455 int UtcDaliAnimationCreateDestroyP(void)
10457 TestApplication application;
10458 Animation* animation = new Animation;
10459 DALI_TEST_CHECK( animation );
10464 struct UpdateManagerTestConstraint
10466 UpdateManagerTestConstraint(TestApplication& application)
10467 : mApplication(application)
10471 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10473 mApplication.SendNotification(); // Process events
10476 TestApplication& mApplication;
10479 int UtcDaliAnimationUpdateManagerP(void)
10481 TestApplication application;
10483 Actor actor = Actor::New();
10484 Stage::GetCurrent().Add( actor );
10486 // Build the animation
10487 Animation animation = Animation::New( 0.0f );
10489 bool signalReceived = false;
10490 AnimationFinishCheck finishCheck( signalReceived );
10491 animation.FinishedSignal().Connect( &application, finishCheck );
10493 Vector3 startValue(1.0f, 1.0f, 1.0f);
10494 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10495 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10496 constraint.Apply();
10498 // Apply animation to actor
10499 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10500 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10504 application.SendNotification();
10505 application.UpdateOnly( 16 );
10507 finishCheck.CheckSignalNotReceived();
10509 application.SendNotification(); // Process events
10511 finishCheck.CheckSignalReceived();
10516 int UtcDaliAnimationSignalOrderP(void)
10518 TestApplication application;
10520 Actor actor = Actor::New();
10521 Stage::GetCurrent().Add( actor );
10523 // Build the animations
10524 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10525 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10527 bool signal1Received = false;
10528 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10530 bool signal2Received = false;
10531 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10533 // Apply animations to actor
10534 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10536 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10539 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10540 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10542 application.SendNotification();
10543 application.UpdateOnly( 10 ); // 10ms progress
10545 // no notifications yet
10546 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10547 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10549 application.SendNotification();
10552 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10553 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10554 signal1Received = false;
10556 // 1st animation is complete now, do another update with no ProcessEvents in between
10557 application.UpdateOnly( 20 ); // 20ms progress
10560 application.SendNotification();
10562 // 2nd should complete now
10563 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10564 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10569 int UtcDaliAnimationExtendDurationP(void)
10571 TestApplication application;
10573 Actor actor = Actor::New();
10575 // Register a float property
10576 float startValue(10.0f);
10577 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10578 Stage::GetCurrent().Add(actor);
10579 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10580 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10582 // Build the animation
10583 float initialDurationSeconds(1.0f);
10584 float animatorDelay = 5.0f;
10585 float animatorDurationSeconds(5.0f);
10586 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10587 Animation animation = Animation::New(initialDurationSeconds);
10588 float targetValue(30.0f);
10589 float relativeValue(targetValue - startValue);
10591 animation.AnimateTo(Property(actor, index),
10593 TimePeriod(animatorDelay, animatorDurationSeconds));
10595 // The duration should have been extended
10596 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10598 // Start the animation
10601 bool signalReceived(false);
10602 AnimationFinishCheck finishCheck(signalReceived);
10603 animation.FinishedSignal().Connect(&application, finishCheck);
10605 application.SendNotification();
10606 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10608 // We didn't expect the animation to finish yet, but cached value should be the final one
10609 application.SendNotification();
10610 finishCheck.CheckSignalNotReceived();
10611 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10612 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10614 application.SendNotification();
10615 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10617 // We didn't expect the animation to finish yet
10618 application.SendNotification();
10619 finishCheck.CheckSignalNotReceived();
10620 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10622 application.SendNotification();
10623 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10625 // We did expect the animation to finish
10626 application.SendNotification();
10627 finishCheck.CheckSignalReceived();
10628 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10629 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10633 int UtcDaliAnimationCustomIntProperty(void)
10635 TestApplication application;
10637 Actor actor = Actor::New();
10638 Stage::GetCurrent().Add(actor);
10639 int startValue(0u);
10641 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10642 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10643 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10645 // Build the animation
10646 float durationSeconds(1.0f);
10647 Animation animation = Animation::New(durationSeconds);
10648 animation.AnimateTo( Property(actor, index), 20 );
10650 // Start the animation
10653 // Target value should be retrievable straight away
10654 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10656 bool signalReceived(false);
10657 AnimationFinishCheck finishCheck(signalReceived);
10658 animation.FinishedSignal().Connect(&application, finishCheck);
10660 application.SendNotification();
10661 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10663 // We didn't expect the animation to finish yet
10664 application.SendNotification();
10665 finishCheck.CheckSignalNotReceived();
10666 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10668 application.SendNotification();
10669 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10671 // We did expect the animation to finish
10672 application.SendNotification();
10673 finishCheck.CheckSignalReceived();
10674 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10675 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10679 int UtcDaliAnimationDuration(void)
10681 TestApplication application;
10683 Actor actor = Actor::New();
10684 Stage::GetCurrent().Add(actor);
10686 Animation animation = Animation::New( 0.0f );
10687 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10689 // The animation duration should automatically increase depending on the animator time period
10691 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10692 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10694 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10695 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10700 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10702 TestApplication application;
10704 Actor actor = Actor::New();
10706 // Register an integer property
10708 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10709 Stage::GetCurrent().Add(actor);
10710 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10714 // Build the animation
10715 Animation animation = Animation::New( 2.0f );
10716 std::string relativeValue = "relative string";
10717 animation.AnimateBy( Property(actor, index), relativeValue );
10718 tet_result(TET_FAIL);
10720 catch ( Dali::DaliException& e )
10722 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10730 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10732 TestApplication application;
10734 Actor actor = Actor::New();
10736 // Register an integer property
10738 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10739 Stage::GetCurrent().Add(actor);
10740 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10744 // Build the animation
10745 Animation animation = Animation::New( 2.0f );
10746 std::string relativeValue = "relative string";
10747 animation.AnimateTo( Property(actor, index), relativeValue );
10749 tet_result(TET_FAIL);
10751 catch ( Dali::DaliException& e )
10753 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10759 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10761 TestApplication application;
10763 Actor actor = Actor::New();
10765 // Register an integer property
10767 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10768 Stage::GetCurrent().Add(actor);
10769 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10773 // Build the animation
10774 KeyFrames keyFrames = KeyFrames::New();
10775 keyFrames.Add( 0.0f, std::string("relative string1") );
10776 keyFrames.Add( 1.0f, std::string("relative string2") );
10777 // no need to really create the animation as keyframes do the check
10779 tet_result(TET_FAIL);
10781 catch ( Dali::DaliException& e )
10783 DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );
10789 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10791 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10793 TestApplication application;
10795 tet_infoline("Set initial position and set up animation to re-position actor");
10797 Actor actor = Actor::New();
10798 Stage::GetCurrent().Add(actor);
10799 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10800 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10802 // Build the animation
10803 Animation animation = Animation::New(2.0f);
10805 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10806 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10807 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10809 tet_infoline("Set target position in animation without intiating play");
10811 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10812 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10814 application.SendNotification();
10815 application.Render();
10817 tet_infoline("Ensure position of actor is still at intial value");
10819 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10820 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10821 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10823 tet_infoline("Play animation and ensure actor position is now target");
10826 application.SendNotification();
10827 application.Render(1000u);
10829 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10831 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10832 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10833 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10835 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10837 application.Render(2000u);
10839 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10841 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10842 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10843 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10848 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10850 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10852 TestApplication application;
10854 std::vector<Vector3> targetPositions;
10856 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10857 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10858 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10860 tet_infoline("Set initial position and set up animation to re-position actor");
10862 Actor actor = Actor::New();
10863 Stage::GetCurrent().Add(actor);
10864 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10865 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10867 // Build the animation
10868 Animation animation = Animation::New(2.0f);
10870 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10871 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10872 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10874 tet_infoline("Set target position in animation without intiating play");
10876 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
10878 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
10881 application.SendNotification();
10882 application.Render();
10884 tet_infoline("Ensure position of actor is still at intial value");
10886 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10887 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10888 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10890 tet_infoline("Play animation and ensure actor position is now target");
10893 application.SendNotification();
10894 application.Render(1000u);
10896 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10898 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10899 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10900 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10902 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10904 application.Render(2000u);
10906 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10908 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10909 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10910 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10915 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
10917 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");
10919 TestApplication application;
10921 std::vector<Vector3> targetSizes;
10922 std::vector<Vector3> targetPositions;
10924 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10925 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10927 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10929 tet_infoline("Set initial position and set up animation to re-position actor");
10931 Actor actor = Actor::New();
10932 Stage::GetCurrent().Add(actor);
10933 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
10934 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
10936 actor.SetProperty( Actor::Property::SIZE, initialSize );
10937 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10939 // Build the animation
10940 Animation animation = Animation::New(2.0f);
10942 tet_infoline("Set target size in animation without intiating play");
10943 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10944 tet_infoline("Set target position in animation without intiating play");
10945 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
10946 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10948 application.SendNotification();
10949 application.Render();
10951 tet_infoline("Ensure position of actor is still at intial size and position");
10953 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10954 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10955 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10957 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
10958 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
10959 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
10961 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10964 application.SendNotification();
10965 application.Render(2000u);
10967 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10969 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10970 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10971 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10973 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
10974 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
10975 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
10980 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
10982 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
10984 TestApplication application;
10986 std::vector<Vector3> targetSizes;
10987 std::vector<float> targetColors;
10989 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10990 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
10992 targetColors.push_back( 1.0f );
10994 tet_infoline("Set initial position and set up animation to re-position actor");
10996 Actor actor = Actor::New();
10997 Stage::GetCurrent().Add(actor);
10998 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
11000 actor.SetProperty( Actor::Property::SIZE, initialSize );
11002 // Build the animation
11003 Animation animation = Animation::New(2.0f);
11005 tet_infoline("Set target size in animation without initiating play");
11006 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11007 tet_infoline("Set target position in animation without intiating play");
11008 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11009 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11011 application.SendNotification();
11012 application.Render();
11014 tet_infoline("Ensure position of actor is still at initial size and position");
11016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11017 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11018 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11020 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11023 application.SendNotification();
11024 application.Render(2000u);
11026 tet_infoline("Ensure position and size of actor is at target value when animation playing");
11028 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11029 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11030 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11032 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
11037 int UtcDaliAnimationTimePeriodOrder(void)
11039 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
11041 TestApplication application;
11043 Actor actor = Actor::New();
11044 Stage::GetCurrent().Add( actor );
11046 application.SendNotification();
11047 application.Render();
11049 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11050 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11051 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11052 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11053 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11055 //////////////////////////////////////////////////////////////////////////////////
11057 tet_infoline( "With two AnimateTo calls" );
11059 Animation animation = Animation::New( 0.0f );
11060 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11061 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11064 tet_infoline( "The target position should change instantly" );
11065 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11066 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11068 application.SendNotification();
11069 application.Render(5000); // After the animation is complete
11071 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11072 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11073 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11075 //////////////////////////////////////////////////////////////////////////////////
11077 tet_infoline( "Same animation again but in a different order - should yield the same result" );
11079 actor.SetX( 0.0f );
11080 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11081 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11083 application.SendNotification();
11084 application.Render();
11086 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11087 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11088 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11090 animation = Animation::New( 0.0f );
11091 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11092 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11095 tet_infoline( "The target position should change instantly" );
11096 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11097 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11099 application.SendNotification();
11100 application.Render(5000); // After the animation is complete
11102 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11103 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11104 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11109 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11111 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" );
11113 TestApplication application;
11115 Actor actor = Actor::New();
11116 Stage::GetCurrent().Add( actor );
11118 application.SendNotification();
11119 application.Render();
11121 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11122 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11123 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11124 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11125 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11127 //////////////////////////////////////////////////////////////////////////////////
11129 tet_infoline( "" );
11131 Animation animation = Animation::New( 0.0f );
11132 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11133 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11134 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11135 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11136 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11137 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11140 tet_infoline( "The target position should change instantly" );
11141 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11142 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11144 application.SendNotification();
11145 application.Render(14000); // After the animation is complete
11147 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11148 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11149 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11151 //////////////////////////////////////////////////////////////////////////////////
11153 tet_infoline( "Same animation again but in a different order - should end up at the same point" );
11155 actor.SetX( 0.0f );
11157 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11158 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11160 application.SendNotification();
11161 application.Render();
11163 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11164 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11165 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11167 animation = Animation::New( 0.0f );
11168 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11169 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11170 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11171 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11172 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11173 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11176 tet_infoline( "The target position should change instantly" );
11177 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11178 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11180 application.SendNotification();
11181 application.Render(14000); // After the animation is complete
11183 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11184 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11185 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11190 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11192 TestApplication application;
11195 Actor actor = Actor::New();
11196 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11197 Stage::GetCurrent().Add(actor);
11199 application.Render();
11200 application.SendNotification();
11202 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
11204 // Build the animation
11205 float durationSeconds(1.0f);
11206 Animation animation = Animation::New(durationSeconds);
11208 KeyFrames keyFrames = KeyFrames::New();
11209 keyFrames.Add(0.0f, 10);
11210 keyFrames.Add(0.2f, 20);
11211 keyFrames.Add(0.4f, 30);
11212 keyFrames.Add(0.6f, 40);
11213 keyFrames.Add(0.8f, 50);
11214 keyFrames.Add(1.0f, 60);
11216 animation.AnimateBetween( Property(actor, index ), keyFrames );
11218 // Start the animation
11221 // Target value should change to the last key-frame's value straight away
11222 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
11227 int UtcDaliAnimationAnimateBetweenVector2P(void)
11229 TestApplication application;
11231 Vector2 startValue( 10.0f, 20.0f );
11232 Actor actor = Actor::New();
11233 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11234 Stage::GetCurrent().Add(actor);
11236 application.Render();
11237 application.SendNotification();
11239 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
11241 // Build the animation
11242 float durationSeconds(1.0f);
11243 Animation animation = Animation::New(durationSeconds);
11245 KeyFrames keyFrames = KeyFrames::New();
11246 keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
11247 keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
11248 keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
11249 keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
11250 keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
11251 keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
11253 animation.AnimateBetween( Property(actor, index ), keyFrames );
11255 // Start the animation
11258 // Target value should change to the last key-frame's value straight away
11259 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );
11264 int UtcDaliAnimationProgressCallbackP(void)
11266 TestApplication application;
11268 Actor actor = Actor::New();
11269 Stage::GetCurrent().Add(actor);
11271 // Build the animation
11272 Animation animation = Animation::New(0.0f);
11275 float durationSeconds(1.0f);
11276 animation.SetDuration(durationSeconds);
11278 bool finishedSignalReceived(false);
11279 bool progressSignalReceived(false);
11281 AnimationFinishCheck finishCheck(finishedSignalReceived);
11282 animation.FinishedSignal().Connect(&application, finishCheck);
11284 AnimationProgressCheck progressCheck(progressSignalReceived);
11285 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
11286 application.SendNotification();
11288 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11289 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11291 tet_infoline( "Animation Progress notification set to 30%" );
11292 DevelAnimation::SetProgressNotification( animation, 0.3f );
11294 application.SendNotification();
11295 application.Render( );
11297 DALI_TEST_EQUALS( 0.3f, DevelAnimation::GetProgressNotification( animation ), TEST_LOCATION );
11299 progressCheck.CheckSignalNotReceived();
11301 // Start the animation from 10% progress
11302 animation.SetCurrentProgress( 0.1f );
11305 tet_infoline( "Animation Playing from 10%" );
11307 application.SendNotification();
11308 application.Render(0); // start animation
11309 application.Render(durationSeconds*100.0f ); // 20% progress
11311 tet_infoline( "Animation at 20%" );
11313 progressCheck.CheckSignalNotReceived();
11315 application.SendNotification();
11316 application.Render(durationSeconds*200.0f ); // 40% progress
11317 application.SendNotification();
11318 tet_infoline( "Animation at 40%" );
11319 DALI_TEST_EQUALS( 0.4f, animation.GetCurrentProgress(), TEST_LOCATION );
11321 progressCheck.CheckSignalReceived();
11323 tet_infoline( "Progress check reset" );
11324 progressCheck.Reset();
11326 application.Render(durationSeconds*100.0f ); // 50% progress
11327 tet_infoline( "Animation at 50%" );
11328 application.SendNotification();
11330 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
11332 progressCheck.CheckSignalNotReceived();
11334 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
11335 application.SendNotification();
11337 tet_infoline( "Animation at 60%" );
11339 finishCheck.CheckSignalNotReceived();
11341 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
11342 application.SendNotification();
11343 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
11344 tet_infoline( "Animation at 80%" );
11346 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
11347 // We did expect the animation to finish
11348 application.SendNotification();
11349 finishCheck.CheckSignalReceived();
11350 tet_infoline( "Animation finished" );
11351 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11356 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
11358 TestApplication application;
11360 tet_infoline( "Connect to ProgressReachedSignal but do not set a required Progress marker" );
11362 Actor actor = Actor::New();
11363 Stage::GetCurrent().Add(actor);
11365 // Build the animation
11366 Animation animation = Animation::New(0.0f);
11369 float durationSeconds(1.0f);
11370 animation.SetDuration(durationSeconds);
11372 bool finishedSignalReceived(false);
11373 bool progressSignalReceived(false);
11375 AnimationFinishCheck finishCheck(finishedSignalReceived);
11376 animation.FinishedSignal().Connect(&application, finishCheck);
11378 AnimationProgressCheck progressCheck( progressSignalReceived );
11379 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
11380 application.SendNotification();
11382 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11383 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11385 progressCheck.CheckSignalNotReceived();
11389 application.SendNotification();
11390 application.Render(0); // start animation
11391 application.Render(durationSeconds*100.0f ); // 10% progress
11392 application.SendNotification();
11394 tet_infoline( "Ensure after animation has started playing that ProgressReachedSignal not emitted" );
11395 progressCheck.CheckSignalNotReceived();
11397 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
11399 application.SendNotification();
11400 finishCheck.CheckSignalReceived();
11401 tet_infoline( "Animation finished" );
11402 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11407 int UtcDaliAnimationMultipleProgressSignalsP(void)
11409 tet_infoline( "Multiple animations with different progress markers" );
11411 TestApplication application;
11413 Actor actor = Actor::New();
11414 Stage::GetCurrent().Add(actor);
11416 // Build the animation
11417 Animation animationAlpha = Animation::New(0.0f);
11418 Animation animationBeta = Animation::New(0.0f);
11421 float durationSeconds(1.0f);
11422 animationAlpha.SetDuration(durationSeconds);
11423 animationBeta.SetDuration(durationSeconds);
11425 bool progressSignalReceivedAlpha(false);
11426 bool progressSignalReceivedBeta(false);
11428 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
11429 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
11431 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
11432 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
11433 application.SendNotification();
11435 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11436 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11437 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11439 tet_infoline( "AnimationAlpha Progress notification set to 30%" );
11440 DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
11442 tet_infoline( "AnimationBeta Progress notification set to 50%" );
11443 DevelAnimation::SetProgressNotification( animationBeta, 0.5f );
11445 application.SendNotification();
11446 application.Render( );
11448 progressCheckAlpha.CheckSignalNotReceived();
11449 progressCheckBeta.CheckSignalNotReceived();
11451 // Start the animations from 10% progress
11452 animationAlpha.SetCurrentProgress( 0.1f );
11453 animationBeta.SetCurrentProgress( 0.1f );
11454 animationAlpha.Play();
11455 animationBeta.Play();
11457 tet_infoline( "Animation Playing from 10%" );
11459 application.SendNotification();
11460 application.Render(0); // start animation
11461 application.Render(durationSeconds*100.0f ); // 20% progress
11463 tet_infoline( "Animation at 20% - No signals to be received" );
11465 progressCheckAlpha.CheckSignalNotReceived();
11466 progressCheckBeta.CheckSignalNotReceived();
11468 application.SendNotification();
11469 application.Render(durationSeconds*200.0f ); // 40% progress
11470 application.SendNotification();
11471 tet_infoline( "Animation at 40% - Alpha signal should be received" );
11472 DALI_TEST_EQUALS( 0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
11474 progressCheckAlpha.CheckSignalReceived();
11475 progressCheckBeta.CheckSignalNotReceived();
11477 tet_infoline( "Progress check reset" );
11478 progressCheckAlpha.Reset();
11479 progressCheckBeta.Reset();
11481 application.Render(durationSeconds*100.0f ); // 50% progress
11482 tet_infoline( "Animation at 50% - Beta should receive signal, Alpha should not" );
11483 application.SendNotification();
11485 DALI_TEST_EQUALS( 0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
11487 progressCheckAlpha.CheckSignalNotReceived();
11488 progressCheckBeta.CheckSignalReceived();
11489 tet_infoline( "Progress check reset" );
11490 progressCheckAlpha.Reset();
11491 progressCheckBeta.Reset();
11493 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
11494 application.SendNotification();
11496 tet_infoline( "Animation at 60%" );
11498 progressCheckAlpha.CheckSignalNotReceived();
11499 progressCheckBeta.CheckSignalNotReceived();
11501 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
11502 application.SendNotification();
11503 tet_infoline( "Animation at 80%" );
11505 progressCheckAlpha.CheckSignalNotReceived();
11506 progressCheckBeta.CheckSignalNotReceived();
11508 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
11509 // We did expect the animation to finish
11510 tet_infoline( "Animation finished" );
11516 int UtcDaliAnimationProgressCallbackLongDurationP(void)
11518 TestApplication application;
11520 Actor actor = Actor::New();
11521 Stage::GetCurrent().Add(actor);
11523 // Build the animation
11524 Animation animation = Animation::New(0.0f);
11527 float durationSeconds(5.0f);
11528 animation.SetDuration(durationSeconds);
11530 bool finishedSignalReceived(false);
11531 bool progressSignalReceived(false);
11533 AnimationFinishCheck finishCheck(finishedSignalReceived);
11534 animation.FinishedSignal().Connect(&application, finishCheck);
11536 AnimationProgressCheck progressCheck(progressSignalReceived);
11537 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
11538 application.SendNotification();
11540 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11541 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11543 tet_infoline( "Animation Progress notification set to 50%" );
11544 DevelAnimation::SetProgressNotification( animation, 0.5f );
11546 application.SendNotification();
11547 application.Render( );
11549 progressCheck.CheckSignalNotReceived();
11553 application.SendNotification();
11554 application.Render(0); // start animation
11555 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
11556 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
11558 tet_infoline( "Animation at 25%" );
11560 progressCheck.CheckSignalNotReceived();
11562 application.SendNotification();
11563 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
11564 application.SendNotification();
11565 tet_infoline( "Animation at 50%" );
11566 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
11568 progressCheck.CheckSignalReceived();
11570 tet_infoline( "Progress check reset" );
11571 progressCheck.Reset();
11573 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
11574 tet_infoline( "Animation at 75%" );
11575 application.SendNotification();
11577 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
11579 progressCheck.CheckSignalNotReceived();