2 * Copyright (c) 2019 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;
45 static const float VECTOR3_EPSILON = 0.0001f;
47 // Functor to test whether a Finish signal is emitted
48 struct AnimationFinishCheck
50 AnimationFinishCheck(bool& signalReceived)
51 : mSignalReceived(signalReceived)
55 void operator()(Animation& animation)
57 mSignalReceived = true;
62 mSignalReceived = false;
65 void CheckSignalReceived()
69 tet_printf("Expected Finish signal was not received\n");
78 void CheckSignalNotReceived()
82 tet_printf("Unexpected Finish signal was received\n");
91 bool& mSignalReceived; // owned by individual tests
94 // Functor to test whether a Progress signal is emitted
95 struct AnimationProgressCheck
97 AnimationProgressCheck(bool& signalReceived, std::string name = " ")
98 : mSignalReceived(signalReceived),
103 void operator()(Animation& animation)
105 mSignalReceived = true;
110 mSignalReceived = false;
113 void CheckSignalReceived()
115 if (!mSignalReceived)
117 tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str() );
118 tet_result(TET_FAIL);
122 tet_result(TET_PASS);
126 void CheckSignalNotReceived()
130 tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
131 tet_result(TET_FAIL);
135 tet_result(TET_PASS);
139 bool& mSignalReceived; // owned by individual tests
145 int UtcDaliAnimationConstructorP(void)
147 TestApplication application;
151 DALI_TEST_CHECK( !animation );
155 int UtcDaliAnimationNewP(void)
157 TestApplication application;
159 Animation animation = Animation::New( 1.0f );
161 DALI_TEST_CHECK(animation);
165 int UtcDaliAnimationNewN(void)
167 TestApplication application;
169 Animation animation = Animation::New( -1.0f );
171 DALI_TEST_CHECK(animation);
172 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
176 int UtcDaliAnimationDownCastP(void)
178 TestApplication application;
180 tet_infoline("Testing Dali::Animation::DownCast()");
182 float durationSeconds(1.0f);
183 Animation animation = Animation::New(durationSeconds);
185 BaseHandle object(animation);
187 Animation animation2 = Animation::DownCast(object);
188 DALI_TEST_CHECK(animation2);
190 Animation animation3 = DownCast< Animation >(object);
191 DALI_TEST_CHECK(animation3);
195 int UtcDaliAnimationDownCastN(void)
197 TestApplication application;
199 BaseHandle unInitializedObject;
201 Animation animation1 = Animation::DownCast( unInitializedObject );
202 DALI_TEST_CHECK( !animation1 );
204 Animation animation2 = DownCast< Animation >( unInitializedObject );
205 DALI_TEST_CHECK( !animation2 );
209 int UtcDaliAnimationCopyConstructorP(void)
211 TestApplication application;
213 // Initialize an object, ref count == 1
214 Animation animation = Animation::New( 1.0f );
216 Animation copy( animation );
217 DALI_TEST_CHECK( copy );
219 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
223 int UtcDaliAnimationAssignmentOperatorP(void)
225 TestApplication application;
227 Animation animation = Animation::New( 1.0f );
229 Animation copy = animation;
230 DALI_TEST_CHECK( copy );
232 DALI_TEST_CHECK( animation == copy );
234 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
238 int UtcDaliAnimationSetDurationP(void)
240 TestApplication application;
242 Actor actor = Actor::New();
243 Stage::GetCurrent().Add(actor);
245 // Build the animation
246 float durationSeconds(1.0f);
247 Animation animation = Animation::New(durationSeconds);
248 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
250 // Start the animation
251 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
252 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
255 bool signalReceived(false);
256 AnimationFinishCheck finishCheck(signalReceived);
257 animation.FinishedSignal().Connect(&application, finishCheck);
259 application.SendNotification();
260 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
262 // We didn't expect the animation to finish yet
263 application.SendNotification();
264 finishCheck.CheckSignalNotReceived();
266 application.Render(2u/*just beyond the animation duration*/);
268 // We did expect the animation to finish
269 application.SendNotification();
270 finishCheck.CheckSignalReceived();
271 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
273 // Restart the animation, with a different duration
275 actor.SetPosition(Vector3::ZERO);
276 durationSeconds = 3.5f;
277 animation.SetDuration(durationSeconds);
278 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
281 application.SendNotification();
282 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
284 // We didn't expect the animation to finish yet
285 application.SendNotification();
286 finishCheck.CheckSignalNotReceived();
288 application.Render(2u/*just beyond the animation duration*/);
290 // We did expect the animation to finish
291 application.SendNotification();
292 finishCheck.CheckSignalReceived();
293 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
295 // Check that nothing has changed after a couple of buffer swaps
296 application.Render(0);
297 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
298 application.Render(0);
299 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
303 int UtcDaliAnimationSetDurationN(void)
305 TestApplication application;
307 Animation animation = Animation::New( 1.0f );
308 DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
310 animation.SetDuration( -1.0f );
311 DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
315 int UtcDaliAnimationGetDurationP(void)
317 TestApplication application;
319 Animation animation = Animation::New(1.0f);
320 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
322 animation.SetDuration(2.0f);
323 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
327 int UtcDaliAnimationSetLoopingP(void)
329 TestApplication application;
331 Actor actor = Actor::New();
332 Stage::GetCurrent().Add(actor);
334 // Build the animation
335 float durationSeconds(1.0f);
336 Animation animation = Animation::New(durationSeconds);
337 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
338 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
340 // Start the animation
341 animation.SetLooping(true);
342 DALI_TEST_CHECK(animation.IsLooping());
345 bool signalReceived(false);
346 AnimationFinishCheck finishCheck(signalReceived);
347 animation.FinishedSignal().Connect(&application, finishCheck);
349 application.SendNotification();
352 float intervalSeconds = 0.25f;
353 float progress = 0.0f;
354 for (int iterations = 0; iterations < 5;)
356 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
358 progress += intervalSeconds;
359 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
361 if (progress >= 1.0f)
363 progress = progress - 1.0f;
368 // We didn't expect the animation to finish yet
369 application.SendNotification();
370 finishCheck.CheckSignalNotReceived();
372 animation.SetLooping(false);
373 DALI_TEST_CHECK(!animation.IsLooping());
375 application.SendNotification();
376 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
378 // We did expect the animation to finish
379 application.SendNotification();
380 finishCheck.CheckSignalReceived();
381 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
383 // Check that nothing has changed after a couple of buffer swaps
384 application.Render(0);
385 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
386 application.Render(0);
387 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
391 int UtcDaliAnimationSetLoopCountP(void)
393 TestApplication application;
395 Actor actor = Actor::New();
396 Stage::GetCurrent().Add(actor);
398 // Build the animation
399 float durationSeconds(1.0f);
400 Animation animation = Animation::New(durationSeconds);
401 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
402 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
404 // Start the animation
405 animation.SetLoopCount(3);
406 DALI_TEST_CHECK(animation.IsLooping());
409 bool signalReceived(false);
410 AnimationFinishCheck finishCheck(signalReceived);
411 animation.FinishedSignal().Connect(&application, finishCheck);
413 application.Render(0);
414 application.SendNotification();
415 application.Render(0);
416 application.SendNotification();
417 application.Render(0);
418 application.SendNotification();
419 application.Render(0);
420 application.SendNotification();
423 float intervalSeconds = 3.0f;
425 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
426 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
428 application.Render(0);
429 application.SendNotification();
430 application.Render(0);
431 application.SendNotification();
432 application.Render(0);
433 application.SendNotification();
434 application.Render(0);
435 application.SendNotification();
436 finishCheck.CheckSignalNotReceived();
438 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
440 application.SendNotification();
441 finishCheck.CheckSignalReceived();
442 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
446 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
447 application.SendNotification();
448 finishCheck.CheckSignalNotReceived();
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.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
454 application.SendNotification();
455 finishCheck.CheckSignalNotReceived();
460 int UtcDaliAnimationSetLoopCountP2(void)
462 TestApplication application;
465 // switching between forever and loop count
468 Actor actor = Actor::New();
469 Stage::GetCurrent().Add(actor);
471 // Build the animation
472 float durationSeconds(1.0f);
473 Animation animation = Animation::New(durationSeconds);
474 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
475 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
476 animation.SetEndAction(Animation::Discard);
478 // Start the animation
479 animation.SetLoopCount(3);
480 DALI_TEST_CHECK(animation.IsLooping());
483 bool signalReceived(false);
484 AnimationFinishCheck finishCheck(signalReceived);
485 animation.FinishedSignal().Connect(&application, finishCheck);
487 float intervalSeconds = 3.0f;
489 application.SendNotification();
490 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
491 application.SendNotification();
492 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
493 application.SendNotification();
494 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
495 application.SendNotification();
497 application.SendNotification();
498 finishCheck.CheckSignalReceived();
503 animation.SetLooping(true);
504 DALI_TEST_CHECK(animation.IsLooping());
506 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
507 application.SendNotification();
508 finishCheck.CheckSignalNotReceived();
510 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
511 application.SendNotification();
512 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
513 application.SendNotification();
514 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
515 application.SendNotification();
516 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
517 application.SendNotification();
518 application.SendNotification();
519 finishCheck.CheckSignalNotReceived();
524 animation.SetLoopCount(3);
525 DALI_TEST_CHECK(animation.IsLooping());
528 application.SendNotification();
529 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
530 application.SendNotification();
531 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
532 application.SendNotification();
533 finishCheck.CheckSignalNotReceived();
535 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
536 application.SendNotification();
537 finishCheck.CheckSignalReceived();
542 animation.SetLooping(true);
543 DALI_TEST_CHECK(animation.IsLooping());
545 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
546 application.SendNotification();
547 finishCheck.CheckSignalNotReceived();
549 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
550 application.SendNotification();
551 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
552 application.SendNotification();
553 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
554 application.SendNotification();
555 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
556 application.SendNotification();
557 finishCheck.CheckSignalNotReceived();
562 animation.SetLoopCount(3);
563 DALI_TEST_CHECK(animation.IsLooping());
565 application.SendNotification();
566 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
567 application.SendNotification();
568 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
569 application.SendNotification();
570 finishCheck.CheckSignalNotReceived();
572 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
573 application.SendNotification();
574 finishCheck.CheckSignalNotReceived(); // we never hit play
582 int UtcDaliAnimationSetLoopCountP3(void)
584 TestApplication application;
587 // switching between forever and loop count
589 Actor actor = Actor::New();
590 Stage::GetCurrent().Add(actor);
592 // Build the animation
593 float durationSeconds(1.0f);
594 Animation animation = Animation::New(durationSeconds);
595 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
596 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
597 animation.SetEndAction(Animation::Discard);
599 float intervalSeconds = 3.0f;
601 bool signalReceived(false);
602 AnimationFinishCheck finishCheck(signalReceived);
603 animation.FinishedSignal().Connect(&application, finishCheck);
606 animation.SetLooping(true);
607 DALI_TEST_CHECK(animation.IsLooping());
609 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
610 application.SendNotification();
611 finishCheck.CheckSignalNotReceived();
613 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
614 application.SendNotification();
615 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
616 application.SendNotification();
617 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
618 application.SendNotification();
619 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
620 application.SendNotification();
621 finishCheck.CheckSignalNotReceived();
626 animation.SetLoopCount(3);
627 DALI_TEST_CHECK(animation.IsLooping());
629 application.SendNotification();
630 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
631 application.SendNotification();
632 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
633 application.SendNotification();
634 finishCheck.CheckSignalNotReceived();
636 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
637 application.SendNotification();
638 finishCheck.CheckSignalNotReceived(); // we never hit play
646 int UtcDaliAnimationSetLoopCountP4(void)
648 TestApplication application;
653 Actor actor = Actor::New();
654 Stage::GetCurrent().Add(actor);
656 // Build the animation
657 float durationSeconds(1.0f);
658 Animation animation = Animation::New(durationSeconds);
659 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
660 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
661 animation.SetEndAction(Animation::Bake);
663 float intervalSeconds = 3.0f;
665 bool signalReceived(false);
666 AnimationFinishCheck finishCheck(signalReceived);
667 animation.FinishedSignal().Connect(&application, finishCheck);
669 animation.SetLoopCount(1);
671 DALI_TEST_CHECK(!animation.IsLooping());
673 application.SendNotification();
674 finishCheck.CheckSignalNotReceived();
675 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
676 application.SendNotification();
677 finishCheck.CheckSignalReceived();
679 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
680 actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
684 animation.Play(); // again
685 DALI_TEST_CHECK(!animation.IsLooping());
687 application.SendNotification();
688 finishCheck.CheckSignalNotReceived();
689 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
690 application.SendNotification();
691 finishCheck.CheckSignalReceived();
693 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
698 int UtcDaliAnimationGetLoopCountP(void)
700 TestApplication application;
702 Actor actor = Actor::New();
703 Stage::GetCurrent().Add(actor);
705 // Build the animation
706 float durationSeconds(1.0f);
707 Animation animation = Animation::New(durationSeconds);
708 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
709 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
711 DALI_TEST_CHECK(1 == animation.GetLoopCount());
713 // Start the animation
714 animation.SetLoopCount(3);
715 DALI_TEST_CHECK(animation.IsLooping());
716 DALI_TEST_CHECK(3 == animation.GetLoopCount());
720 application.Render(0);
721 application.SendNotification();
724 float intervalSeconds = 3.0f;
726 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
727 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
729 application.Render(0);
730 application.SendNotification();
732 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
733 application.SendNotification();
735 animation.SetLoopCount(0);
736 DALI_TEST_CHECK(animation.IsLooping());
737 DALI_TEST_CHECK(0 == animation.GetLoopCount());
739 animation.SetLoopCount(1);
740 DALI_TEST_CHECK(!animation.IsLooping());
741 DALI_TEST_CHECK(1 == animation.GetLoopCount());
747 int UtcDaliAnimationGetCurrentLoopP(void)
749 TestApplication application;
751 Actor actor = Actor::New();
752 Stage::GetCurrent().Add(actor);
754 // Build the animation
755 float durationSeconds(1.0f);
756 Animation animation = Animation::New(durationSeconds);
757 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
758 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
760 // Start the animation
761 animation.SetLoopCount(3);
762 DALI_TEST_CHECK(animation.IsLooping());
763 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
766 bool signalReceived(false);
767 AnimationFinishCheck finishCheck(signalReceived);
768 animation.FinishedSignal().Connect(&application, finishCheck);
770 application.SendNotification();
773 float intervalSeconds = 3.0f;
775 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
776 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
778 application.SendNotification();
779 finishCheck.CheckSignalNotReceived();
780 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
782 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
784 application.SendNotification();
785 finishCheck.CheckSignalReceived();
786 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
787 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
791 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
792 application.SendNotification();
793 finishCheck.CheckSignalNotReceived();
794 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
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.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
800 application.SendNotification();
801 finishCheck.CheckSignalNotReceived();
802 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
807 int UtcDaliAnimationIsLoopingP(void)
809 TestApplication application;
811 Animation animation = Animation::New(1.0f);
812 DALI_TEST_CHECK(!animation.IsLooping());
814 animation.SetLooping(true);
815 DALI_TEST_CHECK(animation.IsLooping());
819 int UtcDaliAnimationSetEndActionN(void)
821 TestApplication application;
823 Actor actor = Actor::New();
824 Stage::GetCurrent().Add(actor);
826 // Build the animation
827 float durationSeconds(1.0f);
828 Animation animation = Animation::New(durationSeconds);
829 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
831 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
832 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
834 // Start the animation
837 bool signalReceived(false);
838 AnimationFinishCheck finishCheck(signalReceived);
839 animation.FinishedSignal().Connect(&application, finishCheck);
841 application.SendNotification();
842 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
844 // We did expect the animation to finish
845 application.SendNotification();
846 finishCheck.CheckSignalReceived();
847 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
849 // Go back to the start
850 actor.SetPosition(Vector3::ZERO);
851 application.SendNotification();
852 application.Render(0);
853 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
855 // Test BakeFinal, animate again, for half the duration
857 animation.SetEndAction(Animation::BakeFinal);
858 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
861 application.SendNotification();
862 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
864 // Stop the animation early
867 // We did NOT expect the animation to finish
868 application.SendNotification();
869 finishCheck.CheckSignalNotReceived();
870 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
872 // The position should be same with target position in the next frame
873 application.Render(0);
874 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
876 // Go back to the start
877 actor.SetPosition(Vector3::ZERO);
878 application.SendNotification();
879 application.Render(0);
880 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
882 // Test EndAction::Discard, animate again, but don't bake this time
884 animation.SetEndAction(Animation::Discard);
885 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
888 application.SendNotification();
889 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
891 // We did expect the animation to finish
892 application.SendNotification();
893 finishCheck.CheckSignalReceived();
894 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
896 // The position should be discarded in the next frame
897 application.Render(0);
898 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
900 // Check that nothing has changed after a couple of buffer swaps
901 application.Render(0);
902 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
903 application.Render(0);
904 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
908 int UtcDaliAnimationGetEndActionP(void)
910 TestApplication application;
912 Animation animation = Animation::New(1.0f);
913 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
915 animation.SetEndAction(Animation::Discard);
916 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
918 animation.SetEndAction(Animation::BakeFinal);
919 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
924 int UtcDaliAnimationSetDisconnectActionP(void)
926 TestApplication application;
927 Stage stage( Stage::GetCurrent() );
929 // Default: BakeFinal
931 Actor actor = Actor::New();
934 // Build the animation
935 float durationSeconds(1.0f);
936 Animation animation = Animation::New(durationSeconds);
937 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
939 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
940 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
942 // Start the animation
945 application.SendNotification();
946 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
950 application.SendNotification();
951 application.Render();
953 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
958 Actor actor = Actor::New();
961 // Build the animation
962 float durationSeconds(1.0f);
963 Animation animation = Animation::New(durationSeconds);
964 animation.SetDisconnectAction( Animation::Bake );
966 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
967 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
969 // Start the animation
972 application.SendNotification();
973 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
977 application.SendNotification();
978 application.Render();
980 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
985 Actor actor = Actor::New();
988 // Build the animation
989 float durationSeconds(1.0f);
990 Animation animation = Animation::New(durationSeconds);
991 animation.SetDisconnectAction( Animation::Discard );
993 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
994 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
996 // Start the animation
999 application.SendNotification();
1000 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1004 application.SendNotification();
1005 application.Render();
1007 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
1010 // Don't play the animation: disconnect action should not be applied
1012 Actor actor = Actor::New();
1015 // Build the animation
1016 float durationSeconds(1.0f);
1017 Animation animation = Animation::New(durationSeconds);
1019 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1020 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1022 application.SendNotification();
1023 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1027 application.SendNotification();
1028 application.Render();
1030 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
1036 int UtcDaliAnimationGetDisconnectActionP(void)
1038 TestApplication application;
1039 Animation animation = Animation::New(1.0f);
1040 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
1042 animation.SetDisconnectAction(Animation::Discard);
1043 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
1045 animation.SetDisconnectAction(Animation::Bake);
1046 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
1051 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1053 TestApplication application;
1055 Animation animation = Animation::New(1.0f);
1056 AlphaFunction func = animation.GetDefaultAlphaFunction();
1057 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1059 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1060 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1061 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1065 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1067 TestApplication application;
1069 Animation animation = Animation::New(1.0f);
1070 AlphaFunction func = animation.GetDefaultAlphaFunction();
1072 // Test that the default is linear
1073 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1075 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1076 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1077 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1082 int UtcDaliAnimationSetCurrentProgressP(void)
1084 TestApplication application;
1086 Actor actor = Actor::New();
1087 Stage::GetCurrent().Add(actor);
1089 // Build the animation
1090 Animation animation = Animation::New(0.0f);
1093 float durationSeconds(1.0f);
1094 animation.SetDuration(durationSeconds);
1096 bool signalReceived(false);
1097 AnimationFinishCheck finishCheck(signalReceived);
1098 animation.FinishedSignal().Connect(&application, finishCheck);
1099 application.SendNotification();
1101 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1102 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1104 // Start the animation from 40% progress
1105 animation.SetCurrentProgress( 0.4f );
1108 application.SendNotification();
1109 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1111 // We didn't expect the animation to finish yet
1112 application.SendNotification();
1113 finishCheck.CheckSignalNotReceived();
1114 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1115 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1117 animation.Play(); // Test that calling play has no effect, when animation is already playing
1118 application.SendNotification();
1120 //Set the progress to 70%
1121 animation.SetCurrentProgress( 0.7f );
1122 application.SendNotification();
1123 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1124 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1126 application.SendNotification();
1127 finishCheck.CheckSignalNotReceived();
1128 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1129 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1131 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1132 // We did expect the animation to finish
1133 application.SendNotification();
1134 finishCheck.CheckSignalReceived();
1135 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1137 // Check that nothing has changed after a couple of buffer swaps
1138 application.Render(0);
1139 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1140 application.Render(0);
1141 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1145 int UtcDaliAnimationSetCurrentProgressN(void)
1147 TestApplication application;
1149 Actor actor = Actor::New();
1150 Stage::GetCurrent().Add(actor);
1152 // Build the animation
1153 Animation animation = Animation::New(0.0f);
1156 float durationSeconds(1.0f);
1157 animation.SetDuration(durationSeconds);
1159 bool signalReceived(false);
1160 AnimationFinishCheck finishCheck(signalReceived);
1161 animation.FinishedSignal().Connect(&application, finishCheck);
1162 application.SendNotification();
1164 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1165 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1167 //Trying to set the current cursor outside the range [0..1] is ignored
1168 animation.SetCurrentProgress( -1.0f);
1169 application.SendNotification();
1170 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1172 animation.SetCurrentProgress( 100.0f);
1173 application.SendNotification();
1174 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1178 int UtcDaliAnimationGetCurrentProgressP(void)
1180 TestApplication application;
1182 Actor actor = Actor::New();
1183 Stage::GetCurrent().Add(actor);
1185 // Build the animation
1186 Animation animation = Animation::New(0.0f);
1189 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1190 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1192 animation.SetCurrentProgress( 0.5f );
1193 application.SendNotification();
1194 application.Render(static_cast<unsigned int>(100.0f));
1196 //Progress should still be 0.0
1197 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1200 float durationSeconds(1.0f);
1201 animation.SetDuration(durationSeconds);
1202 application.SendNotification();
1204 bool signalReceived(false);
1205 AnimationFinishCheck finishCheck(signalReceived);
1206 animation.FinishedSignal().Connect(&application, finishCheck);
1207 application.SendNotification();
1209 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1210 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1212 // Start the animation from 40% progress
1213 animation.SetCurrentProgress( 0.4f );
1216 application.SendNotification();
1217 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1219 // We didn't expect the animation to finish yet
1220 application.SendNotification();
1221 finishCheck.CheckSignalNotReceived();
1222 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1224 animation.Play(); // Test that calling play has no effect, when animation is already playing
1225 application.SendNotification();
1227 //Set the progress to 70%
1228 animation.SetCurrentProgress( 0.7f );
1229 application.SendNotification();
1230 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1231 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1233 application.SendNotification();
1234 finishCheck.CheckSignalNotReceived();
1235 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1237 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1238 // We did expect the animation to finish
1239 application.SendNotification();
1240 finishCheck.CheckSignalReceived();
1244 int UtcDaliAnimationSetSpeedFactorP1(void)
1246 TestApplication application;
1248 tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1250 Actor actor = Actor::New();
1251 Stage::GetCurrent().Add(actor);
1253 // Build the animation
1254 float durationSeconds(1.0f);
1255 Animation animation = Animation::New(durationSeconds);
1257 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1258 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1260 KeyFrames keyframes = KeyFrames::New();
1261 keyframes.Add( 0.0f, initialPosition);
1262 keyframes.Add( 1.0f, targetPosition );
1263 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1265 //Set speed to be x2
1266 animation.SetSpeedFactor(2.0f);
1268 // Start the animation
1271 bool signalReceived(false);
1272 AnimationFinishCheck finishCheck(signalReceived);
1273 animation.FinishedSignal().Connect(&application, finishCheck);
1275 application.SendNotification();
1276 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1278 // We didn't expect the animation to finish yet
1279 application.SendNotification();
1280 finishCheck.CheckSignalNotReceived();
1281 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1283 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1285 // We didn't expect the animation to finish yet
1286 application.SendNotification();
1287 finishCheck.CheckSignalNotReceived();
1288 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1290 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1292 // We did expect the animation to finish
1293 application.SendNotification();
1294 finishCheck.CheckSignalReceived();
1295 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1297 // Check that nothing has changed after a couple of buffer swaps
1298 application.Render(0);
1299 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1300 application.Render(0);
1301 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1306 int UtcDaliAnimationSetSpeedFactorP2(void)
1308 TestApplication application;
1310 Actor actor = Actor::New();
1311 Stage::GetCurrent().Add(actor);
1313 // Build the animation
1314 float durationSeconds(1.0f);
1315 Animation animation = Animation::New(durationSeconds);
1317 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1318 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1320 KeyFrames keyframes = KeyFrames::New();
1321 keyframes.Add( 0.0f, initialPosition);
1322 keyframes.Add( 1.0f, targetPosition );
1323 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1325 tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1326 animation.SetSpeedFactor( -1.0f );
1328 // Start the animation
1331 bool signalReceived(false);
1332 AnimationFinishCheck finishCheck(signalReceived);
1333 animation.FinishedSignal().Connect(&application, finishCheck);
1335 application.SendNotification();
1336 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1338 // We didn't expect the animation to finish yet
1339 application.SendNotification();
1340 finishCheck.CheckSignalNotReceived();
1341 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1343 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1345 // We didn't expect the animation to finish yet
1346 application.SendNotification();
1347 finishCheck.CheckSignalNotReceived();
1348 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1350 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1352 // We didn't expect the animation to finish yet
1353 application.SendNotification();
1354 finishCheck.CheckSignalNotReceived();
1355 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1357 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1359 // We didn't expect the animation to finish yet
1360 application.SendNotification();
1361 finishCheck.CheckSignalNotReceived();
1362 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1364 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1366 // We did expect the animation to finish
1367 application.SendNotification();
1368 finishCheck.CheckSignalReceived();
1369 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1371 // Check that nothing has changed after a couple of buffer swaps
1372 application.Render(0);
1373 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1374 application.Render(0);
1375 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1380 int UtcDaliAnimationSetSpeedFactorP3(void)
1382 TestApplication application;
1384 Actor actor = Actor::New();
1385 Stage::GetCurrent().Add(actor);
1387 // Build the animation
1388 float durationSeconds(1.0f);
1389 Animation animation = Animation::New(durationSeconds);
1391 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1392 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1394 KeyFrames keyframes = KeyFrames::New();
1395 keyframes.Add( 0.0f, initialPosition);
1396 keyframes.Add( 1.0f, targetPosition );
1397 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1399 bool signalReceived(false);
1400 AnimationFinishCheck finishCheck(signalReceived);
1401 animation.FinishedSignal().Connect(&application, finishCheck);
1403 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1405 //Set speed to be half of normal speed
1406 animation.SetSpeedFactor( 0.5f );
1408 // Start the animation
1411 application.SendNotification();
1412 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1414 // We didn't expect the animation to finish yet
1415 application.SendNotification();
1416 finishCheck.CheckSignalNotReceived();
1417 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1419 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1421 // We didn't expect the animation to finish yet
1422 application.SendNotification();
1423 finishCheck.CheckSignalNotReceived();
1424 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1426 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1428 // We didn't expect the animation to finish yet
1429 application.SendNotification();
1430 finishCheck.CheckSignalNotReceived();
1431 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1433 application.SendNotification();
1434 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1436 // We didn't expect the animation to finish yet
1437 application.SendNotification();
1438 finishCheck.CheckSignalNotReceived();
1439 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1441 application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1443 // We did expect the animation to finish
1444 application.SendNotification();
1445 finishCheck.CheckSignalReceived();
1446 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1448 // Check that nothing has changed after a couple of buffer swaps
1449 application.Render(0);
1450 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1451 application.Render(0);
1452 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1457 int UtcDaliAnimationSetSpeedFactorP4(void)
1459 TestApplication application;
1461 Actor actor = Actor::New();
1462 Stage::GetCurrent().Add(actor);
1464 // Build the animation
1465 float durationSeconds(1.0f);
1466 Animation animation = Animation::New(durationSeconds);
1468 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1469 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1471 KeyFrames keyframes = KeyFrames::New();
1472 keyframes.Add( 0.0f, initialPosition);
1473 keyframes.Add( 1.0f, targetPosition );
1474 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1476 bool signalReceived(false);
1477 AnimationFinishCheck finishCheck(signalReceived);
1478 animation.FinishedSignal().Connect(&application, finishCheck);
1480 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1482 tet_printf("Set speed to be half of normal speed\n");
1483 tet_printf("SetSpeedFactor(0.5f)\n");
1484 animation.SetSpeedFactor( 0.5f );
1486 // Start the animation
1489 application.SendNotification();
1490 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1492 // We didn't expect the animation to finish yet
1493 application.SendNotification();
1494 finishCheck.CheckSignalNotReceived();
1495 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1497 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1499 // We didn't expect the animation to finish yet
1500 application.SendNotification();
1501 finishCheck.CheckSignalNotReceived();
1502 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1504 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1506 // We didn't expect the animation to finish yet
1507 application.SendNotification();
1508 finishCheck.CheckSignalNotReceived();
1509 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1511 tet_printf("Reverse direction of animation whilst playing\n");
1512 tet_printf("SetSpeedFactor(-0.5f)\n");
1513 animation.SetSpeedFactor(-0.5f);
1515 application.SendNotification();
1516 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1518 // We didn't expect the animation to finish yet
1519 application.SendNotification();
1520 finishCheck.CheckSignalNotReceived();
1521 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1523 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1525 // We didn't expect the animation to finish yet
1526 application.SendNotification();
1527 finishCheck.CheckSignalNotReceived();
1528 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1530 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1532 // We did expect the animation to finish
1533 application.SendNotification();
1534 finishCheck.CheckSignalReceived();
1535 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1537 // Check that nothing has changed after a couple of buffer swaps
1538 application.Render(0);
1539 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1540 application.Render(0);
1541 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1545 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1547 TestApplication application;
1549 const unsigned int NUM_FRAMES(15);
1557 float expected[NUM_FRAMES];
1560 TestData testData[] = {
1562 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1563 /* |----------PlayRange---------------| */
1565 { 0.0f, 1.0f, // TimePeriod
1566 0.0f, 100.0f, // POS
1567 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1568 /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1579 // ACTOR 1 - Across start of range
1580 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1581 /* |----------PlayRange---------------| */
1583 { 0.2f, 0.5f, // TimePeriod
1584 20.0f, 50.0f, // POS
1585 {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1586 /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1596 // ACTOR 2 - Across end of range
1597 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1598 /* |----------PlayRange---------------| */
1600 {/**/ 0.5f, 0.9f, // TimePeriod
1601 /**/ 50.0f, 90.0f, // POS
1602 { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1603 /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1612 // ACTOR 3 - Before beginning of range
1613 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1614 /* |----------PlayRange---------------| */
1616 {/**/ 0.1f, 0.25f, // TimePeriod
1617 /**/ 10.0f, 25.0f, // POS
1619 /**/ 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
1624 // ACTOR 4 - After end of range
1625 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1626 /* |----------PlayRange---------------| */
1628 {/**/ 0.85f, 1.0f, // TimePeriod
1629 /**/ 85.0f, 100.0f, // POS
1631 /**/ 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
1635 // Actor 5 - Middle of range
1636 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1637 /* |----------PlayRange---------------| */
1639 {/**/ 0.4f, 0.65f, // Time Period
1640 /**/ 40.0f, 65.0f, // Position
1641 { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1642 /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1653 const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1655 // Build the animation
1656 float durationSeconds(1.0f);
1657 Animation animation = Animation::New(durationSeconds);
1658 bool signalReceived(false);
1659 AnimationFinishCheck finishCheck(signalReceived);
1660 animation.FinishedSignal().Connect(&application, finishCheck);
1662 std::vector<Dali::Actor> actors;
1664 for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1666 Actor actor = Actor::New();
1667 actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
1668 actors.push_back(actor);
1669 Stage::GetCurrent().Add(actor);
1671 if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1673 KeyFrames keyframes = KeyFrames::New();
1674 keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1675 keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1676 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1680 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1684 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1685 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1686 tet_printf("SetSpeedFactor(0.5f)\n");
1687 animation.SetSpeedFactor( 0.5f );
1688 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1689 animation.SetLooping(true);
1691 // Start the animation
1693 application.SendNotification();
1694 application.Render(0); // Frame 0 tests initial values
1696 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1698 unsigned int actorIndex = 0u;
1699 for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1701 DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1702 if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
1704 tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1710 tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1711 tet_printf("SetSpeedFactor(-0.5f)\n");
1712 animation.SetSpeedFactor(-0.5f);
1713 application.SendNotification();
1715 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1717 // We didn't expect the animation to finish yet
1718 application.SendNotification();
1719 finishCheck.CheckSignalNotReceived();
1725 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1727 TestApplication application;
1729 const unsigned int NUM_FRAMES(15);
1737 float expected[NUM_FRAMES];
1742 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1743 /* |----------PlayRange---------------| */
1744 { 0.0f, 1.0f, // TimePeriod
1745 0.0f, 100.0f, // POS
1746 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1747 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1748 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1754 // Build the animation
1755 float durationSeconds(1.0f);
1756 Animation animation = Animation::New(durationSeconds);
1757 bool signalReceived(false);
1758 AnimationFinishCheck finishCheck(signalReceived);
1759 animation.FinishedSignal().Connect(&application, finishCheck);
1761 std::vector<Dali::Actor> actors;
1763 Actor actor = Actor::New();
1764 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1765 actors.push_back(actor);
1766 Stage::GetCurrent().Add(actor);
1768 KeyFrames keyframes = KeyFrames::New();
1769 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1770 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1771 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1773 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1774 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1775 tet_printf("SetSpeedFactor(0.5f)\n");
1776 tet_printf("SetLoopCount(3)\n");
1777 animation.SetSpeedFactor( 0.5f );
1778 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1779 animation.SetLoopCount(3);
1781 // Start the animation
1783 application.SendNotification();
1784 application.Render(0); // Frame 0 tests initial values
1786 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1788 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1790 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1792 if( frame < NUM_FRAMES-1 )
1794 // We didn't expect the animation to finish yet
1795 application.SendNotification();
1796 finishCheck.CheckSignalNotReceived();
1800 // We did expect the animation to finish
1801 application.SendNotification();
1802 finishCheck.CheckSignalReceived();
1803 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
1808 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1810 TestApplication application;
1812 const unsigned int NUM_FRAMES(15);
1820 float expected[NUM_FRAMES];
1825 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1826 /* |----------PlayRange---------------| */
1827 { 0.0f, 1.0f, // TimePeriod
1828 0.0f, 100.0f, // POS
1829 {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1830 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1831 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1836 // Build the animation
1837 float durationSeconds(1.0f);
1838 Animation animation = Animation::New(durationSeconds);
1839 bool signalReceived(false);
1840 AnimationFinishCheck finishCheck(signalReceived);
1841 animation.FinishedSignal().Connect(&application, finishCheck);
1843 std::vector<Dali::Actor> actors;
1845 Actor actor = Actor::New();
1846 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1847 actors.push_back(actor);
1848 Stage::GetCurrent().Add(actor);
1850 KeyFrames keyframes = KeyFrames::New();
1851 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1852 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1853 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1855 tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1856 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1857 tet_printf("SetSpeedFactor(-0.5f)\n");
1858 tet_printf("SetLoopCount(3)\n");
1859 animation.SetSpeedFactor( -0.5f );
1860 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1861 animation.SetLoopCount(3);
1863 // Start the animation
1865 application.SendNotification();
1866 application.Render(0); // Frame 0 tests initial values
1868 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1870 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1872 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1874 if( frame < NUM_FRAMES-1 )
1876 // We didn't expect the animation to finish yet
1877 application.SendNotification();
1878 finishCheck.CheckSignalNotReceived();
1882 // We did expect the animation to finish
1883 application.SendNotification();
1884 finishCheck.CheckSignalReceived();
1885 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
1891 int UtcDaliAnimationGetSpeedFactorP(void)
1893 TestApplication application;
1895 Animation animation = Animation::New(1.0f);
1896 animation.SetSpeedFactor(0.5f);
1897 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1899 animation.SetSpeedFactor(-2.5f);
1900 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1904 int UtcDaliAnimationSetPlayRangeP(void)
1906 TestApplication application;
1908 Actor actor = Actor::New();
1909 Stage::GetCurrent().Add( actor );
1911 // Build the animation
1912 float durationSeconds( 1.0f );
1913 Animation animation = Animation::New( durationSeconds );
1915 bool signalReceived( false );
1916 AnimationFinishCheck finishCheck( signalReceived );
1917 animation.FinishedSignal().Connect( &application, finishCheck );
1918 application.SendNotification();
1920 // Set range between 0.4 and 0.8
1921 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1922 application.SendNotification();
1923 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1925 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1926 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1928 // Start the animation from 40% progress
1931 application.SendNotification();
1932 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1934 // We didn't expect the animation to finish yet
1935 application.SendNotification();
1936 finishCheck.CheckSignalNotReceived();
1937 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1939 application.SendNotification();
1940 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1942 application.SendNotification();
1943 finishCheck.CheckSignalNotReceived();
1944 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1946 application.SendNotification();
1947 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1949 // We did expect the animation to finish
1950 application.SendNotification();
1951 finishCheck.CheckSignalReceived();
1952 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1956 int UtcDaliAnimationSetPlayRangeN(void)
1958 TestApplication application;
1960 Actor actor = Actor::New();
1961 Stage::GetCurrent().Add(actor);
1963 // Build the animation
1964 Animation animation = Animation::New(0);
1965 application.SendNotification();
1967 //PlayRange out of bounds
1968 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1969 application.SendNotification();
1970 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1971 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1972 application.SendNotification();
1973 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1975 //If playRange is not in the correct order it has to be ordered
1976 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1977 application.SendNotification();
1978 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1983 int UtcDaliAnimationGetPlayRangeP(void)
1985 TestApplication application;
1987 Actor actor = Actor::New();
1988 Stage::GetCurrent().Add( actor );
1990 // Build the animation
1991 Animation animation = Animation::New( 1.0f );
1992 application.SendNotification();
1994 //If PlayRange not specified it should be 0.0-1.0 by default
1995 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1997 // Set range between 0.4 and 0.8
1998 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1999 application.SendNotification();
2000 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
2005 int UtcDaliAnimationPlayP(void)
2007 TestApplication application;
2009 Actor actor = Actor::New();
2010 Stage::GetCurrent().Add(actor);
2012 // Build the animation
2013 float durationSeconds(1.0f);
2014 Animation animation = Animation::New(durationSeconds);
2015 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2016 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2018 // Start the animation
2021 bool signalReceived(false);
2022 AnimationFinishCheck finishCheck(signalReceived);
2023 animation.FinishedSignal().Connect(&application, finishCheck);
2025 application.SendNotification();
2026 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2028 // We didn't expect the animation to finish yet
2029 application.SendNotification();
2030 finishCheck.CheckSignalNotReceived();
2031 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2033 animation.Play(); // Test that calling play has no effect, when animation is already playing
2034 application.SendNotification();
2035 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2037 // We didn't expect the animation to finish yet
2038 application.SendNotification();
2039 finishCheck.CheckSignalNotReceived();
2040 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2042 animation.Play(); // Test that calling play has no effect, when animation is already playing
2043 application.SendNotification();
2044 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2046 // We didn't expect the animation to finish yet
2047 application.SendNotification();
2048 finishCheck.CheckSignalNotReceived();
2049 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2051 animation.Play(); // Test that calling play has no effect, when animation is already playing
2052 application.SendNotification();
2053 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2055 // We didn't expect the animation to finish yet
2056 application.SendNotification();
2057 finishCheck.CheckSignalNotReceived();
2058 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2060 animation.Play(); // Test that calling play has no effect, when animation is already playing
2061 application.SendNotification();
2062 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2064 // We did expect the animation to finish
2065 application.SendNotification();
2066 finishCheck.CheckSignalReceived();
2067 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2069 // Check that nothing has changed after a couple of buffer swaps
2070 application.Render(0);
2071 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2072 application.Render(0);
2073 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2077 int UtcDaliAnimationPlayOffStageDiscardP(void)
2079 // Test that an animation can be played, when the actor is off-stage.
2080 // When the actor is added to the stage, it should appear at the current position
2081 // i.e. where it would have been anyway, if on-stage from the beginning.
2083 TestApplication application;
2085 Actor actor = Actor::New();
2086 Vector3 basePosition(Vector3::ZERO);
2087 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2088 // Not added to the stage yet!
2090 // Build the animation
2091 float durationSeconds(1.0f);
2092 Animation animation = Animation::New(durationSeconds);
2093 animation.SetDisconnectAction( Animation::Discard );
2094 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2095 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2097 // Start the animation
2100 bool signalReceived(false);
2101 AnimationFinishCheck finishCheck(signalReceived);
2102 animation.FinishedSignal().Connect(&application, finishCheck);
2104 application.SendNotification();
2105 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2107 // We didn't expect the animation to finish yet
2108 application.SendNotification();
2109 finishCheck.CheckSignalNotReceived();
2110 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
2113 Stage::GetCurrent().Add(actor);
2115 application.SendNotification();
2116 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2118 // We didn't expect the animation to finish yet
2119 application.SendNotification();
2120 finishCheck.CheckSignalNotReceived();
2121 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*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 as disconnect behaviour is discard*/, TEST_LOCATION );
2133 // Check that nothing has changed after a couple of buffer swaps
2134 application.Render(0);
2135 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
2136 application.Render(0);
2137 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
2138 application.Render(0);
2139 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
2142 Stage::GetCurrent().Add(actor);
2144 application.SendNotification();
2145 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2147 // We didn't expect the animation to finish yet
2148 application.SendNotification();
2149 finishCheck.CheckSignalNotReceived();
2150 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(80,80,80), TEST_LOCATION );
2152 application.SendNotification();
2153 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2155 // We did expect the animation to finish
2156 application.SendNotification();
2157 finishCheck.CheckSignalReceived();
2158 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2160 // Check that nothing has changed after a couple of buffer swaps
2161 application.Render(0);
2162 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2165 application.Render(0);
2166 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2170 int UtcDaliAnimationPlayOffStageBakeFinalP(void)
2172 // Test that an animation can be played, when the actor is off-stage.
2173 // When the actor is added to the stage, it should appear at the current position
2174 // i.e. where it would have been anyway, if on-stage from the beginning.
2176 TestApplication application;
2178 Actor actor = Actor::New();
2179 Vector3 basePosition(Vector3::ZERO);
2180 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2181 // Not added to the stage!
2183 // Build the animation
2184 float durationSeconds(1.0f);
2185 Animation animation = Animation::New(durationSeconds);
2186 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2187 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2189 // Start the animation
2192 bool signalReceived(false);
2193 AnimationFinishCheck finishCheck(signalReceived);
2194 animation.FinishedSignal().Connect(&application, finishCheck);
2196 application.SendNotification();
2197 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2199 // We didn't expect the animation to finish yet
2200 application.SendNotification();
2201 finishCheck.CheckSignalNotReceived();
2202 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
2205 Stage::GetCurrent().Add(actor);
2207 application.SendNotification();
2208 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2210 // We didn't expect the animation to finish yet
2211 application.SendNotification();
2212 finishCheck.CheckSignalNotReceived();
2213 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2215 // Remove from the stage
2216 Stage::GetCurrent().Remove(actor);
2218 application.SendNotification();
2219 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2221 // We didn't expect the animation to finish yet
2222 application.SendNotification();
2223 finishCheck.CheckSignalNotReceived();
2224 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition /*bake final*/, TEST_LOCATION );
2227 Stage::GetCurrent().Add(actor);
2229 application.SendNotification();
2230 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2232 // We didn't expect the animation to finish yet
2233 application.SendNotification();
2234 finishCheck.CheckSignalNotReceived();
2235 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition /*bake final removed the */, TEST_LOCATION );
2237 application.SendNotification();
2238 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2240 // We did expect the animation to finish
2241 application.SendNotification();
2242 finishCheck.CheckSignalReceived();
2243 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2245 // Check that nothing has changed after a couple of buffer swaps
2246 application.Render(0);
2247 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2249 application.Render(0);
2250 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2254 int UtcDaliAnimationPlayOffStageBakeP(void)
2256 // Test that an animation can be played, when the actor is off-stage.
2257 // When the actor is added to the stage, it should appear at the current position
2258 // i.e. where it would have been anyway, if on-stage from the beginning.
2260 TestApplication application;
2262 Actor actor = Actor::New();
2263 Vector3 basePosition(Vector3::ZERO);
2264 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2265 // Not added to the stage!
2267 // Build the animation
2268 float durationSeconds(1.0f);
2269 Animation animation = Animation::New(durationSeconds);
2270 animation.SetDisconnectAction( Animation::Bake );
2271 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2272 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2274 // Start the animation
2277 bool signalReceived(false);
2278 AnimationFinishCheck finishCheck(signalReceived);
2279 animation.FinishedSignal().Connect(&application, finishCheck);
2281 application.SendNotification();
2282 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2284 // We didn't expect the animation to finish yet
2285 application.SendNotification();
2286 finishCheck.CheckSignalNotReceived();
2287 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
2290 Stage::GetCurrent().Add(actor);
2292 application.SendNotification();
2293 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2295 // We didn't expect the animation to finish yet
2296 application.SendNotification();
2297 finishCheck.CheckSignalNotReceived();
2298 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2300 // Remove from the stage
2301 Stage::GetCurrent().Remove(actor); // baked here
2303 application.SendNotification();
2304 // this render is a no-op in this case as animator is disabled while off stage
2305 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2306 // We didn't expect the animation to finish yet
2307 application.SendNotification();
2308 finishCheck.CheckSignalNotReceived();
2309 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40) /*baked value*/, TEST_LOCATION );
2311 // Add back to the stage
2312 Stage::GetCurrent().Add(actor);
2314 application.SendNotification();
2315 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2316 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION );
2317 application.Render(static_cast<unsigned int>(0.0f) );
2318 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2319 application.Render(static_cast<unsigned int>(0.0f) );
2320 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2322 // Remove from the stage
2323 Stage::GetCurrent().Remove(actor); // baked here
2325 application.SendNotification();
2326 // this render is a no-op in this case as animator is disabled while off stage
2327 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2328 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2329 application.Render(static_cast<unsigned int>(0.0f) );
2330 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2331 application.Render(static_cast<unsigned int>(0.0f) );
2332 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2334 // Add back to the stage
2335 Stage::GetCurrent().Add(actor);
2337 // We didn't expect the animation to finish yet
2338 application.SendNotification();
2339 finishCheck.CheckSignalNotReceived();
2340 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) , TEST_LOCATION );
2342 application.SendNotification();
2343 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2345 // We did expect the animation to finish
2346 application.SendNotification();
2347 finishCheck.CheckSignalReceived();
2348 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2350 // Check that nothing has changed after a couple of buffer swaps
2351 application.Render(0);
2352 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2354 application.Render(0);
2355 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2359 int UtcDaliAnimationPlayDiscardHandleP(void)
2361 TestApplication application;
2363 Actor actor = Actor::New();
2364 Stage::GetCurrent().Add(actor);
2366 // Build the animation
2367 float durationSeconds(1.0f);
2368 Animation animation = Animation::New(durationSeconds);
2369 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2370 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2372 bool signalReceived(false);
2373 AnimationFinishCheck finishCheck(signalReceived);
2374 animation.FinishedSignal().Connect(&application, finishCheck);
2376 // Start the animation
2379 // This is a test of the "Fire and Forget" behaviour
2380 // Discard the animation handle!
2382 DALI_TEST_CHECK( !animation );
2384 application.SendNotification();
2385 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2387 // We didn't expect the animation to finish yet
2388 application.SendNotification();
2389 finishCheck.CheckSignalNotReceived();
2390 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2392 application.SendNotification();
2393 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2395 // We didn't expect the animation to finish yet
2396 application.SendNotification();
2397 finishCheck.CheckSignalNotReceived();
2398 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2400 application.SendNotification();
2401 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2403 // We didn't expect the animation to finish yet
2404 application.SendNotification();
2405 finishCheck.CheckSignalNotReceived();
2406 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2408 application.SendNotification();
2409 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2411 // We didn't expect the animation to finish yet
2412 application.SendNotification();
2413 finishCheck.CheckSignalNotReceived();
2414 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2416 application.SendNotification();
2417 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2419 // We did expect the animation to finish
2420 application.SendNotification();
2421 finishCheck.CheckSignalReceived();
2422 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2424 // Check that nothing has changed after a couple of buffer swaps
2425 application.Render(0);
2426 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2427 application.Render(0);
2428 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2432 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2434 TestApplication application;
2436 Actor actor = Actor::New();
2437 Stage::GetCurrent().Add(actor);
2439 // Build the animation
2440 float durationSeconds(1.0f);
2441 Animation animation = Animation::New(durationSeconds);
2442 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2443 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2445 // Start the animation
2448 bool signalReceived(false);
2449 AnimationFinishCheck finishCheck(signalReceived);
2450 animation.FinishedSignal().Connect(&application, finishCheck);
2452 application.SendNotification();
2453 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2455 // We didn't expect the animation to finish yet
2456 application.SendNotification();
2457 finishCheck.CheckSignalNotReceived();
2458 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2460 // This is a test of the "Fire and Forget" behaviour
2461 // Stop the animation, and Discard the animation handle!
2464 DALI_TEST_CHECK( !animation );
2466 application.SendNotification();
2467 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2469 // We expect the animation to finish at 20% progress
2470 application.SendNotification();
2471 finishCheck.CheckSignalReceived();
2472 finishCheck.Reset();
2473 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2475 application.SendNotification();
2476 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2478 // Check that nothing has changed
2479 application.SendNotification();
2480 finishCheck.CheckSignalNotReceived();
2481 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2483 application.SendNotification();
2484 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2486 // Check that nothing has changed
2487 application.SendNotification();
2488 finishCheck.CheckSignalNotReceived();
2489 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2491 application.SendNotification();
2492 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2494 // Check that nothing has changed
2495 application.SendNotification();
2496 finishCheck.CheckSignalNotReceived();
2497 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2501 int UtcDaliAnimationPlayRangeP(void)
2503 TestApplication application;
2505 Actor actor = Actor::New();
2506 Stage::GetCurrent().Add(actor);
2508 // Build the animation
2509 float durationSeconds(1.0f);
2510 Animation animation = Animation::New(durationSeconds);
2511 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2512 KeyFrames keyframes = KeyFrames::New();
2513 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2514 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2516 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2518 // Set range between 0.4 and 0.8
2519 animation.SetPlayRange( Vector2(0.4f,0.8f) );
2522 bool signalReceived(false);
2523 AnimationFinishCheck finishCheck(signalReceived);
2524 animation.FinishedSignal().Connect(&application, finishCheck);
2526 //Test that setting progress outside the range doesn't work
2527 animation.SetCurrentProgress( 0.9f );
2528 application.SendNotification();
2529 application.Render(0);
2530 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2531 animation.SetCurrentProgress( 0.2f );
2532 application.SendNotification();
2533 application.Render(0);
2534 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2536 application.SendNotification();
2537 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2539 // We didn't expect the animation to finish yet
2540 application.SendNotification();
2541 finishCheck.CheckSignalNotReceived();
2542 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2544 animation.Play(); // Test that calling play has no effect, when animation is already playing
2545 application.SendNotification();
2546 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2548 // We did expect the animation to finish
2549 application.SendNotification();
2550 finishCheck.CheckSignalReceived();
2551 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2553 // Check that nothing has changed after a couple of buffer swaps
2554 application.Render(0);
2555 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2556 application.Render(0);
2557 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2560 //Loop inside the range
2561 finishCheck.Reset();
2562 animation.SetLooping( true );
2564 application.SendNotification();
2565 float intervalSeconds = 0.1f;
2566 float progress = 0.4f;
2567 for (int iterations = 0; iterations < 10; ++iterations )
2569 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2571 progress += intervalSeconds;
2572 if (progress > 0.8f)
2574 progress = progress - 0.4f;
2577 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2580 // We didn't expect the animation to finish yet
2581 application.SendNotification();
2582 finishCheck.CheckSignalNotReceived();
2585 //Test change range on the fly
2586 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2587 application.SendNotification();
2589 for (int iterations = 0; iterations < 10; ++iterations )
2591 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2593 progress += intervalSeconds;
2594 if (progress > 0.9f)
2596 progress = progress - 0.7f;
2599 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2605 int UtcDaliAnimationPlayFromP(void)
2607 TestApplication application;
2609 Actor actor = Actor::New();
2610 Stage::GetCurrent().Add(actor);
2612 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2614 // Build the animation
2615 float durationSeconds(1.0f);
2616 Animation animation = Animation::New(durationSeconds);
2617 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2618 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2620 // Start the animation from 40% progress
2621 animation.PlayFrom( 0.4f );
2623 // Target value should be updated straight away
2624 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2626 bool signalReceived(false);
2627 AnimationFinishCheck finishCheck(signalReceived);
2628 animation.FinishedSignal().Connect(&application, finishCheck);
2630 application.SendNotification();
2631 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2633 // We didn't expect the animation to finish yet
2634 application.SendNotification();
2635 finishCheck.CheckSignalNotReceived();
2636 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2638 animation.Play(); // Test that calling play has no effect, when animation is already playing
2639 application.SendNotification();
2640 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2642 // We didn't expect the animation to finish yet
2643 application.SendNotification();
2644 finishCheck.CheckSignalNotReceived();
2645 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2647 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2648 // We did expect the animation to finish
2649 application.SendNotification();
2650 finishCheck.CheckSignalReceived();
2651 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2653 // Check that nothing has changed after a couple of buffer swaps
2654 application.Render(0);
2655 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2656 application.Render(0);
2657 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2661 int UtcDaliAnimationPlayFromN(void)
2663 TestApplication application;
2665 Actor actor = Actor::New();
2666 Stage::GetCurrent().Add(actor);
2668 // Build the animation
2669 float durationSeconds(1.0f);
2670 Animation animation = Animation::New(durationSeconds);
2671 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2672 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2674 //PlayFrom with an argument outside the range [0..1] will be ignored
2675 animation.PlayFrom(-1.0f);
2676 application.SendNotification();
2677 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2679 animation.PlayFrom(100.0f);
2680 application.SendNotification();
2681 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2685 int UtcDaliAnimationPauseP(void)
2687 TestApplication application;
2689 Actor actor = Actor::New();
2690 Stage::GetCurrent().Add(actor);
2692 // Build the animation
2693 float durationSeconds(1.0f);
2694 Animation animation = Animation::New(durationSeconds);
2695 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2696 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2698 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2700 // Start the animation
2703 bool signalReceived(false);
2704 AnimationFinishCheck finishCheck(signalReceived);
2705 animation.FinishedSignal().Connect(&application, finishCheck);
2707 application.SendNotification();
2708 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2710 // We didn't expect the animation to finish yet
2711 application.SendNotification();
2712 finishCheck.CheckSignalNotReceived();
2713 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2715 // Pause the animation
2717 application.SendNotification();
2720 for (int i=0; i<5; ++i)
2722 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2724 // We didn't expect the animation to finish yet
2725 application.SendNotification();
2726 finishCheck.CheckSignalNotReceived();
2727 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2732 application.SendNotification();
2733 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2735 // We didn't expect the animation to finish yet
2736 application.SendNotification();
2737 finishCheck.CheckSignalNotReceived();
2739 application.SendNotification();
2740 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2742 // We did expect the animation to finish
2743 application.SendNotification();
2744 finishCheck.CheckSignalReceived();
2745 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2747 // Check that nothing has changed after a couple of buffer swaps
2748 application.Render(0);
2749 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2750 application.Render(0);
2751 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2756 int UtcDaliAnimationGetStateP(void)
2758 TestApplication application;
2760 Actor actor = Actor::New();
2761 Stage::GetCurrent().Add(actor);
2763 // Build the animation
2764 float durationSeconds(1.0f);
2765 Animation animation = Animation::New(durationSeconds);
2766 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2767 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2768 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2770 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2772 // Start the animation
2775 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2777 bool signalReceived(false);
2778 AnimationFinishCheck finishCheck(signalReceived);
2779 animation.FinishedSignal().Connect(&application, finishCheck);
2781 application.SendNotification();
2782 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2784 // We didn't expect the animation to finish yet
2785 application.SendNotification();
2786 finishCheck.CheckSignalNotReceived();
2787 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2788 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2790 // Pause the animation
2792 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2793 application.SendNotification();
2794 application.Render(0.f);
2797 for (int i=0; i<5; ++i)
2799 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2801 // We didn't expect the animation to finish yet
2802 application.SendNotification();
2803 finishCheck.CheckSignalNotReceived();
2804 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2805 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2809 finishCheck.Reset();
2811 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2812 application.SendNotification();
2813 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2814 // We didn't expect the animation to finish yet
2815 application.SendNotification();
2816 finishCheck.CheckSignalNotReceived();
2817 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2819 application.SendNotification();
2820 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2822 // We did expect the animation to finish
2823 application.SendNotification();
2824 finishCheck.CheckSignalReceived();
2825 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2826 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2828 // Check that nothing has changed after a couple of buffer swaps
2829 application.Render(0);
2830 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2831 application.Render(0);
2832 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2833 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2836 finishCheck.Reset();
2838 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2839 application.SendNotification();
2840 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2841 application.SendNotification();
2842 finishCheck.CheckSignalNotReceived();
2843 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2849 int UtcDaliAnimationStopP(void)
2851 TestApplication application;
2853 Actor actor = Actor::New();
2854 Stage::GetCurrent().Add(actor);
2856 // Build the animation
2857 float durationSeconds(1.0f);
2858 Animation animation = Animation::New(durationSeconds);
2859 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2860 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2862 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2864 // Start the animation
2867 bool signalReceived(false);
2868 AnimationFinishCheck finishCheck(signalReceived);
2869 animation.FinishedSignal().Connect(&application, finishCheck);
2871 application.SendNotification();
2872 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2874 // We didn't expect the animation to finish yet
2875 application.SendNotification();
2876 finishCheck.CheckSignalNotReceived();
2877 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2879 // Stop the animation
2881 application.SendNotification();
2884 for (int i=0; i<5; ++i)
2886 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2888 // We did expect the animation to finish
2889 application.SendNotification();
2890 finishCheck.CheckSignalReceived();
2891 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2896 int UtcDaliAnimationStopSetPositionP(void)
2898 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2899 // i.e. to check that the animation does not interfere with the position set.
2901 TestApplication application;
2903 Actor actor = Actor::New();
2904 Stage::GetCurrent().Add(actor);
2906 // Build the animation
2907 float durationSeconds(1.0f);
2908 Animation animation = Animation::New(durationSeconds);
2909 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2910 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2912 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2914 // Start the animation
2917 bool signalReceived(false);
2918 AnimationFinishCheck finishCheck(signalReceived);
2919 animation.FinishedSignal().Connect(&application, finishCheck);
2921 application.SendNotification();
2922 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2924 // We didn't expect the animation to finish yet
2925 application.SendNotification();
2926 finishCheck.CheckSignalNotReceived();
2927 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2929 // Stop the animation
2931 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2932 actor.SetPosition(positionSet);
2933 application.SendNotification();
2936 for (int i=0; i<5; ++i)
2938 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2940 // We did expect the animation to finish
2941 application.SendNotification();
2942 finishCheck.CheckSignalReceived();
2943 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2948 int UtcDaliAnimationClearP(void)
2950 TestApplication application;
2952 Actor actor = Actor::New();
2953 Stage::GetCurrent().Add(actor);
2955 // Build the animation
2956 float durationSeconds(1.0f);
2957 Animation animation = Animation::New(durationSeconds);
2958 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2959 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2961 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2963 // Start the animation
2966 bool signalReceived(false);
2967 AnimationFinishCheck finishCheck(signalReceived);
2968 animation.FinishedSignal().Connect(&application, finishCheck);
2970 application.SendNotification();
2971 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2973 // We didn't expect the animation to finish yet
2974 application.SendNotification();
2975 finishCheck.CheckSignalNotReceived();
2976 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2978 // Clear the animation
2980 application.SendNotification();
2982 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2984 // We don't expect the animation to finish now
2985 application.SendNotification();
2986 finishCheck.CheckSignalNotReceived();
2987 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2989 // Restart as a scale animation; this should not move the actor's position
2990 finishCheck.Reset();
2991 actor.SetPosition(Vector3::ZERO);
2992 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2993 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2996 application.SendNotification();
2997 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2999 // We didn't expect the animation to finish yet
3000 application.SendNotification();
3001 finishCheck.CheckSignalNotReceived();
3002 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3003 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
3005 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3007 // We did expect the animation to finish
3008 application.SendNotification();
3009 finishCheck.CheckSignalReceived();
3010 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3011 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
3015 int UtcDaliAnimationFinishedSignalP(void)
3017 TestApplication application;
3019 // Start the empty animation
3020 float durationSeconds(1.0f);
3021 Animation animation = Animation::New(durationSeconds);
3024 bool signalReceived(false);
3025 AnimationFinishCheck finishCheck(signalReceived);
3026 animation.FinishedSignal().Connect(&application, finishCheck);
3028 application.SendNotification();
3029 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
3031 // We did expect the animation to finish
3032 application.SendNotification();
3033 finishCheck.CheckSignalReceived();
3037 int UtcDaliAnimationAnimateByBooleanP(void)
3039 TestApplication application;
3041 Actor actor = Actor::New();
3043 // Register a boolean property
3044 bool startValue(false);
3045 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3046 Stage::GetCurrent().Add(actor);
3047 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3048 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3050 // Build the animation
3051 float durationSeconds(2.0f);
3052 Animation animation = Animation::New(durationSeconds);
3053 const bool relativeValue(true);
3054 const bool finalValue( false || relativeValue );
3055 animation.AnimateBy(Property(actor, index), relativeValue);
3057 // Start the animation
3060 // Target value should be retrievable straight away
3061 DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
3063 bool signalReceived(false);
3064 AnimationFinishCheck finishCheck(signalReceived);
3065 animation.FinishedSignal().Connect(&application, finishCheck);
3067 application.SendNotification();
3068 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3070 // We didn't expect the animation to finish yet
3071 application.SendNotification();
3072 finishCheck.CheckSignalNotReceived();
3073 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3075 application.SendNotification();
3076 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3078 // We did expect the animation to finish
3079 application.SendNotification();
3080 finishCheck.CheckSignalReceived();
3081 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3083 // Check that nothing has changed after a couple of buffer swaps
3084 application.Render(0);
3085 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3086 application.Render(0);
3087 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3089 // Repeat with relative value "false" - this should be an NOOP
3090 animation = Animation::New(durationSeconds);
3091 bool noOpValue(false);
3092 animation.AnimateBy(Property(actor, index), noOpValue);
3094 // Start the animation
3097 finishCheck.Reset();
3098 animation.FinishedSignal().Connect(&application, finishCheck);
3100 application.SendNotification();
3101 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% 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 ) == finalValue );
3108 application.SendNotification();
3109 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3111 // We did expect the animation to finish
3112 application.SendNotification();
3113 finishCheck.CheckSignalReceived();
3114 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3116 // Check that nothing has changed after a couple of buffer swaps
3117 application.Render(0);
3118 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3119 application.Render(0);
3120 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3124 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3126 TestApplication application;
3128 Actor actor = Actor::New();
3130 // Register a boolean property
3131 bool startValue(false);
3132 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3133 Stage::GetCurrent().Add(actor);
3134 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3135 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3137 // Build the animation
3138 float durationSeconds(2.0f);
3139 Animation animation = Animation::New(durationSeconds);
3140 bool relativeValue(true);
3141 bool finalValue( false || relativeValue );
3142 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3144 // Start the animation
3147 bool signalReceived(false);
3148 AnimationFinishCheck finishCheck(signalReceived);
3149 animation.FinishedSignal().Connect(&application, finishCheck);
3151 application.SendNotification();
3152 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3154 // We didn't expect the animation to finish yet
3155 application.SendNotification();
3156 finishCheck.CheckSignalNotReceived();
3157 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3159 application.SendNotification();
3160 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3162 // We did expect the animation to finish
3163 application.SendNotification();
3164 finishCheck.CheckSignalReceived();
3165 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3167 // Check that nothing has changed after a couple of buffer swaps
3168 application.Render(0);
3169 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3170 application.Render(0);
3171 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3173 // Repeat with relative value "false" - this should be an NOOP
3174 animation = Animation::New(durationSeconds);
3175 bool noOpValue(false);
3176 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3178 // Start the animation
3181 finishCheck.Reset();
3182 animation.FinishedSignal().Connect(&application, finishCheck);
3184 application.SendNotification();
3185 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3187 // We didn't expect the animation to finish yet
3188 application.SendNotification();
3189 finishCheck.CheckSignalNotReceived();
3190 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3192 application.SendNotification();
3193 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3195 // We did expect the animation to finish
3196 application.SendNotification();
3197 finishCheck.CheckSignalReceived();
3198 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3202 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3204 TestApplication application;
3206 Actor actor = Actor::New();
3208 // Register a boolean property
3209 bool startValue(false);
3210 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3211 Stage::GetCurrent().Add(actor);
3212 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3213 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3215 // Build the animation
3216 float durationSeconds(2.0f);
3217 Animation animation = Animation::New(durationSeconds);
3218 bool relativeValue(true);
3219 bool finalValue( false || relativeValue );
3220 float animatorDurationSeconds(durationSeconds * 0.5f);
3221 animation.AnimateBy( Property(actor, index),
3223 TimePeriod( animatorDurationSeconds ) );
3225 // Start the animation
3228 bool signalReceived(false);
3229 AnimationFinishCheck finishCheck(signalReceived);
3230 animation.FinishedSignal().Connect(&application, finishCheck);
3232 application.SendNotification();
3233 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3235 // We didn't expect the animation to finish yet
3236 application.SendNotification();
3237 finishCheck.CheckSignalNotReceived();
3238 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3240 application.SendNotification();
3241 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3243 // We didn't expect the animation to finish yet...
3244 application.SendNotification();
3245 finishCheck.CheckSignalNotReceived();
3247 // ...however we should have reached the final value
3248 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3250 application.SendNotification();
3251 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3253 // We did expect the animation to finish
3254 application.SendNotification();
3255 finishCheck.CheckSignalReceived();
3256 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3258 // Check that nothing has changed after a couple of buffer swaps
3259 application.Render(0);
3260 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3261 application.Render(0);
3262 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3266 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3268 TestApplication application;
3270 Actor actor = Actor::New();
3272 // Register a boolean property
3273 bool startValue(false);
3274 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3275 Stage::GetCurrent().Add(actor);
3276 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3277 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3279 // Build the animation
3280 float durationSeconds(2.0f);
3281 Animation animation = Animation::New(durationSeconds);
3282 bool relativeValue(true);
3283 bool finalValue( false || relativeValue );
3284 float animatorDurationSeconds(durationSeconds * 0.5f);
3285 animation.AnimateBy( Property(actor, index),
3287 AlphaFunction::EASE_IN_OUT,
3288 TimePeriod( animatorDurationSeconds ) );
3290 // Start the animation
3293 bool signalReceived(false);
3294 AnimationFinishCheck finishCheck(signalReceived);
3295 animation.FinishedSignal().Connect(&application, finishCheck);
3297 application.SendNotification();
3298 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3300 // We didn't expect the animation to finish yet
3301 application.SendNotification();
3302 finishCheck.CheckSignalNotReceived();
3303 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3305 application.SendNotification();
3306 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3308 // We didn't expect the animation to finish yet...
3309 application.SendNotification();
3310 finishCheck.CheckSignalNotReceived();
3312 // ...however we should have reached the final value
3313 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3315 application.SendNotification();
3316 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3318 // We did expect the animation to finish
3319 application.SendNotification();
3320 finishCheck.CheckSignalReceived();
3321 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3323 // Check that nothing has changed after a couple of buffer swaps
3324 application.Render(0);
3325 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3326 application.Render(0);
3327 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3331 int UtcDaliAnimationAnimateByFloatP(void)
3333 TestApplication application;
3335 Actor actor = Actor::New();
3337 // Register a float property
3338 float startValue(10.0f);
3339 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3340 Stage::GetCurrent().Add(actor);
3341 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3342 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3344 // Build the animation
3345 float durationSeconds(2.0f);
3346 Animation animation = Animation::New(durationSeconds);
3347 float targetValue(50.0f);
3348 float relativeValue(targetValue - startValue);
3349 animation.AnimateBy(Property(actor, index), relativeValue);
3351 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3353 // Start the animation
3356 // Target value should be retrievable straight away
3357 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3359 bool signalReceived(false);
3360 AnimationFinishCheck finishCheck(signalReceived);
3361 animation.FinishedSignal().Connect(&application, finishCheck);
3363 application.SendNotification();
3364 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3366 // We didn't expect the animation to finish yet
3367 application.SendNotification();
3368 finishCheck.CheckSignalNotReceived();
3369 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3371 application.SendNotification();
3372 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3374 // We did expect the animation to finish
3375 application.SendNotification();
3376 finishCheck.CheckSignalReceived();
3377 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3379 // Check that nothing has changed after a couple of buffer swaps
3380 application.Render(0);
3381 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3382 application.Render(0);
3383 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3387 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3389 TestApplication application;
3391 Actor actor = Actor::New();
3393 // Register a float property
3394 float startValue(10.0f);
3395 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3396 Stage::GetCurrent().Add(actor);
3397 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3398 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3400 // Build the animation
3401 float durationSeconds(1.0f);
3402 Animation animation = Animation::New(durationSeconds);
3403 float targetValue(90.0f);
3404 float relativeValue(targetValue - startValue);
3405 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3407 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3409 // Start the animation
3412 bool signalReceived(false);
3413 AnimationFinishCheck finishCheck(signalReceived);
3414 animation.FinishedSignal().Connect(&application, finishCheck);
3416 application.SendNotification();
3417 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3419 // We didn't expect the animation to finish yet
3420 application.SendNotification();
3421 finishCheck.CheckSignalNotReceived();
3423 // The position should have moved more, than with a linear alpha function
3424 float current( actor.GetCurrentProperty< float >( index ) );
3425 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3427 application.SendNotification();
3428 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3430 // We did expect the animation to finish
3431 application.SendNotification();
3432 finishCheck.CheckSignalReceived();
3433 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3435 // Check that nothing has changed after a couple of buffer swaps
3436 application.Render(0);
3437 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3438 application.Render(0);
3439 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3443 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3445 TestApplication application;
3447 Actor actor = Actor::New();
3449 // Register a float property
3450 float startValue(10.0f);
3451 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3452 Stage::GetCurrent().Add(actor);
3453 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3454 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3456 // Build the animation
3457 float durationSeconds(1.0f);
3458 Animation animation = Animation::New(durationSeconds);
3459 float targetValue(30.0f);
3460 float relativeValue(targetValue - startValue);
3462 animation.AnimateBy(Property(actor, index),
3464 TimePeriod(delay, durationSeconds - delay));
3466 // Start the animation
3469 bool signalReceived(false);
3470 AnimationFinishCheck finishCheck(signalReceived);
3471 animation.FinishedSignal().Connect(&application, finishCheck);
3473 application.SendNotification();
3474 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3476 // We didn't expect the animation to finish yet
3477 application.SendNotification();
3478 finishCheck.CheckSignalNotReceived();
3479 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3481 application.SendNotification();
3482 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3484 // We didn't expect the animation to finish yet
3485 application.SendNotification();
3486 finishCheck.CheckSignalNotReceived();
3487 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3489 application.SendNotification();
3490 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3492 // We did expect the animation to finish
3493 application.SendNotification();
3494 finishCheck.CheckSignalReceived();
3495 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3497 // Check that nothing has changed after a couple of buffer swaps
3498 application.Render(0);
3499 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3500 application.Render(0);
3501 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3505 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3507 TestApplication application;
3509 Actor actor = Actor::New();
3511 // Register a float property
3512 float startValue(10.0f);
3513 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3514 Stage::GetCurrent().Add(actor);
3515 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3516 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3518 // Build the animation
3519 float durationSeconds(1.0f);
3520 Animation animation = Animation::New(durationSeconds);
3521 float targetValue(30.0f);
3522 float relativeValue(targetValue - startValue);
3524 animation.AnimateBy(Property(actor, index),
3526 AlphaFunction::LINEAR,
3527 TimePeriod(delay, durationSeconds - delay));
3529 // Start the animation
3532 bool signalReceived(false);
3533 AnimationFinishCheck finishCheck(signalReceived);
3534 animation.FinishedSignal().Connect(&application, finishCheck);
3536 application.SendNotification();
3537 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3539 // We didn't expect the animation to finish yet
3540 application.SendNotification();
3541 finishCheck.CheckSignalNotReceived();
3542 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3544 application.SendNotification();
3545 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3547 // We didn't expect the animation to finish yet
3548 application.SendNotification();
3549 finishCheck.CheckSignalNotReceived();
3550 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3552 application.SendNotification();
3553 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3555 // We did expect the animation to finish
3556 application.SendNotification();
3557 finishCheck.CheckSignalReceived();
3558 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3560 // Check that nothing has changed after a couple of buffer swaps
3561 application.Render(0);
3562 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3563 application.Render(0);
3564 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3568 int UtcDaliAnimationAnimateByIntegerP(void)
3570 TestApplication application;
3572 Actor actor = Actor::New();
3574 // Register an integer property
3576 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3577 Stage::GetCurrent().Add(actor);
3578 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3579 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3581 // Build the animation
3582 float durationSeconds(2.0f);
3583 Animation animation = Animation::New(durationSeconds);
3584 int targetValue(50);
3585 int relativeValue(targetValue - startValue);
3586 animation.AnimateBy(Property(actor, index), relativeValue);
3588 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3590 // Start the animation
3593 // Target value should be retrievable straight away
3594 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3596 bool signalReceived(false);
3597 AnimationFinishCheck finishCheck(signalReceived);
3598 animation.FinishedSignal().Connect(&application, finishCheck);
3600 application.SendNotification();
3601 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3603 // We didn't expect the animation to finish yet
3604 application.SendNotification();
3605 finishCheck.CheckSignalNotReceived();
3606 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3608 application.SendNotification();
3609 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3611 // We did expect the animation to finish
3612 application.SendNotification();
3613 finishCheck.CheckSignalReceived();
3614 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3616 // Check that nothing has changed after a couple of buffer swaps
3617 application.Render(0);
3618 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3619 application.Render(0);
3620 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3624 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3626 TestApplication application;
3628 Actor actor = Actor::New();
3630 // Register an integer property
3632 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3633 Stage::GetCurrent().Add(actor);
3634 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3635 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3637 // Build the animation
3638 float durationSeconds(1.0f);
3639 Animation animation = Animation::New(durationSeconds);
3640 int targetValue(90);
3641 int relativeValue(targetValue - startValue);
3642 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3644 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3646 // Start the animation
3649 bool signalReceived(false);
3650 AnimationFinishCheck finishCheck(signalReceived);
3651 animation.FinishedSignal().Connect(&application, finishCheck);
3653 application.SendNotification();
3654 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3656 // We didn't expect the animation to finish yet
3657 application.SendNotification();
3658 finishCheck.CheckSignalNotReceived();
3660 // The position should have moved more, than with a linear alpha function
3661 int current( actor.GetCurrentProperty< int >( index ) );
3662 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3664 application.SendNotification();
3665 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3667 // We did expect the animation to finish
3668 application.SendNotification();
3669 finishCheck.CheckSignalReceived();
3670 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3672 // Check that nothing has changed after a couple of buffer swaps
3673 application.Render(0);
3674 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3675 application.Render(0);
3676 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3680 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3682 TestApplication application;
3684 Actor actor = Actor::New();
3686 // Register an integer property
3688 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3689 Stage::GetCurrent().Add(actor);
3690 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3691 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3693 // Build the animation
3694 float durationSeconds(1.0f);
3695 Animation animation = Animation::New(durationSeconds);
3696 int targetValue(30);
3697 int relativeValue(targetValue - startValue);
3699 animation.AnimateBy(Property(actor, index),
3701 TimePeriod(delay, durationSeconds - delay));
3703 // Start the animation
3706 bool signalReceived(false);
3707 AnimationFinishCheck finishCheck(signalReceived);
3708 animation.FinishedSignal().Connect(&application, finishCheck);
3710 application.SendNotification();
3711 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3713 // We didn't expect the animation to finish yet
3714 application.SendNotification();
3715 finishCheck.CheckSignalNotReceived();
3716 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3718 application.SendNotification();
3719 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3721 // We didn't expect the animation to finish yet
3722 application.SendNotification();
3723 finishCheck.CheckSignalNotReceived();
3724 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3726 application.SendNotification();
3727 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3729 // We did expect the animation to finish
3730 application.SendNotification();
3731 finishCheck.CheckSignalReceived();
3732 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3734 // Check that nothing has changed after a couple of buffer swaps
3735 application.Render(0);
3736 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3737 application.Render(0);
3738 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3742 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3744 TestApplication application;
3746 Actor actor = Actor::New();
3748 // Register an integer property
3750 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3751 Stage::GetCurrent().Add(actor);
3752 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3753 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3755 // Build the animation
3756 float durationSeconds(1.0f);
3757 Animation animation = Animation::New(durationSeconds);
3758 int targetValue(30);
3759 int relativeValue(targetValue - startValue);
3761 animation.AnimateBy(Property(actor, index),
3763 AlphaFunction::LINEAR,
3764 TimePeriod(delay, durationSeconds - delay));
3766 // Start the animation
3769 bool signalReceived(false);
3770 AnimationFinishCheck finishCheck(signalReceived);
3771 animation.FinishedSignal().Connect(&application, finishCheck);
3773 application.SendNotification();
3774 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3776 // We didn't expect the animation to finish yet
3777 application.SendNotification();
3778 finishCheck.CheckSignalNotReceived();
3779 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3781 application.SendNotification();
3782 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3784 // We didn't expect the animation to finish yet
3785 application.SendNotification();
3786 finishCheck.CheckSignalNotReceived();
3787 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3789 application.SendNotification();
3790 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3792 // We did expect the animation to finish
3793 application.SendNotification();
3794 finishCheck.CheckSignalReceived();
3795 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3797 // Check that nothing has changed after a couple of buffer swaps
3798 application.Render(0);
3799 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3800 application.Render(0);
3801 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3805 int UtcDaliAnimationAnimateByQuaternionP(void)
3807 TestApplication application;
3809 Actor actor = Actor::New();
3811 // Register a quaternion property
3812 const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
3813 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3814 Stage::GetCurrent().Add(actor);
3815 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3816 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3818 // Build the animation
3819 float durationSeconds(2.0f);
3820 Animation animation = Animation::New(durationSeconds);
3821 const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
3822 const Quaternion finalValue( startValue * relativeValue );
3823 animation.AnimateBy(Property(actor, index), relativeValue);
3825 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3826 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3828 // Start the animation
3831 // Target value should be retrievable straight away
3832 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3834 application.SendNotification();
3835 application.Render( 2000 ); // animation complete
3837 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3838 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
3843 int UtcDaliAnimationAnimateByVector2P(void)
3845 TestApplication application;
3847 Actor actor = Actor::New();
3849 // Register a Vector2 property
3850 Vector2 startValue(10.0f, 10.0f);
3851 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3852 Stage::GetCurrent().Add(actor);
3853 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3854 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3856 // Build the animation
3857 float durationSeconds(2.0f);
3858 Animation animation = Animation::New(durationSeconds);
3859 Vector2 targetValue(60.0f, 60.0f);
3860 Vector2 relativeValue(targetValue - startValue);
3861 animation.AnimateBy(Property(actor, index), relativeValue);
3863 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3865 // Start the animation
3868 // Target value should be retrievable straight away
3869 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3871 bool signalReceived(false);
3872 AnimationFinishCheck finishCheck(signalReceived);
3873 animation.FinishedSignal().Connect(&application, finishCheck);
3875 application.SendNotification();
3876 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3878 // We didn't expect the animation to finish yet
3879 application.SendNotification();
3880 finishCheck.CheckSignalNotReceived();
3881 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3883 application.SendNotification();
3884 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3886 // We did expect the animation to finish
3887 application.SendNotification();
3888 finishCheck.CheckSignalReceived();
3889 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3891 // Check that nothing has changed after a couple of buffer swaps
3892 application.Render(0);
3893 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3894 application.Render(0);
3895 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3899 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3901 TestApplication application;
3903 Actor actor = Actor::New();
3905 // Register a Vector2 property
3906 Vector2 startValue(100.0f, 100.0f);
3907 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3908 Stage::GetCurrent().Add(actor);
3909 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3910 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3912 // Build the animation
3913 float durationSeconds(1.0f);
3914 Animation animation = Animation::New(durationSeconds);
3915 Vector2 targetValue(20.0f, 20.0f);
3916 Vector2 relativeValue(targetValue - startValue);
3917 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3919 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3921 // Start the animation
3924 bool signalReceived(false);
3925 AnimationFinishCheck finishCheck(signalReceived);
3926 animation.FinishedSignal().Connect(&application, finishCheck);
3928 application.SendNotification();
3929 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3931 // We didn't expect the animation to finish yet
3932 application.SendNotification();
3933 finishCheck.CheckSignalNotReceived();
3935 // The position should have moved more, than with a linear alpha function
3936 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
3937 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3938 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3940 application.SendNotification();
3941 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3943 // We did expect the animation to finish
3944 application.SendNotification();
3945 finishCheck.CheckSignalReceived();
3946 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3948 // Check that nothing has changed after a couple of buffer swaps
3949 application.Render(0);
3950 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3951 application.Render(0);
3952 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3956 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3958 TestApplication application;
3960 Actor actor = Actor::New();
3962 // Register a Vector2 property
3963 Vector2 startValue(10.0f, 10.0f);
3964 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3965 Stage::GetCurrent().Add(actor);
3966 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3967 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3969 // Build the animation
3970 float durationSeconds(1.0f);
3971 Animation animation = Animation::New(durationSeconds);
3972 Vector2 targetValue(30.0f, 30.0f);
3973 Vector2 relativeValue(targetValue - startValue);
3975 animation.AnimateBy(Property(actor, index),
3977 TimePeriod(delay, durationSeconds - delay));
3979 // Start the animation
3982 bool signalReceived(false);
3983 AnimationFinishCheck finishCheck(signalReceived);
3984 animation.FinishedSignal().Connect(&application, finishCheck);
3986 application.SendNotification();
3987 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3989 // We didn't expect the animation to finish yet
3990 application.SendNotification();
3991 finishCheck.CheckSignalNotReceived();
3992 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3994 application.SendNotification();
3995 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3997 // We didn't expect the animation to finish yet
3998 application.SendNotification();
3999 finishCheck.CheckSignalNotReceived();
4000 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4002 application.SendNotification();
4003 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4005 // We did expect the animation to finish
4006 application.SendNotification();
4007 finishCheck.CheckSignalReceived();
4008 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4010 // Check that nothing has changed after a couple of buffer swaps
4011 application.Render(0);
4012 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4013 application.Render(0);
4014 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4018 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4020 TestApplication application;
4022 Actor actor = Actor::New();
4024 // Register a Vector2 property
4025 Vector2 startValue(5.0f, 5.0f);
4026 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4027 Stage::GetCurrent().Add(actor);
4028 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4029 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4031 // Build the animation
4032 float durationSeconds(1.0f);
4033 Animation animation = Animation::New(durationSeconds);
4034 Vector2 targetValue(10.0f, 10.0f);
4035 Vector2 relativeValue(targetValue - startValue);
4037 animation.AnimateBy(Property(actor, index),
4039 AlphaFunction::LINEAR,
4040 TimePeriod(delay, durationSeconds - delay));
4042 // Start the animation
4045 bool signalReceived(false);
4046 AnimationFinishCheck finishCheck(signalReceived);
4047 animation.FinishedSignal().Connect(&application, finishCheck);
4049 application.SendNotification();
4050 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4052 // We didn't expect the animation to finish yet
4053 application.SendNotification();
4054 finishCheck.CheckSignalNotReceived();
4055 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4057 application.SendNotification();
4058 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4060 // We didn't expect the animation to finish yet
4061 application.SendNotification();
4062 finishCheck.CheckSignalNotReceived();
4063 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4065 application.SendNotification();
4066 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4068 // We did expect the animation to finish
4069 application.SendNotification();
4070 finishCheck.CheckSignalReceived();
4071 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4073 // Check that nothing has changed after a couple of buffer swaps
4074 application.Render(0);
4075 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4076 application.Render(0);
4077 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4081 int UtcDaliAnimationAnimateByVector3P(void)
4083 TestApplication application;
4085 Actor actor = Actor::New();
4087 // Register a Vector3 property
4088 Vector3 startValue(10.0f, 10.0f, 10.0f);
4089 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4090 Stage::GetCurrent().Add(actor);
4091 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4092 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4094 // Build the animation
4095 float durationSeconds(2.0f);
4096 Animation animation = Animation::New(durationSeconds);
4097 Vector3 targetValue(60.0f, 60.0f, 60.0f);
4098 Vector3 relativeValue(targetValue - startValue);
4099 animation.AnimateBy(Property(actor, index), relativeValue);
4101 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4103 // Start the animation
4106 // Target value should be retrievable straight away
4107 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4109 bool signalReceived(false);
4110 AnimationFinishCheck finishCheck(signalReceived);
4111 animation.FinishedSignal().Connect(&application, finishCheck);
4113 application.SendNotification();
4114 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4116 // We didn't expect the animation to finish yet
4117 application.SendNotification();
4118 finishCheck.CheckSignalNotReceived();
4119 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4121 application.SendNotification();
4122 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4124 // We did expect the animation to finish
4125 application.SendNotification();
4126 finishCheck.CheckSignalReceived();
4127 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4129 // Check that nothing has changed after a couple of buffer swaps
4130 application.Render(0);
4131 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4132 application.Render(0);
4133 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4137 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4139 TestApplication application;
4141 Actor actor = Actor::New();
4143 // Register a Vector3 property
4144 Vector3 startValue(100.0f, 100.0f, 100.0f);
4145 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4146 Stage::GetCurrent().Add(actor);
4147 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4148 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4150 // Build the animation
4151 float durationSeconds(1.0f);
4152 Animation animation = Animation::New(durationSeconds);
4153 Vector3 targetValue(20.0f, 20.0f, 20.0f);
4154 Vector3 relativeValue(targetValue - startValue);
4155 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4157 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4159 // Start the animation
4162 bool signalReceived(false);
4163 AnimationFinishCheck finishCheck(signalReceived);
4164 animation.FinishedSignal().Connect(&application, finishCheck);
4166 application.SendNotification();
4167 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4169 // We didn't expect the animation to finish yet
4170 application.SendNotification();
4171 finishCheck.CheckSignalNotReceived();
4173 // The position should have moved more, than with a linear alpha function
4174 Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
4175 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4176 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4177 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4179 application.SendNotification();
4180 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4182 // We did expect the animation to finish
4183 application.SendNotification();
4184 finishCheck.CheckSignalReceived();
4185 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4187 // Check that nothing has changed after a couple of buffer swaps
4188 application.Render(0);
4189 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4190 application.Render(0);
4191 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4195 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4197 TestApplication application;
4199 Actor actor = Actor::New();
4201 // Register a Vector3 property
4202 Vector3 startValue(10.0f, 10.0f, 10.0f);
4203 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4204 Stage::GetCurrent().Add(actor);
4205 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4206 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4208 // Build the animation
4209 float durationSeconds(1.0f);
4210 Animation animation = Animation::New(durationSeconds);
4211 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4212 Vector3 relativeValue(targetValue - startValue);
4214 animation.AnimateBy(Property(actor, index),
4216 TimePeriod(delay, durationSeconds - delay));
4218 // Start the animation
4221 bool signalReceived(false);
4222 AnimationFinishCheck finishCheck(signalReceived);
4223 animation.FinishedSignal().Connect(&application, finishCheck);
4225 application.SendNotification();
4226 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4228 // We didn't expect the animation to finish yet
4229 application.SendNotification();
4230 finishCheck.CheckSignalNotReceived();
4231 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4233 application.SendNotification();
4234 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4236 // We didn't expect the animation to finish yet
4237 application.SendNotification();
4238 finishCheck.CheckSignalNotReceived();
4239 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4241 application.SendNotification();
4242 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4244 // We did expect the animation to finish
4245 application.SendNotification();
4246 finishCheck.CheckSignalReceived();
4247 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4249 // Check that nothing has changed after a couple of buffer swaps
4250 application.Render(0);
4251 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4252 application.Render(0);
4253 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4257 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4259 TestApplication application;
4261 Actor actor = Actor::New();
4263 // Register a Vector3 property
4264 Vector3 startValue(5.0f, 5.0f, 5.0f);
4265 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4266 Stage::GetCurrent().Add(actor);
4267 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4268 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4270 // Build the animation
4271 float durationSeconds(1.0f);
4272 Animation animation = Animation::New(durationSeconds);
4273 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4274 Vector3 relativeValue(targetValue - startValue);
4276 animation.AnimateBy(Property(actor, index),
4278 AlphaFunction::LINEAR,
4279 TimePeriod(delay, durationSeconds - delay));
4281 // Start the animation
4284 bool signalReceived(false);
4285 AnimationFinishCheck finishCheck(signalReceived);
4286 animation.FinishedSignal().Connect(&application, finishCheck);
4288 application.SendNotification();
4289 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4291 // We didn't expect the animation to finish yet
4292 application.SendNotification();
4293 finishCheck.CheckSignalNotReceived();
4294 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4296 application.SendNotification();
4297 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4299 // We didn't expect the animation to finish yet
4300 application.SendNotification();
4301 finishCheck.CheckSignalNotReceived();
4302 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4304 application.SendNotification();
4305 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4307 // We did expect the animation to finish
4308 application.SendNotification();
4309 finishCheck.CheckSignalReceived();
4310 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4312 // Check that nothing has changed after a couple of buffer swaps
4313 application.Render(0);
4314 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4315 application.Render(0);
4316 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4320 int UtcDaliAnimationAnimateByVector4P(void)
4322 TestApplication application;
4324 Actor actor = Actor::New();
4326 // Register a Vector4 property
4327 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4328 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4329 Stage::GetCurrent().Add(actor);
4330 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4331 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4333 // Build the animation
4334 float durationSeconds(2.0f);
4335 Animation animation = Animation::New(durationSeconds);
4336 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4337 Vector4 relativeValue(targetValue - startValue);
4338 animation.AnimateBy(Property(actor, index), relativeValue);
4340 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4342 // Start the animation
4345 // Target value should be retrievable straight away
4346 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4348 bool signalReceived(false);
4349 AnimationFinishCheck finishCheck(signalReceived);
4350 animation.FinishedSignal().Connect(&application, finishCheck);
4352 application.SendNotification();
4353 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4355 // We didn't expect the animation to finish yet
4356 application.SendNotification();
4357 finishCheck.CheckSignalNotReceived();
4358 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4360 application.SendNotification();
4361 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4363 // We did expect the animation to finish
4364 application.SendNotification();
4365 finishCheck.CheckSignalReceived();
4366 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4368 // Check that nothing has changed after a couple of buffer swaps
4369 application.Render(0);
4370 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4371 application.Render(0);
4372 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4376 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4378 TestApplication application;
4380 Actor actor = Actor::New();
4382 // Register a Vector4 property
4383 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4384 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4385 Stage::GetCurrent().Add(actor);
4386 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4387 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4389 // Build the animation
4390 float durationSeconds(1.0f);
4391 Animation animation = Animation::New(durationSeconds);
4392 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4393 Vector4 relativeValue(targetValue - startValue);
4394 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4396 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4398 // Start the animation
4401 bool signalReceived(false);
4402 AnimationFinishCheck finishCheck(signalReceived);
4403 animation.FinishedSignal().Connect(&application, finishCheck);
4405 application.SendNotification();
4406 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4408 // We didn't expect the animation to finish yet
4409 application.SendNotification();
4410 finishCheck.CheckSignalNotReceived();
4412 // The position should have moved more, than with a linear alpha function
4413 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4414 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4415 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4416 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4417 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4419 application.SendNotification();
4420 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4422 // We did expect the animation to finish
4423 application.SendNotification();
4424 finishCheck.CheckSignalReceived();
4425 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4427 // Check that nothing has changed after a couple of buffer swaps
4428 application.Render(0);
4429 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4430 application.Render(0);
4431 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4435 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4437 TestApplication application;
4439 Actor actor = Actor::New();
4441 // Register a Vector4 property
4442 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4443 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4444 Stage::GetCurrent().Add(actor);
4445 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4446 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4448 // Build the animation
4449 float durationSeconds(1.0f);
4450 Animation animation = Animation::New(durationSeconds);
4451 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4452 Vector4 relativeValue(targetValue - startValue);
4454 animation.AnimateBy(Property(actor, index),
4456 TimePeriod(delay, durationSeconds - delay));
4458 // Start the animation
4461 bool signalReceived(false);
4462 AnimationFinishCheck finishCheck(signalReceived);
4463 animation.FinishedSignal().Connect(&application, finishCheck);
4465 application.SendNotification();
4466 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4468 // We didn't expect the animation to finish yet
4469 application.SendNotification();
4470 finishCheck.CheckSignalNotReceived();
4471 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4473 application.SendNotification();
4474 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4476 // We didn't expect the animation to finish yet
4477 application.SendNotification();
4478 finishCheck.CheckSignalNotReceived();
4479 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4481 application.SendNotification();
4482 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4484 // We did expect the animation to finish
4485 application.SendNotification();
4486 finishCheck.CheckSignalReceived();
4487 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4489 // Check that nothing has changed after a couple of buffer swaps
4490 application.Render(0);
4491 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4492 application.Render(0);
4493 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4497 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4499 TestApplication application;
4501 Actor actor = Actor::New();
4503 // Register a Vector4 property
4504 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4505 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4506 Stage::GetCurrent().Add(actor);
4507 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4508 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4510 // Build the animation
4511 float durationSeconds(1.0f);
4512 Animation animation = Animation::New(durationSeconds);
4513 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4514 Vector4 relativeValue(targetValue - startValue);
4516 animation.AnimateBy(Property(actor, index),
4518 AlphaFunction::LINEAR,
4519 TimePeriod(delay, durationSeconds - delay));
4521 // Start the animation
4524 bool signalReceived(false);
4525 AnimationFinishCheck finishCheck(signalReceived);
4526 animation.FinishedSignal().Connect(&application, finishCheck);
4528 application.SendNotification();
4529 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4531 // We didn't expect the animation to finish yet
4532 application.SendNotification();
4533 finishCheck.CheckSignalNotReceived();
4534 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4536 application.SendNotification();
4537 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4539 // We didn't expect the animation to finish yet
4540 application.SendNotification();
4541 finishCheck.CheckSignalNotReceived();
4542 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4544 application.SendNotification();
4545 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4547 // We did expect the animation to finish
4548 application.SendNotification();
4549 finishCheck.CheckSignalReceived();
4550 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4552 // Check that nothing has changed after a couple of buffer swaps
4553 application.Render(0);
4554 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4555 application.Render(0);
4556 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4560 int UtcDaliAnimationAnimateByActorPositionP(void)
4562 TestApplication application;
4564 Actor actor = Actor::New();
4565 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4566 actor.SetPosition(startPosition);
4567 Stage::GetCurrent().Add(actor);
4568 application.SendNotification();
4569 application.Render(0);
4570 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4572 // Build the animation
4573 float durationSeconds(1.0f);
4574 Animation animation = Animation::New(durationSeconds);
4575 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4576 Vector3 relativePosition(targetPosition - startPosition);
4577 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4579 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4581 // Start the animation
4584 // Target value should be retrievable straight away
4585 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4587 bool signalReceived(false);
4588 AnimationFinishCheck finishCheck(signalReceived);
4589 animation.FinishedSignal().Connect(&application, finishCheck);
4591 application.SendNotification();
4592 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4594 // We didn't expect the animation to finish yet
4595 application.SendNotification();
4596 finishCheck.CheckSignalNotReceived();
4597 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4599 application.SendNotification();
4600 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4602 // We did expect the animation to finish
4603 application.SendNotification();
4604 finishCheck.CheckSignalReceived();
4605 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4607 // Check that nothing has changed after a couple of buffer swaps
4608 application.Render(0);
4609 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4610 application.Render(0);
4611 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4615 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4617 TestApplication application;
4619 Actor actor = Actor::New();
4620 Stage::GetCurrent().Add(actor);
4621 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4623 // Build the animation
4624 float durationSeconds(1.0f);
4625 Animation animation = Animation::New(durationSeconds);
4626 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4627 Vector3 relativePosition(targetPosition - Vector3::ZERO);
4628 animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
4629 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
4630 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
4632 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4633 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4635 // Start the animation
4638 // Target value should be retrievable straight away
4639 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4640 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
4641 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
4642 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
4644 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
4646 application.SendNotification();
4647 application.Render( 1000 ); // 1 second progress
4649 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4654 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4656 TestApplication application;
4658 Actor actor = Actor::New();
4659 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4660 actor.SetPosition(startPosition);
4661 Stage::GetCurrent().Add(actor);
4662 application.SendNotification();
4663 application.Render(0);
4664 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4666 // Build the animation
4667 float durationSeconds(1.0f);
4668 Animation animation = Animation::New(durationSeconds);
4669 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4670 Vector3 relativePosition(targetPosition - startPosition);
4671 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4673 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4675 // Start the animation
4678 bool signalReceived(false);
4679 AnimationFinishCheck finishCheck(signalReceived);
4680 animation.FinishedSignal().Connect(&application, finishCheck);
4682 application.SendNotification();
4683 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4685 // We didn't expect the animation to finish yet
4686 application.SendNotification();
4687 finishCheck.CheckSignalNotReceived();
4689 // The position should have moved more, than with a linear alpha function
4690 Vector3 current(actor.GetCurrentPosition());
4691 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4692 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4693 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4695 application.SendNotification();
4696 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4698 // We did expect the animation to finish
4699 application.SendNotification();
4700 finishCheck.CheckSignalReceived();
4701 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4703 // Check that nothing has changed after a couple of buffer swaps
4704 application.Render(0);
4705 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4706 application.Render(0);
4707 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4711 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4713 TestApplication application;
4715 Actor actor = Actor::New();
4716 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4717 actor.SetPosition(startPosition);
4718 Stage::GetCurrent().Add(actor);
4719 application.SendNotification();
4720 application.Render(0);
4721 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4723 // Build the animation
4724 float durationSeconds(1.0f);
4725 Animation animation = Animation::New(durationSeconds);
4726 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4727 Vector3 relativePosition(targetPosition - startPosition);
4729 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4731 TimePeriod(delay, durationSeconds - delay));
4733 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4735 // Start the animation
4738 bool signalReceived(false);
4739 AnimationFinishCheck finishCheck(signalReceived);
4740 animation.FinishedSignal().Connect(&application, finishCheck);
4742 application.SendNotification();
4743 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4745 // We didn't expect the animation to finish yet
4746 application.SendNotification();
4747 finishCheck.CheckSignalNotReceived();
4748 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4750 application.SendNotification();
4751 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4753 // We did expect the animation to finish
4754 application.SendNotification();
4755 finishCheck.CheckSignalReceived();
4756 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4758 // Check that nothing has changed after a couple of buffer swaps
4759 application.Render(0);
4760 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4761 application.Render(0);
4762 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4766 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4768 TestApplication application;
4770 Actor actor = Actor::New();
4771 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4772 actor.SetPosition(startPosition);
4773 Stage::GetCurrent().Add(actor);
4774 application.SendNotification();
4775 application.Render(0);
4776 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4778 // Build the animation
4779 float durationSeconds(1.0f);
4780 Animation animation = Animation::New(durationSeconds);
4781 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4782 Vector3 relativePosition(targetPosition - startPosition);
4784 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4786 AlphaFunction::LINEAR,
4787 TimePeriod(delay, durationSeconds - delay));
4789 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4791 // Start the animation
4794 bool signalReceived(false);
4795 AnimationFinishCheck finishCheck(signalReceived);
4796 animation.FinishedSignal().Connect(&application, finishCheck);
4798 application.SendNotification();
4799 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4801 // We didn't expect the animation to finish yet
4802 application.SendNotification();
4803 finishCheck.CheckSignalNotReceived();
4804 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4806 application.SendNotification();
4807 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4809 // We did expect the animation to finish
4810 application.SendNotification();
4811 finishCheck.CheckSignalReceived();
4812 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4814 // Check that nothing has changed after a couple of buffer swaps
4815 application.Render(0);
4816 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4817 application.Render(0);
4818 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4822 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4824 TestApplication application;
4826 Actor actor = Actor::New();
4827 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4828 Stage::GetCurrent().Add(actor);
4829 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4831 // Build the animation
4832 float durationSeconds(1.0f);
4833 Animation animation = Animation::New(durationSeconds);
4834 Degree relativeRotationDegrees(360.0f);
4835 Radian relativeRotationRadians(relativeRotationDegrees);
4836 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4838 // Start the animation
4841 // Target value should be retrievable straight away
4842 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4844 bool signalReceived(false);
4845 AnimationFinishCheck finishCheck(signalReceived);
4846 animation.FinishedSignal().Connect(&application, finishCheck);
4848 application.SendNotification();
4849 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4851 // We didn't expect the animation to finish yet
4852 application.SendNotification();
4853 finishCheck.CheckSignalNotReceived();
4854 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4856 application.SendNotification();
4857 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4859 // We didn't expect the animation to finish yet
4860 application.SendNotification();
4861 finishCheck.CheckSignalNotReceived();
4862 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4864 application.SendNotification();
4865 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4867 // We didn't expect the animation to finish yet
4868 application.SendNotification();
4869 finishCheck.CheckSignalNotReceived();
4870 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4872 application.SendNotification();
4873 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4875 // We did expect the animation to finish
4876 application.SendNotification();
4877 finishCheck.CheckSignalReceived();
4878 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4882 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4884 TestApplication application;
4886 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4888 Actor actor = Actor::New();
4889 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4890 Stage::GetCurrent().Add(actor);
4891 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4893 // Build the animation
4894 float durationSeconds(1.0f);
4895 Animation animation = Animation::New(durationSeconds);
4896 Degree relativeRotationDegrees(710.0f);
4897 Radian relativeRotationRadians(relativeRotationDegrees);
4899 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4901 // Start the animation
4904 bool signalReceived(false);
4905 AnimationFinishCheck finishCheck(signalReceived);
4906 animation.FinishedSignal().Connect(&application, finishCheck);
4908 application.SendNotification();
4909 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4911 // We didn't expect the animation to finish yet
4912 application.SendNotification();
4913 finishCheck.CheckSignalNotReceived();
4914 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4916 application.SendNotification();
4917 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4919 // We didn't expect the animation to finish yet
4920 application.SendNotification();
4921 finishCheck.CheckSignalNotReceived();
4922 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4924 application.SendNotification();
4925 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4927 // We didn't expect the animation to finish yet
4928 application.SendNotification();
4929 finishCheck.CheckSignalNotReceived();
4930 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4932 application.SendNotification();
4933 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4935 // We did expect the animation to finish
4936 application.SendNotification();
4937 finishCheck.CheckSignalReceived();
4938 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4943 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4945 TestApplication application;
4947 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4949 Actor actor = Actor::New();
4950 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4951 Stage::GetCurrent().Add(actor);
4952 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4954 // Build the animation
4955 float durationSeconds(1.0f);
4956 Animation animation = Animation::New(durationSeconds);
4957 Degree relativeRotationDegrees(730.0f);
4958 Radian relativeRotationRadians(relativeRotationDegrees);
4960 Radian actualRotationRadians( Degree(10.0f) );
4962 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4964 // Start the animation
4967 bool signalReceived(false);
4968 AnimationFinishCheck finishCheck(signalReceived);
4969 animation.FinishedSignal().Connect(&application, finishCheck);
4971 application.SendNotification();
4972 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4974 // We didn't expect the animation to finish yet
4975 application.SendNotification();
4976 finishCheck.CheckSignalNotReceived();
4977 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4979 application.SendNotification();
4980 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4982 // We didn't expect the animation to finish yet
4983 application.SendNotification();
4984 finishCheck.CheckSignalNotReceived();
4985 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4987 application.SendNotification();
4988 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4990 // We didn't expect the animation to finish yet
4991 application.SendNotification();
4992 finishCheck.CheckSignalNotReceived();
4993 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4995 application.SendNotification();
4996 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4998 // We did expect the animation to finish
4999 application.SendNotification();
5000 finishCheck.CheckSignalReceived();
5001 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5002 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5007 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5009 TestApplication application;
5011 Actor actor = Actor::New();
5012 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5013 Stage::GetCurrent().Add(actor);
5014 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5016 // Build the animation
5017 float durationSeconds(1.0f);
5018 Animation animation = Animation::New(durationSeconds);
5019 Degree relativeRotationDegrees(360.0f);
5020 Radian relativeRotationRadians(relativeRotationDegrees);
5021 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
5023 // Start the animation
5026 bool signalReceived(false);
5027 AnimationFinishCheck finishCheck(signalReceived);
5028 animation.FinishedSignal().Connect(&application, finishCheck);
5030 application.SendNotification();
5031 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5033 // We didn't expect the animation to finish yet
5034 application.SendNotification();
5035 finishCheck.CheckSignalNotReceived();
5036 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5038 application.SendNotification();
5039 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5041 // We didn't expect the animation to finish yet
5042 application.SendNotification();
5043 finishCheck.CheckSignalNotReceived();
5044 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5046 application.SendNotification();
5047 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5049 // We didn't expect the animation to finish yet
5050 application.SendNotification();
5051 finishCheck.CheckSignalNotReceived();
5052 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5054 application.SendNotification();
5055 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5057 // We did expect the animation to finish
5058 application.SendNotification();
5059 finishCheck.CheckSignalReceived();
5060 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5064 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5066 TestApplication application;
5068 Actor actor = Actor::New();
5069 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5070 Stage::GetCurrent().Add(actor);
5071 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5073 // Build the animation
5074 float durationSeconds(1.0f);
5075 Animation animation = Animation::New(durationSeconds);
5076 Degree relativeRotationDegrees(360.0f);
5077 Radian relativeRotationRadians(relativeRotationDegrees);
5079 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
5080 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
5082 // Start the animation
5085 bool signalReceived(false);
5086 AnimationFinishCheck finishCheck(signalReceived);
5087 animation.FinishedSignal().Connect(&application, finishCheck);
5089 application.SendNotification();
5090 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5092 // We didn't expect the animation to finish yet
5093 application.SendNotification();
5094 finishCheck.CheckSignalNotReceived();
5095 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5096 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5098 application.SendNotification();
5099 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5101 // We didn't expect the animation to finish yet
5102 application.SendNotification();
5103 finishCheck.CheckSignalNotReceived();
5104 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5105 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5107 application.SendNotification();
5108 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5110 // We didn't expect the animation to finish yet
5111 application.SendNotification();
5112 finishCheck.CheckSignalNotReceived();
5113 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5114 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5116 application.SendNotification();
5117 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5119 // We did expect the animation to finish
5120 application.SendNotification();
5121 finishCheck.CheckSignalReceived();
5122 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5126 int UtcDaliAnimationAnimateByActorScaleP(void)
5128 TestApplication application;
5130 Actor actor = Actor::New();
5131 Stage::GetCurrent().Add(actor);
5132 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5134 // Build the animation
5135 float durationSeconds(1.0f);
5136 Animation animation = Animation::New(durationSeconds);
5137 Vector3 targetScale(2.0f, 2.0f, 2.0f);
5138 Vector3 relativeScale(targetScale - Vector3::ONE);
5139 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
5141 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
5143 // Start the animation
5146 // Target value should be retrievable straight away
5147 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5149 bool signalReceived(false);
5150 AnimationFinishCheck finishCheck(signalReceived);
5151 animation.FinishedSignal().Connect(&application, finishCheck);
5153 application.SendNotification();
5154 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5156 // We didn't expect the animation to finish yet
5157 application.SendNotification();
5158 finishCheck.CheckSignalNotReceived();
5159 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
5161 application.SendNotification();
5162 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5164 // We did expect the animation to finish
5165 application.SendNotification();
5166 finishCheck.CheckSignalReceived();
5167 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5170 finishCheck.Reset();
5171 actor.SetScale(Vector3::ONE);
5172 application.SendNotification();
5173 application.Render(0);
5174 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5176 // Repeat with a different (ease-in) alpha function
5177 animation = Animation::New(durationSeconds);
5178 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
5179 animation.FinishedSignal().Connect(&application, finishCheck);
5182 application.SendNotification();
5183 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5185 // We didn't expect the animation to finish yet
5186 application.SendNotification();
5187 finishCheck.CheckSignalNotReceived();
5189 // The scale should have grown less, than with a linear alpha function
5190 Vector3 current(actor.GetCurrentScale());
5191 DALI_TEST_CHECK( current.x > 1.0f );
5192 DALI_TEST_CHECK( current.y > 1.0f );
5193 DALI_TEST_CHECK( current.z > 1.0f );
5194 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5195 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5196 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5198 application.SendNotification();
5199 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5201 // We did expect the animation to finish
5202 application.SendNotification();
5203 finishCheck.CheckSignalReceived();
5204 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5207 finishCheck.Reset();
5208 actor.SetScale(Vector3::ONE);
5209 application.SendNotification();
5210 application.Render(0);
5211 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5213 // Repeat with a delay
5215 animation = Animation::New(durationSeconds);
5216 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
5217 animation.FinishedSignal().Connect(&application, finishCheck);
5220 application.SendNotification();
5221 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5223 // We didn't expect the animation to finish yet
5224 application.SendNotification();
5225 finishCheck.CheckSignalNotReceived();
5226 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5228 application.SendNotification();
5229 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5231 // We did expect the animation to finish
5232 application.SendNotification();
5233 finishCheck.CheckSignalReceived();
5234 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5238 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5240 TestApplication application;
5242 Actor actor = Actor::New();
5243 Stage::GetCurrent().Add(actor);
5244 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5246 // Build the animation
5247 float durationSeconds(1.0f);
5248 Animation animation = Animation::New(durationSeconds);
5249 Vector3 targetScale(2.0f, 3.0f, 4.0f);
5250 Vector3 relativeScale(targetScale - Vector3::ONE);
5251 animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
5252 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
5253 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
5255 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5256 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5258 // Start the animation
5261 // Target value should be retrievable straight away
5262 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5263 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
5264 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
5265 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
5267 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Not changed yet
5269 application.SendNotification();
5270 application.Render( 1000 ); // 1 second progress
5272 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5277 int UtcDaliAnimationAnimateByActorColorP(void)
5279 TestApplication application;
5281 Actor actor = Actor::New();
5282 Stage::GetCurrent().Add(actor);
5283 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5285 // Build the animation
5286 float durationSeconds(1.0f);
5287 Animation animation = Animation::New(durationSeconds);
5288 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5289 Vector4 relativeColor( targetColor - Color::WHITE );
5290 animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
5292 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5293 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5295 // Start the animation
5298 // Target value should be retrievable straight away
5299 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5300 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5301 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5302 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5303 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5305 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5307 application.SendNotification();
5308 application.Render( 1000 ); // 1 second progress
5310 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5315 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5317 TestApplication application;
5319 Actor actor = Actor::New();
5320 Stage::GetCurrent().Add(actor);
5321 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5323 // Build the animation
5324 float durationSeconds(1.0f);
5325 Animation animation = Animation::New(durationSeconds);
5326 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5327 Vector4 relativeColor( targetColor - Color::WHITE );
5328 animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
5329 animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
5330 animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
5331 animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
5333 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5334 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5336 // Start the animation
5339 // Target value should be retrievable straight away
5340 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5341 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5342 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5343 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5344 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5346 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5348 application.SendNotification();
5349 application.Render( 1000 ); // 1 second progress
5351 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5356 int UtcDaliAnimationAnimateByActorSizeP(void)
5358 TestApplication application;
5360 Actor actor = Actor::New();
5361 Stage::GetCurrent().Add(actor);
5362 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5364 // Build the animation
5365 float durationSeconds(1.0f);
5366 Animation animation = Animation::New(durationSeconds);
5367 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5368 Vector3 relativeSize( targetSize - Vector3::ZERO );
5369 animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
5371 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5372 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5374 // Start the animation
5377 // Target value should be retrievable straight away
5378 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5379 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5380 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5381 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5383 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5385 application.SendNotification();
5386 application.Render( 1000 ); // 1 second progress
5388 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5393 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5395 TestApplication application;
5397 Actor actor = Actor::New();
5398 Stage::GetCurrent().Add(actor);
5399 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5401 // Build the animation
5402 float durationSeconds(1.0f);
5403 Animation animation = Animation::New(durationSeconds);
5404 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5405 Vector3 relativeSize( targetSize - Vector3::ZERO );
5406 animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
5407 animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
5408 animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
5410 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5411 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5413 // Start the animation
5416 // Target value should be retrievable straight away
5417 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5418 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5419 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5420 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5422 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5424 application.SendNotification();
5425 application.Render( 1000 ); // 1 second progress
5427 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5432 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5434 TestApplication application;
5436 Actor actor = Actor::New();
5437 Stage::GetCurrent().Add(actor);
5438 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5440 actor.SetVisible( false );
5442 application.SendNotification();
5443 application.Render();
5445 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
5447 // Build the animation
5448 float durationSeconds(1.0f);
5449 Animation animation = Animation::New(durationSeconds);
5450 bool targetVisibility( true );
5451 bool relativeVisibility( targetVisibility );
5452 animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
5454 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5456 // Start the animation
5459 // Target value should be retrievable straight away
5460 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
5461 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION ); // Not changed yet
5463 application.SendNotification();
5464 application.Render( 1000 ); // 1 second progress
5466 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5471 int UtcDaliAnimationAnimateToBooleanP(void)
5473 TestApplication application;
5475 Actor actor = Actor::New();
5477 // Register a boolean property
5478 const bool startValue(false);
5479 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5480 Stage::GetCurrent().Add(actor);
5481 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5482 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5484 // Build the animation
5485 float durationSeconds(2.0f);
5486 Animation animation = Animation::New(durationSeconds);
5487 const bool targetValue( !startValue );
5488 animation.AnimateTo(Property(actor, index), targetValue);
5490 // Start the animation
5493 bool signalReceived(false);
5494 AnimationFinishCheck finishCheck(signalReceived);
5495 animation.FinishedSignal().Connect(&application, finishCheck);
5497 application.SendNotification();
5498 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5500 // We didn't expect the animation to finish yet
5501 application.SendNotification();
5502 finishCheck.CheckSignalNotReceived();
5503 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5505 application.SendNotification();
5506 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5508 // We did expect the animation to finish
5509 application.SendNotification();
5510 finishCheck.CheckSignalReceived();
5511 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5513 // Check that nothing has changed after a couple of buffer swaps
5514 application.Render(0);
5515 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5516 application.Render(0);
5517 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5519 // Repeat with target value "false"
5520 animation = Animation::New(durationSeconds);
5521 const bool finalValue( !targetValue );
5522 animation.AnimateTo(Property(actor, index), finalValue);
5524 // Start the animation
5527 finishCheck.Reset();
5528 animation.FinishedSignal().Connect(&application, finishCheck);
5530 application.SendNotification();
5531 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5533 // We didn't expect the animation to finish yet
5534 application.SendNotification();
5535 finishCheck.CheckSignalNotReceived();
5536 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5538 application.SendNotification();
5539 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5541 // We did expect the animation to finish
5542 application.SendNotification();
5543 finishCheck.CheckSignalReceived();
5544 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5546 // Check that nothing has changed after a couple of buffer swaps
5547 application.Render(0);
5548 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5549 application.Render(0);
5550 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5554 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5556 TestApplication application;
5558 Actor actor = Actor::New();
5560 // Register a boolean property
5561 const bool startValue(false);
5562 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5563 Stage::GetCurrent().Add(actor);
5564 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5565 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5567 // Build the animation
5568 float durationSeconds(2.0f);
5569 Animation animation = Animation::New(durationSeconds);
5570 const bool targetValue( !startValue );
5571 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5573 // Start the animation
5576 bool signalReceived(false);
5577 AnimationFinishCheck finishCheck(signalReceived);
5578 animation.FinishedSignal().Connect(&application, finishCheck);
5580 application.SendNotification();
5581 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5583 // We didn't expect the animation to finish yet
5584 application.SendNotification();
5585 finishCheck.CheckSignalNotReceived();
5586 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5588 application.SendNotification();
5589 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5591 // We did expect the animation to finish
5592 application.SendNotification();
5593 finishCheck.CheckSignalReceived();
5594 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5596 // Check that nothing has changed after a couple of buffer swaps
5597 application.Render(0);
5598 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5599 application.Render(0);
5600 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5602 // Repeat with target value "false"
5603 animation = Animation::New(durationSeconds);
5604 const bool finalValue( !targetValue );
5605 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5607 // Start the animation
5610 finishCheck.Reset();
5611 animation.FinishedSignal().Connect(&application, finishCheck);
5613 application.SendNotification();
5614 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5616 // We didn't expect the animation to finish yet
5617 application.SendNotification();
5618 finishCheck.CheckSignalNotReceived();
5619 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5621 application.SendNotification();
5622 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5624 // We did expect the animation to finish
5625 application.SendNotification();
5626 finishCheck.CheckSignalReceived();
5627 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5629 // Check that nothing has changed after a couple of buffer swaps
5630 application.Render(0);
5631 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5632 application.Render(0);
5633 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5637 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5639 TestApplication application;
5641 Actor actor = Actor::New();
5643 // Register a boolean property
5644 bool startValue(false);
5645 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5646 Stage::GetCurrent().Add(actor);
5647 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5648 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5650 // Build the animation
5651 float durationSeconds(2.0f);
5652 Animation animation = Animation::New(durationSeconds);
5653 bool finalValue( !startValue );
5654 float animatorDurationSeconds(durationSeconds * 0.5f);
5655 animation.AnimateTo( Property(actor, index),
5657 TimePeriod( animatorDurationSeconds ) );
5659 // Start the animation
5662 bool signalReceived(false);
5663 AnimationFinishCheck finishCheck(signalReceived);
5664 animation.FinishedSignal().Connect(&application, finishCheck);
5666 application.SendNotification();
5667 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5669 // We didn't expect the animation to finish yet
5670 application.SendNotification();
5671 finishCheck.CheckSignalNotReceived();
5672 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5674 application.SendNotification();
5675 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5677 // We didn't expect the animation to finish yet...
5678 application.SendNotification();
5679 finishCheck.CheckSignalNotReceived();
5681 // ...however we should have reached the final value
5682 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5684 application.SendNotification();
5685 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5687 // We did expect the animation to finish
5688 application.SendNotification();
5689 finishCheck.CheckSignalReceived();
5690 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5692 // Check that nothing has changed after a couple of buffer swaps
5693 application.Render(0);
5694 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5695 application.Render(0);
5696 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5700 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5702 TestApplication application;
5704 Actor actor = Actor::New();
5706 // Register a boolean property
5707 bool startValue(false);
5708 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5709 Stage::GetCurrent().Add(actor);
5710 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5711 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5713 // Build the animation
5714 float durationSeconds(2.0f);
5715 Animation animation = Animation::New(durationSeconds);
5716 bool finalValue( !startValue );
5717 float animatorDurationSeconds(durationSeconds * 0.5f);
5718 animation.AnimateTo( Property(actor, index),
5720 AlphaFunction::LINEAR,
5721 TimePeriod( animatorDurationSeconds ) );
5723 // Start the animation
5726 bool signalReceived(false);
5727 AnimationFinishCheck finishCheck(signalReceived);
5728 animation.FinishedSignal().Connect(&application, finishCheck);
5730 application.SendNotification();
5731 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5733 // We didn't expect the animation to finish yet
5734 application.SendNotification();
5735 finishCheck.CheckSignalNotReceived();
5736 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5738 application.SendNotification();
5739 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5741 // We didn't expect the animation to finish yet...
5742 application.SendNotification();
5743 finishCheck.CheckSignalNotReceived();
5745 // ...however we should have reached the final value
5746 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5748 application.SendNotification();
5749 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5751 // We did expect the animation to finish
5752 application.SendNotification();
5753 finishCheck.CheckSignalReceived();
5754 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5756 // Check that nothing has changed after a couple of buffer swaps
5757 application.Render(0);
5758 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5759 application.Render(0);
5760 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5764 int UtcDaliAnimationAnimateToFloatP(void)
5766 TestApplication application;
5768 Actor actor = Actor::New();
5770 // Register a float property
5771 float startValue(10.0f);
5772 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5773 Stage::GetCurrent().Add(actor);
5774 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5777 // Build the animation
5778 float durationSeconds(2.0f);
5779 Animation animation = Animation::New(durationSeconds);
5780 float targetValue(50.0f);
5781 float relativeValue(targetValue - startValue);
5782 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5784 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5786 // Start the animation
5789 bool signalReceived(false);
5790 AnimationFinishCheck finishCheck(signalReceived);
5791 animation.FinishedSignal().Connect(&application, finishCheck);
5793 application.SendNotification();
5794 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5796 // We didn't expect the animation to finish yet
5797 application.SendNotification();
5798 finishCheck.CheckSignalNotReceived();
5799 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5801 application.SendNotification();
5802 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5804 // We did expect the animation to finish
5805 application.SendNotification();
5806 finishCheck.CheckSignalReceived();
5807 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5811 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5813 TestApplication application;
5815 Actor actor = Actor::New();
5817 // Register a float property
5818 float startValue(10.0f);
5819 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5820 Stage::GetCurrent().Add(actor);
5821 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5822 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5824 // Build the animation
5825 float durationSeconds(1.0f);
5826 Animation animation = Animation::New(durationSeconds);
5827 float targetValue(90.0f);
5828 float relativeValue(targetValue - startValue);
5829 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5831 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5833 // Start the animation
5836 bool signalReceived(false);
5837 AnimationFinishCheck finishCheck(signalReceived);
5838 animation.FinishedSignal().Connect(&application, finishCheck);
5840 application.SendNotification();
5841 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5843 // We didn't expect the animation to finish yet
5844 application.SendNotification();
5845 finishCheck.CheckSignalNotReceived();
5847 // The position should have moved more, than with a linear alpha function
5848 float current( actor.GetCurrentProperty< float >( index ) );
5849 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5851 application.SendNotification();
5852 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5854 // We did expect the animation to finish
5855 application.SendNotification();
5856 finishCheck.CheckSignalReceived();
5857 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5861 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5863 TestApplication application;
5865 Actor actor = Actor::New();
5867 // Register a float property
5868 float startValue(10.0f);
5869 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5870 Stage::GetCurrent().Add(actor);
5871 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5872 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5874 // Build the animation
5875 float durationSeconds(1.0f);
5876 Animation animation = Animation::New(durationSeconds);
5877 float targetValue(30.0f);
5878 float relativeValue(targetValue - startValue);
5880 animation.AnimateTo(Property(actor, index),
5882 TimePeriod(delay, durationSeconds - delay));
5884 // Start the animation
5887 bool signalReceived(false);
5888 AnimationFinishCheck finishCheck(signalReceived);
5889 animation.FinishedSignal().Connect(&application, finishCheck);
5891 application.SendNotification();
5892 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5894 // We didn't expect the animation to finish yet
5895 application.SendNotification();
5896 finishCheck.CheckSignalNotReceived();
5897 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5899 application.SendNotification();
5900 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5902 // We didn't expect the animation to finish yet
5903 application.SendNotification();
5904 finishCheck.CheckSignalNotReceived();
5905 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5907 application.SendNotification();
5908 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5910 // We did expect the animation to finish
5911 application.SendNotification();
5912 finishCheck.CheckSignalReceived();
5913 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5917 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5919 TestApplication application;
5921 Actor actor = Actor::New();
5923 // Register a float property
5924 float startValue(10.0f);
5925 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5926 Stage::GetCurrent().Add(actor);
5927 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5928 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5930 // Build the animation
5931 float durationSeconds(1.0f);
5932 Animation animation = Animation::New(durationSeconds);
5933 float targetValue(30.0f);
5934 float relativeValue(targetValue - startValue);
5936 animation.AnimateTo(Property(actor, index),
5938 AlphaFunction::LINEAR,
5939 TimePeriod(delay, durationSeconds - delay));
5941 // Start the animation
5944 bool signalReceived(false);
5945 AnimationFinishCheck finishCheck(signalReceived);
5946 animation.FinishedSignal().Connect(&application, finishCheck);
5948 application.SendNotification();
5949 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5951 // We didn't expect the animation to finish yet
5952 application.SendNotification();
5953 finishCheck.CheckSignalNotReceived();
5954 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5956 application.SendNotification();
5957 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5959 // We didn't expect the animation to finish yet
5960 application.SendNotification();
5961 finishCheck.CheckSignalNotReceived();
5962 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5964 application.SendNotification();
5965 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5967 // We did expect the animation to finish
5968 application.SendNotification();
5969 finishCheck.CheckSignalReceived();
5970 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5974 int UtcDaliAnimationAnimateToIntegerP(void)
5976 TestApplication application;
5978 Actor actor = Actor::New();
5980 // Register an integer property
5982 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5983 Stage::GetCurrent().Add(actor);
5984 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5985 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5987 // Build the animation
5988 float durationSeconds(2.0f);
5989 Animation animation = Animation::New(durationSeconds);
5990 int targetValue(50);
5991 int relativeValue(targetValue - startValue);
5992 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5994 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5996 // Start the animation
5999 bool signalReceived(false);
6000 AnimationFinishCheck finishCheck(signalReceived);
6001 animation.FinishedSignal().Connect(&application, finishCheck);
6003 application.SendNotification();
6004 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6006 // We didn't expect the animation to finish yet
6007 application.SendNotification();
6008 finishCheck.CheckSignalNotReceived();
6009 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6011 application.SendNotification();
6012 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6014 // We did expect the animation to finish
6015 application.SendNotification();
6016 finishCheck.CheckSignalReceived();
6017 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6021 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6023 TestApplication application;
6025 Actor actor = Actor::New();
6027 // Register an integer property
6029 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6030 Stage::GetCurrent().Add(actor);
6031 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6032 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6034 // Build the animation
6035 float durationSeconds(1.0f);
6036 Animation animation = Animation::New(durationSeconds);
6037 int targetValue(90);
6038 int relativeValue(targetValue - startValue);
6039 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6041 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
6043 // Start the animation
6046 bool signalReceived(false);
6047 AnimationFinishCheck finishCheck(signalReceived);
6048 animation.FinishedSignal().Connect(&application, finishCheck);
6050 application.SendNotification();
6051 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6053 // We didn't expect the animation to finish yet
6054 application.SendNotification();
6055 finishCheck.CheckSignalNotReceived();
6057 // The position should have moved more, than with a linear alpha function
6058 int current( actor.GetCurrentProperty< int >( index ) );
6059 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
6061 application.SendNotification();
6062 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6064 // We did expect the animation to finish
6065 application.SendNotification();
6066 finishCheck.CheckSignalReceived();
6067 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6071 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6073 TestApplication application;
6075 Actor actor = Actor::New();
6077 // Register an integer property
6079 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6080 Stage::GetCurrent().Add(actor);
6081 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6082 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6084 // Build the animation
6085 float durationSeconds(1.0f);
6086 Animation animation = Animation::New(durationSeconds);
6087 int targetValue(30);
6088 int relativeValue(targetValue - startValue);
6090 animation.AnimateTo(Property(actor, index),
6092 TimePeriod(delay, durationSeconds - delay));
6094 // Start the animation
6097 bool signalReceived(false);
6098 AnimationFinishCheck finishCheck(signalReceived);
6099 animation.FinishedSignal().Connect(&application, finishCheck);
6101 application.SendNotification();
6102 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6104 // We didn't expect the animation to finish yet
6105 application.SendNotification();
6106 finishCheck.CheckSignalNotReceived();
6107 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6109 application.SendNotification();
6110 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6112 // We didn't expect the animation to finish yet
6113 application.SendNotification();
6114 finishCheck.CheckSignalNotReceived();
6115 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6117 application.SendNotification();
6118 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6120 // We did expect the animation to finish
6121 application.SendNotification();
6122 finishCheck.CheckSignalReceived();
6123 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6127 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6129 TestApplication application;
6131 Actor actor = Actor::New();
6133 // Register an integer property
6135 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6136 Stage::GetCurrent().Add(actor);
6137 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6138 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6140 // Build the animation
6141 float durationSeconds(1.0f);
6142 Animation animation = Animation::New(durationSeconds);
6143 int targetValue(30);
6144 int relativeValue(targetValue - startValue);
6146 animation.AnimateTo(Property(actor, index),
6148 AlphaFunction::LINEAR,
6149 TimePeriod(delay, durationSeconds - delay));
6151 // Start the animation
6154 bool signalReceived(false);
6155 AnimationFinishCheck finishCheck(signalReceived);
6156 animation.FinishedSignal().Connect(&application, finishCheck);
6158 application.SendNotification();
6159 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6161 // We didn't expect the animation to finish yet
6162 application.SendNotification();
6163 finishCheck.CheckSignalNotReceived();
6164 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6166 application.SendNotification();
6167 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6169 // We didn't expect the animation to finish yet
6170 application.SendNotification();
6171 finishCheck.CheckSignalNotReceived();
6172 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6174 application.SendNotification();
6175 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6177 // We did expect the animation to finish
6178 application.SendNotification();
6179 finishCheck.CheckSignalReceived();
6180 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6184 int UtcDaliAnimationAnimateToVector2P(void)
6186 TestApplication application;
6188 Actor actor = Actor::New();
6190 // Register a Vector2 property
6191 Vector2 startValue(-50.0f, -50.0f);
6192 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6193 Stage::GetCurrent().Add(actor);
6194 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6195 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6197 // Build the animation
6198 float durationSeconds(2.0f);
6199 Animation animation = Animation::New(durationSeconds);
6200 Vector2 targetValue(50.0f, 50.0f);
6201 Vector2 relativeValue(targetValue - startValue);
6202 animation.AnimateTo(Property(actor, index), targetValue);
6204 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6206 // Start the animation
6209 bool signalReceived(false);
6210 AnimationFinishCheck finishCheck(signalReceived);
6211 animation.FinishedSignal().Connect(&application, finishCheck);
6213 application.SendNotification();
6214 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6216 // We didn't expect the animation to finish yet
6217 application.SendNotification();
6218 finishCheck.CheckSignalNotReceived();
6219 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6221 application.SendNotification();
6222 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6224 // We did expect the animation to finish
6225 application.SendNotification();
6226 finishCheck.CheckSignalReceived();
6227 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6231 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6233 TestApplication application;
6235 Actor actor = Actor::New();
6237 // Register a Vector2 property
6238 Vector2 startValue(1000.0f, 1000.0f);
6239 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6240 Stage::GetCurrent().Add(actor);
6241 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6242 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6244 // Build the animation
6245 float durationSeconds(1.0f);
6246 Animation animation = Animation::New(durationSeconds);
6247 Vector2 targetValue(9000.0f, 9000.0f);
6248 Vector2 relativeValue(targetValue - startValue);
6249 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6251 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6253 // Start the animation
6256 bool signalReceived(false);
6257 AnimationFinishCheck finishCheck(signalReceived);
6258 animation.FinishedSignal().Connect(&application, finishCheck);
6260 application.SendNotification();
6261 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6263 // We didn't expect the animation to finish yet
6264 application.SendNotification();
6265 finishCheck.CheckSignalNotReceived();
6267 // The position should have moved more, than with a linear alpha function
6268 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
6269 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6270 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6272 application.SendNotification();
6273 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6275 // We did expect the animation to finish
6276 application.SendNotification();
6277 finishCheck.CheckSignalReceived();
6278 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6282 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6284 TestApplication application;
6286 Actor actor = Actor::New();
6288 // Register a Vector2 property
6289 Vector2 startValue(10.0f, 10.0f);
6290 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6291 Stage::GetCurrent().Add(actor);
6292 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6293 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6295 // Build the animation
6296 float durationSeconds(1.0f);
6297 Animation animation = Animation::New(durationSeconds);
6298 Vector2 targetValue(-10.0f, 20.0f);
6299 Vector2 relativeValue(targetValue - startValue);
6301 animation.AnimateTo(Property(actor, index),
6303 TimePeriod(delay, durationSeconds - delay));
6305 // Start the animation
6308 bool signalReceived(false);
6309 AnimationFinishCheck finishCheck(signalReceived);
6310 animation.FinishedSignal().Connect(&application, finishCheck);
6312 application.SendNotification();
6313 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6315 // We didn't expect the animation to finish yet
6316 application.SendNotification();
6317 finishCheck.CheckSignalNotReceived();
6318 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6320 application.SendNotification();
6321 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6323 // We didn't expect the animation to finish yet
6324 application.SendNotification();
6325 finishCheck.CheckSignalNotReceived();
6326 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6328 application.SendNotification();
6329 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6331 // We did expect the animation to finish
6332 application.SendNotification();
6333 finishCheck.CheckSignalReceived();
6334 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6338 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6340 TestApplication application;
6342 Actor actor = Actor::New();
6344 // Register a Vector2 property
6345 Vector2 startValue(10.0f, 10.0f);
6346 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6347 Stage::GetCurrent().Add(actor);
6348 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6349 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6351 // Build the animation
6352 float durationSeconds(1.0f);
6353 Animation animation = Animation::New(durationSeconds);
6354 Vector2 targetValue(30.0f, 30.0f);
6355 Vector2 relativeValue(targetValue - startValue);
6357 animation.AnimateTo(Property(actor, index),
6359 AlphaFunction::LINEAR,
6360 TimePeriod(delay, durationSeconds - delay));
6362 // Start the animation
6365 bool signalReceived(false);
6366 AnimationFinishCheck finishCheck(signalReceived);
6367 animation.FinishedSignal().Connect(&application, finishCheck);
6369 application.SendNotification();
6370 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6372 // We didn't expect the animation to finish yet, but cached value should be the final one
6373 application.SendNotification();
6374 finishCheck.CheckSignalNotReceived();
6375 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6376 DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
6378 application.SendNotification();
6379 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6381 // We didn't expect the animation to finish yet
6382 application.SendNotification();
6383 finishCheck.CheckSignalNotReceived();
6384 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6386 application.SendNotification();
6387 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6389 // We did expect the animation to finish
6390 application.SendNotification();
6391 finishCheck.CheckSignalReceived();
6392 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6393 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6397 int UtcDaliAnimationAnimateToVector3P(void)
6399 TestApplication application;
6401 Actor actor = Actor::New();
6403 // Register a Vector3 property
6404 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6405 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6406 Stage::GetCurrent().Add(actor);
6407 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
6408 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6410 // Build the animation
6411 float durationSeconds(2.0f);
6412 Animation animation = Animation::New(durationSeconds);
6413 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6414 Vector3 relativeValue(targetValue - startValue);
6415 animation.AnimateTo(Property(actor, index), targetValue);
6417 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6419 // Start the animation
6422 bool signalReceived(false);
6423 AnimationFinishCheck finishCheck(signalReceived);
6424 animation.FinishedSignal().Connect(&application, finishCheck);
6426 application.SendNotification();
6427 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6429 // We didn't expect the animation to finish yet
6430 application.SendNotification();
6431 finishCheck.CheckSignalNotReceived();
6432 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6434 application.SendNotification();
6435 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6437 // We did expect the animation to finish
6438 application.SendNotification();
6439 finishCheck.CheckSignalReceived();
6440 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6444 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6446 TestApplication application;
6448 Actor actor = Actor::New();
6450 // Register a Vector3 property
6451 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6452 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6453 Stage::GetCurrent().Add(actor);
6454 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6455 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6457 // Build the animation
6458 float durationSeconds(1.0f);
6459 Animation animation = Animation::New(durationSeconds);
6460 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6461 Vector3 relativeValue(targetValue - startValue);
6462 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6464 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6466 // Start the animation
6469 bool signalReceived(false);
6470 AnimationFinishCheck finishCheck(signalReceived);
6471 animation.FinishedSignal().Connect(&application, finishCheck);
6473 application.SendNotification();
6474 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6476 // We didn't expect the animation to finish yet
6477 application.SendNotification();
6478 finishCheck.CheckSignalNotReceived();
6480 // The position should have moved more, than with a linear alpha function
6481 Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
6482 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6483 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6484 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6486 application.SendNotification();
6487 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6489 // We did expect the animation to finish
6490 application.SendNotification();
6491 finishCheck.CheckSignalReceived();
6492 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6496 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6498 TestApplication application;
6500 Actor actor = Actor::New();
6502 // Register a Vector3 property
6503 Vector3 startValue(10.0f, 10.0f, 10.0f);
6504 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6505 Stage::GetCurrent().Add(actor);
6506 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6507 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6509 // Build the animation
6510 float durationSeconds(1.0f);
6511 Animation animation = Animation::New(durationSeconds);
6512 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6513 Vector3 relativeValue(targetValue - startValue);
6515 animation.AnimateTo(Property(actor, index),
6517 TimePeriod(delay, durationSeconds - delay));
6519 // Start the animation
6522 bool signalReceived(false);
6523 AnimationFinishCheck finishCheck(signalReceived);
6524 animation.FinishedSignal().Connect(&application, finishCheck);
6526 application.SendNotification();
6527 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6529 // We didn't expect the animation to finish yet
6530 application.SendNotification();
6531 finishCheck.CheckSignalNotReceived();
6532 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6534 application.SendNotification();
6535 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6537 // We didn't expect the animation to finish yet
6538 application.SendNotification();
6539 finishCheck.CheckSignalNotReceived();
6540 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6542 application.SendNotification();
6543 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6545 // We did expect the animation to finish
6546 application.SendNotification();
6547 finishCheck.CheckSignalReceived();
6548 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6552 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6554 TestApplication application;
6556 Actor actor = Actor::New();
6558 // Register a Vector3 property
6559 Vector3 startValue(10.0f, 10.0f, 10.0f);
6560 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6561 Stage::GetCurrent().Add(actor);
6562 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6563 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6565 // Build the animation
6566 float durationSeconds(1.0f);
6567 Animation animation = Animation::New(durationSeconds);
6568 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6569 Vector3 relativeValue(targetValue - startValue);
6571 animation.AnimateTo(Property(actor, "testProperty"),
6573 AlphaFunction::LINEAR,
6574 TimePeriod(delay, durationSeconds - delay));
6576 // Start the animation
6579 bool signalReceived(false);
6580 AnimationFinishCheck finishCheck(signalReceived);
6581 animation.FinishedSignal().Connect(&application, finishCheck);
6583 application.SendNotification();
6584 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6586 // We didn't expect the animation to finish yet
6587 application.SendNotification();
6588 finishCheck.CheckSignalNotReceived();
6589 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6591 application.SendNotification();
6592 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6594 // We didn't expect the animation to finish yet
6595 application.SendNotification();
6596 finishCheck.CheckSignalNotReceived();
6597 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6599 application.SendNotification();
6600 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6602 // We did expect the animation to finish
6603 application.SendNotification();
6604 finishCheck.CheckSignalReceived();
6605 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6609 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6611 TestApplication application;
6613 Actor actor = Actor::New();
6615 // Register a Vector3 property
6616 Vector3 startValue(10.0f, 10.0f, 10.0f);
6617 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6618 Stage::GetCurrent().Add(actor);
6619 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6620 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6622 // Build the animation
6623 float durationSeconds(1.0f);
6624 Animation animation = Animation::New(durationSeconds);
6625 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6626 Vector3 relativeValue(targetValue - startValue);
6628 animation.AnimateTo(Property(actor, "testProperty", 0),
6630 AlphaFunction::LINEAR,
6631 TimePeriod(delay, durationSeconds - delay));
6632 animation.AnimateTo(Property(actor, index, 1),
6634 AlphaFunction::LINEAR,
6635 TimePeriod(delay, durationSeconds - delay));
6637 // Start the animation
6640 bool signalReceived(false);
6641 AnimationFinishCheck finishCheck(signalReceived);
6642 animation.FinishedSignal().Connect(&application, finishCheck);
6644 application.SendNotification();
6645 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6647 // We didn't expect the animation to finish yet
6648 application.SendNotification();
6649 finishCheck.CheckSignalNotReceived();
6650 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6652 application.SendNotification();
6653 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6655 // We didn't expect the animation to finish yet
6656 application.SendNotification();
6657 finishCheck.CheckSignalNotReceived();
6658 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6660 application.SendNotification();
6661 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6663 // We did expect the animation to finish
6664 application.SendNotification();
6665 finishCheck.CheckSignalReceived();
6666 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6670 int UtcDaliAnimationAnimateToVector4P(void)
6672 TestApplication application;
6674 Actor actor = Actor::New();
6676 // Register a Vector4 property
6677 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6678 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6679 Stage::GetCurrent().Add(actor);
6680 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6681 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6683 // Build the animation
6684 float durationSeconds(2.0f);
6685 Animation animation = Animation::New(durationSeconds);
6686 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6687 Vector4 relativeValue(targetValue - startValue);
6688 animation.AnimateTo(Property(actor, index), targetValue);
6690 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6692 // Start the animation
6695 bool signalReceived(false);
6696 AnimationFinishCheck finishCheck(signalReceived);
6697 animation.FinishedSignal().Connect(&application, finishCheck);
6699 application.SendNotification();
6700 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6702 // We didn't expect the animation to finish yet
6703 application.SendNotification();
6704 finishCheck.CheckSignalNotReceived();
6705 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6707 application.SendNotification();
6708 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6710 // We did expect the animation to finish
6711 application.SendNotification();
6712 finishCheck.CheckSignalReceived();
6713 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6717 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6719 TestApplication application;
6721 Actor actor = Actor::New();
6723 // Register a Vector4 property
6724 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6725 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6726 Stage::GetCurrent().Add(actor);
6727 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6728 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6730 // Build the animation
6731 float durationSeconds(1.0f);
6732 Animation animation = Animation::New(durationSeconds);
6733 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6734 Vector4 relativeValue(targetValue - startValue);
6735 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6737 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6739 // Start the animation
6742 bool signalReceived(false);
6743 AnimationFinishCheck finishCheck(signalReceived);
6744 animation.FinishedSignal().Connect(&application, finishCheck);
6746 application.SendNotification();
6747 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6749 // We didn't expect the animation to finish yet
6750 application.SendNotification();
6751 finishCheck.CheckSignalNotReceived();
6753 // The position should have moved more, than with a linear alpha function
6754 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6755 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6756 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6757 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6758 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6760 application.SendNotification();
6761 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6763 // We did expect the animation to finish
6764 application.SendNotification();
6765 finishCheck.CheckSignalReceived();
6766 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6770 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6772 TestApplication application;
6774 Actor actor = Actor::New();
6776 // Register a Vector4 property
6777 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6778 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6779 Stage::GetCurrent().Add(actor);
6780 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6781 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6783 // Build the animation
6784 float durationSeconds(1.0f);
6785 Animation animation = Animation::New(durationSeconds);
6786 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6787 Vector4 relativeValue(targetValue - startValue);
6789 animation.AnimateTo(Property(actor, index),
6791 TimePeriod(delay, durationSeconds - delay));
6793 // Start the animation
6796 bool signalReceived(false);
6797 AnimationFinishCheck finishCheck(signalReceived);
6798 animation.FinishedSignal().Connect(&application, finishCheck);
6800 application.SendNotification();
6801 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6803 // We didn't expect the animation to finish yet
6804 application.SendNotification();
6805 finishCheck.CheckSignalNotReceived();
6806 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6808 application.SendNotification();
6809 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6811 // We didn't expect the animation to finish yet
6812 application.SendNotification();
6813 finishCheck.CheckSignalNotReceived();
6814 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6816 application.SendNotification();
6817 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6819 // We did expect the animation to finish
6820 application.SendNotification();
6821 finishCheck.CheckSignalReceived();
6822 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6826 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6828 TestApplication application;
6830 Actor actor = Actor::New();
6832 // Register a Vector4 property
6833 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6834 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6835 Stage::GetCurrent().Add(actor);
6836 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6837 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6839 // Build the animation
6840 float durationSeconds(1.0f);
6841 Animation animation = Animation::New(durationSeconds);
6842 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6843 Vector4 relativeValue(targetValue - startValue);
6845 animation.AnimateTo(Property(actor, index),
6847 AlphaFunction::LINEAR,
6848 TimePeriod(delay, durationSeconds - delay));
6850 // Start the animation
6853 bool signalReceived(false);
6854 AnimationFinishCheck finishCheck(signalReceived);
6855 animation.FinishedSignal().Connect(&application, finishCheck);
6857 application.SendNotification();
6858 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6860 // We didn't expect the animation to finish yet
6861 application.SendNotification();
6862 finishCheck.CheckSignalNotReceived();
6863 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6865 application.SendNotification();
6866 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6868 // We didn't expect the animation to finish yet
6869 application.SendNotification();
6870 finishCheck.CheckSignalNotReceived();
6871 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6873 application.SendNotification();
6874 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6876 // We did expect the animation to finish
6877 application.SendNotification();
6878 finishCheck.CheckSignalReceived();
6879 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6883 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6885 TestApplication application;
6887 Actor actor = Actor::New();
6888 Stage::GetCurrent().Add(actor);
6889 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6891 // Build the animation
6892 float durationSeconds(1.0f);
6893 Animation animation = Animation::New(durationSeconds);
6894 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6896 DALI_TEST_ASSERTION(
6898 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6899 }, "Property is not animatable" );
6904 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
6906 TestApplication application;
6908 Actor actor = Actor::New();
6909 Stage::GetCurrent().Add(actor);
6910 float startValue(0.0f);
6911 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6912 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6914 // Build the animation
6915 float durationSeconds(1.0f);
6916 Animation animation = Animation::New(durationSeconds);
6917 float targetX(1.0f);
6919 DALI_TEST_ASSERTION(
6921 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6922 }, "Property is not animatable" );
6927 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
6929 TestApplication application;
6931 Actor actor = Actor::New();
6932 Stage::GetCurrent().Add(actor);
6933 float startValue(0.0f);
6934 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6935 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6937 // Build the animation
6938 float durationSeconds(1.0f);
6939 Animation animation = Animation::New(durationSeconds);
6940 float targetY(1.0f);
6942 DALI_TEST_ASSERTION(
6944 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6945 }, "Property is not animatable" );
6950 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
6952 TestApplication application;
6954 Actor actor = Actor::New();
6955 Stage::GetCurrent().Add(actor);
6956 float startValue(0.5f);
6957 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6958 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6960 // Build the animation
6961 float durationSeconds(1.0f);
6962 Animation animation = Animation::New(durationSeconds);
6963 float targetZ(1.0f);
6965 DALI_TEST_ASSERTION(
6967 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6968 }, "Property is not animatable" );
6973 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
6975 TestApplication application;
6977 Actor actor = Actor::New();
6978 Stage::GetCurrent().Add(actor);
6979 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6981 // Build the animation
6982 float durationSeconds(1.0f);
6983 Animation animation = Animation::New(durationSeconds);
6984 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6986 DALI_TEST_ASSERTION(
6988 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6989 }, "Property is not animatable" );
6994 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
6996 TestApplication application;
6998 Actor actor = Actor::New();
6999 Stage::GetCurrent().Add(actor);
7000 float startValue(0.5f);
7001 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
7002 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
7004 // Build the animation
7005 float durationSeconds(1.0f);
7006 Animation animation = Animation::New(durationSeconds);
7007 float targetX(1.0f);
7009 DALI_TEST_ASSERTION(
7011 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
7012 }, "Property is not animatable" );
7017 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7019 TestApplication application;
7021 Actor actor = Actor::New();
7022 Stage::GetCurrent().Add(actor);
7023 float startValue(0.5f);
7024 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
7025 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
7027 // Build the animation
7028 float durationSeconds(1.0f);
7029 Animation animation = Animation::New(durationSeconds);
7030 float targetY(0.0f);
7032 DALI_TEST_ASSERTION(
7034 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
7035 }, "Property is not animatable" );
7040 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7042 TestApplication application;
7044 Actor actor = Actor::New();
7045 Stage::GetCurrent().Add(actor);
7046 float startValue(0.5f);
7047 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
7048 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
7050 // Build the animation
7051 float durationSeconds(1.0f);
7052 Animation animation = Animation::New(durationSeconds);
7053 float targetZ(100.0f);
7055 DALI_TEST_ASSERTION(
7057 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
7058 }, "Property is not animatable" );
7063 int UtcDaliAnimationAnimateToActorSizeP(void)
7065 TestApplication application;
7067 Actor actor = Actor::New();
7068 Stage::GetCurrent().Add(actor);
7069 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7071 // Build the animation
7072 float durationSeconds(1.0f);
7073 Animation animation = Animation::New(durationSeconds);
7074 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7075 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
7077 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7079 // Should return the initial properties before play
7080 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7081 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
7082 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
7083 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
7085 // Start the animation
7088 // Should return the target property after play
7089 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7090 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
7091 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
7092 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
7094 bool signalReceived(false);
7095 AnimationFinishCheck finishCheck(signalReceived);
7096 animation.FinishedSignal().Connect(&application, finishCheck);
7098 application.SendNotification();
7099 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7101 // We didn't expect the animation to finish yet
7102 application.SendNotification();
7103 finishCheck.CheckSignalNotReceived();
7104 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
7106 application.SendNotification();
7107 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7109 // We did expect the animation to finish
7110 application.SendNotification();
7111 finishCheck.CheckSignalReceived();
7112 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7115 finishCheck.Reset();
7116 actor.SetSize(Vector3::ZERO);
7117 application.SendNotification();
7118 application.Render(0);
7119 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7121 // Repeat with a different (ease-in) alpha function
7122 animation = Animation::New(durationSeconds);
7123 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7124 animation.FinishedSignal().Connect(&application, finishCheck);
7127 application.SendNotification();
7128 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7130 // We didn't expect the animation to finish yet
7131 application.SendNotification();
7132 finishCheck.CheckSignalNotReceived();
7134 // The size should have travelled less, than with a linear alpha function
7135 Vector3 current(actor.GetCurrentSize());
7136 DALI_TEST_CHECK( current.x > 0.0f );
7137 DALI_TEST_CHECK( current.y > 0.0f );
7138 DALI_TEST_CHECK( current.z > 0.0f );
7139 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7140 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7141 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7143 application.SendNotification();
7144 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7146 // We did expect the animation to finish
7147 application.SendNotification();
7148 finishCheck.CheckSignalReceived();
7149 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7152 finishCheck.Reset();
7153 actor.SetSize(Vector3::ZERO);
7154 application.SendNotification();
7155 application.Render(0);
7156 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7158 // Repeat with a delay
7160 animation = Animation::New(durationSeconds);
7161 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7162 animation.FinishedSignal().Connect(&application, finishCheck);
7165 application.SendNotification();
7166 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7168 // We didn't expect the animation to finish yet
7169 application.SendNotification();
7170 finishCheck.CheckSignalNotReceived();
7171 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7173 application.SendNotification();
7174 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7176 // We did expect the animation to finish
7177 application.SendNotification();
7178 finishCheck.CheckSignalReceived();
7179 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7183 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7185 TestApplication application;
7187 Actor actor = Actor::New();
7188 Stage::GetCurrent().Add(actor);
7189 float startValue(0.0f);
7190 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
7191 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
7193 // Build the animation
7194 float durationSeconds(1.0f);
7195 Animation animation = Animation::New(durationSeconds);
7196 float targetWidth(10.0f);
7197 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
7199 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
7201 // Should return the initial properties before play
7202 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7203 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
7205 // Start the animation
7208 // Should return the target property after play
7209 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
7210 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
7212 bool signalReceived(false);
7213 AnimationFinishCheck finishCheck(signalReceived);
7214 animation.FinishedSignal().Connect(&application, finishCheck);
7216 application.SendNotification();
7217 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7219 // We didn't expect the animation to finish yet
7220 application.SendNotification();
7221 finishCheck.CheckSignalNotReceived();
7222 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
7224 application.SendNotification();
7225 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7227 // We did expect the animation to finish
7228 application.SendNotification();
7229 finishCheck.CheckSignalReceived();
7230 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
7231 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
7235 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7237 TestApplication application;
7239 Actor actor = Actor::New();
7240 Stage::GetCurrent().Add(actor);
7241 float startValue(0.0f);
7242 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
7243 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
7245 // Build the animation
7246 float durationSeconds(1.0f);
7247 Animation animation = Animation::New(durationSeconds);
7248 float targetHeight(-10.0f);
7249 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
7251 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
7253 // Should return the initial properties before play
7254 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7255 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
7257 // Start the animation
7260 // Should return the target property after play
7261 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
7262 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
7264 bool signalReceived(false);
7265 AnimationFinishCheck finishCheck(signalReceived);
7266 animation.FinishedSignal().Connect(&application, finishCheck);
7268 application.SendNotification();
7269 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7271 // We didn't expect the animation to finish yet
7272 application.SendNotification();
7273 finishCheck.CheckSignalNotReceived();
7274 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
7276 application.SendNotification();
7277 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7279 // We did expect the animation to finish
7280 application.SendNotification();
7281 finishCheck.CheckSignalReceived();
7282 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
7283 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
7287 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7289 TestApplication application;
7291 Actor actor = Actor::New();
7292 Stage::GetCurrent().Add(actor);
7293 float startValue(0.0f);
7294 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
7295 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
7297 // Build the animation
7298 float durationSeconds(1.0f);
7299 Animation animation = Animation::New(durationSeconds);
7300 float targetDepth(-10.0f);
7301 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
7303 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
7305 // Should return the initial properties before play
7306 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7307 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
7309 // Start the animation
7312 // Should return the target property after play
7313 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
7314 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
7316 bool signalReceived(false);
7317 AnimationFinishCheck finishCheck(signalReceived);
7318 animation.FinishedSignal().Connect(&application, finishCheck);
7320 application.SendNotification();
7321 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7323 // We didn't expect the animation to finish yet
7324 application.SendNotification();
7325 finishCheck.CheckSignalNotReceived();
7326 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
7328 application.SendNotification();
7329 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7331 // We did expect the animation to finish
7332 application.SendNotification();
7333 finishCheck.CheckSignalReceived();
7334 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
7335 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
7339 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7341 TestApplication application;
7343 Actor actor = Actor::New();
7344 Stage::GetCurrent().Add(actor);
7345 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7347 // Build the animation
7348 float durationSeconds(1.0f);
7349 Animation animation = Animation::New(durationSeconds);
7350 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7351 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
7353 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7355 // Start the animation
7358 bool signalReceived(false);
7359 AnimationFinishCheck finishCheck(signalReceived);
7360 animation.FinishedSignal().Connect(&application, finishCheck);
7362 application.SendNotification();
7363 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7365 // We didn't expect the animation to finish yet
7366 application.SendNotification();
7367 finishCheck.CheckSignalNotReceived();
7368 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
7370 application.SendNotification();
7371 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7373 // We did expect the animation to finish
7374 application.SendNotification();
7375 finishCheck.CheckSignalReceived();
7376 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7379 finishCheck.Reset();
7380 actor.SetSize(Vector3::ZERO);
7381 application.SendNotification();
7382 application.Render(0);
7383 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7385 // Repeat with a different (ease-in) alpha function
7386 animation = Animation::New(durationSeconds);
7387 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
7388 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
7389 animation.FinishedSignal().Connect(&application, finishCheck);
7392 application.SendNotification();
7393 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7395 // We didn't expect the animation to finish yet
7396 application.SendNotification();
7397 finishCheck.CheckSignalNotReceived();
7399 // The size should have travelled less, than with a linear alpha function
7400 Vector3 current(actor.GetCurrentSize());
7401 DALI_TEST_CHECK( current.x > 0.0f );
7402 DALI_TEST_CHECK( current.y > 0.0f );
7403 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7404 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7406 application.SendNotification();
7407 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7409 // We did expect the animation to finish
7410 application.SendNotification();
7411 finishCheck.CheckSignalReceived();
7412 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7413 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7416 finishCheck.Reset();
7417 actor.SetSize(Vector3::ZERO);
7418 application.SendNotification();
7419 application.Render(0);
7420 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7422 // Repeat with a delay
7424 animation = Animation::New(durationSeconds);
7425 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7426 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7427 animation.FinishedSignal().Connect(&application, finishCheck);
7430 application.SendNotification();
7431 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7433 // We didn't expect the animation to finish yet
7434 application.SendNotification();
7435 finishCheck.CheckSignalNotReceived();
7436 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7438 application.SendNotification();
7439 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7441 // We did expect the animation to finish
7442 application.SendNotification();
7443 finishCheck.CheckSignalReceived();
7444 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7445 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7449 int UtcDaliAnimationAnimateToActorPositionP(void)
7451 TestApplication application;
7453 Actor actor = Actor::New();
7454 Stage::GetCurrent().Add(actor);
7455 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7457 // Build the animation
7458 float durationSeconds(1.0f);
7459 Animation animation = Animation::New(durationSeconds);
7460 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7461 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7463 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7465 // Should return the initial properties before play
7466 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7467 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
7468 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
7469 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
7471 // Start the animation
7474 // Should return the target property after play
7475 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7476 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
7477 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
7478 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, 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*750.0f)/* 75% progress */);
7487 // We didn't expect the animation to finish yet
7488 application.SendNotification();
7489 finishCheck.CheckSignalNotReceived();
7490 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7492 application.SendNotification();
7493 application.Render(static_cast<unsigned int>(durationSeconds*250.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(), targetPosition, TEST_LOCATION );
7502 int UtcDaliAnimationAnimateToActorPositionXP(void)
7504 TestApplication application;
7506 Actor actor = Actor::New();
7507 Stage::GetCurrent().Add(actor);
7508 float startValue(0.0f);
7509 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
7510 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7511 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7512 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7514 // Build the animation
7515 float durationSeconds(1.0f);
7516 Animation animation = Animation::New(durationSeconds);
7517 float targetX(1.0f);
7518 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
7520 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7522 // Should return the initial properties before play
7523 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7524 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
7526 // Start the animation
7529 // Should return the target property after play
7530 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7531 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7533 bool signalReceived(false);
7534 AnimationFinishCheck finishCheck(signalReceived);
7535 animation.FinishedSignal().Connect(&application, finishCheck);
7537 application.SendNotification();
7538 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7540 // We didn't expect the animation to finish yet
7541 application.SendNotification();
7542 finishCheck.CheckSignalNotReceived();
7543 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
7545 application.SendNotification();
7546 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7548 // We did expect the animation to finish
7549 application.SendNotification();
7550 finishCheck.CheckSignalReceived();
7551 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
7552 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7553 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7554 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7558 int UtcDaliAnimationAnimateToActorPositionYP(void)
7560 TestApplication application;
7562 Actor actor = Actor::New();
7563 Stage::GetCurrent().Add(actor);
7564 float startValue(0.0f);
7565 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7566 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7567 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7568 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7570 // Build the animation
7571 float durationSeconds(1.0f);
7572 Animation animation = Animation::New(durationSeconds);
7573 float targetY(10.0f);
7574 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7576 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7578 // Should return the initial properties before play
7579 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7580 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7582 // Start the animation
7585 // Should return the target property after play
7586 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7587 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7589 bool signalReceived(false);
7590 AnimationFinishCheck finishCheck(signalReceived);
7591 animation.FinishedSignal().Connect(&application, finishCheck);
7593 application.SendNotification();
7594 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7596 // We didn't expect the animation to finish yet
7597 application.SendNotification();
7598 finishCheck.CheckSignalNotReceived();
7599 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7601 application.SendNotification();
7602 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7604 // We did expect the animation to finish
7605 application.SendNotification();
7606 finishCheck.CheckSignalReceived();
7607 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7608 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7609 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7610 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7614 int UtcDaliAnimationAnimateToActorPositionZP(void)
7616 TestApplication application;
7618 Actor actor = Actor::New();
7619 Stage::GetCurrent().Add(actor);
7620 float startValue(0.0f);
7621 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7622 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7623 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7624 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7626 // Build the animation
7627 float durationSeconds(1.0f);
7628 Animation animation = Animation::New(durationSeconds);
7629 float targetZ(-5.0f);
7630 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7632 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7634 // Should return the initial properties before play
7635 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7636 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7638 // Start the animation
7641 // Should return the target property after play
7642 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7643 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7645 bool signalReceived(false);
7646 AnimationFinishCheck finishCheck(signalReceived);
7647 animation.FinishedSignal().Connect(&application, finishCheck);
7649 application.SendNotification();
7650 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7652 // We didn't expect the animation to finish yet
7653 application.SendNotification();
7654 finishCheck.CheckSignalNotReceived();
7655 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7657 application.SendNotification();
7658 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7660 // We did expect the animation to finish
7661 application.SendNotification();
7662 finishCheck.CheckSignalReceived();
7663 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7664 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7665 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7666 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7670 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7672 TestApplication application;
7674 Actor actor = Actor::New();
7675 Stage::GetCurrent().Add(actor);
7676 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7678 // Build the animation
7679 float durationSeconds(1.0f);
7680 Animation animation = Animation::New(durationSeconds);
7681 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7682 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7684 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7686 // Start the animation
7689 bool signalReceived(false);
7690 AnimationFinishCheck finishCheck(signalReceived);
7691 animation.FinishedSignal().Connect(&application, finishCheck);
7693 application.SendNotification();
7694 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7696 // We didn't expect the animation to finish yet
7697 application.SendNotification();
7698 finishCheck.CheckSignalNotReceived();
7700 // The position should have moved less, than with a linear alpha function
7701 Vector3 current(actor.GetCurrentPosition());
7702 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7703 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7704 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7705 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7706 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7707 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
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.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7719 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7721 TestApplication application;
7723 Actor actor = Actor::New();
7724 Stage::GetCurrent().Add(actor);
7725 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7727 // Build the animation
7728 float durationSeconds(1.0f);
7729 Animation animation = Animation::New(durationSeconds);
7730 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7732 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7734 TimePeriod( delay, durationSeconds - delay ) );
7736 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7738 // Start the animation
7741 bool signalReceived(false);
7742 AnimationFinishCheck finishCheck(signalReceived);
7743 animation.FinishedSignal().Connect(&application, finishCheck);
7745 application.SendNotification();
7746 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7748 // We didn't expect the animation to finish yet
7749 application.SendNotification();
7750 finishCheck.CheckSignalNotReceived();
7751 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7753 application.SendNotification();
7754 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7756 // We didn't expect the animation to finish yet
7757 application.SendNotification();
7758 finishCheck.CheckSignalNotReceived();
7759 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7761 application.SendNotification();
7762 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7764 // We did expect the animation to finish
7765 application.SendNotification();
7766 finishCheck.CheckSignalReceived();
7767 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7771 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7773 TestApplication application;
7775 Actor actor = Actor::New();
7776 Stage::GetCurrent().Add(actor);
7777 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7779 // Build the animation
7780 float durationSeconds(1.0f);
7781 Animation animation = Animation::New(durationSeconds);
7782 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7784 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7786 AlphaFunction::LINEAR,
7787 TimePeriod( delay, durationSeconds - delay ) );
7789 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7791 // Start the animation
7794 bool signalReceived(false);
7795 AnimationFinishCheck finishCheck(signalReceived);
7796 animation.FinishedSignal().Connect(&application, finishCheck);
7798 application.SendNotification();
7799 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7801 // We didn't expect the animation to finish yet
7802 application.SendNotification();
7803 finishCheck.CheckSignalNotReceived();
7804 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7806 application.SendNotification();
7807 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7809 // We didn't expect the animation to finish yet
7810 application.SendNotification();
7811 finishCheck.CheckSignalNotReceived();
7812 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7814 application.SendNotification();
7815 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7817 // We did expect the animation to finish
7818 application.SendNotification();
7819 finishCheck.CheckSignalReceived();
7820 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7824 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7826 TestApplication application;
7828 Actor actor = Actor::New();
7829 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7830 Stage::GetCurrent().Add(actor);
7831 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7833 // Build the animation
7834 float durationSeconds(1.0f);
7835 Animation animation = Animation::New(durationSeconds);
7836 Degree targetRotationDegrees(90.0f);
7837 Radian targetRotationRadians(targetRotationDegrees);
7838 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7840 // Start the animation
7843 // Target value should be retrievable straight away
7844 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7846 bool signalReceived(false);
7847 AnimationFinishCheck finishCheck(signalReceived);
7848 animation.FinishedSignal().Connect(&application, finishCheck);
7850 application.SendNotification();
7851 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7853 // We didn't expect the animation to finish yet
7854 application.SendNotification();
7855 finishCheck.CheckSignalNotReceived();
7856 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7858 application.SendNotification();
7859 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7861 // We didn't expect the animation to finish yet
7862 application.SendNotification();
7863 finishCheck.CheckSignalNotReceived();
7864 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7866 application.SendNotification();
7867 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7869 // We didn't expect the animation to finish yet
7870 application.SendNotification();
7871 finishCheck.CheckSignalNotReceived();
7872 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7874 application.SendNotification();
7875 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7877 // We did expect the animation to finish
7878 application.SendNotification();
7879 finishCheck.CheckSignalReceived();
7880 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7884 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7886 TestApplication application;
7888 Actor actor = Actor::New();
7889 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7890 Stage::GetCurrent().Add(actor);
7891 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7893 // Build the animation
7894 float durationSeconds(1.0f);
7895 Animation animation = Animation::New(durationSeconds);
7896 Degree targetRotationDegrees(90.0f);
7897 Radian targetRotationRadians(targetRotationDegrees);
7898 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7899 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7901 // Start the animation
7904 bool signalReceived(false);
7905 AnimationFinishCheck finishCheck(signalReceived);
7906 animation.FinishedSignal().Connect(&application, finishCheck);
7908 application.SendNotification();
7909 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7911 // We didn't expect the animation to finish yet
7912 application.SendNotification();
7913 finishCheck.CheckSignalNotReceived();
7914 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7916 application.SendNotification();
7917 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7919 // We didn't expect the animation to finish yet
7920 application.SendNotification();
7921 finishCheck.CheckSignalNotReceived();
7922 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7924 application.SendNotification();
7925 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7927 // We didn't expect the animation to finish yet
7928 application.SendNotification();
7929 finishCheck.CheckSignalNotReceived();
7930 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7932 application.SendNotification();
7933 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7935 // We did expect the animation to finish
7936 application.SendNotification();
7937 finishCheck.CheckSignalReceived();
7938 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7942 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7944 TestApplication application;
7946 Actor actor = Actor::New();
7947 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7948 Stage::GetCurrent().Add(actor);
7949 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7951 // Build the animation
7952 float durationSeconds(1.0f);
7953 Animation animation = Animation::New(durationSeconds);
7954 Degree targetRotationDegrees(90.0f);
7955 Radian targetRotationRadians(targetRotationDegrees);
7956 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7958 // Start the animation
7961 bool signalReceived(false);
7962 AnimationFinishCheck finishCheck(signalReceived);
7963 animation.FinishedSignal().Connect(&application, finishCheck);
7965 application.SendNotification();
7966 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7968 // We didn't expect the animation to finish yet
7969 application.SendNotification();
7970 finishCheck.CheckSignalNotReceived();
7971 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7973 application.SendNotification();
7974 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7976 // We didn't expect the animation to finish yet
7977 application.SendNotification();
7978 finishCheck.CheckSignalNotReceived();
7979 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7981 application.SendNotification();
7982 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7984 // We didn't expect the animation to finish yet
7985 application.SendNotification();
7986 finishCheck.CheckSignalNotReceived();
7987 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7989 application.SendNotification();
7990 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7992 // We did expect the animation to finish
7993 application.SendNotification();
7994 finishCheck.CheckSignalReceived();
7995 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7999 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8001 TestApplication application;
8003 Actor actor = Actor::New();
8004 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8005 Stage::GetCurrent().Add(actor);
8006 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8008 // Build the animation
8009 float durationSeconds(1.0f);
8010 Animation animation = Animation::New(durationSeconds);
8011 Degree targetRotationDegrees(90.0f);
8012 Radian targetRotationRadians(targetRotationDegrees);
8014 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8016 // Start the animation
8019 bool signalReceived(false);
8020 AnimationFinishCheck finishCheck(signalReceived);
8021 animation.FinishedSignal().Connect(&application, finishCheck);
8023 application.SendNotification();
8024 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8026 // We didn't expect the animation to finish yet
8027 application.SendNotification();
8028 finishCheck.CheckSignalNotReceived();
8029 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8030 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8032 application.SendNotification();
8033 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8035 // We didn't expect the animation to finish yet
8036 application.SendNotification();
8037 finishCheck.CheckSignalNotReceived();
8038 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8039 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8041 application.SendNotification();
8042 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8044 // We didn't expect the animation to finish yet
8045 application.SendNotification();
8046 finishCheck.CheckSignalNotReceived();
8047 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8048 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8050 application.SendNotification();
8051 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8053 // We did expect the animation to finish
8054 application.SendNotification();
8055 finishCheck.CheckSignalReceived();
8056 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8060 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8062 TestApplication application;
8064 Actor actor = Actor::New();
8065 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8066 Stage::GetCurrent().Add(actor);
8067 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8069 // Build the animation
8070 float durationSeconds(1.0f);
8071 Animation animation = Animation::New(durationSeconds);
8072 Degree targetRotationDegrees(90.0f);
8073 Radian targetRotationRadians(targetRotationDegrees);
8075 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8077 // Start the animation
8080 bool signalReceived(false);
8081 AnimationFinishCheck finishCheck(signalReceived);
8082 animation.FinishedSignal().Connect(&application, finishCheck);
8084 application.SendNotification();
8085 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8087 // We didn't expect the animation to finish yet
8088 application.SendNotification();
8089 finishCheck.CheckSignalNotReceived();
8090 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8091 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8093 application.SendNotification();
8094 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8096 // We didn't expect the animation to finish yet
8097 application.SendNotification();
8098 finishCheck.CheckSignalNotReceived();
8099 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8100 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8102 application.SendNotification();
8103 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8105 // We didn't expect the animation to finish yet
8106 application.SendNotification();
8107 finishCheck.CheckSignalNotReceived();
8108 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8109 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8111 application.SendNotification();
8112 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8114 // We did expect the animation to finish
8115 application.SendNotification();
8116 finishCheck.CheckSignalReceived();
8117 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8121 int UtcDaliAnimationAnimateToActorScaleP(void)
8123 TestApplication application;
8125 Actor actor = Actor::New();
8126 Stage::GetCurrent().Add(actor);
8127 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8129 // Build the animation
8130 float durationSeconds(1.0f);
8131 Animation animation = Animation::New(durationSeconds);
8132 Vector3 targetScale(2.0f, 2.0f, 2.0f);
8133 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
8135 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
8137 // Start the animation
8140 // Target value should be retrievable straight away
8141 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8142 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
8143 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
8144 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
8146 bool signalReceived(false);
8147 AnimationFinishCheck finishCheck(signalReceived);
8148 animation.FinishedSignal().Connect(&application, finishCheck);
8150 application.SendNotification();
8151 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8153 // We didn't expect the animation to finish yet
8154 application.SendNotification();
8155 finishCheck.CheckSignalNotReceived();
8156 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
8158 application.SendNotification();
8159 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8161 // We did expect the animation to finish
8162 application.SendNotification();
8163 finishCheck.CheckSignalReceived();
8164 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8167 finishCheck.Reset();
8168 actor.SetScale(Vector3::ONE);
8169 application.SendNotification();
8170 application.Render(0);
8171 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8173 // Repeat with a different (ease-in) alpha function
8174 animation = Animation::New(durationSeconds);
8175 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8176 animation.FinishedSignal().Connect(&application, finishCheck);
8179 application.SendNotification();
8180 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8182 // We didn't expect the animation to finish yet
8183 application.SendNotification();
8184 finishCheck.CheckSignalNotReceived();
8186 // The scale should have grown less, than with a linear alpha function
8187 Vector3 current(actor.GetCurrentScale());
8188 DALI_TEST_CHECK( current.x > 1.0f );
8189 DALI_TEST_CHECK( current.y > 1.0f );
8190 DALI_TEST_CHECK( current.z > 1.0f );
8191 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8192 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8193 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8195 application.SendNotification();
8196 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8198 // We did expect the animation to finish
8199 application.SendNotification();
8200 finishCheck.CheckSignalReceived();
8201 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8204 finishCheck.Reset();
8205 actor.SetScale(Vector3::ONE);
8206 application.SendNotification();
8207 application.Render(0);
8208 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8210 // Repeat with a delay
8212 animation = Animation::New(durationSeconds);
8213 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8214 animation.FinishedSignal().Connect(&application, finishCheck);
8217 application.SendNotification();
8218 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8220 // We didn't expect the animation to finish yet
8221 application.SendNotification();
8222 finishCheck.CheckSignalNotReceived();
8223 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8225 application.SendNotification();
8226 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8228 // We did expect the animation to finish
8229 application.SendNotification();
8230 finishCheck.CheckSignalReceived();
8231 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8235 int UtcDaliAnimationAnimateToActorScaleXP(void)
8237 TestApplication application;
8239 Actor actor = Actor::New();
8240 Stage::GetCurrent().Add(actor);
8241 float startValue(1.0f);
8242 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
8243 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8244 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8245 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8246 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8247 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8248 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8250 // Build the animation
8251 float durationSeconds(1.0f);
8252 Animation animation = Animation::New(durationSeconds);
8253 float targetX(10.0f);
8254 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
8256 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
8258 // Start the animation
8261 // Target value should be retrievable straight away
8262 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
8263 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8265 bool signalReceived(false);
8266 AnimationFinishCheck finishCheck(signalReceived);
8267 animation.FinishedSignal().Connect(&application, finishCheck);
8269 application.SendNotification();
8270 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8272 // We didn't expect the animation to finish yet
8273 application.SendNotification();
8274 finishCheck.CheckSignalNotReceived();
8275 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
8276 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
8277 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8278 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8280 application.SendNotification();
8281 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8283 // We did expect the animation to finish
8284 application.SendNotification();
8285 finishCheck.CheckSignalReceived();
8286 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
8287 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8288 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8289 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8293 int UtcDaliAnimationAnimateToActorScaleYP(void)
8295 TestApplication application;
8297 Actor actor = Actor::New();
8298 Stage::GetCurrent().Add(actor);
8299 float startValue(1.0f);
8300 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
8301 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8304 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8305 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8306 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8308 // Build the animation
8309 float durationSeconds(1.0f);
8310 Animation animation = Animation::New(durationSeconds);
8311 float targetY(1000.0f);
8312 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
8314 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
8316 // Start the animation
8319 // Target value should be retrievable straight away
8320 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
8321 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8323 bool signalReceived(false);
8324 AnimationFinishCheck finishCheck(signalReceived);
8325 animation.FinishedSignal().Connect(&application, finishCheck);
8327 application.SendNotification();
8328 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8330 // We didn't expect the animation to finish yet
8331 application.SendNotification();
8332 finishCheck.CheckSignalNotReceived();
8333 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
8334 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8335 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
8336 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8338 application.SendNotification();
8339 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8341 // We did expect the animation to finish
8342 application.SendNotification();
8343 finishCheck.CheckSignalReceived();
8344 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
8345 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8346 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8347 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8351 int UtcDaliAnimationAnimateToActorScaleZP(void)
8353 TestApplication application;
8355 Actor actor = Actor::New();
8356 Stage::GetCurrent().Add(actor);
8357 float startValue(1.0f);
8358 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
8359 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8360 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8361 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8362 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8363 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8364 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8366 // Build the animation
8367 float durationSeconds(1.0f);
8368 Animation animation = Animation::New(durationSeconds);
8369 float targetZ(-1000.0f);
8370 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
8372 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
8374 // Start the animation
8377 // Target value should be retrievable straight away
8378 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
8379 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8381 bool signalReceived(false);
8382 AnimationFinishCheck finishCheck(signalReceived);
8383 animation.FinishedSignal().Connect(&application, finishCheck);
8385 application.SendNotification();
8386 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8388 // We didn't expect the animation to finish yet
8389 application.SendNotification();
8390 finishCheck.CheckSignalNotReceived();
8391 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
8392 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8393 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8394 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
8396 application.SendNotification();
8397 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8399 // We did expect the animation to finish
8400 application.SendNotification();
8401 finishCheck.CheckSignalReceived();
8402 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
8403 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8404 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8405 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8409 int UtcDaliAnimationAnimateToActorColorP(void)
8411 TestApplication application;
8413 Actor actor = Actor::New();
8414 Stage::GetCurrent().Add(actor);
8415 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8417 // Build the animation
8418 float durationSeconds(1.0f);
8419 Animation animation = Animation::New(durationSeconds);
8420 Vector4 targetColor(Color::RED);
8421 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
8423 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8424 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8426 // Start the animation
8429 // Target value should be retrievable straight away
8430 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8431 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
8432 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
8433 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
8434 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
8435 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
8437 bool signalReceived(false);
8438 AnimationFinishCheck finishCheck(signalReceived);
8439 animation.FinishedSignal().Connect(&application, finishCheck);
8441 application.SendNotification();
8442 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8444 // We didn't expect the animation to finish yet
8445 application.SendNotification();
8446 finishCheck.CheckSignalNotReceived();
8447 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
8449 application.SendNotification();
8450 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8452 // We did expect the animation to finish
8453 application.SendNotification();
8454 finishCheck.CheckSignalReceived();
8455 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8458 finishCheck.Reset();
8459 actor.SetColor(Color::WHITE);
8460 application.SendNotification();
8461 application.Render(0);
8462 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8464 // Repeat with a different (ease-in) alpha function
8465 animation = Animation::New(durationSeconds);
8466 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8467 animation.FinishedSignal().Connect(&application, finishCheck);
8470 application.SendNotification();
8471 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8473 // We didn't expect the animation to finish yet
8474 application.SendNotification();
8475 finishCheck.CheckSignalNotReceived();
8477 // The color should have changed less, than with a linear alpha function
8478 Vector4 current(actor.GetCurrentColor());
8479 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
8480 DALI_TEST_CHECK( current.y < 1.0f );
8481 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
8482 DALI_TEST_CHECK( current.z < 1.0f );
8483 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
8484 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8486 application.SendNotification();
8487 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8489 // We did expect the animation to finish
8490 application.SendNotification();
8491 finishCheck.CheckSignalReceived();
8492 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8495 finishCheck.Reset();
8496 actor.SetColor(Color::WHITE);
8497 application.SendNotification();
8498 application.Render(0);
8499 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8501 // Repeat with a shorter animator duration
8502 float animatorDuration = 0.5f;
8503 animation = Animation::New(durationSeconds);
8504 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8505 animation.FinishedSignal().Connect(&application, finishCheck);
8508 application.SendNotification();
8509 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8511 // We didn't expect the animation to finish yet
8512 application.SendNotification();
8513 finishCheck.CheckSignalNotReceived();
8514 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
8516 application.SendNotification();
8517 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8519 // We didn't expect the animation to finish yet
8520 application.SendNotification();
8521 finishCheck.CheckSignalNotReceived();
8522 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8524 application.SendNotification();
8525 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8527 // We did expect the animation to finish
8528 application.SendNotification();
8529 finishCheck.CheckSignalReceived();
8530 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8534 int UtcDaliAnimationAnimateToActorColorRedP(void)
8536 TestApplication application;
8538 Actor actor = Actor::New();
8539 Stage::GetCurrent().Add(actor);
8540 float startValue(1.0f);
8541 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
8542 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8543 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8544 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8545 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8546 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8547 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8548 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8549 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8551 // Build the animation
8552 float durationSeconds(1.0f);
8553 Animation animation = Animation::New(durationSeconds);
8554 float targetRed(0.5f);
8555 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8557 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8559 // Start the animation
8562 // Target value should be retrievable straight away
8563 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8564 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8566 bool signalReceived(false);
8567 AnimationFinishCheck finishCheck(signalReceived);
8568 animation.FinishedSignal().Connect(&application, finishCheck);
8570 application.SendNotification();
8571 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8573 // We didn't expect the animation to finish yet
8574 application.SendNotification();
8575 finishCheck.CheckSignalNotReceived();
8576 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8577 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
8578 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8579 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8580 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8582 application.SendNotification();
8583 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8585 // We did expect the animation to finish
8586 application.SendNotification();
8587 finishCheck.CheckSignalReceived();
8588 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8589 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
8590 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8591 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8592 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8596 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8598 TestApplication application;
8600 Actor actor = Actor::New();
8601 Stage::GetCurrent().Add(actor);
8602 float startValue(1.0f);
8603 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8604 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8607 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8608 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8609 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8610 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8611 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8613 // Build the animation
8614 float durationSeconds(1.0f);
8615 Animation animation = Animation::New(durationSeconds);
8616 float targetGreen(0.5f);
8617 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8619 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8621 // Start the animation
8624 // Target value should be retrievable straight away
8625 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8626 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8628 bool signalReceived(false);
8629 AnimationFinishCheck finishCheck(signalReceived);
8630 animation.FinishedSignal().Connect(&application, finishCheck);
8632 application.SendNotification();
8633 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8635 // We didn't expect the animation to finish yet
8636 application.SendNotification();
8637 finishCheck.CheckSignalNotReceived();
8638 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8639 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8640 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8641 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8642 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8644 application.SendNotification();
8645 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8647 // We did expect the animation to finish
8648 application.SendNotification();
8649 finishCheck.CheckSignalReceived();
8650 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8651 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8652 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8653 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8654 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8658 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8660 TestApplication application;
8662 Actor actor = Actor::New();
8663 Stage::GetCurrent().Add(actor);
8664 float startValue(1.0f);
8665 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8666 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8667 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8668 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8669 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8670 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8671 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8672 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8673 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8675 // Build the animation
8676 float durationSeconds(1.0f);
8677 Animation animation = Animation::New(durationSeconds);
8678 float targetBlue(0.5f);
8679 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8681 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8683 // Start the animation
8686 // Target value should be retrievable straight away
8687 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8688 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8690 bool signalReceived(false);
8691 AnimationFinishCheck finishCheck(signalReceived);
8692 animation.FinishedSignal().Connect(&application, finishCheck);
8694 application.SendNotification();
8695 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8697 // We didn't expect the animation to finish yet
8698 application.SendNotification();
8699 finishCheck.CheckSignalNotReceived();
8700 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8701 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8702 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8703 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8704 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8706 application.SendNotification();
8707 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8709 // We did expect the animation to finish
8710 application.SendNotification();
8711 finishCheck.CheckSignalReceived();
8712 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8713 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8714 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8715 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8716 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8720 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8722 TestApplication application;
8724 Actor actor = Actor::New();
8725 Stage::GetCurrent().Add(actor);
8726 float startValue(1.0f);
8727 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8728 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8729 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8730 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8731 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8732 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8733 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8734 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8735 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8737 // Build the animation
8738 float durationSeconds(1.0f);
8739 Animation animation = Animation::New(durationSeconds);
8740 float targetAlpha(0.5f);
8741 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8743 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8745 // Start the animation
8748 // Target value should be retrievable straight away
8749 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8750 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8751 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8753 bool signalReceived(false);
8754 AnimationFinishCheck finishCheck(signalReceived);
8755 animation.FinishedSignal().Connect(&application, finishCheck);
8757 application.SendNotification();
8758 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8760 // We didn't expect the animation to finish yet
8761 application.SendNotification();
8762 finishCheck.CheckSignalNotReceived();
8763 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8764 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8765 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8766 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8767 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8769 application.SendNotification();
8770 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8772 // We did expect the animation to finish
8773 application.SendNotification();
8774 finishCheck.CheckSignalReceived();
8775 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8776 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8777 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8778 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8779 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8783 int UtcDaliAnimationKeyFrames01P(void)
8785 TestApplication application;
8787 KeyFrames keyFrames = KeyFrames::New();
8788 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8790 keyFrames.Add(0.0f, 0.1f);
8792 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8794 KeyFrames keyFrames2( keyFrames);
8795 DALI_TEST_CHECK( keyFrames2 );
8796 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8798 KeyFrames keyFrames3 = KeyFrames::New();
8799 keyFrames3.Add(0.6f, true);
8800 DALI_TEST_CHECK( keyFrames3 );
8801 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8803 keyFrames3 = keyFrames;
8804 DALI_TEST_CHECK( keyFrames3 );
8805 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8810 int UtcDaliAnimationKeyFrames02N(void)
8812 TestApplication application;
8814 KeyFrames keyFrames = KeyFrames::New();
8815 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8817 keyFrames.Add(0.0f, 0.1f);
8818 keyFrames.Add(0.2f, 0.5f);
8819 keyFrames.Add(0.4f, 0.0f);
8820 keyFrames.Add(0.6f, 1.0f);
8821 keyFrames.Add(0.8f, 0.7f);
8822 keyFrames.Add(1.0f, 0.9f);
8824 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8826 DALI_TEST_ASSERTION(
8828 keyFrames.Add(1.9f, false);
8829 }, "mType == value.GetType()" );
8834 int UtcDaliAnimationKeyFrames03N(void)
8836 TestApplication application;
8838 KeyFrames keyFrames = KeyFrames::New();
8839 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8841 keyFrames.Add(0.0f, true);
8842 keyFrames.Add(0.2f, false);
8843 keyFrames.Add(0.4f, false);
8844 keyFrames.Add(0.6f, true);
8845 keyFrames.Add(0.8f, true);
8846 keyFrames.Add(1.0f, false);
8848 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8850 DALI_TEST_ASSERTION(
8852 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8853 }, "mType == value.GetType()" );
8858 int UtcDaliAnimationKeyFrames04N(void)
8860 TestApplication application;
8862 KeyFrames keyFrames = KeyFrames::New();
8863 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8865 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8866 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8867 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8868 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8869 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8870 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8872 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8874 DALI_TEST_ASSERTION(
8876 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8877 }, "mType == value.GetType()" );
8882 int UtcDaliAnimationKeyFrames05N(void)
8884 TestApplication application;
8886 KeyFrames keyFrames = KeyFrames::New();
8887 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8889 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8890 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8891 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8892 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8893 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8894 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8896 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8898 DALI_TEST_ASSERTION(
8900 keyFrames.Add(0.7f, 1.0f);
8901 }, "mType == value.GetType()" );
8906 int UtcDaliAnimationKeyFrames06N(void)
8908 TestApplication application;
8910 KeyFrames keyFrames = KeyFrames::New();
8911 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8913 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8914 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8915 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8916 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8917 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8918 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8920 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8922 DALI_TEST_ASSERTION(
8924 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8925 }, "mType == value.GetType()" );
8930 int UtcDaliAnimationKeyFrames07N(void)
8932 TestApplication application;
8934 KeyFrames keyFrames = KeyFrames::New();
8935 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8937 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8938 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8939 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8940 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8941 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8942 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8944 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8946 DALI_TEST_ASSERTION(
8948 keyFrames.Add(0.7f, 1.1f);
8949 }, "mType == value.GetType()" );
8954 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8956 TestApplication application;
8958 float startValue(1.0f);
8959 Actor actor = Actor::New();
8960 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8961 Stage::GetCurrent().Add(actor);
8963 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8964 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8965 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8967 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8968 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8969 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8970 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8971 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8973 // Build the animation
8974 float durationSeconds(1.0f);
8975 Animation animation = Animation::New(durationSeconds);
8977 KeyFrames keyFrames = KeyFrames::New();
8978 keyFrames.Add(0.0f, 0.1f);
8979 keyFrames.Add(0.2f, 0.5f);
8980 keyFrames.Add(0.4f, 0.0f);
8981 keyFrames.Add(0.6f, 1.0f);
8982 keyFrames.Add(0.8f, 0.7f);
8983 keyFrames.Add(1.0f, 0.9f);
8985 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8987 // Start the animation
8990 // Final key frame value should be retrievable straight away
8991 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
8993 bool signalReceived(false);
8994 AnimationFinishCheck finishCheck(signalReceived);
8995 animation.FinishedSignal().Connect(&application, finishCheck);
8996 application.SendNotification();
8997 application.Render(0);
8998 application.SendNotification();
8999 finishCheck.CheckSignalNotReceived();
9000 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
9002 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9003 application.SendNotification();
9004 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9005 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9006 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9007 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
9008 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
9010 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9011 application.SendNotification();
9012 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9013 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9014 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9015 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
9016 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
9018 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9019 application.SendNotification();
9020 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9021 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9022 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9023 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
9024 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
9026 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9027 application.SendNotification();
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), 0.7f, 0.01f, TEST_LOCATION );
9032 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
9034 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9035 application.SendNotification();
9036 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9037 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9038 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9039 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
9040 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
9042 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9043 application.SendNotification();
9044 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9045 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9046 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9047 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
9048 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
9050 // We did expect the animation to finish
9052 finishCheck.CheckSignalReceived();
9056 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9058 TestApplication application;
9060 float startValue(1.0f);
9061 Actor actor = Actor::New();
9062 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9063 Stage::GetCurrent().Add(actor);
9065 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9066 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9067 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9068 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9069 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9070 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9071 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9072 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9073 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9075 // Build the animation
9076 float durationSeconds(1.0f);
9077 Animation animation = Animation::New(durationSeconds);
9079 KeyFrames keyFrames = KeyFrames::New();
9080 keyFrames.Add(0.0f, 0.1f);
9081 keyFrames.Add(0.2f, 0.5f);
9082 keyFrames.Add(0.4f, 0.0f);
9083 keyFrames.Add(0.6f, 1.0f);
9084 keyFrames.Add(0.8f, 0.7f);
9085 keyFrames.Add(1.0f, 0.9f);
9087 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
9089 // Start the animation
9092 bool signalReceived(false);
9093 AnimationFinishCheck finishCheck(signalReceived);
9094 animation.FinishedSignal().Connect(&application, finishCheck);
9095 application.SendNotification();
9096 application.Render(0);
9097 application.SendNotification();
9098 finishCheck.CheckSignalNotReceived();
9099 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
9101 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9102 application.SendNotification();
9103 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9104 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9105 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9106 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
9107 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
9109 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9110 application.SendNotification();
9111 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9112 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9113 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9114 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
9115 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
9117 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9118 application.SendNotification();
9119 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9120 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9121 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9122 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
9123 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
9125 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9126 application.SendNotification();
9127 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9128 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9129 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9130 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
9131 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
9133 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9134 application.SendNotification();
9135 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9136 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9137 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9138 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
9139 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
9141 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9142 application.SendNotification();
9143 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9144 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9145 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9146 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
9147 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
9149 // We did expect the animation to finish
9151 finishCheck.CheckSignalReceived();
9155 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9157 TestApplication application;
9159 float startValue(1.0f);
9160 Actor actor = Actor::New();
9161 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9162 Stage::GetCurrent().Add(actor);
9164 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9165 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9166 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9167 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9168 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9169 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9170 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9171 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9172 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9174 // Build the animation
9175 float durationSeconds(1.0f);
9176 Animation animation = Animation::New(durationSeconds);
9178 KeyFrames keyFrames = KeyFrames::New();
9179 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9180 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9181 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9183 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
9185 // Start the animation
9188 bool signalReceived(false);
9189 AnimationFinishCheck finishCheck(signalReceived);
9190 animation.FinishedSignal().Connect(&application, finishCheck);
9191 application.SendNotification();
9192 application.Render(0);
9193 application.SendNotification();
9194 finishCheck.CheckSignalNotReceived();
9195 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9196 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9197 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9198 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9200 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9201 application.SendNotification();
9202 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9203 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9204 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9205 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9207 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9208 application.SendNotification();
9209 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9210 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9211 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9212 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9214 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9215 application.SendNotification();
9216 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9217 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9218 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9219 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9221 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9222 application.SendNotification();
9223 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9224 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9225 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9226 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9228 // We did expect the animation to finish
9230 finishCheck.CheckSignalReceived();
9234 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9236 TestApplication application;
9238 float startValue(1.0f);
9239 Actor actor = Actor::New();
9240 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9241 Stage::GetCurrent().Add(actor);
9243 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9244 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9245 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9246 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9247 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9248 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9249 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9250 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9251 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9253 // Build the animation
9254 float durationSeconds(1.0f);
9255 Animation animation = Animation::New(durationSeconds);
9257 KeyFrames keyFrames = KeyFrames::New();
9258 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9259 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9260 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9262 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
9264 // Start the animation
9267 bool signalReceived(false);
9268 AnimationFinishCheck finishCheck(signalReceived);
9269 animation.FinishedSignal().Connect(&application, finishCheck);
9270 application.SendNotification();
9271 application.Render(0);
9272 application.SendNotification();
9273 finishCheck.CheckSignalNotReceived();
9274 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9275 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9276 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9277 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9279 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9280 application.SendNotification();
9281 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9282 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9283 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9284 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9286 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9287 application.SendNotification();
9288 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9289 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9290 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9291 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9293 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9294 application.SendNotification();
9295 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9296 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9297 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9298 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9300 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9301 application.SendNotification();
9302 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9303 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9304 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9305 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9307 // We did expect the animation to finish
9309 finishCheck.CheckSignalReceived();
9313 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9315 TestApplication application;
9317 Actor actor = Actor::New();
9318 AngleAxis aa(Degree(90), Vector3::XAXIS);
9319 actor.SetOrientation(aa.angle, aa.axis);
9320 Stage::GetCurrent().Add(actor);
9322 application.SendNotification();
9323 application.Render(0);
9325 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9327 // Build the animation
9328 float durationSeconds(1.0f);
9329 Animation animation = Animation::New(durationSeconds);
9331 KeyFrames keyFrames = KeyFrames::New();
9332 keyFrames.Add(0.0f, false);
9333 keyFrames.Add(0.2f, true);
9334 keyFrames.Add(0.4f, true);
9335 keyFrames.Add(0.8f, false);
9336 keyFrames.Add(1.0f, true);
9338 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
9340 // Start the animation
9343 // Final key frame value should be retrievable straight away
9344 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9346 bool signalReceived(false);
9347 AnimationFinishCheck finishCheck(signalReceived);
9348 animation.FinishedSignal().Connect(&application, finishCheck);
9349 application.SendNotification();
9350 application.SendNotification();
9351 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9352 application.SendNotification();
9353 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9354 application.SendNotification();
9356 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9357 finishCheck.CheckSignalReceived();
9361 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9363 TestApplication application;
9365 Actor actor = Actor::New();
9366 AngleAxis aa(Degree(90), Vector3::XAXIS);
9367 actor.SetOrientation(aa.angle, aa.axis);
9368 Stage::GetCurrent().Add(actor);
9370 application.SendNotification();
9371 application.Render(0);
9373 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9375 // Build the animation
9376 float durationSeconds(1.0f);
9377 Animation animation = Animation::New(durationSeconds);
9379 KeyFrames keyFrames = KeyFrames::New();
9380 keyFrames.Add(0.0f, false);
9381 keyFrames.Add(0.2f, true);
9382 keyFrames.Add(0.4f, true);
9383 keyFrames.Add(0.8f, false);
9384 keyFrames.Add(1.0f, true);
9386 //Cubic interpolation for boolean values should be ignored
9387 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
9389 // Start the animation
9392 bool signalReceived(false);
9393 AnimationFinishCheck finishCheck(signalReceived);
9394 animation.FinishedSignal().Connect(&application, finishCheck);
9395 application.SendNotification();
9396 application.SendNotification();
9397 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9398 application.SendNotification();
9399 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9400 application.SendNotification();
9402 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9403 finishCheck.CheckSignalReceived();
9407 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9409 TestApplication application;
9411 Actor actor = Actor::New();
9412 AngleAxis aa(Degree(90), Vector3::XAXIS);
9413 actor.SetOrientation(aa.angle, aa.axis);
9414 Stage::GetCurrent().Add(actor);
9416 application.SendNotification();
9417 application.Render(0);
9418 Quaternion start(Radian(aa.angle), aa.axis);
9419 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9421 // Build the animation
9422 float durationSeconds(1.0f);
9423 Animation animation = Animation::New(durationSeconds);
9425 KeyFrames keyFrames = KeyFrames::New();
9426 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9428 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9430 // Start the animation
9433 // Final key frame value should be retrievable straight away
9434 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
9436 bool signalReceived(false);
9437 AnimationFinishCheck finishCheck(signalReceived);
9438 animation.FinishedSignal().Connect(&application, finishCheck);
9439 application.SendNotification();
9440 application.SendNotification();
9441 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9442 application.SendNotification();
9443 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9444 application.SendNotification();
9446 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9448 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9449 finishCheck.CheckSignalReceived();
9453 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9455 TestApplication application;
9457 Actor actor = Actor::New();
9458 AngleAxis aa(Degree(90), Vector3::XAXIS);
9459 actor.SetOrientation(aa.angle, aa.axis);
9460 application.SendNotification();
9461 application.Render(0);
9462 Stage::GetCurrent().Add(actor);
9464 Quaternion start(Radian(aa.angle), aa.axis);
9465 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9467 // Build the animation
9468 float durationSeconds(1.0f);
9469 Animation animation = Animation::New(durationSeconds);
9471 KeyFrames keyFrames = KeyFrames::New();
9472 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9473 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9474 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9476 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9478 // Start the animation
9481 bool signalReceived(false);
9482 AnimationFinishCheck finishCheck(signalReceived);
9483 animation.FinishedSignal().Connect(&application, finishCheck);
9484 application.SendNotification();
9485 application.Render(0);
9486 application.SendNotification();
9487 finishCheck.CheckSignalNotReceived();
9489 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9490 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9492 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9493 application.SendNotification();
9494 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9495 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9497 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9498 application.SendNotification();
9499 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9500 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9502 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9503 application.SendNotification();
9504 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
9505 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9507 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9508 application.SendNotification();
9509 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9510 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9512 // We did expect the animation to finish
9514 finishCheck.CheckSignalReceived();
9518 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9520 TestApplication application;
9522 Actor actor = Actor::New();
9523 AngleAxis aa(Degree(90), Vector3::XAXIS);
9524 actor.SetOrientation(aa.angle, aa.axis);
9525 Stage::GetCurrent().Add(actor);
9527 application.SendNotification();
9528 application.Render(0);
9529 Quaternion start(Radian(aa.angle), aa.axis);
9530 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9532 // Build the animation
9533 float durationSeconds(1.0f);
9534 Animation animation = Animation::New(durationSeconds);
9536 KeyFrames keyFrames = KeyFrames::New();
9537 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9539 //Cubic interpolation should be ignored for quaternions
9540 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9542 // Start the animation
9545 bool signalReceived(false);
9546 AnimationFinishCheck finishCheck(signalReceived);
9547 animation.FinishedSignal().Connect(&application, finishCheck);
9548 application.SendNotification();
9549 application.SendNotification();
9550 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9551 application.SendNotification();
9552 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9553 application.SendNotification();
9555 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9557 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9558 finishCheck.CheckSignalReceived();
9562 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9564 TestApplication application;
9566 Actor actor = Actor::New();
9567 AngleAxis aa(Degree(90), Vector3::XAXIS);
9568 actor.SetOrientation(aa.angle, aa.axis);
9569 application.SendNotification();
9570 application.Render(0);
9571 Stage::GetCurrent().Add(actor);
9573 Quaternion start(Radian(aa.angle), aa.axis);
9574 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9576 // Build the animation
9577 float durationSeconds(1.0f);
9578 Animation animation = Animation::New(durationSeconds);
9580 KeyFrames keyFrames = KeyFrames::New();
9581 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9582 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9583 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9585 //Cubic interpolation should be ignored for quaternions
9586 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9588 // Start the animation
9591 bool signalReceived(false);
9592 AnimationFinishCheck finishCheck(signalReceived);
9593 animation.FinishedSignal().Connect(&application, finishCheck);
9594 application.SendNotification();
9595 application.Render(0);
9596 application.SendNotification();
9597 finishCheck.CheckSignalNotReceived();
9599 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9600 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9602 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9603 application.SendNotification();
9604 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9605 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9607 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9608 application.SendNotification();
9609 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9610 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9612 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9613 application.SendNotification();
9614 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9615 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9617 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9618 application.SendNotification();
9619 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9620 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9622 // We did expect the animation to finish
9624 finishCheck.CheckSignalReceived();
9628 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9630 TestApplication application;
9632 float startValue(1.0f);
9633 Actor actor = Actor::New();
9634 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9635 Stage::GetCurrent().Add(actor);
9637 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9638 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9639 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9640 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9641 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9642 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9643 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9644 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9645 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9647 // Build the animation
9648 float durationSeconds(1.0f);
9649 Animation animation = Animation::New(durationSeconds);
9651 KeyFrames keyFrames = KeyFrames::New();
9652 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9653 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9654 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9656 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9658 // Start the animation
9661 bool signalReceived(false);
9662 AnimationFinishCheck finishCheck(signalReceived);
9663 animation.FinishedSignal().Connect(&application, finishCheck);
9664 application.SendNotification();
9665 application.Render(0);
9666 application.SendNotification();
9667 finishCheck.CheckSignalNotReceived();
9668 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9669 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9670 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9671 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9673 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9674 application.SendNotification();
9675 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9676 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9677 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9678 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9680 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9681 application.SendNotification();
9682 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9683 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9684 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9685 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9687 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9688 application.SendNotification();
9689 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9690 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9691 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9692 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9694 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9695 application.SendNotification();
9696 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9697 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9698 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9699 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9701 // We did expect the animation to finish
9703 finishCheck.CheckSignalReceived();
9707 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9709 TestApplication application;
9711 float startValue(1.0f);
9712 Actor actor = Actor::New();
9713 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9714 Stage::GetCurrent().Add(actor);
9716 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9717 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9718 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9719 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9720 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9721 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9722 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9723 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9724 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9726 // Build the animation
9727 float durationSeconds(1.0f);
9728 Animation animation = Animation::New(durationSeconds);
9730 KeyFrames keyFrames = KeyFrames::New();
9731 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9732 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9733 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9735 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9737 // Start the animation
9740 bool signalReceived(false);
9741 AnimationFinishCheck finishCheck(signalReceived);
9742 animation.FinishedSignal().Connect(&application, finishCheck);
9743 application.SendNotification();
9744 application.Render(0);
9745 application.SendNotification();
9746 finishCheck.CheckSignalNotReceived();
9747 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9748 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9749 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9750 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9752 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9753 application.SendNotification();
9754 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9755 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9756 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9757 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9759 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9760 application.SendNotification();
9761 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9762 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9763 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9764 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9766 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9767 application.SendNotification();
9768 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9769 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9770 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9771 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9773 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9774 application.SendNotification();
9775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9776 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9777 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9778 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9780 // We did expect the animation to finish
9782 finishCheck.CheckSignalReceived();
9786 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9788 TestApplication application;
9790 float startValue(1.0f);
9791 Actor actor = Actor::New();
9792 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9793 Stage::GetCurrent().Add(actor);
9795 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9796 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9797 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9798 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9799 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9800 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9801 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9802 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9803 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9805 // Build the animation
9806 float durationSeconds(1.0f);
9808 Animation animation = Animation::New(durationSeconds);
9810 KeyFrames keyFrames = KeyFrames::New();
9811 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9812 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9813 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9815 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9817 // Start the animation
9820 bool signalReceived(false);
9821 AnimationFinishCheck finishCheck(signalReceived);
9822 animation.FinishedSignal().Connect(&application, finishCheck);
9823 application.SendNotification();
9825 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9826 application.SendNotification();
9827 finishCheck.CheckSignalNotReceived();
9828 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9829 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9830 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9831 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9833 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9834 application.SendNotification();
9835 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9836 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9837 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9838 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9840 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9841 application.SendNotification();
9842 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9843 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9844 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9845 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9847 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9848 application.SendNotification();
9849 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9850 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9851 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9852 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9854 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9855 application.SendNotification();
9856 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9857 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9858 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9859 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9861 // We did expect the animation to finish
9863 finishCheck.CheckSignalReceived();
9867 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9869 TestApplication application;
9871 float startValue(1.0f);
9872 Actor actor = Actor::New();
9873 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9874 Stage::GetCurrent().Add(actor);
9876 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9877 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9878 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9879 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9880 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9881 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9882 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9883 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9884 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9886 // Build the animation
9887 float durationSeconds(1.0f);
9889 Animation animation = Animation::New(durationSeconds);
9891 KeyFrames keyFrames = KeyFrames::New();
9892 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9893 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9894 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9896 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9898 // Start the animation
9901 bool signalReceived(false);
9902 AnimationFinishCheck finishCheck(signalReceived);
9903 animation.FinishedSignal().Connect(&application, finishCheck);
9904 application.SendNotification();
9906 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9907 application.SendNotification();
9908 finishCheck.CheckSignalNotReceived();
9909 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9910 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9911 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9912 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9914 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9915 application.SendNotification();
9916 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9917 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9918 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9919 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9921 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9922 application.SendNotification();
9923 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9924 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9925 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9926 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9928 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9929 application.SendNotification();
9930 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9931 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9932 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9933 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9935 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9936 application.SendNotification();
9937 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9938 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9939 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9940 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9942 // We did expect the animation to finish
9944 finishCheck.CheckSignalReceived();
9948 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9950 TestApplication application;
9952 float startValue(1.0f);
9954 Actor actor = Actor::New();
9955 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9956 Stage::GetCurrent().Add(actor);
9958 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9959 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9960 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9961 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9962 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9963 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9964 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9965 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9966 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9968 // Build the animation
9969 float durationSeconds(1.0f);
9970 Animation animation = Animation::New(durationSeconds);
9972 KeyFrames keyFrames = KeyFrames::New();
9973 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9974 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9975 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9977 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9979 // Start the animation
9982 bool signalReceived(false);
9983 AnimationFinishCheck finishCheck(signalReceived);
9984 animation.FinishedSignal().Connect(&application, finishCheck);
9985 application.SendNotification();
9987 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9988 application.SendNotification();
9989 finishCheck.CheckSignalNotReceived();
9990 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9991 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9992 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9993 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9995 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9996 application.SendNotification();
9997 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9998 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9999 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
10000 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
10002 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10003 application.SendNotification();
10004 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
10005 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10006 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
10007 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10009 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10010 application.SendNotification();
10011 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
10012 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
10013 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
10014 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
10016 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10017 application.SendNotification();
10018 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
10019 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10020 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
10021 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10023 // We did expect the animation to finish
10025 finishCheck.CheckSignalReceived();
10029 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10031 TestApplication application;
10033 float startValue(1.0f);
10034 Actor actor = Actor::New();
10035 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
10036 Stage::GetCurrent().Add(actor);
10038 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
10039 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
10040 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
10041 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
10042 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
10043 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
10044 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
10045 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
10046 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
10049 // Build the animation
10050 float durationSeconds(1.0f);
10051 float delay = 0.5f;
10052 Animation animation = Animation::New(durationSeconds);
10054 KeyFrames keyFrames = KeyFrames::New();
10055 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10056 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10057 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10059 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
10061 // Start the animation
10064 bool signalReceived(false);
10065 AnimationFinishCheck finishCheck(signalReceived);
10066 animation.FinishedSignal().Connect(&application, finishCheck);
10067 application.SendNotification();
10069 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
10070 application.SendNotification();
10071 finishCheck.CheckSignalNotReceived();
10072 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
10073 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
10074 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
10075 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
10077 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
10078 application.SendNotification();
10079 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
10080 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
10081 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
10082 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
10084 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10085 application.SendNotification();
10086 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
10087 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10088 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
10089 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10091 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10092 application.SendNotification();
10093 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
10094 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
10095 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
10096 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
10098 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10099 application.SendNotification();
10100 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
10101 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10102 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
10103 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10105 // We did expect the animation to finish
10107 finishCheck.CheckSignalReceived();
10111 int UtcDaliAnimationAnimateP(void)
10113 TestApplication application;
10115 Actor actor = Actor::New();
10116 Stage::GetCurrent().Add(actor);
10119 Vector3 position0( 30.0, 80.0, 0.0);
10120 Vector3 position1( 70.0, 120.0, 0.0);
10121 Vector3 position2( 100.0, 100.0, 0.0);
10123 Dali::Path path = Dali::Path::New();
10124 path.AddPoint(position0);
10125 path.AddPoint(position1);
10126 path.AddPoint(position2);
10128 //Control points for first segment
10129 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10130 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10132 //Control points for second segment
10133 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10134 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10136 // Build the animation
10137 float durationSeconds( 1.0f );
10138 Animation animation = Animation::New(durationSeconds);
10139 animation.Animate(actor, path, Vector3::XAXIS);
10141 // Start the animation
10144 bool signalReceived(false);
10145 AnimationFinishCheck finishCheck(signalReceived);
10146 animation.FinishedSignal().Connect(&application, finishCheck);
10147 application.SendNotification();
10148 application.Render(0);
10149 application.SendNotification();
10150 finishCheck.CheckSignalNotReceived();
10151 Vector3 position, tangent;
10152 Quaternion rotation;
10153 path.Sample( 0.0f, position, tangent );
10154 rotation = Quaternion( Vector3::XAXIS, tangent );
10155 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10156 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10158 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10159 application.SendNotification();
10160 path.Sample( 0.25f, position, tangent );
10161 rotation = Quaternion( Vector3::XAXIS, tangent );
10162 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10163 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10165 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10166 application.SendNotification();
10167 path.Sample( 0.5f, position, tangent );
10168 rotation = Quaternion( Vector3::XAXIS, tangent );
10169 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10170 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10172 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10173 application.SendNotification();
10174 path.Sample( 0.75f, position, tangent );
10175 rotation = Quaternion( Vector3::XAXIS, tangent );
10176 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10177 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10179 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10180 application.SendNotification();
10181 path.Sample( 1.0f, position, tangent );
10182 rotation = Quaternion( Vector3::XAXIS, tangent );
10183 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10184 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10186 finishCheck.CheckSignalReceived();
10190 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10192 TestApplication application;
10194 Actor actor = Actor::New();
10195 Stage::GetCurrent().Add(actor);
10198 Vector3 position0( 30.0, 80.0, 0.0);
10199 Vector3 position1( 70.0, 120.0, 0.0);
10200 Vector3 position2( 100.0, 100.0, 0.0);
10202 Dali::Path path = Dali::Path::New();
10203 path.AddPoint(position0);
10204 path.AddPoint(position1);
10205 path.AddPoint(position2);
10207 //Control points for first segment
10208 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10209 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10211 //Control points for second segment
10212 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10213 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10215 // Build the animation
10216 float durationSeconds( 1.0f );
10217 Animation animation = Animation::New(durationSeconds);
10218 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10220 // Start the animation
10223 bool signalReceived(false);
10224 AnimationFinishCheck finishCheck(signalReceived);
10225 animation.FinishedSignal().Connect(&application, finishCheck);
10226 application.SendNotification();
10227 application.Render(0);
10228 application.SendNotification();
10229 finishCheck.CheckSignalNotReceived();
10230 Vector3 position, tangent;
10231 Quaternion rotation;
10232 path.Sample( 0.0f, position, tangent );
10233 rotation = Quaternion( Vector3::XAXIS, tangent );
10234 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10235 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10237 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10238 application.SendNotification();
10239 path.Sample( 0.25f, position, tangent );
10240 rotation = Quaternion( Vector3::XAXIS, tangent );
10241 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10242 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10244 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10245 application.SendNotification();
10246 path.Sample( 0.5f, position, tangent );
10247 rotation = Quaternion( Vector3::XAXIS, tangent );
10248 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10249 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10251 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10252 application.SendNotification();
10253 path.Sample( 0.75f, position, tangent );
10254 rotation = Quaternion( Vector3::XAXIS, tangent );
10255 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10256 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10258 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10259 application.SendNotification();
10260 path.Sample( 1.0f, position, tangent );
10261 rotation = Quaternion( Vector3::XAXIS, tangent );
10262 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10263 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10265 finishCheck.CheckSignalReceived();
10269 int UtcDaliAnimationAnimateTimePeriodP(void)
10271 TestApplication application;
10273 Actor actor = Actor::New();
10274 Stage::GetCurrent().Add(actor);
10277 Vector3 position0( 30.0, 80.0, 0.0);
10278 Vector3 position1( 70.0, 120.0, 0.0);
10279 Vector3 position2( 100.0, 100.0, 0.0);
10281 Dali::Path path = Dali::Path::New();
10282 path.AddPoint(position0);
10283 path.AddPoint(position1);
10284 path.AddPoint(position2);
10286 //Control points for first segment
10287 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10288 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10290 //Control points for second segment
10291 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10292 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10294 // Build the animation
10295 float durationSeconds( 1.0f );
10296 Animation animation = Animation::New(durationSeconds);
10297 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10299 // Start the animation
10302 bool signalReceived(false);
10303 AnimationFinishCheck finishCheck(signalReceived);
10304 animation.FinishedSignal().Connect(&application, finishCheck);
10305 application.SendNotification();
10306 application.Render(0);
10307 application.SendNotification();
10308 finishCheck.CheckSignalNotReceived();
10309 Vector3 position, tangent;
10310 Quaternion rotation;
10311 path.Sample( 0.0f, position, tangent );
10312 rotation = Quaternion( Vector3::XAXIS, tangent );
10313 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10314 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10316 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10317 application.SendNotification();
10318 path.Sample( 0.25f, position, tangent );
10319 rotation = Quaternion( Vector3::XAXIS, tangent );
10320 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10321 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10323 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10324 application.SendNotification();
10325 path.Sample( 0.5f, position, tangent );
10326 rotation = Quaternion( Vector3::XAXIS, tangent );
10327 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10328 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10330 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10331 application.SendNotification();
10332 path.Sample( 0.75f, position, tangent );
10333 rotation = Quaternion( Vector3::XAXIS, tangent );
10334 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10335 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10337 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10338 application.SendNotification();
10339 path.Sample( 1.0f, position, tangent );
10340 rotation = Quaternion( Vector3::XAXIS, tangent );
10341 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10342 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10344 finishCheck.CheckSignalReceived();
10348 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10350 TestApplication application;
10352 Actor actor = Actor::New();
10353 Stage::GetCurrent().Add(actor);
10356 Vector3 position0( 30.0, 80.0, 0.0);
10357 Vector3 position1( 70.0, 120.0, 0.0);
10358 Vector3 position2( 100.0, 100.0, 0.0);
10360 Dali::Path path = Dali::Path::New();
10361 path.AddPoint(position0);
10362 path.AddPoint(position1);
10363 path.AddPoint(position2);
10365 //Control points for first segment
10366 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10367 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10369 //Control points for second segment
10370 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10371 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10373 // Build the animation
10374 float durationSeconds( 1.0f );
10375 Animation animation = Animation::New(durationSeconds);
10376 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10378 // Start the animation
10381 bool signalReceived(false);
10382 AnimationFinishCheck finishCheck(signalReceived);
10383 animation.FinishedSignal().Connect(&application, finishCheck);
10384 application.SendNotification();
10385 application.Render(0);
10386 application.SendNotification();
10387 finishCheck.CheckSignalNotReceived();
10388 Vector3 position, tangent;
10389 Quaternion rotation;
10390 path.Sample( 0.0f, position, tangent );
10391 rotation = Quaternion( Vector3::XAXIS, tangent );
10392 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10393 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10395 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10396 application.SendNotification();
10397 path.Sample( 0.25f, position, tangent );
10398 rotation = Quaternion( Vector3::XAXIS, tangent );
10399 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10400 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10402 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10403 application.SendNotification();
10404 path.Sample( 0.5f, position, tangent );
10405 rotation = Quaternion( Vector3::XAXIS, tangent );
10406 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10407 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10409 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10410 application.SendNotification();
10411 path.Sample( 0.75f, position, tangent );
10412 rotation = Quaternion( Vector3::XAXIS, tangent );
10413 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10414 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10416 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10417 application.SendNotification();
10418 path.Sample( 1.0f, position, tangent );
10419 rotation = Quaternion( Vector3::XAXIS, tangent );
10420 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10421 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10423 finishCheck.CheckSignalReceived();
10427 int UtcDaliAnimationShowP(void)
10429 TestApplication application;
10431 Actor actor = Actor::New();
10432 actor.SetVisible(false);
10433 application.SendNotification();
10434 application.Render(0);
10435 DALI_TEST_CHECK( !actor.IsVisible() );
10436 Stage::GetCurrent().Add(actor);
10438 // Start the animation
10439 float durationSeconds(10.0f);
10440 Animation animation = Animation::New(durationSeconds);
10441 animation.Show(actor, durationSeconds*0.5f);
10444 bool signalReceived(false);
10445 AnimationFinishCheck finishCheck(signalReceived);
10446 animation.FinishedSignal().Connect(&application, finishCheck);
10448 application.SendNotification();
10449 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10451 // We didn't expect the animation to finish yet
10452 application.SendNotification();
10453 finishCheck.CheckSignalNotReceived();
10454 DALI_TEST_CHECK( !actor.IsVisible() );
10456 application.SendNotification();
10457 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
10459 // We didn't expect the animation to finish yet
10460 application.SendNotification();
10461 finishCheck.CheckSignalNotReceived();
10462 DALI_TEST_CHECK( actor.IsVisible() );
10464 application.SendNotification();
10465 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10467 // We did expect the animation to finish
10468 application.SendNotification();
10469 finishCheck.CheckSignalReceived();
10470 DALI_TEST_CHECK( actor.IsVisible() );
10474 int UtcDaliAnimationHideP(void)
10476 TestApplication application;
10478 Actor actor = Actor::New();
10479 DALI_TEST_CHECK( actor.IsVisible() );
10480 Stage::GetCurrent().Add(actor);
10482 // Start the animation
10483 float durationSeconds(10.0f);
10484 Animation animation = Animation::New(durationSeconds);
10485 animation.Hide(actor, durationSeconds*0.5f);
10488 bool signalReceived(false);
10489 AnimationFinishCheck finishCheck(signalReceived);
10490 animation.FinishedSignal().Connect(&application, finishCheck);
10492 application.SendNotification();
10493 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10495 // We didn't expect the animation to finish yet
10496 application.SendNotification();
10497 finishCheck.CheckSignalNotReceived();
10498 DALI_TEST_CHECK( actor.IsVisible() );
10500 application.SendNotification();
10501 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
10503 // We didn't expect the animation to finish yet
10504 application.SendNotification();
10505 finishCheck.CheckSignalNotReceived();
10506 DALI_TEST_CHECK( !actor.IsVisible() );
10508 application.SendNotification();
10509 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10511 // We did expect the animation to finish
10512 application.SendNotification();
10513 finishCheck.CheckSignalReceived();
10514 DALI_TEST_CHECK( !actor.IsVisible() );
10518 int UtcDaliAnimationShowHideAtEndP(void)
10520 // Test that show/hide delay can be the same as animation duration
10521 // i.e. to show/hide at the end of the animation
10523 TestApplication application;
10525 Actor actor = Actor::New();
10526 DALI_TEST_CHECK( actor.IsVisible() );
10527 Stage::GetCurrent().Add(actor);
10529 // Start Hide animation
10530 float durationSeconds(10.0f);
10531 Animation animation = Animation::New(durationSeconds);
10532 animation.Hide(actor, durationSeconds/*Hide at end*/);
10535 bool signalReceived(false);
10536 AnimationFinishCheck finishCheck(signalReceived);
10537 animation.FinishedSignal().Connect(&application, finishCheck);
10539 application.SendNotification();
10540 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10542 // We did expect the animation to finish
10543 application.SendNotification();
10544 finishCheck.CheckSignalReceived();
10545 DALI_TEST_CHECK( !actor.IsVisible() );
10547 // Start Show animation
10548 animation = Animation::New(durationSeconds);
10549 animation.Show(actor, durationSeconds/*Show at end*/);
10550 animation.FinishedSignal().Connect(&application, finishCheck);
10553 application.SendNotification();
10554 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10556 // We did expect the animation to finish
10557 application.SendNotification();
10558 finishCheck.CheckSignalReceived();
10559 DALI_TEST_CHECK( actor.IsVisible() );
10563 int UtcDaliKeyFramesCreateDestroyP(void)
10565 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10567 KeyFrames* keyFrames = new KeyFrames;
10569 DALI_TEST_CHECK( true );
10573 int UtcDaliKeyFramesDownCastP(void)
10575 TestApplication application;
10576 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10578 KeyFrames keyFrames = KeyFrames::New();
10579 BaseHandle object(keyFrames);
10581 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10582 DALI_TEST_CHECK(keyFrames2);
10584 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10585 DALI_TEST_CHECK(keyFrames3);
10587 BaseHandle unInitializedObject;
10588 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10589 DALI_TEST_CHECK(!keyFrames4);
10591 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10592 DALI_TEST_CHECK(!keyFrames5);
10596 int UtcDaliAnimationCreateDestroyP(void)
10598 TestApplication application;
10599 Animation* animation = new Animation;
10600 DALI_TEST_CHECK( animation );
10605 struct UpdateManagerTestConstraint
10607 UpdateManagerTestConstraint(TestApplication& application)
10608 : mApplication(application)
10612 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10614 mApplication.SendNotification(); // Process events
10617 TestApplication& mApplication;
10620 int UtcDaliAnimationUpdateManagerP(void)
10622 TestApplication application;
10624 Actor actor = Actor::New();
10625 Stage::GetCurrent().Add( actor );
10627 // Build the animation
10628 Animation animation = Animation::New( 0.0f );
10630 bool signalReceived = false;
10631 AnimationFinishCheck finishCheck( signalReceived );
10632 animation.FinishedSignal().Connect( &application, finishCheck );
10634 Vector3 startValue(1.0f, 1.0f, 1.0f);
10635 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10636 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10637 constraint.Apply();
10639 // Apply animation to actor
10640 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10641 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10645 application.SendNotification();
10646 application.UpdateOnly( 16 );
10648 finishCheck.CheckSignalNotReceived();
10650 application.SendNotification(); // Process events
10652 finishCheck.CheckSignalReceived();
10657 int UtcDaliAnimationSignalOrderP(void)
10659 TestApplication application;
10661 Actor actor = Actor::New();
10662 Stage::GetCurrent().Add( actor );
10664 // Build the animations
10665 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10666 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10668 bool signal1Received = false;
10669 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10671 bool signal2Received = false;
10672 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10674 // Apply animations to actor
10675 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10677 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10680 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10681 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10683 application.SendNotification();
10684 application.UpdateOnly( 10 ); // 10ms progress
10686 // no notifications yet
10687 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10688 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10690 application.SendNotification();
10693 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10694 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10695 signal1Received = false;
10697 // 1st animation is complete now, do another update with no ProcessEvents in between
10698 application.UpdateOnly( 20 ); // 20ms progress
10701 application.SendNotification();
10703 // 2nd should complete now
10704 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10705 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10710 int UtcDaliAnimationExtendDurationP(void)
10712 TestApplication application;
10714 Actor actor = Actor::New();
10716 // Register a float property
10717 float startValue(10.0f);
10718 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10719 Stage::GetCurrent().Add(actor);
10720 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10721 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10723 // Build the animation
10724 float initialDurationSeconds(1.0f);
10725 float animatorDelay = 5.0f;
10726 float animatorDurationSeconds(5.0f);
10727 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10728 Animation animation = Animation::New(initialDurationSeconds);
10729 float targetValue(30.0f);
10730 float relativeValue(targetValue - startValue);
10732 animation.AnimateTo(Property(actor, index),
10734 TimePeriod(animatorDelay, animatorDurationSeconds));
10736 // The duration should have been extended
10737 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10739 // Start the animation
10742 bool signalReceived(false);
10743 AnimationFinishCheck finishCheck(signalReceived);
10744 animation.FinishedSignal().Connect(&application, finishCheck);
10746 application.SendNotification();
10747 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10749 // We didn't expect the animation to finish yet, but cached value should be the final one
10750 application.SendNotification();
10751 finishCheck.CheckSignalNotReceived();
10752 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10753 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10755 application.SendNotification();
10756 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10758 // We didn't expect the animation to finish yet
10759 application.SendNotification();
10760 finishCheck.CheckSignalNotReceived();
10761 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10763 application.SendNotification();
10764 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10766 // We did expect the animation to finish
10767 application.SendNotification();
10768 finishCheck.CheckSignalReceived();
10769 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10770 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10774 int UtcDaliAnimationCustomIntProperty(void)
10776 TestApplication application;
10778 Actor actor = Actor::New();
10779 Stage::GetCurrent().Add(actor);
10780 int startValue(0u);
10782 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10783 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10784 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10786 // Build the animation
10787 float durationSeconds(1.0f);
10788 Animation animation = Animation::New(durationSeconds);
10789 animation.AnimateTo( Property(actor, index), 20 );
10791 // Start the animation
10794 // Target value should be retrievable straight away
10795 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10797 bool signalReceived(false);
10798 AnimationFinishCheck finishCheck(signalReceived);
10799 animation.FinishedSignal().Connect(&application, finishCheck);
10801 application.SendNotification();
10802 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10804 // We didn't expect the animation to finish yet
10805 application.SendNotification();
10806 finishCheck.CheckSignalNotReceived();
10807 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10809 application.SendNotification();
10810 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10812 // We did expect the animation to finish
10813 application.SendNotification();
10814 finishCheck.CheckSignalReceived();
10815 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10816 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10820 int UtcDaliAnimationDuration(void)
10822 TestApplication application;
10824 Actor actor = Actor::New();
10825 Stage::GetCurrent().Add(actor);
10827 Animation animation = Animation::New( 0.0f );
10828 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10830 // The animation duration should automatically increase depending on the animator time period
10832 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10833 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10835 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10836 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10841 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10843 TestApplication application;
10845 Actor actor = Actor::New();
10847 // Register an integer property
10849 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10850 Stage::GetCurrent().Add(actor);
10851 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10853 DALI_TEST_ASSERTION(
10855 // Build the animation
10856 Animation animation = Animation::New( 2.0f );
10857 std::string relativeValue = "relative string";
10858 animation.AnimateBy( Property(actor, index), relativeValue );
10859 tet_result(TET_FAIL);
10860 }, "Target value is not animatable" );
10866 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10868 TestApplication application;
10870 Actor actor = Actor::New();
10872 // Register an integer property
10874 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10875 Stage::GetCurrent().Add(actor);
10876 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10878 DALI_TEST_ASSERTION(
10880 // Build the animation
10881 Animation animation = Animation::New( 2.0f );
10882 std::string relativeValue = "relative string";
10883 animation.AnimateTo( Property(actor, index), relativeValue );
10884 }, "Target value is not animatable" );
10889 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10891 TestApplication application;
10893 Actor actor = Actor::New();
10895 // Register an integer property
10897 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10898 Stage::GetCurrent().Add(actor);
10899 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10901 DALI_TEST_ASSERTION(
10903 // Build the animation
10904 KeyFrames keyFrames = KeyFrames::New();
10905 keyFrames.Add( 0.0f, std::string("relative string1") );
10906 keyFrames.Add( 1.0f, std::string("relative string2") );
10907 // no need to really create the animation as keyframes do the check
10908 }, "Property type is not animatable" );
10913 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10915 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10917 TestApplication application;
10919 tet_infoline("Set initial position and set up animation to re-position actor");
10921 Actor actor = Actor::New();
10922 Stage::GetCurrent().Add(actor);
10923 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10924 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10926 // Build the animation
10927 Animation animation = Animation::New(2.0f);
10929 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10930 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10931 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10933 tet_infoline("Set target position in animation without intiating play");
10935 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10936 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10938 application.SendNotification();
10939 application.Render();
10941 tet_infoline("Ensure position of actor is still at intial value");
10943 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10944 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10945 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10947 tet_infoline("Play animation and ensure actor position is now target");
10950 application.SendNotification();
10951 application.Render(1000u);
10953 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10955 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10956 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10957 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10959 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10961 application.Render(2000u);
10963 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10965 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10967 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10972 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10974 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10976 TestApplication application;
10978 std::vector<Vector3> targetPositions;
10980 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10981 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10982 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10984 tet_infoline("Set initial position and set up animation to re-position actor");
10986 Actor actor = Actor::New();
10987 Stage::GetCurrent().Add(actor);
10988 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10989 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10991 // Build the animation
10992 Animation animation = Animation::New(2.0f);
10994 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10995 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10996 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10998 tet_infoline("Set target position in animation without intiating play");
11000 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
11002 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11005 application.SendNotification();
11006 application.Render();
11008 tet_infoline("Ensure position of actor is still at intial value");
11010 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
11011 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
11012 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
11014 tet_infoline("Play animation and ensure actor position is now target");
11017 application.SendNotification();
11018 application.Render(1000u);
11020 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11022 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11024 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11026 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
11028 application.Render(2000u);
11030 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11032 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11033 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11034 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11039 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11041 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");
11043 TestApplication application;
11045 std::vector<Vector3> targetSizes;
11046 std::vector<Vector3> targetPositions;
11048 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11049 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
11051 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
11053 tet_infoline("Set initial position and set up animation to re-position actor");
11055 Actor actor = Actor::New();
11056 Stage::GetCurrent().Add(actor);
11057 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
11058 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11060 actor.SetProperty( Actor::Property::SIZE, initialSize );
11061 actor.SetProperty( Actor::Property::POSITION, initialPosition );
11063 // Build the animation
11064 Animation animation = Animation::New(2.0f);
11066 tet_infoline("Set target size in animation without intiating play");
11067 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11068 tet_infoline("Set target position in animation without intiating play");
11069 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11070 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11072 application.SendNotification();
11073 application.Render();
11075 tet_infoline("Ensure position of actor is still at intial size and position");
11077 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11079 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11081 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
11082 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
11083 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
11085 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11088 application.SendNotification();
11089 application.Render(2000u);
11091 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11093 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11094 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11095 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11097 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
11098 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
11099 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
11104 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11106 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11108 TestApplication application;
11110 std::vector<Vector3> targetSizes;
11111 std::vector<float> targetColors;
11113 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11114 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
11116 targetColors.push_back( 1.0f );
11118 tet_infoline("Set initial position and set up animation to re-position actor");
11120 Actor actor = Actor::New();
11121 Stage::GetCurrent().Add(actor);
11122 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
11124 actor.SetProperty( Actor::Property::SIZE, initialSize );
11126 // Build the animation
11127 Animation animation = Animation::New(2.0f);
11129 tet_infoline("Set target size in animation without initiating play");
11130 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11131 tet_infoline("Set target position in animation without intiating play");
11132 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11133 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11135 application.SendNotification();
11136 application.Render();
11138 tet_infoline("Ensure position of actor is still at initial size and position");
11140 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11141 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11142 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11144 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11147 application.SendNotification();
11148 application.Render(2000u);
11150 tet_infoline("Ensure position and size of actor is at target value when animation playing");
11152 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11153 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11154 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11156 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
11161 int UtcDaliAnimationTimePeriodOrder(void)
11163 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
11165 TestApplication application;
11167 Actor actor = Actor::New();
11168 Stage::GetCurrent().Add( actor );
11170 application.SendNotification();
11171 application.Render();
11173 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11174 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11175 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11176 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11177 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11179 //////////////////////////////////////////////////////////////////////////////////
11181 tet_infoline( "With two AnimateTo calls" );
11183 Animation animation = Animation::New( 0.0f );
11184 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11185 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11188 tet_infoline( "The target position should change instantly" );
11189 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11190 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11192 application.SendNotification();
11193 application.Render(5000); // After the animation is complete
11195 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11196 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11197 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11199 //////////////////////////////////////////////////////////////////////////////////
11201 tet_infoline( "Same animation again but in a different order - should yield the same result" );
11203 actor.SetX( 0.0f );
11204 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11205 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11207 application.SendNotification();
11208 application.Render();
11210 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11211 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11212 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11214 animation = Animation::New( 0.0f );
11215 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11216 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11219 tet_infoline( "The target position should change instantly" );
11220 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11221 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11223 application.SendNotification();
11224 application.Render(5000); // After the animation is complete
11226 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11227 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11228 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11233 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11235 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" );
11237 TestApplication application;
11239 Actor actor = Actor::New();
11240 Stage::GetCurrent().Add( actor );
11242 application.SendNotification();
11243 application.Render();
11245 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11246 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11247 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11248 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11249 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11251 //////////////////////////////////////////////////////////////////////////////////
11253 tet_infoline( "" );
11255 Animation animation = Animation::New( 0.0f );
11256 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11257 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11258 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11259 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11260 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11261 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11264 tet_infoline( "The target position should change instantly" );
11265 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11266 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11268 application.SendNotification();
11269 application.Render(14000); // After the animation is complete
11271 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11272 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11273 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11275 //////////////////////////////////////////////////////////////////////////////////
11277 tet_infoline( "Same animation again but in a different order - should end up at the same point" );
11279 actor.SetX( 0.0f );
11281 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11282 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11284 application.SendNotification();
11285 application.Render();
11287 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11288 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11289 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11291 animation = Animation::New( 0.0f );
11292 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11293 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11294 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11295 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11296 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11297 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11300 tet_infoline( "The target position should change instantly" );
11301 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11302 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11304 application.SendNotification();
11305 application.Render(14000); // After the animation is complete
11307 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11308 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11309 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11314 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11316 TestApplication application;
11319 Actor actor = Actor::New();
11320 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11321 Stage::GetCurrent().Add(actor);
11323 application.Render();
11324 application.SendNotification();
11326 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
11328 // Build the animation
11329 float durationSeconds(1.0f);
11330 Animation animation = Animation::New(durationSeconds);
11332 KeyFrames keyFrames = KeyFrames::New();
11333 keyFrames.Add(0.0f, 10);
11334 keyFrames.Add(0.2f, 20);
11335 keyFrames.Add(0.4f, 30);
11336 keyFrames.Add(0.6f, 40);
11337 keyFrames.Add(0.8f, 50);
11338 keyFrames.Add(1.0f, 60);
11340 animation.AnimateBetween( Property(actor, index ), keyFrames );
11342 // Start the animation
11345 // Target value should change to the last key-frame's value straight away
11346 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
11351 int UtcDaliAnimationAnimateBetweenVector2P(void)
11353 TestApplication application;
11355 Vector2 startValue( 10.0f, 20.0f );
11356 Actor actor = Actor::New();
11357 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11358 Stage::GetCurrent().Add(actor);
11360 application.Render();
11361 application.SendNotification();
11363 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
11365 // Build the animation
11366 float durationSeconds(1.0f);
11367 Animation animation = Animation::New(durationSeconds);
11369 KeyFrames keyFrames = KeyFrames::New();
11370 keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
11371 keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
11372 keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
11373 keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
11374 keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
11375 keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
11377 animation.AnimateBetween( Property(actor, index ), keyFrames );
11379 // Start the animation
11382 // Target value should change to the last key-frame's value straight away
11383 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );
11388 int UtcDaliAnimationProgressCallbackP(void)
11390 TestApplication application;
11392 Actor actor = Actor::New();
11393 Stage::GetCurrent().Add(actor);
11395 // Build the animation
11396 Animation animation = Animation::New(0.0f);
11399 float durationSeconds(1.0f);
11400 animation.SetDuration(durationSeconds);
11402 bool finishedSignalReceived(false);
11403 bool progressSignalReceived(false);
11405 AnimationFinishCheck finishCheck(finishedSignalReceived);
11406 animation.FinishedSignal().Connect(&application, finishCheck);
11408 AnimationProgressCheck progressCheck(progressSignalReceived);
11409 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
11410 application.SendNotification();
11412 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11413 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11415 tet_infoline( "Animation Progress notification set to 30%" );
11416 DevelAnimation::SetProgressNotification( animation, 0.3f );
11418 application.SendNotification();
11419 application.Render( );
11421 DALI_TEST_EQUALS( 0.3f, DevelAnimation::GetProgressNotification( animation ), TEST_LOCATION );
11423 progressCheck.CheckSignalNotReceived();
11425 // Start the animation from 10% progress
11426 animation.SetCurrentProgress( 0.1f );
11429 tet_infoline( "Animation Playing from 10%" );
11431 application.SendNotification();
11432 application.Render(0); // start animation
11433 application.Render(durationSeconds*100.0f ); // 20% progress
11435 tet_infoline( "Animation at 20%" );
11437 progressCheck.CheckSignalNotReceived();
11439 application.SendNotification();
11440 application.Render(durationSeconds*200.0f ); // 40% progress
11441 application.SendNotification();
11442 tet_infoline( "Animation at 40%" );
11443 DALI_TEST_EQUALS( 0.4f, animation.GetCurrentProgress(), TEST_LOCATION );
11445 progressCheck.CheckSignalReceived();
11447 tet_infoline( "Progress check reset" );
11448 progressCheck.Reset();
11450 application.Render(durationSeconds*100.0f ); // 50% progress
11451 tet_infoline( "Animation at 50%" );
11452 application.SendNotification();
11454 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
11456 progressCheck.CheckSignalNotReceived();
11458 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
11459 application.SendNotification();
11461 tet_infoline( "Animation at 60%" );
11463 finishCheck.CheckSignalNotReceived();
11465 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
11466 application.SendNotification();
11467 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
11468 tet_infoline( "Animation at 80%" );
11470 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
11471 // We did expect the animation to finish
11472 application.SendNotification();
11473 finishCheck.CheckSignalReceived();
11474 tet_infoline( "Animation finished" );
11475 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11480 int UtcDaliAnimationPlayAfterP(void)
11482 TestApplication application;
11484 tet_printf("Testing that playing after 2 seconds\n");
11487 Actor actor = Actor::New();
11488 Stage::GetCurrent().Add(actor);
11490 // Build the animation
11491 float durationSeconds(1.0f);
11492 Animation animation = Animation::New(durationSeconds);
11494 bool signalReceived( false );
11495 AnimationFinishCheck finishCheck( signalReceived );
11496 animation.FinishedSignal().Connect( &application, finishCheck );
11497 application.SendNotification();
11499 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11500 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11502 // Play animation after the initial delay time
11503 animation.PlayAfter( 0.2f );
11504 application.SendNotification();
11505 application.Render(0); // start animation
11507 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11508 application.SendNotification();
11509 finishCheck.CheckSignalNotReceived();
11510 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11512 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11514 // We didn't expect the animation to finish yet
11515 application.SendNotification();
11516 finishCheck.CheckSignalNotReceived();
11517 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11519 application.SendNotification();
11520 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11522 application.SendNotification();
11523 finishCheck.CheckSignalNotReceived();
11524 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11526 application.SendNotification();
11527 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11529 // We did expect the animation to finish
11530 application.SendNotification();
11531 finishCheck.CheckSignalReceived();
11532 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11534 // Check that nothing has changed after a couple of buffer swaps
11535 application.Render(0);
11536 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11539 tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11542 Actor actor = Actor::New();
11543 Stage::GetCurrent().Add(actor);
11545 // Build the animation
11546 float durationSeconds(1.0f);
11547 Animation animation = Animation::New(durationSeconds);
11548 animation.SetSpeedFactor( -1.0f ); // Set SpeedFactor as < 0
11550 bool signalReceived( false );
11551 AnimationFinishCheck finishCheck( signalReceived );
11552 animation.FinishedSignal().Connect( &application, finishCheck );
11553 application.SendNotification();
11555 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11556 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11558 // Play animation after the initial delay time
11559 animation.PlayAfter( 0.2f );
11560 application.SendNotification();
11561 application.Render(0); // start animation
11563 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11564 application.SendNotification();
11565 finishCheck.CheckSignalNotReceived();
11566 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11568 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11570 // We didn't expect the animation to finish yet
11571 application.SendNotification();
11572 finishCheck.CheckSignalNotReceived();
11573 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11575 application.SendNotification();
11576 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11578 application.SendNotification();
11579 finishCheck.CheckSignalNotReceived();
11580 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION );
11582 application.SendNotification();
11583 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) + 1u/*just beyond the animation duration*/ );
11585 // We did expect the animation to finish
11586 application.SendNotification();
11587 finishCheck.CheckSignalReceived();
11588 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of Timeperiod in seconds
11590 // Check that nothing has changed after a couple of buffer swaps
11591 application.Render(0);
11592 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11598 int UtcDaliAnimationPlayAfterP2(void)
11600 TestApplication application;
11602 tet_printf("Testing that playing after 2 seconds before looping\n");
11605 Actor actor = Actor::New();
11606 Stage::GetCurrent().Add(actor);
11608 // Build the animation
11609 float durationSeconds(1.0f);
11610 Animation animation = Animation::New(durationSeconds);
11611 animation.SetLooping( true );
11613 bool signalReceived( false );
11614 AnimationFinishCheck finishCheck( signalReceived );
11615 animation.FinishedSignal().Connect( &application, finishCheck );
11616 application.SendNotification();
11618 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11619 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11621 // Play animation after the initial delay time
11622 animation.PlayAfter( 0.2f );
11623 application.SendNotification();
11624 application.Render(0); // start animation
11626 for( int iterations = 0; iterations < 3; ++iterations )
11628 // The initial delay time of PlayAfter() applies only once in looping mode.
11629 if( iterations == 0 )
11631 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11632 application.SendNotification();
11633 finishCheck.CheckSignalNotReceived();
11634 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11637 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11639 // We didn't expect the animation to finish yet
11640 application.SendNotification();
11641 finishCheck.CheckSignalNotReceived();
11642 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11644 application.SendNotification();
11645 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11647 application.SendNotification();
11648 finishCheck.CheckSignalNotReceived();
11649 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11651 application.SendNotification();
11652 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) /* 100% progress */ );
11654 // We did expect the animation to finish
11655 application.SendNotification();
11656 finishCheck.CheckSignalNotReceived();
11657 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11660 animation.SetLooping(false);
11661 application.SendNotification();
11662 application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11664 application.SendNotification();
11665 finishCheck.CheckSignalReceived();
11666 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11669 tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11672 Actor actor = Actor::New();
11673 Stage::GetCurrent().Add(actor);
11675 // Build the animation
11676 float durationSeconds(1.0f);
11677 Animation animation = Animation::New(durationSeconds);
11678 animation.SetLooping( true );
11679 animation.SetSpeedFactor( -1.0f ); //Set SpeedFactor as < 0
11681 bool signalReceived( false );
11682 AnimationFinishCheck finishCheck( signalReceived );
11683 animation.FinishedSignal().Connect( &application, finishCheck );
11684 application.SendNotification();
11686 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11687 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11689 // Play animation after the initial delay time
11690 animation.PlayAfter( 0.2f );
11691 application.SendNotification();
11692 application.Render(0); // start animation
11694 for( int iterations = 0; iterations < 3; ++iterations )
11696 // The initial delay time of PlayAfter() applies only once in looping mode.
11697 if( iterations == 0 )
11699 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11700 application.SendNotification();
11701 finishCheck.CheckSignalNotReceived();
11702 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11705 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11707 // We didn't expect the animation to finish yet
11708 application.SendNotification();
11709 finishCheck.CheckSignalNotReceived();
11710 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11712 application.SendNotification();
11713 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11715 application.SendNotification();
11716 finishCheck.CheckSignalNotReceived();
11717 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION );
11719 application.SendNotification();
11720 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) /* 100% progress */ );
11722 // We did expect the animation to finish
11723 application.SendNotification();
11724 finishCheck.CheckSignalNotReceived();
11725 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in second
11728 animation.SetLooping(false);
11729 application.SendNotification();
11730 application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11732 application.SendNotification();
11733 finishCheck.CheckSignalReceived();
11734 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11740 int UtcDaliAnimationPlayAfterP3(void)
11742 TestApplication application;
11744 tet_printf("Testing that PlayAfter with the negative delay seconds\n");
11746 Actor actor = Actor::New();
11747 Stage::GetCurrent().Add(actor);
11749 // Build the animation
11750 float durationSeconds(1.0f);
11751 Animation animation = Animation::New(durationSeconds);
11753 bool signalReceived( false );
11754 AnimationFinishCheck finishCheck( signalReceived );
11755 animation.FinishedSignal().Connect( &application, finishCheck );
11756 application.SendNotification();
11758 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11759 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11761 // When the delay time is negative value, it would treat as play immediately.
11762 animation.PlayAfter( -2.0f );
11763 application.SendNotification();
11764 application.Render(0); // start animation
11766 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11768 // We didn't expect the animation to finish yet
11769 application.SendNotification();
11770 finishCheck.CheckSignalNotReceived();
11771 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11773 application.SendNotification();
11774 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11776 application.SendNotification();
11777 finishCheck.CheckSignalNotReceived();
11778 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.5f ), TEST_LOCATION );
11780 application.SendNotification();
11781 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11783 // We did expect the animation to finish
11784 application.SendNotification();
11785 finishCheck.CheckSignalReceived();
11786 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11788 // Check that nothing has changed after a couple of buffer swaps
11789 application.Render(0);
11790 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11794 int UtcDaliAnimationPlayAfterP4(void)
11796 TestApplication application;
11798 tet_printf("Testing that PlayAfter with progress value\n");
11800 Actor actor = Actor::New();
11801 Stage::GetCurrent().Add(actor);
11803 // Build the animation
11804 float durationSeconds(1.0f);
11805 Animation animation = Animation::New(durationSeconds);
11807 bool signalReceived( false );
11808 AnimationFinishCheck finishCheck( signalReceived );
11809 animation.FinishedSignal().Connect( &application, finishCheck );
11810 application.SendNotification();
11812 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11813 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11815 // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
11816 animation.PlayAfter( durationSeconds * 0.3f );
11817 application.SendNotification();
11818 application.Render(0); // start animation
11820 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 5/6 delay progress, 0% animation progress, 0% animator progress */ );
11822 // We didn't expect the animation to finish yet
11823 application.SendNotification();
11824 finishCheck.CheckSignalNotReceived();
11825 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of PlayAfter
11827 application.SendNotification();
11828 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 20% animation progress, 0% animator progress */ );
11830 application.SendNotification();
11831 finishCheck.CheckSignalNotReceived();
11832 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11834 application.SendNotification();
11835 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 45% animation progress, 0% animator progress */ );
11837 application.SendNotification();
11838 finishCheck.CheckSignalNotReceived();
11839 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11841 application.SendNotification();
11842 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 70% animation progress, 40% animator progress */ );
11844 application.SendNotification();
11845 finishCheck.CheckSignalNotReceived();
11846 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.4f ), TEST_LOCATION ); // 40% of animator progress
11848 application.SendNotification();
11849 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 95% animation progress, 90% animator progress */ );
11851 application.SendNotification();
11852 finishCheck.CheckSignalNotReceived();
11853 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION ); // 90% of animator progress
11855 application.SendNotification();
11856 application.Render( static_cast< unsigned int >( durationSeconds * 50.0f ) + 1u/*just beyond the animation duration*/ );
11858 // We did expect the animation to finish
11859 application.SendNotification();
11860 finishCheck.CheckSignalReceived();
11861 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11863 // Check that nothing has changed after a couple of buffer swaps
11864 application.Render(0);
11865 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11869 int UtcDaliAnimationSetLoopingModeP(void)
11871 // Test Loop forever and Loop mode being set
11872 TestApplication application;
11873 Stage stage( Stage::GetCurrent() );
11875 // Default: LoopingMode::RESTART
11877 Actor actor = Actor::New();
11878 stage.Add( actor );
11880 float durationSeconds( 1.0f );
11881 Animation animation = Animation::New( durationSeconds );
11882 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
11884 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
11885 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11887 // Start the animation
11889 application.SendNotification();
11890 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
11894 application.SendNotification();
11895 application.Render();
11896 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11899 // LoopingMode::AUTO_REVERSE
11901 Actor actor = Actor::New();
11902 stage.Add( actor );
11904 float durationSeconds( 1.0f );
11905 Animation animation = Animation::New( durationSeconds );
11906 animation.SetLooping( true );
11908 bool signalReceived( false );
11909 AnimationFinishCheck finishCheck( signalReceived );
11910 animation.FinishedSignal().Connect( &application, finishCheck );
11911 application.SendNotification();
11913 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11914 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11916 animation.SetLoopingMode( Animation::LoopingMode::AUTO_REVERSE );
11917 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
11919 // Start the animation
11921 application.SendNotification();
11922 application.Render(0);
11924 for( int iterations = 0; iterations < 3; ++iterations )
11926 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
11927 application.SendNotification();
11928 finishCheck.CheckSignalNotReceived();
11930 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
11931 // and arrives at the beginning.
11932 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
11934 application.SendNotification();
11935 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
11937 // We did expect the animation to finish
11938 application.SendNotification();
11939 finishCheck.CheckSignalNotReceived();
11940 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
11943 animation.SetLooping( false );
11944 application.SendNotification();
11945 application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
11947 application.SendNotification();
11948 finishCheck.CheckSignalReceived();
11950 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
11953 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
11955 Actor actor = Actor::New();
11956 stage.Add( actor );
11958 float durationSeconds( 1.0f );
11959 Animation animation = Animation::New( durationSeconds );
11960 animation.SetLooping( true );
11962 bool signalReceived( false );
11963 AnimationFinishCheck finishCheck( signalReceived );
11964 animation.FinishedSignal().Connect( &application, finishCheck );
11965 application.SendNotification();
11967 // Specify a negative multiplier to play the animation in reverse
11968 animation.SetSpeedFactor( -1.0f );
11970 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11971 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11973 animation.SetLoopingMode( Animation::AUTO_REVERSE );
11974 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
11976 // Start the animation
11978 application.SendNotification();
11979 application.Render(0);
11981 for( int iterations = 0; iterations < 3; ++iterations )
11983 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
11984 application.SendNotification();
11985 finishCheck.CheckSignalNotReceived();
11987 // Setting a negative speed factor is to play the animation in reverse.
11988 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
11989 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
11990 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
11992 application.SendNotification();
11993 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
11995 // We did expect the animation to finish
11996 application.SendNotification();
11997 finishCheck.CheckSignalNotReceived();
11998 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12001 animation.SetLooping( false );
12002 application.SendNotification();
12003 application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
12005 application.SendNotification();
12006 finishCheck.CheckSignalReceived();
12008 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12014 int UtcDaliAnimationSetLoopingModeP2(void)
12016 // Test Loop Count and Loop mode being set
12017 TestApplication application;
12018 Stage stage( Stage::GetCurrent() );
12020 // LoopingMode::AUTO_REVERSE
12022 Actor actor = Actor::New();
12023 stage.Add( actor );
12025 float durationSeconds( 1.0f );
12026 Animation animation = Animation::New( durationSeconds );
12027 animation.SetLoopCount(3);
12028 DALI_TEST_CHECK(animation.IsLooping());
12030 bool signalReceived( false );
12031 AnimationFinishCheck finishCheck( signalReceived );
12032 animation.FinishedSignal().Connect( &application, finishCheck );
12033 application.SendNotification();
12035 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12036 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12038 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12039 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12041 // Start the animation
12044 application.Render(0);
12045 application.SendNotification();
12046 application.Render(0);
12047 application.SendNotification();
12048 application.Render(0);
12049 application.SendNotification();
12050 application.Render(0);
12051 application.SendNotification();
12054 float intervalSeconds = 3.0f;
12056 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12057 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12058 // and arrives at the beginning.
12059 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12061 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12063 application.Render(0);
12064 application.SendNotification();
12065 application.Render(0);
12066 application.SendNotification();
12067 application.Render(0);
12068 application.SendNotification();
12069 application.Render(0);
12070 application.SendNotification();
12071 finishCheck.CheckSignalNotReceived();
12073 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12075 application.SendNotification();
12076 finishCheck.CheckSignalReceived();
12077 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12079 finishCheck.Reset();
12082 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12084 Actor actor = Actor::New();
12085 stage.Add( actor );
12087 float durationSeconds( 1.0f );
12088 Animation animation = Animation::New( durationSeconds );
12089 animation.SetLoopCount(3);
12090 DALI_TEST_CHECK(animation.IsLooping());
12092 bool signalReceived( false );
12093 AnimationFinishCheck finishCheck( signalReceived );
12094 animation.FinishedSignal().Connect( &application, finishCheck );
12095 application.SendNotification();
12097 // Specify a negative multiplier to play the animation in reverse
12098 animation.SetSpeedFactor( -1.0f );
12100 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12101 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12103 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12104 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12106 // Start the animation
12109 application.Render(0);
12110 application.SendNotification();
12111 application.Render(0);
12112 application.SendNotification();
12113 application.Render(0);
12114 application.SendNotification();
12115 application.Render(0);
12116 application.SendNotification();
12119 float intervalSeconds = 3.0f;
12121 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12122 // Setting a negative speed factor is to play the animation in reverse.
12123 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12124 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12125 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12127 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12129 application.Render(0);
12130 application.SendNotification();
12131 application.Render(0);
12132 application.SendNotification();
12133 application.Render(0);
12134 application.SendNotification();
12135 application.Render(0);
12136 application.SendNotification();
12137 finishCheck.CheckSignalNotReceived();
12139 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12141 application.SendNotification();
12142 finishCheck.CheckSignalReceived();
12143 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12145 finishCheck.Reset();
12151 int UtcDaliAnimationSetLoopingModeP3(void)
12153 // Test Loop Count is 1 (== default) and Loop mode being set
12154 TestApplication application;
12155 Stage stage( Stage::GetCurrent() );
12157 // LoopingMode::AUTO_REVERSE
12159 Actor actor = Actor::New();
12160 stage.Add( actor );
12162 float durationSeconds( 1.0f );
12163 Animation animation = Animation::New( durationSeconds );
12164 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12166 bool signalReceived( false );
12167 AnimationFinishCheck finishCheck( signalReceived );
12168 animation.FinishedSignal().Connect( &application, finishCheck );
12169 application.SendNotification();
12171 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12172 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12174 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12175 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12177 // Start the animation
12179 application.Render(0);
12180 application.SendNotification();
12182 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12183 application.SendNotification();
12184 finishCheck.CheckSignalNotReceived();
12186 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12187 // and arrives at the beginning.
12188 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12190 application.SendNotification();
12191 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12193 application.SendNotification();
12194 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12196 application.SendNotification();
12197 application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12199 application.SendNotification();
12200 application.Render(0);
12201 application.SendNotification();
12202 finishCheck.CheckSignalReceived();
12204 // After all animation finished, arrives at the beginning.
12205 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12207 finishCheck.Reset();
12210 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12212 Actor actor = Actor::New();
12213 stage.Add( actor );
12215 float durationSeconds( 1.0f );
12216 Animation animation = Animation::New( durationSeconds );
12217 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12219 bool signalReceived( false );
12220 AnimationFinishCheck finishCheck( signalReceived );
12221 animation.FinishedSignal().Connect( &application, finishCheck );
12222 application.SendNotification();
12224 // Specify a negative multiplier to play the animation in reverse
12225 animation.SetSpeedFactor( -1.0f );
12227 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12228 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12230 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12231 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12233 // Start the animation
12235 application.Render(0);
12236 application.SendNotification();
12238 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12239 application.SendNotification();
12240 finishCheck.CheckSignalNotReceived();
12242 // Setting a negative speed factor is to play the animation in reverse.
12243 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12244 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12245 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12247 application.SendNotification();
12248 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12250 application.SendNotification();
12251 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12253 application.SendNotification();
12254 application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12256 application.SendNotification();
12257 application.Render(0);
12258 application.SendNotification();
12259 finishCheck.CheckSignalReceived();
12261 // After all animation finished, arrives at the target.
12262 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12264 finishCheck.Reset();
12270 int UtcDaliAnimationGetLoopingModeP(void)
12272 TestApplication application;
12274 Animation animation = Animation::New(1.0f);
12277 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
12279 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12280 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12285 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12287 TestApplication application;
12289 tet_infoline( "Connect to ProgressReachedSignal but do not set a required Progress marker" );
12291 Actor actor = Actor::New();
12292 Stage::GetCurrent().Add(actor);
12294 // Build the animation
12295 Animation animation = Animation::New(0.0f);
12298 float durationSeconds(1.0f);
12299 animation.SetDuration(durationSeconds);
12301 bool finishedSignalReceived(false);
12302 bool progressSignalReceived(false);
12304 AnimationFinishCheck finishCheck(finishedSignalReceived);
12305 animation.FinishedSignal().Connect(&application, finishCheck);
12307 AnimationProgressCheck progressCheck( progressSignalReceived );
12308 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12309 application.SendNotification();
12311 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12312 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12314 progressCheck.CheckSignalNotReceived();
12318 application.SendNotification();
12319 application.Render(0); // start animation
12320 application.Render(durationSeconds*100.0f ); // 10% progress
12321 application.SendNotification();
12323 tet_infoline( "Ensure after animation has started playing that ProgressReachedSignal not emitted" );
12324 progressCheck.CheckSignalNotReceived();
12326 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
12328 application.SendNotification();
12329 finishCheck.CheckSignalReceived();
12330 tet_infoline( "Animation finished" );
12331 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
12336 int UtcDaliAnimationMultipleProgressSignalsP(void)
12338 tet_infoline( "Multiple animations with different progress markers" );
12340 TestApplication application;
12342 Actor actor = Actor::New();
12343 Stage::GetCurrent().Add(actor);
12345 // Build the animation
12346 Animation animationAlpha = Animation::New(0.0f);
12347 Animation animationBeta = Animation::New(0.0f);
12350 float durationSeconds(1.0f);
12351 animationAlpha.SetDuration(durationSeconds);
12352 animationBeta.SetDuration(durationSeconds);
12354 bool progressSignalReceivedAlpha(false);
12355 bool progressSignalReceivedBeta(false);
12357 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12358 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12360 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12361 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12362 application.SendNotification();
12364 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12365 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12366 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12368 tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12369 DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12371 tet_infoline( "AnimationBeta Progress notification set to 50%" );
12372 DevelAnimation::SetProgressNotification( animationBeta, 0.5f );
12374 application.SendNotification();
12375 application.Render( );
12377 progressCheckAlpha.CheckSignalNotReceived();
12378 progressCheckBeta.CheckSignalNotReceived();
12380 // Start the animations from 10% progress
12381 animationAlpha.SetCurrentProgress( 0.1f );
12382 animationBeta.SetCurrentProgress( 0.1f );
12383 animationAlpha.Play();
12384 animationBeta.Play();
12386 tet_infoline( "Animation Playing from 10%" );
12388 application.SendNotification();
12389 application.Render(0); // start animation
12390 application.Render(durationSeconds*100.0f ); // 20% progress
12392 tet_infoline( "Animation at 20% - No signals to be received" );
12394 progressCheckAlpha.CheckSignalNotReceived();
12395 progressCheckBeta.CheckSignalNotReceived();
12397 application.SendNotification();
12398 application.Render(durationSeconds*200.0f ); // 40% progress
12399 application.SendNotification();
12400 tet_infoline( "Animation at 40% - Alpha signal should be received" );
12401 DALI_TEST_EQUALS( 0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12403 progressCheckAlpha.CheckSignalReceived();
12404 progressCheckBeta.CheckSignalNotReceived();
12406 tet_infoline( "Progress check reset" );
12407 progressCheckAlpha.Reset();
12408 progressCheckBeta.Reset();
12410 application.Render(durationSeconds*100.0f ); // 50% progress
12411 tet_infoline( "Animation at 50% - Beta should receive signal, Alpha should not" );
12412 application.SendNotification();
12414 DALI_TEST_EQUALS( 0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12416 progressCheckAlpha.CheckSignalNotReceived();
12417 progressCheckBeta.CheckSignalReceived();
12418 tet_infoline( "Progress check reset" );
12419 progressCheckAlpha.Reset();
12420 progressCheckBeta.Reset();
12422 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
12423 application.SendNotification();
12425 tet_infoline( "Animation at 60%" );
12427 progressCheckAlpha.CheckSignalNotReceived();
12428 progressCheckBeta.CheckSignalNotReceived();
12430 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12431 application.SendNotification();
12432 tet_infoline( "Animation at 80%" );
12434 progressCheckAlpha.CheckSignalNotReceived();
12435 progressCheckBeta.CheckSignalNotReceived();
12437 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12438 // We did expect the animation to finish
12439 tet_infoline( "Animation finished" );
12444 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12446 tet_infoline( "Multiple animations with different progress markers and big step time" );
12448 TestApplication application;
12450 Actor actor = Actor::New();
12451 Stage::GetCurrent().Add(actor);
12453 // Build the animation
12454 Animation animationAlpha = Animation::New(0.0f);
12455 Animation animationBeta = Animation::New(0.0f);
12458 const float durationSeconds(1.0f);
12459 animationAlpha.SetDuration(durationSeconds);
12460 animationBeta.SetDuration(durationSeconds);
12462 bool progressSignalReceivedAlpha(false);
12463 bool progressSignalReceivedBeta(false);
12465 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12466 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12468 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12469 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12470 application.SendNotification();
12472 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12473 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12474 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12476 tet_infoline( "AnimationAlpha Progress notification set to 1%" );
12477 DevelAnimation::SetProgressNotification( animationAlpha, 0.01f );
12479 tet_infoline( "AnimationBeta Progress notification set to 99%" );
12480 DevelAnimation::SetProgressNotification( animationBeta, 0.99f );
12482 application.SendNotification();
12483 application.Render( );
12485 progressCheckAlpha.CheckSignalNotReceived();
12486 progressCheckBeta.CheckSignalNotReceived();
12488 // Start the animations unlimited looping
12489 animationAlpha.SetLooping( true );
12490 animationBeta.SetLooping( true );
12491 animationAlpha.Play();
12492 animationBeta.Play();
12494 application.SendNotification();
12495 application.Render(0); // start animation
12496 application.Render(durationSeconds*20.0f ); // 2% progress
12497 application.SendNotification();
12498 DALI_TEST_EQUALS( 0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12500 tet_infoline( "Animation at 2% - Alpha signals should be received, Beta should not." );
12502 progressCheckAlpha.CheckSignalReceived();
12503 progressCheckBeta.CheckSignalNotReceived();
12505 tet_infoline( "Progress check reset" );
12506 progressCheckAlpha.Reset();
12507 progressCheckBeta.Reset();
12509 application.SendNotification();
12510 application.Render(durationSeconds*960.0f ); // 98% progress
12511 application.SendNotification();
12512 tet_infoline( "Animation at 98% - No signal received" );
12513 DALI_TEST_EQUALS( 0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12515 progressCheckAlpha.CheckSignalNotReceived();
12516 progressCheckBeta.CheckSignalNotReceived();
12518 application.SendNotification();
12519 application.Render(durationSeconds*40.0f ); // 2% progress
12520 application.SendNotification();
12521 tet_infoline( "Animation loop once and now 2% - Alpha and Beta should receive signal" );
12522 application.SendNotification();
12524 DALI_TEST_EQUALS( 0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12526 progressCheckAlpha.CheckSignalReceived();
12527 progressCheckBeta.CheckSignalReceived();
12529 tet_infoline( "Progress check reset" );
12530 progressCheckAlpha.Reset();
12531 progressCheckBeta.Reset();
12533 application.SendNotification();
12534 application.Render(durationSeconds*980.0f ); // 100% progress
12535 application.SendNotification();
12536 tet_infoline( "Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not" );
12537 application.SendNotification();
12539 progressCheckAlpha.CheckSignalNotReceived();
12540 progressCheckBeta.CheckSignalReceived();
12542 tet_infoline( "Progress check reset" );
12543 progressCheckAlpha.Reset();
12544 progressCheckBeta.Reset();
12546 animationAlpha.SetLooping( false );
12547 animationBeta.SetLooping( false );
12549 application.SendNotification();
12550 application.Render(static_cast<unsigned int>(durationSeconds*2000.0f) + 1u/*just beyond the animation duration*/);
12551 application.SendNotification();
12553 // We did expect the animation to finish
12554 tet_infoline( "Animation finished" );
12559 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12561 tet_infoline( "Multiple animations with different progress markers" );
12563 TestApplication application;
12565 Actor actor = Actor::New();
12566 Stage::GetCurrent().Add(actor);
12568 // Build the animation
12569 Animation animationAlpha = Animation::New(0.0f);
12570 Animation animationBeta = Animation::New(0.0f);
12573 float durationSeconds(1.0f);
12574 float delaySeconds(0.5f);
12575 animationAlpha.SetDuration(durationSeconds);
12576 animationBeta.SetDuration(durationSeconds);
12578 bool progressSignalReceivedAlpha(false);
12579 bool progressSignalReceivedBeta(false);
12581 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12582 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12584 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12585 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12586 application.SendNotification();
12588 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12589 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12590 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12592 tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12593 DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12595 tet_infoline( "AnimationBeta Progress notification set to ~0% (==Notify when delay is done)" );
12596 DevelAnimation::SetProgressNotification( animationBeta, Math::MACHINE_EPSILON_1 );
12598 application.SendNotification();
12599 application.Render( );
12601 progressCheckAlpha.CheckSignalNotReceived();
12602 progressCheckBeta.CheckSignalNotReceived();
12604 // Start the animations from 10% progress
12605 animationAlpha.PlayAfter(delaySeconds);
12606 animationBeta.PlayAfter(delaySeconds);
12608 application.SendNotification();
12609 application.Render(0); // start animation
12610 application.Render(delaySeconds * 500.0f ); // 50% wait progress
12612 tet_infoline( "Delay at 50% - No signals to be received" );
12614 progressCheckAlpha.CheckSignalNotReceived();
12615 progressCheckBeta.CheckSignalNotReceived();
12617 application.SendNotification();
12618 application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f ); // 100% wait, 5% progress
12619 application.SendNotification();
12620 tet_infoline( "Delay at 100%, Animation at 5% - Beta signal should be received" );
12621 DALI_TEST_EQUALS( 0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12623 progressCheckBeta.CheckSignalReceived();
12624 progressCheckAlpha.CheckSignalNotReceived();
12626 tet_infoline( "Progress check reset" );
12627 progressCheckAlpha.Reset();
12628 progressCheckBeta.Reset();
12630 application.Render(durationSeconds * 200.0f ); // 25% progress
12631 tet_infoline( "Animation at 25% - No signals to be received" );
12632 application.SendNotification();
12634 progressCheckAlpha.CheckSignalNotReceived();
12635 progressCheckBeta.CheckSignalNotReceived();
12637 application.Render(durationSeconds * 200.0f ); // 45% progress
12638 tet_infoline( "Animation at 45% - Alpha should receive signal, Beta should not" );
12639 application.SendNotification();
12641 DALI_TEST_EQUALS( 0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12643 progressCheckAlpha.CheckSignalReceived();
12644 progressCheckBeta.CheckSignalNotReceived();
12646 tet_infoline( "Progress check reset" );
12647 progressCheckAlpha.Reset();
12648 progressCheckBeta.Reset();
12650 application.Render(static_cast<unsigned int>(durationSeconds*150.0f)/* 60% progress */);
12651 application.SendNotification();
12653 tet_infoline( "Animation at 60%" );
12655 progressCheckAlpha.CheckSignalNotReceived();
12656 progressCheckBeta.CheckSignalNotReceived();
12658 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12659 application.SendNotification();
12660 tet_infoline( "Animation at 80%" );
12662 progressCheckAlpha.CheckSignalNotReceived();
12663 progressCheckBeta.CheckSignalNotReceived();
12665 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12666 // We did expect the animation to finish
12667 tet_infoline( "Animation finished" );
12672 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12674 TestApplication application;
12676 Actor actor = Actor::New();
12677 Stage::GetCurrent().Add(actor);
12679 // Build the animation
12680 Animation animation = Animation::New(0.0f);
12683 const float durationSeconds(1.0f);
12684 animation.SetDuration(durationSeconds);
12686 // Set Looping Count
12687 const int loopCount( 4 );
12688 animation.SetLoopCount( loopCount );
12690 bool finishedSignalReceived(false);
12691 bool progressSignalReceived(false);
12693 AnimationFinishCheck finishCheck(finishedSignalReceived);
12694 animation.FinishedSignal().Connect(&application, finishCheck);
12696 AnimationProgressCheck progressCheck(progressSignalReceived);
12697 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12698 application.SendNotification();
12700 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12701 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12703 tet_infoline( "Animation Progress notification set to 50% with looping count 4" );
12704 DevelAnimation::SetProgressNotification( animation, 0.5f );
12706 application.SendNotification();
12707 application.Render( );
12709 progressCheck.CheckSignalNotReceived();
12713 for(int count = 0; count < loopCount; count++)
12715 application.SendNotification();
12716 application.Render(0); // start animation
12717 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12718 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12720 tet_infoline( "Animation at 25%" );
12722 progressCheck.CheckSignalNotReceived();
12724 application.SendNotification();
12725 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12726 application.SendNotification();
12727 tet_infoline( "Animation at 50%" );
12728 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12730 progressCheck.CheckSignalReceived();
12732 tet_infoline( "Progress check reset" );
12733 progressCheck.Reset();
12735 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12736 tet_infoline( "Animation at 75%" );
12737 application.SendNotification();
12739 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12741 progressCheck.CheckSignalNotReceived();
12743 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12744 tet_infoline( "Animation at 100%" );
12745 application.SendNotification();
12747 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12748 application.SendNotification();
12750 application.Render(10u);
12751 application.SendNotification();
12752 application.Render(0u);
12753 application.SendNotification();
12755 finishCheck.CheckSignalReceived();
12760 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
12762 TestApplication application;
12764 Actor actor = Actor::New();
12765 Stage::GetCurrent().Add(actor);
12767 // Build the animation
12768 Animation animation = Animation::New(0.0f);
12771 const float durationSeconds(1.0f);
12772 animation.SetDuration(durationSeconds);
12774 // Set Looping Unlmited
12775 animation.SetLooping( true );
12777 bool finishedSignalReceived(false);
12778 bool progressSignalReceived(false);
12780 AnimationFinishCheck finishCheck(finishedSignalReceived);
12781 animation.FinishedSignal().Connect(&application, finishCheck);
12783 AnimationProgressCheck progressCheck(progressSignalReceived);
12784 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12785 application.SendNotification();
12787 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12788 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12790 tet_infoline( "Animation Progress notification set to 50% with unlimited looping" );
12791 DevelAnimation::SetProgressNotification( animation, 0.5f );
12793 application.SendNotification();
12794 application.Render( );
12796 progressCheck.CheckSignalNotReceived();
12800 for(int count = 0; count < 4; count++)
12802 application.SendNotification();
12803 application.Render(0); // start animation
12804 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12805 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12807 tet_infoline( "Animation at 25%" );
12809 progressCheck.CheckSignalNotReceived();
12811 application.SendNotification();
12812 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12813 application.SendNotification();
12814 tet_infoline( "Animation at 50%" );
12815 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12817 progressCheck.CheckSignalReceived();
12819 tet_infoline( "Progress check reset" );
12820 progressCheck.Reset();
12822 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12823 tet_infoline( "Animation at 75%" );
12824 application.SendNotification();
12826 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12828 progressCheck.CheckSignalNotReceived();
12830 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12831 tet_infoline( "Animation at 100%" );
12832 application.SendNotification();
12834 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12835 finishCheck.CheckSignalNotReceived();
12836 application.SendNotification();
12838 finishCheck.CheckSignalNotReceived();
12840 animation.SetLooping( false );
12841 application.Render(0u);
12842 application.SendNotification();
12843 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
12844 application.SendNotification();
12845 application.Render(0u);
12846 application.SendNotification();
12848 finishCheck.CheckSignalReceived();
12853 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
12855 TestApplication application;
12857 Actor actor = Actor::New();
12858 Stage::GetCurrent().Add(actor);
12860 // Build the animation
12861 Animation animation = Animation::New(0.0f);
12864 const float durationSeconds(1.0f);
12865 animation.SetDuration(durationSeconds);
12867 //Set speed negative
12868 animation.SetSpeedFactor( -1.0f );
12870 // Set Looping Unlmited
12871 animation.SetLooping( true );
12873 bool finishedSignalReceived(false);
12874 bool progressSignalReceived(false);
12876 AnimationFinishCheck finishCheck(finishedSignalReceived);
12877 animation.FinishedSignal().Connect(&application, finishCheck);
12879 AnimationProgressCheck progressCheck(progressSignalReceived);
12880 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12881 application.SendNotification();
12883 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12884 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12886 tet_infoline( "Animation Progress notification set to 50%" );
12887 DevelAnimation::SetProgressNotification( animation, 0.5f );
12889 application.SendNotification();
12890 application.Render( );
12892 progressCheck.CheckSignalNotReceived();
12896 for(int count = 0; count < 4; count++)
12898 application.SendNotification();
12899 application.Render(0); // start animation
12900 progressCheck.CheckSignalNotReceived();
12902 application.SendNotification();
12903 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12904 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12906 tet_infoline( "Animation at 25%" );
12908 progressCheck.CheckSignalNotReceived();
12910 application.SendNotification();
12911 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12912 application.SendNotification();
12913 tet_infoline( "Animation at 50%" );
12914 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12916 progressCheck.CheckSignalReceived();
12918 tet_infoline( "Progress check reset" );
12919 progressCheck.Reset();
12921 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12922 tet_infoline( "Animation at 75%" );
12923 application.SendNotification();
12925 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12927 progressCheck.CheckSignalNotReceived();
12929 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12930 tet_infoline( "Animation at 100%" );
12931 application.SendNotification();
12933 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12934 finishCheck.CheckSignalNotReceived();
12935 application.SendNotification();
12937 finishCheck.CheckSignalNotReceived();
12940 animation.SetLooping( false );
12941 animation.SetLoopCount( 4 );
12943 application.Render(0u);
12944 application.SendNotification();
12946 for(int count = 0; count < 4; count++)
12948 application.SendNotification();
12949 application.Render(0); // start animation
12950 progressCheck.CheckSignalNotReceived();
12952 application.SendNotification();
12953 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12954 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12956 tet_infoline( "Animation at 25%" );
12958 progressCheck.CheckSignalNotReceived();
12960 application.SendNotification();
12961 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12962 application.SendNotification();
12963 tet_infoline( "Animation at 50%" );
12964 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12966 progressCheck.CheckSignalReceived();
12968 tet_infoline( "Progress check reset" );
12969 progressCheck.Reset();
12971 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12972 tet_infoline( "Animation at 75%" );
12973 application.SendNotification();
12975 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12977 progressCheck.CheckSignalNotReceived();
12979 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12980 tet_infoline( "Animation at 100%" );
12981 application.SendNotification();
12983 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12984 application.SendNotification();
12986 application.Render(10u);
12987 application.SendNotification();
12988 application.Render(0u);
12989 application.SendNotification();
12991 finishCheck.CheckSignalReceived();
12996 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
12998 TestApplication application;
13000 Actor actor = Actor::New();
13001 Stage::GetCurrent().Add(actor);
13003 // Build the animation
13004 Animation animation = Animation::New(0.0f);
13007 const float durationSeconds(1.0f);
13008 animation.SetDuration(durationSeconds);
13010 bool finishedSignalReceived(false);
13011 bool progressSignalReceived(false);
13013 AnimationFinishCheck finishCheck(finishedSignalReceived);
13014 animation.FinishedSignal().Connect(&application, finishCheck);
13016 AnimationProgressCheck progressCheck(progressSignalReceived);
13017 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13018 application.SendNotification();
13020 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13021 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13023 tet_infoline( "Animation Progress PlayRange as 10% ~ 90%" );
13024 animation.SetPlayRange( Vector2( 0.1f, 0.9f ) );
13026 tet_infoline( "Animation Progress notification set to >90% that never can notificated" );
13027 DevelAnimation::SetProgressNotification( animation, 0.9f + Math::MACHINE_EPSILON_1 );
13029 application.SendNotification();
13030 application.Render( );
13032 progressCheck.CheckSignalNotReceived();
13036 application.SendNotification();
13037 application.Render(0); // start animation
13038 application.Render(durationSeconds*0.25*1000.0f ); // 35% progress
13039 DALI_TEST_EQUALS( 0.35f, animation.GetCurrentProgress(), TEST_LOCATION );
13041 tet_infoline( "Animation at 35%" );
13043 progressCheck.CheckSignalNotReceived();
13045 application.SendNotification();
13046 application.Render(durationSeconds*0.25*1000.0f ); // 60% progress
13047 application.SendNotification();
13048 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
13050 tet_infoline( "Animation at 60%" );
13052 progressCheck.CheckSignalNotReceived();
13054 application.Render(durationSeconds*0.25*1000.0f ); // 85% progress
13055 tet_infoline( "Animation at 85%" );
13056 application.SendNotification();
13057 DALI_TEST_EQUALS( 0.85f, animation.GetCurrentProgress(), TEST_LOCATION );
13059 progressCheck.CheckSignalNotReceived();
13061 application.Render(durationSeconds*0.25*1000.0f ); // 90% progress
13062 tet_infoline( "Animation over 90%" );
13063 application.SendNotification();
13065 // progress never signaled because playrange is 90%
13066 progressCheck.CheckSignalNotReceived();
13071 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13073 TestApplication application;
13075 Actor actor = Actor::New();
13076 Stage::GetCurrent().Add(actor);
13078 // Build the animation
13079 Animation animation = Animation::New(0.0f);
13082 float durationSeconds(5.0f);
13083 animation.SetDuration(durationSeconds);
13085 bool finishedSignalReceived(false);
13086 bool progressSignalReceived(false);
13088 AnimationFinishCheck finishCheck(finishedSignalReceived);
13089 animation.FinishedSignal().Connect(&application, finishCheck);
13091 AnimationProgressCheck progressCheck(progressSignalReceived);
13092 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13093 application.SendNotification();
13095 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13096 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13098 tet_infoline( "Animation Progress notification set to 50%" );
13099 DevelAnimation::SetProgressNotification( animation, 0.5f );
13101 application.SendNotification();
13102 application.Render( );
13104 progressCheck.CheckSignalNotReceived();
13108 application.SendNotification();
13109 application.Render(0); // start animation
13110 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
13111 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
13113 tet_infoline( "Animation at 25%" );
13115 progressCheck.CheckSignalNotReceived();
13117 application.SendNotification();
13118 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
13119 application.SendNotification();
13120 tet_infoline( "Animation at 50%" );
13121 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
13123 progressCheck.CheckSignalReceived();
13125 tet_infoline( "Progress check reset" );
13126 progressCheck.Reset();
13128 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
13129 tet_infoline( "Animation at 75%" );
13130 application.SendNotification();
13132 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
13134 progressCheck.CheckSignalNotReceived();
13139 int UtcDaliAnimationAnimateByInvalidParameters(void)
13141 TestApplication application;
13143 Actor actor = Actor::New();
13144 Stage::GetCurrent().Add(actor);
13146 // Create the animation
13147 Animation animation = Animation::New(1.0f);
13149 DALI_TEST_ASSERTION(
13151 // non animateable property (STRING)
13152 animation.AnimateBy( Property( actor, Actor::Property::LAYOUT_DIRECTION ), Property::Value( "new direction" ) );
13153 }, "Property type is not animatable" );
13155 DALI_TEST_ASSERTION(
13157 // non animateable property (MATRIX)
13158 Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Dali::Matrix() ), Property::ANIMATABLE );
13159 animation.AnimateBy( Property( actor, index ), Property::Value( Property::MATRIX ) );
13160 }, "Property type is not animatable" );
13163 DALI_TEST_ASSERTION(
13165 // non animateable target (NONE)
13166 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value() );
13167 }, "Target value is not animatable" );
13169 DALI_TEST_ASSERTION(
13171 // non animateable target (STRING)
13172 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value("foo") );
13173 }, "Target value is not animatable" );
13175 DALI_TEST_ASSERTION(
13177 // not mathing properties (VECTOR3, FLOAT)
13178 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( 10.f ) );
13179 }, "Property and target types don't match" );
13181 DALI_TEST_ASSERTION(
13183 // not mathing properties (VECTOR3.A, VECTOR2)
13184 animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), Property::Value( Property::VECTOR2 ) );
13185 }, "Property and target types don't match" );
13187 DALI_TEST_ASSERTION(
13189 // negative duration
13190 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13191 }, "Duration must be >=0" );
13196 int UtcDaliAnimationAnimateToInvalidParameters(void)
13198 TestApplication application;
13200 Actor actor = Actor::New();
13201 Stage::GetCurrent().Add(actor);
13203 // Create the animation
13204 Animation animation = Animation::New(1.0f);
13207 DALI_TEST_ASSERTION(
13209 // non animateable property (MAP)
13210 Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::MAP ), Property::ANIMATABLE );
13211 animation.AnimateTo( Property( actor, index ), Property::Value( Property::MAP ) );
13212 }, "Property type is not animatable" );
13214 DALI_TEST_ASSERTION(
13216 // non animateable target (NONE)
13217 animation.AnimateTo( Property( actor, Actor::Property::CLIPPING_MODE ), Property::Value() );
13218 }, "Property type is not animatable" );
13220 DALI_TEST_ASSERTION(
13222 // non animateable target (ARRAY)
13223 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Property::ARRAY ) );
13224 }, "Target value is not animatable" );
13226 DALI_TEST_ASSERTION(
13228 // non animateable target (RECTANGLE)
13229 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Rect<int32_t>() ) );
13230 }, "Target value is not animatable" );
13232 DALI_TEST_ASSERTION(
13234 // not mathing properties (FLOAT, INT)
13235 animation.AnimateTo( Property( actor, Actor::Property::SCALE_Y ), Property::Value(10) );
13236 }, "Property and target types don't match" );
13238 DALI_TEST_ASSERTION(
13240 // not mathing properties (VECTOR3, VECTOR2)
13241 animation.AnimateTo( Property( actor, Actor::Property::COLOR ), Property::Value( Property::VECTOR2 ) );
13242 }, "Property and target types don't match" );
13244 DALI_TEST_ASSERTION(
13246 // negative duration
13247 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13248 }, "Duration must be >=0" );
13253 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13255 TestApplication application;
13257 Actor actor = Actor::New();
13258 Stage::GetCurrent().Add(actor);
13260 // Create the animation
13261 Animation animation = Animation::New(1.0f);
13264 DALI_TEST_ASSERTION(
13266 // non animateable property (ARRAY)
13267 Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::ARRAY ), Property::ANIMATABLE );
13268 KeyFrames keyframes = KeyFrames::New();
13269 keyframes.Add( 0.5f, Property::Value( Property::ARRAY ) );
13270 animation.AnimateBetween( Property( actor, index ), keyframes );
13271 }, "Property type is not animatable" );
13273 DALI_TEST_ASSERTION(
13275 // non animateable target (NONE)
13276 KeyFrames keyframes = KeyFrames::New();
13277 keyframes.Add( 0.5f, Property::Value() );
13278 animation.AnimateBetween( Property( actor, Actor::Property::CLIPPING_MODE ), keyframes );
13279 }, "Property type is not animatable" );
13281 DALI_TEST_ASSERTION(
13283 // non animateable target (EXTENTS)
13284 KeyFrames keyframes = KeyFrames::New();
13285 keyframes.Add( 0.5f, Property::Value( Property::EXTENTS ) ); // throws
13286 animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13287 }, "Property type is not animatable" );
13289 DALI_TEST_ASSERTION(
13291 // non animateable target (RECTANGLE)
13292 KeyFrames keyframes = KeyFrames::New();
13293 keyframes.Add( 0.5f, Property::Value( Property::MAP ) ); // throws
13294 animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13295 }, "Property type is not animatable" );
13297 DALI_TEST_ASSERTION(
13299 // not mathing properties (VECTOR2, VECTOR4)
13300 KeyFrames keyframes = KeyFrames::New();
13301 keyframes.Add( 0.5f, Property::Value( Vector4( 1, 2, 3, 4 ) ) );
13302 animation.AnimateBetween( Property( actor, Actor::Property::MAXIMUM_SIZE ), keyframes );
13303 }, "Property and target types don't match" );
13305 DALI_TEST_ASSERTION(
13307 // negative duration
13308 KeyFrames keyframes = KeyFrames::New();
13309 keyframes.Add( 0.5f, Property::Value(Vector3( 1, 2, 3 ) ) );
13310 animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes, TimePeriod(-1) );
13311 }, "Duration must be >=0" );
13316 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13324 void CheckPropertyValuesWhenCallingAnimationMethod( TestFunction functionToTest, const char * testName )
13326 tet_printf( "Testing %s\n", testName );
13328 // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13329 // This test checks that that is being done
13331 const float durationSeconds( 1.0f );
13332 unsigned int halfAnimationDuration( static_cast< unsigned int >( durationSeconds * 1000.0f * 0.5f ) );
13333 const Vector3 originalPosition( Vector3::ZERO );
13334 const Vector3 targetPosition( 10.0f, 10.0f, 10.0f );
13335 const Vector3 halfWayToTarget( targetPosition * 0.5f );
13337 struct ExpectedValue
13339 Animation::EndAction endAction;
13340 Vector3 expectedGetPropertyValue;
13343 ExpectedValue expectedValueTable[] =
13345 { Animation::Bake, halfWayToTarget }, // When baking, the current value is the final value.
13346 { Animation::BakeFinal, targetPosition }, // When BakeFinal, we should jump to the final value when clearing or stopping.
13347 { Animation::Discard, originalPosition }, // When discarding, we should jump back to the original value when clearing or stopping.
13349 const auto expectedValueTableCount = sizeof( expectedValueTable ) / sizeof( ExpectedValue );
13351 for( auto i = 0u; i < expectedValueTableCount; ++i )
13353 TestApplication application;
13355 Actor actor = Actor::New();
13356 Stage::GetCurrent().Add(actor);
13358 // Build the animation
13359 Animation animation = Animation::New( durationSeconds );
13360 animation.SetEndAction( expectedValueTable[ i ].endAction );
13361 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
13363 // Start the animation
13366 application.SendNotification();
13367 application.Render( halfAnimationDuration );
13369 // Stop or Clear the animation early, both have the same effect
13370 if( functionToTest == TestFunction::STOP )
13379 // The event side property should be set the expected value immediately, the update side property will still only be halfway as we haven't run an update yet
13380 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
13381 DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13383 // After one frame, both values should match regardless of the End Action
13384 application.SendNotification();
13385 application.Render();
13387 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
13388 DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
13391 } // unnamed namespace
13393 int UtcDaliAnimationStopPropertyValue(void)
13395 CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::STOP, "UtcDaliAnimationStopPropertyValue" );
13399 int UtcDaliAnimationClearPropertyValue(void)
13401 CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue" );
13405 int UtcDaliAnimationPausePropertyValue(void)
13407 const float durationSeconds( 1.0f );
13408 unsigned int halfAnimationDuration( static_cast< unsigned int >( durationSeconds * 1000.0f * 0.5f ) );
13409 const Vector3 originalPosition( Vector3::ZERO );
13410 const Vector3 targetPosition( 10.0f, 10.0f, 10.0f );
13411 const Vector3 halfWayToTarget( targetPosition * 0.5f );
13413 Animation::EndAction endActions[] =
13416 Animation::BakeFinal,
13417 Animation::Discard,
13419 const auto endActionCount = sizeof( endActions ) / sizeof( endActions[0] );
13421 // For all end actions, when pausing, we stay at the current value
13422 for( auto i = 0u; i < endActionCount; ++i )
13424 TestApplication application;
13426 Actor actor = Actor::New();
13427 Stage::GetCurrent().Add(actor);
13429 // Build the animation
13430 Animation animation = Animation::New( durationSeconds );
13431 animation.SetEndAction( endActions[ i ] );
13432 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
13434 // Start the animation
13437 application.SendNotification();
13438 application.Render( halfAnimationDuration );
13440 // Puase the animation early
13443 // The event side property should be set the current value immediately, the update side property will still only be halfway
13444 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13445 DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13447 // After one frame, both values should match regardless of the End Action
13448 application.SendNotification();
13449 application.Render();
13451 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13452 DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );