2 * Copyright (c) 2020 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 UtcDaliAnimationMoveConstructor(void)
240 TestApplication application;
244 Animation animation = Animation::New( 1.0f );
245 DALI_TEST_CHECK( animation );
246 DALI_TEST_EQUALS( 1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION );
247 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION );
249 Animation movedAnimation = std::move( animation );
250 DALI_TEST_CHECK( movedAnimation );
251 DALI_TEST_EQUALS( 1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION );
252 DALI_TEST_EQUALS( 1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION );
253 DALI_TEST_CHECK( !animation );
257 KeyFrames keyframes = KeyFrames::New();
258 DALI_TEST_CHECK( keyframes );
259 DALI_TEST_EQUALS( 1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION );
260 DALI_TEST_EQUALS( Property::Type::NONE, keyframes.GetType(), TEST_LOCATION );
262 keyframes.Add( 0.0f, Vector3( 0.0f, 0.0f, 0.0f ) );
263 keyframes.Add( 1.0f, Vector3( 100.0f, 100.0f, 100.0f ) );
264 DALI_TEST_EQUALS( Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION );
266 KeyFrames movedKeyFrames = std::move( keyframes );
267 DALI_TEST_CHECK( movedKeyFrames );
268 DALI_TEST_EQUALS( 1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION );
269 DALI_TEST_EQUALS( Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION );
270 DALI_TEST_CHECK( !keyframes );
275 int UtcDaliAnimationMoveAssignment(void)
277 TestApplication application;
281 Animation animation = Animation::New( 1.0f );
282 DALI_TEST_CHECK( animation );
283 DALI_TEST_EQUALS( 1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION );
284 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION );
287 move = std::move( animation );
288 DALI_TEST_CHECK( move );
289 DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
290 DALI_TEST_EQUALS( 1.0f, move.GetDuration(), 0.001f, TEST_LOCATION );
291 DALI_TEST_CHECK( !animation );
295 KeyFrames keyframes = KeyFrames::New();
296 DALI_TEST_CHECK( keyframes );
297 DALI_TEST_EQUALS( 1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION );
298 DALI_TEST_EQUALS( Property::Type::NONE, keyframes.GetType(), TEST_LOCATION );
300 keyframes.Add( 0.0f, Vector3( 0.0f, 0.0f, 0.0f ) );
301 keyframes.Add( 1.0f, Vector3( 100.0f, 100.0f, 100.0f ) );
302 DALI_TEST_EQUALS( Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION );
304 KeyFrames movedKeyFrames;
305 movedKeyFrames = std::move( keyframes );
306 DALI_TEST_CHECK( movedKeyFrames );
307 DALI_TEST_EQUALS( 1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION );
308 DALI_TEST_EQUALS( Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION );
309 DALI_TEST_CHECK( !keyframes );
314 int UtcDaliAnimationSetDurationP(void)
316 TestApplication application;
318 Actor actor = Actor::New();
319 application.GetScene().Add(actor);
321 // Build the animation
322 float durationSeconds(1.0f);
323 Animation animation = Animation::New(durationSeconds);
324 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
326 // Start the animation
327 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
328 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
331 bool signalReceived(false);
332 AnimationFinishCheck finishCheck(signalReceived);
333 animation.FinishedSignal().Connect(&application, finishCheck);
335 application.SendNotification();
336 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
338 // We didn't expect the animation to finish yet
339 application.SendNotification();
340 finishCheck.CheckSignalNotReceived();
342 application.Render(2u/*just beyond the animation duration*/);
344 // We did expect the animation to finish
345 application.SendNotification();
346 finishCheck.CheckSignalReceived();
347 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
349 // Restart the animation, with a different duration
351 actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
352 durationSeconds = 3.5f;
353 animation.SetDuration(durationSeconds);
354 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
357 application.SendNotification();
358 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
360 // We didn't expect the animation to finish yet
361 application.SendNotification();
362 finishCheck.CheckSignalNotReceived();
364 application.Render(2u/*just beyond the animation duration*/);
366 // We did expect the animation to finish
367 application.SendNotification();
368 finishCheck.CheckSignalReceived();
369 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
371 // Check that nothing has changed after a couple of buffer swaps
372 application.Render(0);
373 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
374 application.Render(0);
375 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
379 int UtcDaliAnimationSetDurationN(void)
381 TestApplication application;
383 Animation animation = Animation::New( 1.0f );
384 DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
386 animation.SetDuration( -1.0f );
387 DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
391 int UtcDaliAnimationGetDurationP(void)
393 TestApplication application;
395 Animation animation = Animation::New(1.0f);
396 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
398 animation.SetDuration(2.0f);
399 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
403 int UtcDaliAnimationSetLoopingP(void)
405 TestApplication application;
407 Actor actor = Actor::New();
408 application.GetScene().Add(actor);
410 // Build the animation
411 float durationSeconds(1.0f);
412 Animation animation = Animation::New(durationSeconds);
413 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
414 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
416 // Start the animation
417 animation.SetLooping(true);
418 DALI_TEST_CHECK(animation.IsLooping());
421 bool signalReceived(false);
422 AnimationFinishCheck finishCheck(signalReceived);
423 animation.FinishedSignal().Connect(&application, finishCheck);
425 application.SendNotification();
428 float intervalSeconds = 0.25f;
429 float progress = 0.0f;
430 for (int iterations = 0; iterations < 5;)
432 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
434 progress += intervalSeconds;
435 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION );
437 if (progress >= 1.0f)
439 progress = progress - 1.0f;
444 // We didn't expect the animation to finish yet
445 application.SendNotification();
446 finishCheck.CheckSignalNotReceived();
448 animation.SetLooping(false);
449 DALI_TEST_CHECK(!animation.IsLooping());
451 application.SendNotification();
452 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
454 // We did expect the animation to finish
455 application.SendNotification();
456 finishCheck.CheckSignalReceived();
457 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
459 // Check that nothing has changed after a couple of buffer swaps
460 application.Render(0);
461 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
462 application.Render(0);
463 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
467 int UtcDaliAnimationSetLoopCountP(void)
469 TestApplication application;
471 Actor actor = Actor::New();
472 application.GetScene().Add(actor);
474 // Build the animation
475 float durationSeconds(1.0f);
476 Animation animation = Animation::New(durationSeconds);
477 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
478 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
480 // Start the animation
481 animation.SetLoopCount(3);
482 DALI_TEST_CHECK(animation.IsLooping());
485 bool signalReceived(false);
486 AnimationFinishCheck finishCheck(signalReceived);
487 animation.FinishedSignal().Connect(&application, finishCheck);
489 application.Render(0);
490 application.SendNotification();
491 application.Render(0);
492 application.SendNotification();
493 application.Render(0);
494 application.SendNotification();
495 application.Render(0);
496 application.SendNotification();
499 float intervalSeconds = 3.0f;
501 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
502 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
504 application.Render(0);
505 application.SendNotification();
506 application.Render(0);
507 application.SendNotification();
508 application.Render(0);
509 application.SendNotification();
510 application.Render(0);
511 application.SendNotification();
512 finishCheck.CheckSignalNotReceived();
514 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
516 application.SendNotification();
517 finishCheck.CheckSignalReceived();
518 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
522 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
523 application.SendNotification();
524 finishCheck.CheckSignalNotReceived();
526 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
527 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
528 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
529 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
530 application.SendNotification();
531 finishCheck.CheckSignalNotReceived();
536 int UtcDaliAnimationSetLoopCountP2(void)
538 TestApplication application;
541 // switching between forever and loop count
544 Actor actor = Actor::New();
545 application.GetScene().Add(actor);
547 // Build the animation
548 float durationSeconds(1.0f);
549 Animation animation = Animation::New(durationSeconds);
550 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
551 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
552 animation.SetEndAction(Animation::Discard);
554 // Start the animation
555 animation.SetLoopCount(3);
556 DALI_TEST_CHECK(animation.IsLooping());
559 bool signalReceived(false);
560 AnimationFinishCheck finishCheck(signalReceived);
561 animation.FinishedSignal().Connect(&application, finishCheck);
563 float intervalSeconds = 3.0f;
565 application.SendNotification();
566 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
567 application.SendNotification();
568 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
569 application.SendNotification();
570 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
571 application.SendNotification();
573 application.SendNotification();
574 finishCheck.CheckSignalReceived();
579 animation.SetLooping(true);
580 DALI_TEST_CHECK(animation.IsLooping());
582 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
583 application.SendNotification();
584 finishCheck.CheckSignalNotReceived();
586 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
587 application.SendNotification();
588 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
589 application.SendNotification();
590 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
591 application.SendNotification();
592 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
593 application.SendNotification();
594 application.SendNotification();
595 finishCheck.CheckSignalNotReceived();
600 animation.SetLoopCount(3);
601 DALI_TEST_CHECK(animation.IsLooping());
604 application.SendNotification();
605 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
606 application.SendNotification();
607 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
608 application.SendNotification();
609 finishCheck.CheckSignalNotReceived();
611 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
612 application.SendNotification();
613 finishCheck.CheckSignalReceived();
618 animation.SetLooping(true);
619 DALI_TEST_CHECK(animation.IsLooping());
621 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
622 application.SendNotification();
623 finishCheck.CheckSignalNotReceived();
625 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
626 application.SendNotification();
627 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
628 application.SendNotification();
629 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
630 application.SendNotification();
631 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
632 application.SendNotification();
633 finishCheck.CheckSignalNotReceived();
638 animation.SetLoopCount(3);
639 DALI_TEST_CHECK(animation.IsLooping());
641 application.SendNotification();
642 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
643 application.SendNotification();
644 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
645 application.SendNotification();
646 finishCheck.CheckSignalNotReceived();
648 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
649 application.SendNotification();
650 finishCheck.CheckSignalNotReceived(); // we never hit play
658 int UtcDaliAnimationSetLoopCountP3(void)
660 TestApplication application;
663 // switching between forever and loop count
665 Actor actor = Actor::New();
666 application.GetScene().Add(actor);
668 // Build the animation
669 float durationSeconds(1.0f);
670 Animation animation = Animation::New(durationSeconds);
671 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
672 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
673 animation.SetEndAction(Animation::Discard);
675 float intervalSeconds = 3.0f;
677 bool signalReceived(false);
678 AnimationFinishCheck finishCheck(signalReceived);
679 animation.FinishedSignal().Connect(&application, finishCheck);
682 animation.SetLooping(true);
683 DALI_TEST_CHECK(animation.IsLooping());
685 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
686 application.SendNotification();
687 finishCheck.CheckSignalNotReceived();
689 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
690 application.SendNotification();
691 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
692 application.SendNotification();
693 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
694 application.SendNotification();
695 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
696 application.SendNotification();
697 finishCheck.CheckSignalNotReceived();
702 animation.SetLoopCount(3);
703 DALI_TEST_CHECK(animation.IsLooping());
705 application.SendNotification();
706 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
707 application.SendNotification();
708 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
709 application.SendNotification();
710 finishCheck.CheckSignalNotReceived();
712 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
713 application.SendNotification();
714 finishCheck.CheckSignalNotReceived(); // we never hit play
722 int UtcDaliAnimationSetLoopCountP4(void)
724 TestApplication application;
729 Actor actor = Actor::New();
730 application.GetScene().Add(actor);
732 // Build the animation
733 float durationSeconds(1.0f);
734 Animation animation = Animation::New(durationSeconds);
735 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
736 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
737 animation.SetEndAction(Animation::Bake);
739 float intervalSeconds = 3.0f;
741 bool signalReceived(false);
742 AnimationFinishCheck finishCheck(signalReceived);
743 animation.FinishedSignal().Connect(&application, finishCheck);
745 animation.SetLoopCount(1);
747 DALI_TEST_CHECK(!animation.IsLooping());
749 application.SendNotification();
750 finishCheck.CheckSignalNotReceived();
751 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
752 application.SendNotification();
753 finishCheck.CheckSignalReceived();
755 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
756 actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
760 animation.Play(); // again
761 DALI_TEST_CHECK(!animation.IsLooping());
763 application.SendNotification();
764 finishCheck.CheckSignalNotReceived();
765 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
766 application.SendNotification();
767 finishCheck.CheckSignalReceived();
769 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
774 int UtcDaliAnimationGetLoopCountP(void)
776 TestApplication application;
778 Actor actor = Actor::New();
779 application.GetScene().Add(actor);
781 // Build the animation
782 float durationSeconds(1.0f);
783 Animation animation = Animation::New(durationSeconds);
784 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
785 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
787 DALI_TEST_CHECK(1 == animation.GetLoopCount());
789 // Start the animation
790 animation.SetLoopCount(3);
791 DALI_TEST_CHECK(animation.IsLooping());
792 DALI_TEST_CHECK(3 == animation.GetLoopCount());
796 application.Render(0);
797 application.SendNotification();
800 float intervalSeconds = 3.0f;
802 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
803 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
805 application.Render(0);
806 application.SendNotification();
808 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
809 application.SendNotification();
811 animation.SetLoopCount(0);
812 DALI_TEST_CHECK(animation.IsLooping());
813 DALI_TEST_CHECK(0 == animation.GetLoopCount());
815 animation.SetLoopCount(1);
816 DALI_TEST_CHECK(!animation.IsLooping());
817 DALI_TEST_CHECK(1 == animation.GetLoopCount());
823 int UtcDaliAnimationGetCurrentLoopP(void)
825 TestApplication application;
827 Actor actor = Actor::New();
828 application.GetScene().Add(actor);
830 // Build the animation
831 float durationSeconds(1.0f);
832 Animation animation = Animation::New(durationSeconds);
833 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
834 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
836 // Start the animation
837 animation.SetLoopCount(3);
838 DALI_TEST_CHECK(animation.IsLooping());
839 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
842 bool signalReceived(false);
843 AnimationFinishCheck finishCheck(signalReceived);
844 animation.FinishedSignal().Connect(&application, finishCheck);
846 application.SendNotification();
849 float intervalSeconds = 3.0f;
851 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
852 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
854 application.SendNotification();
855 finishCheck.CheckSignalNotReceived();
856 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
858 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
860 application.SendNotification();
861 finishCheck.CheckSignalReceived();
862 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
863 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
867 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
868 application.SendNotification();
869 finishCheck.CheckSignalNotReceived();
870 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
872 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
873 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
874 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
875 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
876 application.SendNotification();
877 finishCheck.CheckSignalNotReceived();
878 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
883 int UtcDaliAnimationIsLoopingP(void)
885 TestApplication application;
887 Animation animation = Animation::New(1.0f);
888 DALI_TEST_CHECK(!animation.IsLooping());
890 animation.SetLooping(true);
891 DALI_TEST_CHECK(animation.IsLooping());
895 int UtcDaliAnimationSetEndActionN(void)
897 TestApplication application;
899 Actor actor = Actor::New();
900 application.GetScene().Add(actor);
902 // Build the animation
903 float durationSeconds(1.0f);
904 Animation animation = Animation::New(durationSeconds);
905 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
907 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
908 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
910 // Start the animation
913 bool signalReceived(false);
914 AnimationFinishCheck finishCheck(signalReceived);
915 animation.FinishedSignal().Connect(&application, finishCheck);
917 application.SendNotification();
918 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
920 // We did expect the animation to finish
921 application.SendNotification();
922 finishCheck.CheckSignalReceived();
923 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
925 // Go back to the start
926 actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
927 application.SendNotification();
928 application.Render(0);
929 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
931 // Test BakeFinal, animate again, for half the duration
933 animation.SetEndAction(Animation::BakeFinal);
934 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
937 application.SendNotification();
938 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
940 // Stop the animation early
943 // We did NOT expect the animation to finish
944 application.SendNotification();
945 finishCheck.CheckSignalNotReceived();
946 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), VECTOR4_EPSILON, TEST_LOCATION );
948 // The position should be same with target position in the next frame
949 application.Render(0);
950 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
952 // Go back to the start
953 actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
954 application.SendNotification();
955 application.Render(0);
956 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
958 // Test EndAction::Discard, animate again, but don't bake this time
960 animation.SetEndAction(Animation::Discard);
961 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
964 application.SendNotification();
965 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
967 // We did expect the animation to finish
968 application.SendNotification();
969 finishCheck.CheckSignalReceived();
970 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
972 // The position should be discarded in the next frame
973 application.Render(0);
974 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
976 // Check that nothing has changed after a couple of buffer swaps
977 application.Render(0);
978 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
979 application.Render(0);
980 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
984 int UtcDaliAnimationGetEndActionP(void)
986 TestApplication application;
988 Animation animation = Animation::New(1.0f);
989 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
991 animation.SetEndAction(Animation::Discard);
992 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
994 animation.SetEndAction(Animation::BakeFinal);
995 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
1000 int UtcDaliAnimationSetDisconnectActionP(void)
1002 TestApplication application;
1003 Integration::Scene stage( application.GetScene() );
1005 // Default: BakeFinal
1007 Actor actor = Actor::New();
1010 // Build the animation
1011 float durationSeconds(1.0f);
1012 Animation animation = Animation::New(durationSeconds);
1013 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
1015 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1016 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1018 // Start the animation
1021 application.SendNotification();
1022 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1026 application.SendNotification();
1027 application.Render();
1029 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
1034 Actor actor = Actor::New();
1037 // Build the animation
1038 float durationSeconds(1.0f);
1039 Animation animation = Animation::New(durationSeconds);
1040 animation.SetDisconnectAction( Animation::Bake );
1042 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1043 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1045 // Start the animation
1048 application.SendNotification();
1049 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1053 application.SendNotification();
1054 application.Render();
1056 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition*0.5f, TEST_LOCATION );
1061 Actor actor = Actor::New();
1064 // Build the animation
1065 float durationSeconds(1.0f);
1066 Animation animation = Animation::New(durationSeconds);
1067 animation.SetDisconnectAction( Animation::Discard );
1069 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1070 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1072 // Start the animation
1075 application.SendNotification();
1076 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1080 application.SendNotification();
1081 application.Render();
1083 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
1086 // Don't play the animation: disconnect action should not be applied
1088 Actor actor = Actor::New();
1091 // Build the animation
1092 float durationSeconds(1.0f);
1093 Animation animation = Animation::New(durationSeconds);
1095 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
1096 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1098 application.SendNotification();
1099 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
1103 application.SendNotification();
1104 application.Render();
1106 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
1112 int UtcDaliAnimationGetDisconnectActionP(void)
1114 TestApplication application;
1115 Animation animation = Animation::New(1.0f);
1116 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
1118 animation.SetDisconnectAction(Animation::Discard);
1119 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
1121 animation.SetDisconnectAction(Animation::Bake);
1122 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
1127 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1129 TestApplication application;
1131 Animation animation = Animation::New(1.0f);
1132 AlphaFunction func = animation.GetDefaultAlphaFunction();
1133 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1135 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1136 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1137 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1141 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1143 TestApplication application;
1145 Animation animation = Animation::New(1.0f);
1146 AlphaFunction func = animation.GetDefaultAlphaFunction();
1148 // Test that the default is linear
1149 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1151 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1152 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1153 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1158 int UtcDaliAnimationSetCurrentProgressP(void)
1160 TestApplication application;
1162 Actor actor = Actor::New();
1163 application.GetScene().Add(actor);
1165 // Build the animation
1166 Animation animation = Animation::New(0.0f);
1169 float durationSeconds(1.0f);
1170 animation.SetDuration(durationSeconds);
1172 bool signalReceived(false);
1173 AnimationFinishCheck finishCheck(signalReceived);
1174 animation.FinishedSignal().Connect(&application, finishCheck);
1175 application.SendNotification();
1177 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1178 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1180 // Start the animation from 40% progress
1181 animation.SetCurrentProgress( 0.4f );
1184 application.SendNotification();
1185 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1187 // We didn't expect the animation to finish yet
1188 application.SendNotification();
1189 finishCheck.CheckSignalNotReceived();
1190 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
1191 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1193 animation.Play(); // Test that calling play has no effect, when animation is already playing
1194 application.SendNotification();
1196 //Set the progress to 70%
1197 animation.SetCurrentProgress( 0.7f );
1198 application.SendNotification();
1199 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1200 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1202 application.SendNotification();
1203 finishCheck.CheckSignalNotReceived();
1204 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
1205 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1207 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1208 // We did expect the animation to finish
1209 application.SendNotification();
1210 finishCheck.CheckSignalReceived();
1211 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
1213 // Check that nothing has changed after a couple of buffer swaps
1214 application.Render(0);
1215 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1216 application.Render(0);
1217 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1221 int UtcDaliAnimationSetCurrentProgressN(void)
1223 TestApplication application;
1225 Actor actor = Actor::New();
1226 application.GetScene().Add(actor);
1228 // Build the animation
1229 Animation animation = Animation::New(0.0f);
1232 float durationSeconds(1.0f);
1233 animation.SetDuration(durationSeconds);
1235 bool signalReceived(false);
1236 AnimationFinishCheck finishCheck(signalReceived);
1237 animation.FinishedSignal().Connect(&application, finishCheck);
1238 application.SendNotification();
1240 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1241 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1243 //Trying to set the current cursor outside the range [0..1] is ignored
1244 animation.SetCurrentProgress( -1.0f);
1245 application.SendNotification();
1246 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1248 animation.SetCurrentProgress( 100.0f);
1249 application.SendNotification();
1250 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1254 int UtcDaliAnimationGetCurrentProgressP(void)
1256 TestApplication application;
1258 Actor actor = Actor::New();
1259 application.GetScene().Add(actor);
1261 // Build the animation
1262 Animation animation = Animation::New(0.0f);
1265 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1266 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1268 animation.SetCurrentProgress( 0.5f );
1269 application.SendNotification();
1270 application.Render(static_cast<unsigned int>(100.0f));
1272 //Progress should still be 0.0
1273 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1276 float durationSeconds(1.0f);
1277 animation.SetDuration(durationSeconds);
1278 application.SendNotification();
1280 bool signalReceived(false);
1281 AnimationFinishCheck finishCheck(signalReceived);
1282 animation.FinishedSignal().Connect(&application, finishCheck);
1283 application.SendNotification();
1285 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1286 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1288 // Start the animation from 40% progress
1289 animation.SetCurrentProgress( 0.4f );
1292 application.SendNotification();
1293 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1295 // We didn't expect the animation to finish yet
1296 application.SendNotification();
1297 finishCheck.CheckSignalNotReceived();
1298 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1300 animation.Play(); // Test that calling play has no effect, when animation is already playing
1301 application.SendNotification();
1303 //Set the progress to 70%
1304 animation.SetCurrentProgress( 0.7f );
1305 application.SendNotification();
1306 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1307 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1309 application.SendNotification();
1310 finishCheck.CheckSignalNotReceived();
1311 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1313 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1314 // We did expect the animation to finish
1315 application.SendNotification();
1316 finishCheck.CheckSignalReceived();
1320 int UtcDaliAnimationSetSpeedFactorP1(void)
1322 TestApplication application;
1324 tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1326 Actor actor = Actor::New();
1327 application.GetScene().Add(actor);
1329 // Build the animation
1330 float durationSeconds(1.0f);
1331 Animation animation = Animation::New(durationSeconds);
1333 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1334 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1336 KeyFrames keyframes = KeyFrames::New();
1337 keyframes.Add( 0.0f, initialPosition);
1338 keyframes.Add( 1.0f, targetPosition );
1339 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1341 //Set speed to be x2
1342 animation.SetSpeedFactor(2.0f);
1344 // Start the animation
1347 bool signalReceived(false);
1348 AnimationFinishCheck finishCheck(signalReceived);
1349 animation.FinishedSignal().Connect(&application, finishCheck);
1351 application.SendNotification();
1352 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1354 // We didn't expect the animation to finish yet
1355 application.SendNotification();
1356 finishCheck.CheckSignalNotReceived();
1357 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
1359 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1361 // We didn't expect the animation to finish yet
1362 application.SendNotification();
1363 finishCheck.CheckSignalNotReceived();
1364 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
1366 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1368 // We did expect the animation to finish
1369 application.SendNotification();
1370 finishCheck.CheckSignalReceived();
1371 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
1373 // Check that nothing has changed after a couple of buffer swaps
1374 application.Render(0);
1375 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1376 application.Render(0);
1377 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1382 int UtcDaliAnimationSetSpeedFactorP2(void)
1384 TestApplication application;
1386 Actor actor = Actor::New();
1387 application.GetScene().Add(actor);
1389 // Build the animation
1390 float durationSeconds(1.0f);
1391 Animation animation = Animation::New(durationSeconds);
1393 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1394 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1396 KeyFrames keyframes = KeyFrames::New();
1397 keyframes.Add( 0.0f, initialPosition);
1398 keyframes.Add( 1.0f, targetPosition );
1399 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1401 tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1402 animation.SetSpeedFactor( -1.0f );
1404 // Start the animation
1407 bool signalReceived(false);
1408 AnimationFinishCheck finishCheck(signalReceived);
1409 animation.FinishedSignal().Connect(&application, finishCheck);
1411 application.SendNotification();
1412 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1414 // We didn't expect the animation to finish yet
1415 application.SendNotification();
1416 finishCheck.CheckSignalNotReceived();
1417 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
1419 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1421 // We didn't expect the animation to finish yet
1422 application.SendNotification();
1423 finishCheck.CheckSignalNotReceived();
1424 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
1426 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1428 // We didn't expect the animation to finish yet
1429 application.SendNotification();
1430 finishCheck.CheckSignalNotReceived();
1431 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
1433 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1435 // We didn't expect the animation to finish yet
1436 application.SendNotification();
1437 finishCheck.CheckSignalNotReceived();
1438 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
1440 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1442 // We did expect the animation to finish
1443 application.SendNotification();
1444 finishCheck.CheckSignalReceived();
1445 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), initialPosition, TEST_LOCATION );
1447 // Check that nothing has changed after a couple of buffer swaps
1448 application.Render(0);
1449 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1450 application.Render(0);
1451 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1456 int UtcDaliAnimationSetSpeedFactorP3(void)
1458 TestApplication application;
1460 Actor actor = Actor::New();
1461 application.GetScene().Add(actor);
1463 // Build the animation
1464 float durationSeconds(1.0f);
1465 Animation animation = Animation::New(durationSeconds);
1467 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1468 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1470 KeyFrames keyframes = KeyFrames::New();
1471 keyframes.Add( 0.0f, initialPosition);
1472 keyframes.Add( 1.0f, targetPosition );
1473 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1475 bool signalReceived(false);
1476 AnimationFinishCheck finishCheck(signalReceived);
1477 animation.FinishedSignal().Connect(&application, finishCheck);
1479 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1481 //Set speed to be half of normal speed
1482 animation.SetSpeedFactor( 0.5f );
1484 // Start the animation
1487 application.SendNotification();
1488 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1490 // We didn't expect the animation to finish yet
1491 application.SendNotification();
1492 finishCheck.CheckSignalNotReceived();
1493 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), TEST_LOCATION );
1495 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1497 // We didn't expect the animation to finish yet
1498 application.SendNotification();
1499 finishCheck.CheckSignalNotReceived();
1500 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
1502 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1504 // We didn't expect the animation to finish yet
1505 application.SendNotification();
1506 finishCheck.CheckSignalNotReceived();
1507 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.3f), TEST_LOCATION );
1509 application.SendNotification();
1510 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1512 // We didn't expect the animation to finish yet
1513 application.SendNotification();
1514 finishCheck.CheckSignalNotReceived();
1515 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
1517 application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1519 // We did expect the animation to finish
1520 application.SendNotification();
1521 finishCheck.CheckSignalReceived();
1522 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
1524 // Check that nothing has changed after a couple of buffer swaps
1525 application.Render(0);
1526 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1527 application.Render(0);
1528 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1533 int UtcDaliAnimationSetSpeedFactorP4(void)
1535 TestApplication application;
1537 Actor actor = Actor::New();
1538 application.GetScene().Add(actor);
1540 // Build the animation
1541 float durationSeconds(1.0f);
1542 Animation animation = Animation::New(durationSeconds);
1544 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1545 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1547 KeyFrames keyframes = KeyFrames::New();
1548 keyframes.Add( 0.0f, initialPosition);
1549 keyframes.Add( 1.0f, targetPosition );
1550 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1552 bool signalReceived(false);
1553 AnimationFinishCheck finishCheck(signalReceived);
1554 animation.FinishedSignal().Connect(&application, finishCheck);
1556 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1558 tet_printf("Set speed to be half of normal speed\n");
1559 tet_printf("SetSpeedFactor(0.5f)\n");
1560 animation.SetSpeedFactor( 0.5f );
1562 // Start the animation
1565 application.SendNotification();
1566 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1568 // We didn't expect the animation to finish yet
1569 application.SendNotification();
1570 finishCheck.CheckSignalNotReceived();
1571 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), TEST_LOCATION );
1573 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1575 // We didn't expect the animation to finish yet
1576 application.SendNotification();
1577 finishCheck.CheckSignalNotReceived();
1578 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
1580 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1582 // We didn't expect the animation to finish yet
1583 application.SendNotification();
1584 finishCheck.CheckSignalNotReceived();
1585 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.3f), TEST_LOCATION );
1587 tet_printf("Reverse direction of animation whilst playing\n");
1588 tet_printf("SetSpeedFactor(-0.5f)\n");
1589 animation.SetSpeedFactor(-0.5f);
1591 application.SendNotification();
1592 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1594 // We didn't expect the animation to finish yet
1595 application.SendNotification();
1596 finishCheck.CheckSignalNotReceived();
1597 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
1599 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1601 // We didn't expect the animation to finish yet
1602 application.SendNotification();
1603 finishCheck.CheckSignalNotReceived();
1604 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1606 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1608 // We did expect the animation to finish
1609 application.SendNotification();
1610 finishCheck.CheckSignalReceived();
1611 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), initialPosition, TEST_LOCATION );
1613 // Check that nothing has changed after a couple of buffer swaps
1614 application.Render(0);
1615 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1616 application.Render(0);
1617 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1621 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1623 TestApplication application;
1625 const unsigned int NUM_FRAMES(15);
1633 float expected[NUM_FRAMES];
1636 TestData testData[] = {
1638 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1639 /* |----------PlayRange---------------| */
1641 { 0.0f, 1.0f, // TimePeriod
1642 0.0f, 100.0f, // POS
1643 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1644 /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1655 // ACTOR 1 - Across start of range
1656 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1657 /* |----------PlayRange---------------| */
1659 { 0.2f, 0.5f, // TimePeriod
1660 20.0f, 50.0f, // POS
1661 {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1662 /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1672 // ACTOR 2 - Across end of range
1673 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1674 /* |----------PlayRange---------------| */
1676 {/**/ 0.5f, 0.9f, // TimePeriod
1677 /**/ 50.0f, 90.0f, // POS
1678 { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1679 /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1688 // ACTOR 3 - Before beginning of range
1689 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1690 /* |----------PlayRange---------------| */
1692 {/**/ 0.1f, 0.25f, // TimePeriod
1693 /**/ 10.0f, 25.0f, // POS
1695 /**/ 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
1700 // ACTOR 4 - After end of range
1701 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1702 /* |----------PlayRange---------------| */
1704 {/**/ 0.85f, 1.0f, // TimePeriod
1705 /**/ 85.0f, 100.0f, // POS
1707 /**/ 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
1711 // Actor 5 - Middle of range
1712 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1713 /* |----------PlayRange---------------| */
1715 {/**/ 0.4f, 0.65f, // Time Period
1716 /**/ 40.0f, 65.0f, // Position
1717 { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1718 /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1729 const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1731 // Build the animation
1732 float durationSeconds(1.0f);
1733 Animation animation = Animation::New(durationSeconds);
1734 bool signalReceived(false);
1735 AnimationFinishCheck finishCheck(signalReceived);
1736 animation.FinishedSignal().Connect(&application, finishCheck);
1738 std::vector<Dali::Actor> actors;
1740 for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1742 Actor actor = Actor::New();
1743 actor.SetProperty( Actor::Property::POSITION, Vector3( testData[actorIndex].startX, 0, 0 ) );
1744 actors.push_back(actor);
1745 application.GetScene().Add(actor);
1747 if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1749 KeyFrames keyframes = KeyFrames::New();
1750 keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1751 keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1752 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1756 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1760 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1761 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1762 tet_printf("SetSpeedFactor(0.5f)\n");
1763 animation.SetSpeedFactor( 0.5f );
1764 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1765 animation.SetLooping(true);
1767 // Start the animation
1769 application.SendNotification();
1770 application.Render(0); // Frame 0 tests initial values
1772 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1774 unsigned int actorIndex = 0u;
1775 for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1777 DALI_TEST_EQUALS( actors[actorIndex].GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1778 if( ! Equals(actors[actorIndex].GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData[actorIndex].expected[frame]) )
1780 tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1786 tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1787 tet_printf("SetSpeedFactor(-0.5f)\n");
1788 animation.SetSpeedFactor(-0.5f);
1789 application.SendNotification();
1791 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1793 // We didn't expect the animation to finish yet
1794 application.SendNotification();
1795 finishCheck.CheckSignalNotReceived();
1801 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1803 TestApplication application;
1805 const unsigned int NUM_FRAMES(15);
1813 float expected[NUM_FRAMES];
1818 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1819 /* |----------PlayRange---------------| */
1820 { 0.0f, 1.0f, // TimePeriod
1821 0.0f, 100.0f, // POS
1822 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1823 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1824 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1830 // Build the animation
1831 float durationSeconds(1.0f);
1832 Animation animation = Animation::New(durationSeconds);
1833 bool signalReceived(false);
1834 AnimationFinishCheck finishCheck(signalReceived);
1835 animation.FinishedSignal().Connect(&application, finishCheck);
1837 std::vector<Dali::Actor> actors;
1839 Actor actor = Actor::New();
1840 actor.SetProperty( Actor::Property::POSITION, Vector3( testData.startX, 0, 0 ) );
1841 actors.push_back(actor);
1842 application.GetScene().Add(actor);
1844 KeyFrames keyframes = KeyFrames::New();
1845 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1846 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1847 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1849 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1850 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1851 tet_printf("SetSpeedFactor(0.5f)\n");
1852 tet_printf("SetLoopCount(3)\n");
1853 animation.SetSpeedFactor( 0.5f );
1854 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1855 animation.SetLoopCount(3);
1857 // Start the animation
1859 application.SendNotification();
1860 application.Render(0); // Frame 0 tests initial values
1862 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1864 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData.expected[frame], 0.001, TEST_LOCATION );
1866 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1868 if( frame < NUM_FRAMES-1 )
1870 // We didn't expect the animation to finish yet
1871 application.SendNotification();
1872 finishCheck.CheckSignalNotReceived();
1876 // We did expect the animation to finish
1877 application.SendNotification();
1878 finishCheck.CheckSignalReceived();
1879 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, 80.0f, 0.001, TEST_LOCATION );
1884 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1886 TestApplication application;
1888 const unsigned int NUM_FRAMES(15);
1896 float expected[NUM_FRAMES];
1901 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1902 /* |----------PlayRange---------------| */
1903 { 0.0f, 1.0f, // TimePeriod
1904 0.0f, 100.0f, // POS
1905 {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1906 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1907 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1912 // Build the animation
1913 float durationSeconds(1.0f);
1914 Animation animation = Animation::New(durationSeconds);
1915 bool signalReceived(false);
1916 AnimationFinishCheck finishCheck(signalReceived);
1917 animation.FinishedSignal().Connect(&application, finishCheck);
1919 std::vector<Dali::Actor> actors;
1921 Actor actor = Actor::New();
1922 actor.SetProperty( Actor::Property::POSITION, Vector3( testData.startX, 0, 0 ) );
1923 actors.push_back(actor);
1924 application.GetScene().Add(actor);
1926 KeyFrames keyframes = KeyFrames::New();
1927 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1928 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1929 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1931 tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1932 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1933 tet_printf("SetSpeedFactor(-0.5f)\n");
1934 tet_printf("SetLoopCount(3)\n");
1935 animation.SetSpeedFactor( -0.5f );
1936 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1937 animation.SetLoopCount(3);
1939 // Start the animation
1941 application.SendNotification();
1942 application.Render(0); // Frame 0 tests initial values
1944 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1946 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData.expected[frame], 0.001, TEST_LOCATION );
1948 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1950 if( frame < NUM_FRAMES-1 )
1952 // We didn't expect the animation to finish yet
1953 application.SendNotification();
1954 finishCheck.CheckSignalNotReceived();
1958 // We did expect the animation to finish
1959 application.SendNotification();
1960 finishCheck.CheckSignalReceived();
1961 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, 30.0f, 0.001, TEST_LOCATION );
1967 int UtcDaliAnimationGetSpeedFactorP(void)
1969 TestApplication application;
1971 Animation animation = Animation::New(1.0f);
1972 animation.SetSpeedFactor(0.5f);
1973 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1975 animation.SetSpeedFactor(-2.5f);
1976 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1980 int UtcDaliAnimationSetPlayRangeP(void)
1982 TestApplication application;
1984 Actor actor = Actor::New();
1985 application.GetScene().Add( actor );
1987 // Build the animation
1988 float durationSeconds( 1.0f );
1989 Animation animation = Animation::New( durationSeconds );
1991 bool signalReceived( false );
1992 AnimationFinishCheck finishCheck( signalReceived );
1993 animation.FinishedSignal().Connect( &application, finishCheck );
1994 application.SendNotification();
1996 // Set range between 0.4 and 0.8
1997 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1998 application.SendNotification();
1999 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
2001 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
2002 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
2004 // Start the animation from 40% progress
2007 application.SendNotification();
2008 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
2010 // We didn't expect the animation to finish yet
2011 application.SendNotification();
2012 finishCheck.CheckSignalNotReceived();
2013 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.6f ), TEST_LOCATION );
2015 application.SendNotification();
2016 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
2018 application.SendNotification();
2019 finishCheck.CheckSignalNotReceived();
2020 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.8f ), TEST_LOCATION );
2022 application.SendNotification();
2023 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
2025 // We did expect the animation to finish
2026 application.SendNotification();
2027 finishCheck.CheckSignalReceived();
2028 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.9f ), TEST_LOCATION );
2032 int UtcDaliAnimationSetPlayRangeN(void)
2034 TestApplication application;
2036 Actor actor = Actor::New();
2037 application.GetScene().Add(actor);
2039 // Build the animation
2040 Animation animation = Animation::New(0);
2041 application.SendNotification();
2043 //PlayRange out of bounds
2044 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
2045 application.SendNotification();
2046 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
2047 animation.SetPlayRange( Vector2(0.0f,2.0f) );
2048 application.SendNotification();
2049 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
2051 //If playRange is not in the correct order it has to be ordered
2052 animation.SetPlayRange( Vector2(0.8f,0.2f) );
2053 application.SendNotification();
2054 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
2059 int UtcDaliAnimationGetPlayRangeP(void)
2061 TestApplication application;
2063 Actor actor = Actor::New();
2064 application.GetScene().Add( actor );
2066 // Build the animation
2067 Animation animation = Animation::New( 1.0f );
2068 application.SendNotification();
2070 //If PlayRange not specified it should be 0.0-1.0 by default
2071 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
2073 // Set range between 0.4 and 0.8
2074 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
2075 application.SendNotification();
2076 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
2081 int UtcDaliAnimationPlayP(void)
2083 TestApplication application;
2085 Actor actor = Actor::New();
2086 application.GetScene().Add(actor);
2088 // Build the animation
2089 float durationSeconds(1.0f);
2090 Animation animation = Animation::New(durationSeconds);
2091 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2092 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2094 // Start the animation
2097 bool signalReceived(false);
2098 AnimationFinishCheck finishCheck(signalReceived);
2099 animation.FinishedSignal().Connect(&application, finishCheck);
2101 application.SendNotification();
2102 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2104 // We didn't expect the animation to finish yet
2105 application.SendNotification();
2106 finishCheck.CheckSignalNotReceived();
2107 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2109 animation.Play(); // Test that calling play has no effect, when animation is already playing
2110 application.SendNotification();
2111 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2113 // We didn't expect the animation to finish yet
2114 application.SendNotification();
2115 finishCheck.CheckSignalNotReceived();
2116 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
2118 animation.Play(); // Test that calling play has no effect, when animation is already playing
2119 application.SendNotification();
2120 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2122 // We didn't expect the animation to finish yet
2123 application.SendNotification();
2124 finishCheck.CheckSignalNotReceived();
2125 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
2127 animation.Play(); // Test that calling play has no effect, when animation is already playing
2128 application.SendNotification();
2129 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2131 // We didn't expect the animation to finish yet
2132 application.SendNotification();
2133 finishCheck.CheckSignalNotReceived();
2134 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
2136 animation.Play(); // Test that calling play has no effect, when animation is already playing
2137 application.SendNotification();
2138 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2140 // We did expect the animation to finish
2141 application.SendNotification();
2142 finishCheck.CheckSignalReceived();
2143 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2145 // Check that nothing has changed after a couple of buffer swaps
2146 application.Render(0);
2147 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2148 application.Render(0);
2149 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2153 int UtcDaliAnimationPlayOffSceneDiscardP(void)
2155 // Test that an animation can be played, when the actor is off-stage.
2156 // When the actor is added to the stage, it should appear at the current position
2157 // i.e. where it would have been anyway, if on-stage from the beginning.
2159 TestApplication application;
2161 Actor actor = Actor::New();
2162 Vector3 basePosition(Vector3::ZERO);
2163 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION );
2164 // Not added to the stage yet!
2166 // Build the animation
2167 float durationSeconds(1.0f);
2168 Animation animation = Animation::New(durationSeconds);
2169 animation.SetDisconnectAction( Animation::Discard );
2170 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2171 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2173 // Start the animation
2176 bool signalReceived(false);
2177 AnimationFinishCheck finishCheck(signalReceived);
2178 animation.FinishedSignal().Connect(&application, finishCheck);
2180 application.SendNotification();
2181 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2183 // We didn't expect the animation to finish yet
2184 application.SendNotification();
2185 finishCheck.CheckSignalNotReceived();
2186 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION );
2189 application.GetScene().Add(actor);
2191 application.SendNotification();
2192 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2194 // We didn't expect the animation to finish yet
2195 application.SendNotification();
2196 finishCheck.CheckSignalNotReceived();
2197 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2199 // Remove from the stage
2200 application.GetScene().Remove(actor);
2202 application.SendNotification();
2203 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2205 // We didn't expect the animation to finish yet
2206 application.SendNotification();
2207 finishCheck.CheckSignalNotReceived();
2208 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*back to start position as disconnect behaviour is discard*/, TEST_LOCATION );
2209 // Check that nothing has changed after a couple of buffer swaps
2210 application.Render(0);
2211 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2212 application.Render(0);
2213 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2214 application.Render(0);
2215 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2218 application.GetScene().Add(actor);
2220 application.SendNotification();
2221 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2223 // We didn't expect the animation to finish yet
2224 application.SendNotification();
2225 finishCheck.CheckSignalNotReceived();
2226 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(80,80,80), TEST_LOCATION );
2228 application.SendNotification();
2229 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2231 // We did expect the animation to finish
2232 application.SendNotification();
2233 finishCheck.CheckSignalReceived();
2234 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2236 // Check that nothing has changed after a couple of buffer swaps
2237 application.Render(0);
2238 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2241 application.Render(0);
2242 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2246 int UtcDaliAnimationPlayOffSceneBakeFinalP(void)
2248 // Test that an animation can be played, when the actor is off-stage.
2249 // When the actor is added to the stage, it should appear at the current position
2250 // i.e. where it would have been anyway, if on-stage from the beginning.
2252 TestApplication application;
2254 Actor actor = Actor::New();
2255 Vector3 basePosition(Vector3::ZERO);
2256 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION );
2257 // Not added to the stage!
2259 // Build the animation
2260 float durationSeconds(1.0f);
2261 Animation animation = Animation::New(durationSeconds);
2262 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2263 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2265 // Start the animation
2268 bool signalReceived(false);
2269 AnimationFinishCheck finishCheck(signalReceived);
2270 animation.FinishedSignal().Connect(&application, finishCheck);
2272 application.SendNotification();
2273 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2275 // We didn't expect the animation to finish yet
2276 application.SendNotification();
2277 finishCheck.CheckSignalNotReceived();
2278 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION );
2281 application.GetScene().Add(actor);
2283 application.SendNotification();
2284 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2286 // We didn't expect the animation to finish yet
2287 application.SendNotification();
2288 finishCheck.CheckSignalNotReceived();
2289 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2291 // Remove from the stage
2292 application.GetScene().Remove(actor);
2294 application.SendNotification();
2295 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2297 // We didn't expect the animation to finish yet
2298 application.SendNotification();
2299 finishCheck.CheckSignalNotReceived();
2300 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition /*bake final*/, TEST_LOCATION );
2303 application.GetScene().Add(actor);
2305 application.SendNotification();
2306 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2308 // We didn't expect the animation to finish yet
2309 application.SendNotification();
2310 finishCheck.CheckSignalNotReceived();
2311 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition /*bake final removed the */, TEST_LOCATION );
2313 application.SendNotification();
2314 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2316 // We did expect the animation to finish
2317 application.SendNotification();
2318 finishCheck.CheckSignalReceived();
2319 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2321 // Check that nothing has changed after a couple of buffer swaps
2322 application.Render(0);
2323 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2325 application.Render(0);
2326 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2330 int UtcDaliAnimationPlayOffSceneBakeP(void)
2332 // Test that an animation can be played, when the actor is off-stage.
2333 // When the actor is added to the stage, it should appear at the current position
2334 // i.e. where it would have been anyway, if on-stage from the beginning.
2336 TestApplication application;
2338 Actor actor = Actor::New();
2339 Vector3 basePosition(Vector3::ZERO);
2340 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION );
2341 // Not added to the stage!
2343 // Build the animation
2344 float durationSeconds(1.0f);
2345 Animation animation = Animation::New(durationSeconds);
2346 animation.SetDisconnectAction( Animation::Bake );
2347 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2348 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2350 // Start the animation
2353 bool signalReceived(false);
2354 AnimationFinishCheck finishCheck(signalReceived);
2355 animation.FinishedSignal().Connect(&application, finishCheck);
2357 application.SendNotification();
2358 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2360 // We didn't expect the animation to finish yet
2361 application.SendNotification();
2362 finishCheck.CheckSignalNotReceived();
2363 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION );
2366 application.GetScene().Add(actor);
2368 application.SendNotification();
2369 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2371 // We didn't expect the animation to finish yet
2372 application.SendNotification();
2373 finishCheck.CheckSignalNotReceived();
2374 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
2376 // Remove from the stage
2377 application.GetScene().Remove(actor); // baked here
2379 application.SendNotification();
2380 // this render is a no-op in this case as animator is disabled while off stage
2381 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2382 // We didn't expect the animation to finish yet
2383 application.SendNotification();
2384 finishCheck.CheckSignalNotReceived();
2385 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40) /*baked value*/, TEST_LOCATION );
2387 // Add back to the stage
2388 application.GetScene().Add(actor);
2390 application.SendNotification();
2391 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2392 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION );
2393 application.Render(static_cast<unsigned int>(0.0f) );
2394 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2395 application.Render(static_cast<unsigned int>(0.0f) );
2396 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2398 // Remove from the stage
2399 application.GetScene().Remove(actor); // baked here
2401 application.SendNotification();
2402 // this render is a no-op in this case as animator is disabled while off stage
2403 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2404 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2405 application.Render(static_cast<unsigned int>(0.0f) );
2406 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2407 application.Render(static_cast<unsigned int>(0.0f) );
2408 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
2410 // Add back to the stage
2411 application.GetScene().Add(actor);
2413 // We didn't expect the animation to finish yet
2414 application.SendNotification();
2415 finishCheck.CheckSignalNotReceived();
2416 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) , TEST_LOCATION );
2418 application.SendNotification();
2419 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2421 // We did expect the animation to finish
2422 application.SendNotification();
2423 finishCheck.CheckSignalReceived();
2424 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2426 // Check that nothing has changed after a couple of buffer swaps
2427 application.Render(0);
2428 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2430 application.Render(0);
2431 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2435 int UtcDaliAnimationPlayDiscardHandleP(void)
2437 TestApplication application;
2439 Actor actor = Actor::New();
2440 application.GetScene().Add(actor);
2442 // Build the animation
2443 float durationSeconds(1.0f);
2444 Animation animation = Animation::New(durationSeconds);
2445 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2446 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2448 bool signalReceived(false);
2449 AnimationFinishCheck finishCheck(signalReceived);
2450 animation.FinishedSignal().Connect(&application, finishCheck);
2452 // Start the animation
2455 // This is a test of the "Fire and Forget" behaviour
2456 // Discard the animation handle!
2458 DALI_TEST_CHECK( !animation );
2460 application.SendNotification();
2461 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2463 // We didn't expect the animation to finish yet
2464 application.SendNotification();
2465 finishCheck.CheckSignalNotReceived();
2466 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2468 application.SendNotification();
2469 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2471 // We didn't expect the animation to finish yet
2472 application.SendNotification();
2473 finishCheck.CheckSignalNotReceived();
2474 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
2476 application.SendNotification();
2477 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2479 // We didn't expect the animation to finish yet
2480 application.SendNotification();
2481 finishCheck.CheckSignalNotReceived();
2482 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
2484 application.SendNotification();
2485 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2487 // We didn't expect the animation to finish yet
2488 application.SendNotification();
2489 finishCheck.CheckSignalNotReceived();
2490 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
2492 application.SendNotification();
2493 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2495 // We did expect the animation to finish
2496 application.SendNotification();
2497 finishCheck.CheckSignalReceived();
2498 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2500 // Check that nothing has changed after a couple of buffer swaps
2501 application.Render(0);
2502 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2503 application.Render(0);
2504 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2508 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2510 TestApplication application;
2512 Actor actor = Actor::New();
2513 application.GetScene().Add(actor);
2515 // Build the animation
2516 float durationSeconds(1.0f);
2517 Animation animation = Animation::New(durationSeconds);
2518 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2519 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2521 // Start the animation
2524 bool signalReceived(false);
2525 AnimationFinishCheck finishCheck(signalReceived);
2526 animation.FinishedSignal().Connect(&application, finishCheck);
2528 application.SendNotification();
2529 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2531 // We didn't expect the animation to finish yet
2532 application.SendNotification();
2533 finishCheck.CheckSignalNotReceived();
2534 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2536 // This is a test of the "Fire and Forget" behaviour
2537 // Stop the animation, and Discard the animation handle!
2540 DALI_TEST_CHECK( !animation );
2542 application.SendNotification();
2543 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2545 // We expect the animation to finish at 20% progress
2546 application.SendNotification();
2547 finishCheck.CheckSignalReceived();
2548 finishCheck.Reset();
2549 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2551 application.SendNotification();
2552 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2554 // Check that nothing has changed
2555 application.SendNotification();
2556 finishCheck.CheckSignalNotReceived();
2557 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2559 application.SendNotification();
2560 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2562 // Check that nothing has changed
2563 application.SendNotification();
2564 finishCheck.CheckSignalNotReceived();
2565 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2567 application.SendNotification();
2568 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2570 // Check that nothing has changed
2571 application.SendNotification();
2572 finishCheck.CheckSignalNotReceived();
2573 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
2577 int UtcDaliAnimationPlayRangeP(void)
2579 TestApplication application;
2581 Actor actor = Actor::New();
2582 application.GetScene().Add(actor);
2584 // Build the animation
2585 float durationSeconds(1.0f);
2586 Animation animation = Animation::New(durationSeconds);
2587 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2588 KeyFrames keyframes = KeyFrames::New();
2589 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2590 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2592 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2594 // Set range between 0.4 and 0.8
2595 animation.SetPlayRange( Vector2(0.4f,0.8f) );
2598 bool signalReceived(false);
2599 AnimationFinishCheck finishCheck(signalReceived);
2600 animation.FinishedSignal().Connect(&application, finishCheck);
2602 //Test that setting progress outside the range doesn't work
2603 animation.SetCurrentProgress( 0.9f );
2604 application.SendNotification();
2605 application.Render(0);
2606 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2607 animation.SetCurrentProgress( 0.2f );
2608 application.SendNotification();
2609 application.Render(0);
2610 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2612 application.SendNotification();
2613 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2615 // We didn't expect the animation to finish yet
2616 application.SendNotification();
2617 finishCheck.CheckSignalNotReceived();
2618 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
2620 animation.Play(); // Test that calling play has no effect, when animation is already playing
2621 application.SendNotification();
2622 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2624 // We did expect the animation to finish
2625 application.SendNotification();
2626 finishCheck.CheckSignalReceived();
2627 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
2629 // Check that nothing has changed after a couple of buffer swaps
2630 application.Render(0);
2631 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2632 application.Render(0);
2633 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2636 //Loop inside the range
2637 finishCheck.Reset();
2638 animation.SetLooping( true );
2640 application.SendNotification();
2641 float intervalSeconds = 0.1f;
2642 float progress = 0.4f;
2643 for (int iterations = 0; iterations < 10; ++iterations )
2645 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2647 progress += intervalSeconds;
2648 if (progress > 0.8f)
2650 progress = progress - 0.4f;
2653 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION );
2656 // We didn't expect the animation to finish yet
2657 application.SendNotification();
2658 finishCheck.CheckSignalNotReceived();
2661 //Test change range on the fly
2662 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2663 application.SendNotification();
2665 for (int iterations = 0; iterations < 10; ++iterations )
2667 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2669 progress += intervalSeconds;
2670 if (progress > 0.9f)
2672 progress = progress - 0.7f;
2675 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION );
2681 int UtcDaliAnimationPlayFromP(void)
2683 TestApplication application;
2685 Actor actor = Actor::New();
2686 application.GetScene().Add(actor);
2688 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2690 // Build the animation
2691 float durationSeconds(1.0f);
2692 Animation animation = Animation::New(durationSeconds);
2693 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2694 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2696 // Start the animation from 40% progress
2697 animation.PlayFrom( 0.4f );
2699 // Target value should be updated straight away
2700 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2702 bool signalReceived(false);
2703 AnimationFinishCheck finishCheck(signalReceived);
2704 animation.FinishedSignal().Connect(&application, finishCheck);
2706 application.SendNotification();
2707 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2709 // We didn't expect the animation to finish yet
2710 application.SendNotification();
2711 finishCheck.CheckSignalNotReceived();
2712 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
2714 animation.Play(); // Test that calling play has no effect, when animation is already playing
2715 application.SendNotification();
2716 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2718 // We didn't expect the animation to finish yet
2719 application.SendNotification();
2720 finishCheck.CheckSignalNotReceived();
2721 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
2723 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2724 // We did expect the animation to finish
2725 application.SendNotification();
2726 finishCheck.CheckSignalReceived();
2727 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2729 // Check that nothing has changed after a couple of buffer swaps
2730 application.Render(0);
2731 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2732 application.Render(0);
2733 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2737 int UtcDaliAnimationPlayFromN(void)
2739 TestApplication application;
2741 Actor actor = Actor::New();
2742 application.GetScene().Add(actor);
2744 // Build the animation
2745 float durationSeconds(1.0f);
2746 Animation animation = Animation::New(durationSeconds);
2747 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2748 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2750 //PlayFrom with an argument outside the range [0..1] will be ignored
2751 animation.PlayFrom(-1.0f);
2752 application.SendNotification();
2753 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2755 animation.PlayFrom(100.0f);
2756 application.SendNotification();
2757 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2761 int UtcDaliAnimationPauseP(void)
2763 TestApplication application;
2765 Actor actor = Actor::New();
2766 application.GetScene().Add(actor);
2768 // Build the animation
2769 float durationSeconds(1.0f);
2770 Animation animation = Animation::New(durationSeconds);
2771 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2772 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2774 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2776 // Start the animation
2779 bool signalReceived(false);
2780 AnimationFinishCheck finishCheck(signalReceived);
2781 animation.FinishedSignal().Connect(&application, finishCheck);
2783 application.SendNotification();
2784 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2786 // We didn't expect the animation to finish yet
2787 application.SendNotification();
2788 finishCheck.CheckSignalNotReceived();
2789 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
2791 // Pause the animation
2793 application.SendNotification();
2796 for (int i=0; i<5; ++i)
2798 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2800 // We didn't expect the animation to finish yet
2801 application.SendNotification();
2802 finishCheck.CheckSignalNotReceived();
2803 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2808 application.SendNotification();
2809 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2811 // We didn't expect the animation to finish yet
2812 application.SendNotification();
2813 finishCheck.CheckSignalNotReceived();
2815 application.SendNotification();
2816 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2818 // We did expect the animation to finish
2819 application.SendNotification();
2820 finishCheck.CheckSignalReceived();
2821 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2823 // Check that nothing has changed after a couple of buffer swaps
2824 application.Render(0);
2825 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2826 application.Render(0);
2827 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2832 int UtcDaliAnimationGetStateP(void)
2834 TestApplication application;
2836 Actor actor = Actor::New();
2837 application.GetScene().Add(actor);
2839 // Build the animation
2840 float durationSeconds(1.0f);
2841 Animation animation = Animation::New(durationSeconds);
2842 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2843 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2844 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2846 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2848 // Start the animation
2851 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2853 bool signalReceived(false);
2854 AnimationFinishCheck finishCheck(signalReceived);
2855 animation.FinishedSignal().Connect(&application, finishCheck);
2857 application.SendNotification();
2858 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2860 // We didn't expect the animation to finish yet
2861 application.SendNotification();
2862 finishCheck.CheckSignalNotReceived();
2863 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2864 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
2866 // Pause the animation
2868 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2869 application.SendNotification();
2870 application.Render(0.f);
2873 for (int i=0; i<5; ++i)
2875 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2877 // We didn't expect the animation to finish yet
2878 application.SendNotification();
2879 finishCheck.CheckSignalNotReceived();
2880 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2881 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2885 finishCheck.Reset();
2887 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2888 application.SendNotification();
2889 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2890 // We didn't expect the animation to finish yet
2891 application.SendNotification();
2892 finishCheck.CheckSignalNotReceived();
2893 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2895 application.SendNotification();
2896 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2898 // We did expect the animation to finish
2899 application.SendNotification();
2900 finishCheck.CheckSignalReceived();
2901 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2902 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2904 // Check that nothing has changed after a couple of buffer swaps
2905 application.Render(0);
2906 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2907 application.Render(0);
2908 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
2909 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2912 finishCheck.Reset();
2914 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2915 application.SendNotification();
2916 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2917 application.SendNotification();
2918 finishCheck.CheckSignalNotReceived();
2919 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2925 int UtcDaliAnimationStopP(void)
2927 TestApplication application;
2929 Actor actor = Actor::New();
2930 application.GetScene().Add(actor);
2932 // Build the animation
2933 float durationSeconds(1.0f);
2934 Animation animation = Animation::New(durationSeconds);
2935 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2936 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2938 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2940 // Start the animation
2943 bool signalReceived(false);
2944 AnimationFinishCheck finishCheck(signalReceived);
2945 animation.FinishedSignal().Connect(&application, finishCheck);
2947 application.SendNotification();
2948 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2950 // We didn't expect the animation to finish yet
2951 application.SendNotification();
2952 finishCheck.CheckSignalNotReceived();
2953 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
2955 // Stop the animation
2957 application.SendNotification();
2960 for (int i=0; i<5; ++i)
2962 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2964 // We did expect the animation to finish
2965 application.SendNotification();
2966 finishCheck.CheckSignalReceived();
2967 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2972 int UtcDaliAnimationStopSetPositionP(void)
2974 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2975 // i.e. to check that the animation does not interfere with the position set.
2977 TestApplication application;
2979 Actor actor = Actor::New();
2980 application.GetScene().Add(actor);
2982 // Build the animation
2983 float durationSeconds(1.0f);
2984 Animation animation = Animation::New(durationSeconds);
2985 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2986 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2988 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2990 // Start the animation
2993 bool signalReceived(false);
2994 AnimationFinishCheck finishCheck(signalReceived);
2995 animation.FinishedSignal().Connect(&application, finishCheck);
2997 application.SendNotification();
2998 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
3000 // We didn't expect the animation to finish yet
3001 application.SendNotification();
3002 finishCheck.CheckSignalNotReceived();
3003 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
3005 // Stop the animation
3007 Vector3 positionSet(2.0f, 3.0f, 4.0f);
3008 actor.SetProperty( Actor::Property::POSITION, positionSet );
3009 application.SendNotification();
3012 for (int i=0; i<5; ++i)
3014 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
3016 // We did expect the animation to finish
3017 application.SendNotification();
3018 finishCheck.CheckSignalReceived();
3019 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
3024 int UtcDaliAnimationClearP(void)
3026 TestApplication application;
3028 Actor actor = Actor::New();
3029 application.GetScene().Add(actor);
3031 // Build the animation
3032 float durationSeconds(1.0f);
3033 Animation animation = Animation::New(durationSeconds);
3034 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
3035 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
3037 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
3039 // Start the animation
3042 bool signalReceived(false);
3043 AnimationFinishCheck finishCheck(signalReceived);
3044 animation.FinishedSignal().Connect(&application, finishCheck);
3046 application.SendNotification();
3047 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
3049 // We didn't expect the animation to finish yet
3050 application.SendNotification();
3051 finishCheck.CheckSignalNotReceived();
3052 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
3054 // Clear the animation
3056 application.SendNotification();
3058 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3060 // We don't expect the animation to finish now
3061 application.SendNotification();
3062 finishCheck.CheckSignalNotReceived();
3063 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
3065 // Restart as a scale animation; this should not move the actor's position
3066 finishCheck.Reset();
3067 actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
3068 Vector3 targetScale(3.0f, 3.0f, 3.0f);
3069 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
3072 application.SendNotification();
3073 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
3075 // We didn't expect the animation to finish yet
3076 application.SendNotification();
3077 finishCheck.CheckSignalNotReceived();
3078 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3079 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
3081 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
3083 // We did expect the animation to finish
3084 application.SendNotification();
3085 finishCheck.CheckSignalReceived();
3086 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
3087 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
3091 int UtcDaliAnimationFinishedSignalP(void)
3093 TestApplication application;
3095 // Start the empty animation
3096 float durationSeconds(1.0f);
3097 Animation animation = Animation::New(durationSeconds);
3100 bool signalReceived(false);
3101 AnimationFinishCheck finishCheck(signalReceived);
3102 animation.FinishedSignal().Connect(&application, finishCheck);
3104 application.SendNotification();
3105 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
3107 // We did expect the animation to finish
3108 application.SendNotification();
3109 finishCheck.CheckSignalReceived();
3113 int UtcDaliAnimationAnimateByBooleanP(void)
3115 TestApplication application;
3117 Actor actor = Actor::New();
3119 // Register a boolean property
3120 bool startValue(false);
3121 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3122 application.GetScene().Add(actor);
3123 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3124 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3126 // Build the animation
3127 float durationSeconds(2.0f);
3128 Animation animation = Animation::New(durationSeconds);
3129 const bool relativeValue(true);
3130 const bool finalValue( false || relativeValue );
3131 animation.AnimateBy(Property(actor, index), relativeValue);
3133 // Start the animation
3136 // Target value should be retrievable straight away
3137 DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
3139 bool signalReceived(false);
3140 AnimationFinishCheck finishCheck(signalReceived);
3141 animation.FinishedSignal().Connect(&application, finishCheck);
3143 application.SendNotification();
3144 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3146 // We didn't expect the animation to finish yet
3147 application.SendNotification();
3148 finishCheck.CheckSignalNotReceived();
3149 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3151 application.SendNotification();
3152 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3154 // We did expect the animation to finish
3155 application.SendNotification();
3156 finishCheck.CheckSignalReceived();
3157 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3159 // Check that nothing has changed after a couple of buffer swaps
3160 application.Render(0);
3161 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3162 application.Render(0);
3163 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3165 // Repeat with relative value "false" - this should be an NOOP
3166 animation = Animation::New(durationSeconds);
3167 bool noOpValue(false);
3168 animation.AnimateBy(Property(actor, index), noOpValue);
3170 // Start the animation
3173 finishCheck.Reset();
3174 animation.FinishedSignal().Connect(&application, finishCheck);
3176 application.SendNotification();
3177 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3179 // We didn't expect the animation to finish yet
3180 application.SendNotification();
3181 finishCheck.CheckSignalNotReceived();
3182 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3184 application.SendNotification();
3185 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3187 // We did expect the animation to finish
3188 application.SendNotification();
3189 finishCheck.CheckSignalReceived();
3190 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3192 // Check that nothing has changed after a couple of buffer swaps
3193 application.Render(0);
3194 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3195 application.Render(0);
3196 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3200 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
3202 TestApplication application;
3204 Actor actor = Actor::New();
3206 // Register a boolean property
3207 bool startValue(false);
3208 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3209 application.GetScene().Add(actor);
3210 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3211 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3213 // Build the animation
3214 float durationSeconds(2.0f);
3215 Animation animation = Animation::New(durationSeconds);
3216 bool relativeValue(true);
3217 bool finalValue( false || relativeValue );
3218 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
3220 // Start the animation
3223 bool signalReceived(false);
3224 AnimationFinishCheck finishCheck(signalReceived);
3225 animation.FinishedSignal().Connect(&application, finishCheck);
3227 application.SendNotification();
3228 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3230 // We didn't expect the animation to finish yet
3231 application.SendNotification();
3232 finishCheck.CheckSignalNotReceived();
3233 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3235 application.SendNotification();
3236 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3238 // We did expect the animation to finish
3239 application.SendNotification();
3240 finishCheck.CheckSignalReceived();
3241 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3243 // Check that nothing has changed after a couple of buffer swaps
3244 application.Render(0);
3245 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3246 application.Render(0);
3247 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3249 // Repeat with relative value "false" - this should be an NOOP
3250 animation = Animation::New(durationSeconds);
3251 bool noOpValue(false);
3252 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
3254 // Start the animation
3257 finishCheck.Reset();
3258 animation.FinishedSignal().Connect(&application, finishCheck);
3260 application.SendNotification();
3261 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3263 // We didn't expect the animation to finish yet
3264 application.SendNotification();
3265 finishCheck.CheckSignalNotReceived();
3266 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3268 application.SendNotification();
3269 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3271 // We did expect the animation to finish
3272 application.SendNotification();
3273 finishCheck.CheckSignalReceived();
3274 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3278 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
3280 TestApplication application;
3282 Actor actor = Actor::New();
3284 // Register a boolean property
3285 bool startValue(false);
3286 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3287 application.GetScene().Add(actor);
3288 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3289 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3291 // Build the animation
3292 float durationSeconds(2.0f);
3293 Animation animation = Animation::New(durationSeconds);
3294 bool relativeValue(true);
3295 bool finalValue( false || relativeValue );
3296 float animatorDurationSeconds(durationSeconds * 0.5f);
3297 animation.AnimateBy( Property(actor, index),
3299 TimePeriod( animatorDurationSeconds ) );
3301 // Start the animation
3304 bool signalReceived(false);
3305 AnimationFinishCheck finishCheck(signalReceived);
3306 animation.FinishedSignal().Connect(&application, finishCheck);
3308 application.SendNotification();
3309 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3311 // We didn't expect the animation to finish yet
3312 application.SendNotification();
3313 finishCheck.CheckSignalNotReceived();
3314 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3316 application.SendNotification();
3317 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3319 // We didn't expect the animation to finish yet...
3320 application.SendNotification();
3321 finishCheck.CheckSignalNotReceived();
3323 // ...however we should have reached the final value
3324 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3326 application.SendNotification();
3327 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3329 // We did expect the animation to finish
3330 application.SendNotification();
3331 finishCheck.CheckSignalReceived();
3332 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3334 // Check that nothing has changed after a couple of buffer swaps
3335 application.Render(0);
3336 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3337 application.Render(0);
3338 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3342 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3344 TestApplication application;
3346 Actor actor = Actor::New();
3348 // Register a boolean property
3349 bool startValue(false);
3350 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3351 application.GetScene().Add(actor);
3352 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3353 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3355 // Build the animation
3356 float durationSeconds(2.0f);
3357 Animation animation = Animation::New(durationSeconds);
3358 bool relativeValue(true);
3359 bool finalValue( false || relativeValue );
3360 float animatorDurationSeconds(durationSeconds * 0.5f);
3361 animation.AnimateBy( Property(actor, index),
3363 AlphaFunction::EASE_IN_OUT,
3364 TimePeriod( animatorDurationSeconds ) );
3366 // Start the animation
3369 bool signalReceived(false);
3370 AnimationFinishCheck finishCheck(signalReceived);
3371 animation.FinishedSignal().Connect(&application, finishCheck);
3373 application.SendNotification();
3374 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3376 // We didn't expect the animation to finish yet
3377 application.SendNotification();
3378 finishCheck.CheckSignalNotReceived();
3379 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3381 application.SendNotification();
3382 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3384 // We didn't expect the animation to finish yet...
3385 application.SendNotification();
3386 finishCheck.CheckSignalNotReceived();
3388 // ...however we should have reached the final value
3389 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3391 application.SendNotification();
3392 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3394 // We did expect the animation to finish
3395 application.SendNotification();
3396 finishCheck.CheckSignalReceived();
3397 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3399 // Check that nothing has changed after a couple of buffer swaps
3400 application.Render(0);
3401 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3402 application.Render(0);
3403 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3407 int UtcDaliAnimationAnimateByFloatP(void)
3409 TestApplication application;
3411 Actor actor = Actor::New();
3413 // Register a float property
3414 float startValue(10.0f);
3415 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3416 application.GetScene().Add(actor);
3417 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3418 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3420 // Build the animation
3421 float durationSeconds(2.0f);
3422 Animation animation = Animation::New(durationSeconds);
3423 float targetValue(50.0f);
3424 float relativeValue(targetValue - startValue);
3425 animation.AnimateBy(Property(actor, index), relativeValue);
3427 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3429 // Start the animation
3432 // Target value should be retrievable straight away
3433 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3435 bool signalReceived(false);
3436 AnimationFinishCheck finishCheck(signalReceived);
3437 animation.FinishedSignal().Connect(&application, finishCheck);
3439 application.SendNotification();
3440 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3442 // We didn't expect the animation to finish yet
3443 application.SendNotification();
3444 finishCheck.CheckSignalNotReceived();
3445 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3447 application.SendNotification();
3448 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3450 // We did expect the animation to finish
3451 application.SendNotification();
3452 finishCheck.CheckSignalReceived();
3453 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3455 // Check that nothing has changed after a couple of buffer swaps
3456 application.Render(0);
3457 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3458 application.Render(0);
3459 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3463 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3465 TestApplication application;
3467 Actor actor = Actor::New();
3469 // Register a float property
3470 float startValue(10.0f);
3471 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3472 application.GetScene().Add(actor);
3473 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3474 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3476 // Build the animation
3477 float durationSeconds(1.0f);
3478 Animation animation = Animation::New(durationSeconds);
3479 float targetValue(90.0f);
3480 float relativeValue(targetValue - startValue);
3481 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3483 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3485 // Start the animation
3488 bool signalReceived(false);
3489 AnimationFinishCheck finishCheck(signalReceived);
3490 animation.FinishedSignal().Connect(&application, finishCheck);
3492 application.SendNotification();
3493 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3495 // We didn't expect the animation to finish yet
3496 application.SendNotification();
3497 finishCheck.CheckSignalNotReceived();
3499 // The position should have moved more, than with a linear alpha function
3500 float current( actor.GetCurrentProperty< float >( index ) );
3501 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3503 application.SendNotification();
3504 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3506 // We did expect the animation to finish
3507 application.SendNotification();
3508 finishCheck.CheckSignalReceived();
3509 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3511 // Check that nothing has changed after a couple of buffer swaps
3512 application.Render(0);
3513 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3514 application.Render(0);
3515 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3519 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3521 TestApplication application;
3523 Actor actor = Actor::New();
3525 // Register a float property
3526 float startValue(10.0f);
3527 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3528 application.GetScene().Add(actor);
3529 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3530 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3532 // Build the animation
3533 float durationSeconds(1.0f);
3534 Animation animation = Animation::New(durationSeconds);
3535 float targetValue(30.0f);
3536 float relativeValue(targetValue - startValue);
3538 animation.AnimateBy(Property(actor, index),
3540 TimePeriod(delay, durationSeconds - delay));
3542 // Start the animation
3545 bool signalReceived(false);
3546 AnimationFinishCheck finishCheck(signalReceived);
3547 animation.FinishedSignal().Connect(&application, finishCheck);
3549 application.SendNotification();
3550 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3552 // We didn't expect the animation to finish yet
3553 application.SendNotification();
3554 finishCheck.CheckSignalNotReceived();
3555 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3557 application.SendNotification();
3558 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3560 // We didn't expect the animation to finish yet
3561 application.SendNotification();
3562 finishCheck.CheckSignalNotReceived();
3563 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3565 application.SendNotification();
3566 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3568 // We did expect the animation to finish
3569 application.SendNotification();
3570 finishCheck.CheckSignalReceived();
3571 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3573 // Check that nothing has changed after a couple of buffer swaps
3574 application.Render(0);
3575 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3576 application.Render(0);
3577 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3581 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3583 TestApplication application;
3585 Actor actor = Actor::New();
3587 // Register a float property
3588 float startValue(10.0f);
3589 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3590 application.GetScene().Add(actor);
3591 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3592 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3594 // Build the animation
3595 float durationSeconds(1.0f);
3596 Animation animation = Animation::New(durationSeconds);
3597 float targetValue(30.0f);
3598 float relativeValue(targetValue - startValue);
3600 animation.AnimateBy(Property(actor, index),
3602 AlphaFunction::LINEAR,
3603 TimePeriod(delay, durationSeconds - delay));
3605 // Start the animation
3608 bool signalReceived(false);
3609 AnimationFinishCheck finishCheck(signalReceived);
3610 animation.FinishedSignal().Connect(&application, finishCheck);
3612 application.SendNotification();
3613 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3615 // We didn't expect the animation to finish yet
3616 application.SendNotification();
3617 finishCheck.CheckSignalNotReceived();
3618 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3620 application.SendNotification();
3621 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3623 // We didn't expect the animation to finish yet
3624 application.SendNotification();
3625 finishCheck.CheckSignalNotReceived();
3626 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3628 application.SendNotification();
3629 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3631 // We did expect the animation to finish
3632 application.SendNotification();
3633 finishCheck.CheckSignalReceived();
3634 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3636 // Check that nothing has changed after a couple of buffer swaps
3637 application.Render(0);
3638 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3639 application.Render(0);
3640 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3644 int UtcDaliAnimationAnimateByIntegerP(void)
3646 TestApplication application;
3648 Actor actor = Actor::New();
3650 // Register an integer property
3652 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3653 application.GetScene().Add(actor);
3654 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3655 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3657 // Build the animation
3658 float durationSeconds(2.0f);
3659 Animation animation = Animation::New(durationSeconds);
3660 int targetValue(50);
3661 int relativeValue(targetValue - startValue);
3662 animation.AnimateBy(Property(actor, index), relativeValue);
3664 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3666 // Start the animation
3669 // Target value should be retrievable straight away
3670 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3672 bool signalReceived(false);
3673 AnimationFinishCheck finishCheck(signalReceived);
3674 animation.FinishedSignal().Connect(&application, finishCheck);
3676 application.SendNotification();
3677 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3679 // We didn't expect the animation to finish yet
3680 application.SendNotification();
3681 finishCheck.CheckSignalNotReceived();
3682 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3684 application.SendNotification();
3685 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3687 // We did expect the animation to finish
3688 application.SendNotification();
3689 finishCheck.CheckSignalReceived();
3690 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3692 // Check that nothing has changed after a couple of buffer swaps
3693 application.Render(0);
3694 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3695 application.Render(0);
3696 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3700 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3702 TestApplication application;
3704 Actor actor = Actor::New();
3706 // Register an integer property
3708 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3709 application.GetScene().Add(actor);
3710 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3711 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3713 // Build the animation
3714 float durationSeconds(1.0f);
3715 Animation animation = Animation::New(durationSeconds);
3716 int targetValue(90);
3717 int relativeValue(targetValue - startValue);
3718 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3720 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3722 // Start the animation
3725 bool signalReceived(false);
3726 AnimationFinishCheck finishCheck(signalReceived);
3727 animation.FinishedSignal().Connect(&application, finishCheck);
3729 application.SendNotification();
3730 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3732 // We didn't expect the animation to finish yet
3733 application.SendNotification();
3734 finishCheck.CheckSignalNotReceived();
3736 // The position should have moved more, than with a linear alpha function
3737 int current( actor.GetCurrentProperty< int >( index ) );
3738 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3740 application.SendNotification();
3741 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3743 // We did expect the animation to finish
3744 application.SendNotification();
3745 finishCheck.CheckSignalReceived();
3746 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3748 // Check that nothing has changed after a couple of buffer swaps
3749 application.Render(0);
3750 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3751 application.Render(0);
3752 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3756 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3758 TestApplication application;
3760 Actor actor = Actor::New();
3762 // Register an integer property
3764 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3765 application.GetScene().Add(actor);
3766 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3767 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3769 // Build the animation
3770 float durationSeconds(1.0f);
3771 Animation animation = Animation::New(durationSeconds);
3772 int targetValue(30);
3773 int relativeValue(targetValue - startValue);
3775 animation.AnimateBy(Property(actor, index),
3777 TimePeriod(delay, durationSeconds - delay));
3779 // Start the animation
3782 bool signalReceived(false);
3783 AnimationFinishCheck finishCheck(signalReceived);
3784 animation.FinishedSignal().Connect(&application, finishCheck);
3786 application.SendNotification();
3787 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3789 // We didn't expect the animation to finish yet
3790 application.SendNotification();
3791 finishCheck.CheckSignalNotReceived();
3792 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3794 application.SendNotification();
3795 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3797 // We didn't expect the animation to finish yet
3798 application.SendNotification();
3799 finishCheck.CheckSignalNotReceived();
3800 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3802 application.SendNotification();
3803 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3805 // We did expect the animation to finish
3806 application.SendNotification();
3807 finishCheck.CheckSignalReceived();
3808 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3810 // Check that nothing has changed after a couple of buffer swaps
3811 application.Render(0);
3812 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3813 application.Render(0);
3814 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3818 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3820 TestApplication application;
3822 Actor actor = Actor::New();
3824 // Register an integer property
3826 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3827 application.GetScene().Add(actor);
3828 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3829 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3831 // Build the animation
3832 float durationSeconds(1.0f);
3833 Animation animation = Animation::New(durationSeconds);
3834 int targetValue(30);
3835 int relativeValue(targetValue - startValue);
3837 animation.AnimateBy(Property(actor, index),
3839 AlphaFunction::LINEAR,
3840 TimePeriod(delay, durationSeconds - delay));
3842 // Start the animation
3845 bool signalReceived(false);
3846 AnimationFinishCheck finishCheck(signalReceived);
3847 animation.FinishedSignal().Connect(&application, finishCheck);
3849 application.SendNotification();
3850 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3852 // We didn't expect the animation to finish yet
3853 application.SendNotification();
3854 finishCheck.CheckSignalNotReceived();
3855 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3857 application.SendNotification();
3858 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3860 // We didn't expect the animation to finish yet
3861 application.SendNotification();
3862 finishCheck.CheckSignalNotReceived();
3863 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3865 application.SendNotification();
3866 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3868 // We did expect the animation to finish
3869 application.SendNotification();
3870 finishCheck.CheckSignalReceived();
3871 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3873 // Check that nothing has changed after a couple of buffer swaps
3874 application.Render(0);
3875 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3876 application.Render(0);
3877 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3881 int UtcDaliAnimationAnimateByQuaternionP(void)
3883 TestApplication application;
3885 Actor actor = Actor::New();
3887 // Register a quaternion property
3888 const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
3889 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3890 application.GetScene().Add(actor);
3891 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3892 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3894 // Build the animation
3895 float durationSeconds(2.0f);
3896 Animation animation = Animation::New(durationSeconds);
3897 const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
3898 const Quaternion finalValue( startValue * relativeValue );
3899 animation.AnimateBy(Property(actor, index), relativeValue);
3901 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3902 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3904 // Start the animation
3907 // Target value should be retrievable straight away
3908 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3910 application.SendNotification();
3911 application.Render( 2000 ); // animation complete
3913 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3914 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
3919 int UtcDaliAnimationAnimateByVector2P(void)
3921 TestApplication application;
3923 Actor actor = Actor::New();
3925 // Register a Vector2 property
3926 Vector2 startValue(10.0f, 10.0f);
3927 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3928 application.GetScene().Add(actor);
3929 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3930 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3932 // Build the animation
3933 float durationSeconds(2.0f);
3934 Animation animation = Animation::New(durationSeconds);
3935 Vector2 targetValue(60.0f, 60.0f);
3936 Vector2 relativeValue(targetValue - startValue);
3937 animation.AnimateBy(Property(actor, index), relativeValue);
3939 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3941 // Start the animation
3944 // Target value should be retrievable straight away
3945 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3947 bool signalReceived(false);
3948 AnimationFinishCheck finishCheck(signalReceived);
3949 animation.FinishedSignal().Connect(&application, finishCheck);
3951 application.SendNotification();
3952 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3954 // We didn't expect the animation to finish yet
3955 application.SendNotification();
3956 finishCheck.CheckSignalNotReceived();
3957 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3959 application.SendNotification();
3960 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3962 // We did expect the animation to finish
3963 application.SendNotification();
3964 finishCheck.CheckSignalReceived();
3965 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3967 // Check that nothing has changed after a couple of buffer swaps
3968 application.Render(0);
3969 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3970 application.Render(0);
3971 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3975 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3977 TestApplication application;
3979 Actor actor = Actor::New();
3981 // Register a Vector2 property
3982 Vector2 startValue(100.0f, 100.0f);
3983 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3984 application.GetScene().Add(actor);
3985 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3986 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3988 // Build the animation
3989 float durationSeconds(1.0f);
3990 Animation animation = Animation::New(durationSeconds);
3991 Vector2 targetValue(20.0f, 20.0f);
3992 Vector2 relativeValue(targetValue - startValue);
3993 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3995 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3997 // Start the animation
4000 bool signalReceived(false);
4001 AnimationFinishCheck finishCheck(signalReceived);
4002 animation.FinishedSignal().Connect(&application, finishCheck);
4004 application.SendNotification();
4005 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4007 // We didn't expect the animation to finish yet
4008 application.SendNotification();
4009 finishCheck.CheckSignalNotReceived();
4011 // The position should have moved more, than with a linear alpha function
4012 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
4013 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4014 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4016 application.SendNotification();
4017 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4019 // We did expect the animation to finish
4020 application.SendNotification();
4021 finishCheck.CheckSignalReceived();
4022 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4024 // Check that nothing has changed after a couple of buffer swaps
4025 application.Render(0);
4026 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4027 application.Render(0);
4028 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4032 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
4034 TestApplication application;
4036 Actor actor = Actor::New();
4038 // Register a Vector2 property
4039 Vector2 startValue(10.0f, 10.0f);
4040 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4041 application.GetScene().Add(actor);
4042 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4043 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4045 // Build the animation
4046 float durationSeconds(1.0f);
4047 Animation animation = Animation::New(durationSeconds);
4048 Vector2 targetValue(30.0f, 30.0f);
4049 Vector2 relativeValue(targetValue - startValue);
4051 animation.AnimateBy(Property(actor, index),
4053 TimePeriod(delay, durationSeconds - delay));
4055 // Start the animation
4058 bool signalReceived(false);
4059 AnimationFinishCheck finishCheck(signalReceived);
4060 animation.FinishedSignal().Connect(&application, finishCheck);
4062 application.SendNotification();
4063 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4065 // We didn't expect the animation to finish yet
4066 application.SendNotification();
4067 finishCheck.CheckSignalNotReceived();
4068 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4070 application.SendNotification();
4071 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4073 // We didn't expect the animation to finish yet
4074 application.SendNotification();
4075 finishCheck.CheckSignalNotReceived();
4076 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4078 application.SendNotification();
4079 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4081 // We did expect the animation to finish
4082 application.SendNotification();
4083 finishCheck.CheckSignalReceived();
4084 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4086 // Check that nothing has changed after a couple of buffer swaps
4087 application.Render(0);
4088 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4089 application.Render(0);
4090 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4094 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
4096 TestApplication application;
4098 Actor actor = Actor::New();
4100 // Register a Vector2 property
4101 Vector2 startValue(5.0f, 5.0f);
4102 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4103 application.GetScene().Add(actor);
4104 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
4105 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4107 // Build the animation
4108 float durationSeconds(1.0f);
4109 Animation animation = Animation::New(durationSeconds);
4110 Vector2 targetValue(10.0f, 10.0f);
4111 Vector2 relativeValue(targetValue - startValue);
4113 animation.AnimateBy(Property(actor, index),
4115 AlphaFunction::LINEAR,
4116 TimePeriod(delay, durationSeconds - delay));
4118 // Start the animation
4121 bool signalReceived(false);
4122 AnimationFinishCheck finishCheck(signalReceived);
4123 animation.FinishedSignal().Connect(&application, finishCheck);
4125 application.SendNotification();
4126 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4128 // We didn't expect the animation to finish yet
4129 application.SendNotification();
4130 finishCheck.CheckSignalNotReceived();
4131 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
4133 application.SendNotification();
4134 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4136 // We didn't expect the animation to finish yet
4137 application.SendNotification();
4138 finishCheck.CheckSignalNotReceived();
4139 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4141 application.SendNotification();
4142 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4144 // We did expect the animation to finish
4145 application.SendNotification();
4146 finishCheck.CheckSignalReceived();
4147 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4149 // Check that nothing has changed after a couple of buffer swaps
4150 application.Render(0);
4151 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4152 application.Render(0);
4153 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
4157 int UtcDaliAnimationAnimateByVector3P(void)
4159 TestApplication application;
4161 Actor actor = Actor::New();
4163 // Register a Vector3 property
4164 Vector3 startValue(10.0f, 10.0f, 10.0f);
4165 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4166 application.GetScene().Add(actor);
4167 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4168 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4170 // Build the animation
4171 float durationSeconds(2.0f);
4172 Animation animation = Animation::New(durationSeconds);
4173 Vector3 targetValue(60.0f, 60.0f, 60.0f);
4174 Vector3 relativeValue(targetValue - startValue);
4175 animation.AnimateBy(Property(actor, index), relativeValue);
4177 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4179 // Start the animation
4182 // Target value should be retrievable straight away
4183 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4185 bool signalReceived(false);
4186 AnimationFinishCheck finishCheck(signalReceived);
4187 animation.FinishedSignal().Connect(&application, finishCheck);
4189 application.SendNotification();
4190 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4192 // We didn't expect the animation to finish yet
4193 application.SendNotification();
4194 finishCheck.CheckSignalNotReceived();
4195 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4197 application.SendNotification();
4198 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4200 // We did expect the animation to finish
4201 application.SendNotification();
4202 finishCheck.CheckSignalReceived();
4203 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4205 // Check that nothing has changed after a couple of buffer swaps
4206 application.Render(0);
4207 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4208 application.Render(0);
4209 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4213 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
4215 TestApplication application;
4217 Actor actor = Actor::New();
4219 // Register a Vector3 property
4220 Vector3 startValue(100.0f, 100.0f, 100.0f);
4221 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4222 application.GetScene().Add(actor);
4223 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4224 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4226 // Build the animation
4227 float durationSeconds(1.0f);
4228 Animation animation = Animation::New(durationSeconds);
4229 Vector3 targetValue(20.0f, 20.0f, 20.0f);
4230 Vector3 relativeValue(targetValue - startValue);
4231 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4233 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4235 // Start the animation
4238 bool signalReceived(false);
4239 AnimationFinishCheck finishCheck(signalReceived);
4240 animation.FinishedSignal().Connect(&application, finishCheck);
4242 application.SendNotification();
4243 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4245 // We didn't expect the animation to finish yet
4246 application.SendNotification();
4247 finishCheck.CheckSignalNotReceived();
4249 // The position should have moved more, than with a linear alpha function
4250 Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
4251 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4252 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4253 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4255 application.SendNotification();
4256 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4258 // We did expect the animation to finish
4259 application.SendNotification();
4260 finishCheck.CheckSignalReceived();
4261 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4263 // Check that nothing has changed after a couple of buffer swaps
4264 application.Render(0);
4265 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4266 application.Render(0);
4267 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4271 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
4273 TestApplication application;
4275 Actor actor = Actor::New();
4277 // Register a Vector3 property
4278 Vector3 startValue(10.0f, 10.0f, 10.0f);
4279 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4280 application.GetScene().Add(actor);
4281 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4282 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4284 // Build the animation
4285 float durationSeconds(1.0f);
4286 Animation animation = Animation::New(durationSeconds);
4287 Vector3 targetValue(30.0f, 30.0f, 30.0f);
4288 Vector3 relativeValue(targetValue - startValue);
4290 animation.AnimateBy(Property(actor, index),
4292 TimePeriod(delay, durationSeconds - delay));
4294 // Start the animation
4297 bool signalReceived(false);
4298 AnimationFinishCheck finishCheck(signalReceived);
4299 animation.FinishedSignal().Connect(&application, finishCheck);
4301 application.SendNotification();
4302 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4304 // We didn't expect the animation to finish yet
4305 application.SendNotification();
4306 finishCheck.CheckSignalNotReceived();
4307 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4309 application.SendNotification();
4310 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4312 // We didn't expect the animation to finish yet
4313 application.SendNotification();
4314 finishCheck.CheckSignalNotReceived();
4315 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4317 application.SendNotification();
4318 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4320 // We did expect the animation to finish
4321 application.SendNotification();
4322 finishCheck.CheckSignalReceived();
4323 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4325 // Check that nothing has changed after a couple of buffer swaps
4326 application.Render(0);
4327 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4328 application.Render(0);
4329 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4333 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4335 TestApplication application;
4337 Actor actor = Actor::New();
4339 // Register a Vector3 property
4340 Vector3 startValue(5.0f, 5.0f, 5.0f);
4341 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4342 application.GetScene().Add(actor);
4343 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4344 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4346 // Build the animation
4347 float durationSeconds(1.0f);
4348 Animation animation = Animation::New(durationSeconds);
4349 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4350 Vector3 relativeValue(targetValue - startValue);
4352 animation.AnimateBy(Property(actor, index),
4354 AlphaFunction::LINEAR,
4355 TimePeriod(delay, durationSeconds - delay));
4357 // Start the animation
4360 bool signalReceived(false);
4361 AnimationFinishCheck finishCheck(signalReceived);
4362 animation.FinishedSignal().Connect(&application, finishCheck);
4364 application.SendNotification();
4365 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4367 // We didn't expect the animation to finish yet
4368 application.SendNotification();
4369 finishCheck.CheckSignalNotReceived();
4370 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4372 application.SendNotification();
4373 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4375 // We didn't expect the animation to finish yet
4376 application.SendNotification();
4377 finishCheck.CheckSignalNotReceived();
4378 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4380 application.SendNotification();
4381 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4383 // We did expect the animation to finish
4384 application.SendNotification();
4385 finishCheck.CheckSignalReceived();
4386 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4388 // Check that nothing has changed after a couple of buffer swaps
4389 application.Render(0);
4390 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4391 application.Render(0);
4392 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4396 int UtcDaliAnimationAnimateByVector4P(void)
4398 TestApplication application;
4400 Actor actor = Actor::New();
4402 // Register a Vector4 property
4403 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4404 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4405 application.GetScene().Add(actor);
4406 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4407 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4409 // Build the animation
4410 float durationSeconds(2.0f);
4411 Animation animation = Animation::New(durationSeconds);
4412 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4413 Vector4 relativeValue(targetValue - startValue);
4414 animation.AnimateBy(Property(actor, index), relativeValue);
4416 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4418 // Start the animation
4421 // Target value should be retrievable straight away
4422 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4424 bool signalReceived(false);
4425 AnimationFinishCheck finishCheck(signalReceived);
4426 animation.FinishedSignal().Connect(&application, finishCheck);
4428 application.SendNotification();
4429 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4431 // We didn't expect the animation to finish yet
4432 application.SendNotification();
4433 finishCheck.CheckSignalNotReceived();
4434 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4436 application.SendNotification();
4437 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4439 // We did expect the animation to finish
4440 application.SendNotification();
4441 finishCheck.CheckSignalReceived();
4442 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4444 // Check that nothing has changed after a couple of buffer swaps
4445 application.Render(0);
4446 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4447 application.Render(0);
4448 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4452 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4454 TestApplication application;
4456 Actor actor = Actor::New();
4458 // Register a Vector4 property
4459 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4460 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4461 application.GetScene().Add(actor);
4462 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4463 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4465 // Build the animation
4466 float durationSeconds(1.0f);
4467 Animation animation = Animation::New(durationSeconds);
4468 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4469 Vector4 relativeValue(targetValue - startValue);
4470 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4472 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4474 // Start the animation
4477 bool signalReceived(false);
4478 AnimationFinishCheck finishCheck(signalReceived);
4479 animation.FinishedSignal().Connect(&application, finishCheck);
4481 application.SendNotification();
4482 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4484 // We didn't expect the animation to finish yet
4485 application.SendNotification();
4486 finishCheck.CheckSignalNotReceived();
4488 // The position should have moved more, than with a linear alpha function
4489 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4490 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4491 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4492 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4493 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4495 application.SendNotification();
4496 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4498 // We did expect the animation to finish
4499 application.SendNotification();
4500 finishCheck.CheckSignalReceived();
4501 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4503 // Check that nothing has changed after a couple of buffer swaps
4504 application.Render(0);
4505 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4506 application.Render(0);
4507 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4511 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4513 TestApplication application;
4515 Actor actor = Actor::New();
4517 // Register a Vector4 property
4518 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4519 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4520 application.GetScene().Add(actor);
4521 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4522 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4524 // Build the animation
4525 float durationSeconds(1.0f);
4526 Animation animation = Animation::New(durationSeconds);
4527 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4528 Vector4 relativeValue(targetValue - startValue);
4530 animation.AnimateBy(Property(actor, index),
4532 TimePeriod(delay, durationSeconds - delay));
4534 // Start the animation
4537 bool signalReceived(false);
4538 AnimationFinishCheck finishCheck(signalReceived);
4539 animation.FinishedSignal().Connect(&application, finishCheck);
4541 application.SendNotification();
4542 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4544 // We didn't expect the animation to finish yet
4545 application.SendNotification();
4546 finishCheck.CheckSignalNotReceived();
4547 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4549 application.SendNotification();
4550 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4552 // We didn't expect the animation to finish yet
4553 application.SendNotification();
4554 finishCheck.CheckSignalNotReceived();
4555 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4557 application.SendNotification();
4558 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4560 // We did expect the animation to finish
4561 application.SendNotification();
4562 finishCheck.CheckSignalReceived();
4563 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4565 // Check that nothing has changed after a couple of buffer swaps
4566 application.Render(0);
4567 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4568 application.Render(0);
4569 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4573 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4575 TestApplication application;
4577 Actor actor = Actor::New();
4579 // Register a Vector4 property
4580 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4581 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4582 application.GetScene().Add(actor);
4583 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4584 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4586 // Build the animation
4587 float durationSeconds(1.0f);
4588 Animation animation = Animation::New(durationSeconds);
4589 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4590 Vector4 relativeValue(targetValue - startValue);
4592 animation.AnimateBy(Property(actor, index),
4594 AlphaFunction::LINEAR,
4595 TimePeriod(delay, durationSeconds - delay));
4597 // Start the animation
4600 bool signalReceived(false);
4601 AnimationFinishCheck finishCheck(signalReceived);
4602 animation.FinishedSignal().Connect(&application, finishCheck);
4604 application.SendNotification();
4605 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4607 // We didn't expect the animation to finish yet
4608 application.SendNotification();
4609 finishCheck.CheckSignalNotReceived();
4610 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4612 application.SendNotification();
4613 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4615 // We didn't expect the animation to finish yet
4616 application.SendNotification();
4617 finishCheck.CheckSignalNotReceived();
4618 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4620 application.SendNotification();
4621 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4623 // We did expect the animation to finish
4624 application.SendNotification();
4625 finishCheck.CheckSignalReceived();
4626 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4628 // Check that nothing has changed after a couple of buffer swaps
4629 application.Render(0);
4630 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4631 application.Render(0);
4632 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4636 int UtcDaliAnimationAnimateByActorPositionP(void)
4638 TestApplication application;
4640 Actor actor = Actor::New();
4641 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4642 actor.SetProperty( Actor::Property::POSITION, startPosition );
4643 application.GetScene().Add(actor);
4644 application.SendNotification();
4645 application.Render(0);
4646 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4648 // Build the animation
4649 float durationSeconds(1.0f);
4650 Animation animation = Animation::New(durationSeconds);
4651 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4652 Vector3 relativePosition(targetPosition - startPosition);
4653 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4655 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4657 // Start the animation
4660 // Target value should be retrievable straight away
4661 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4663 bool signalReceived(false);
4664 AnimationFinishCheck finishCheck(signalReceived);
4665 animation.FinishedSignal().Connect(&application, finishCheck);
4667 application.SendNotification();
4668 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4670 // We didn't expect the animation to finish yet
4671 application.SendNotification();
4672 finishCheck.CheckSignalNotReceived();
4673 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ninetyFivePercentProgress, TEST_LOCATION );
4675 application.SendNotification();
4676 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4678 // We did expect the animation to finish
4679 application.SendNotification();
4680 finishCheck.CheckSignalReceived();
4681 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4683 // Check that nothing has changed after a couple of buffer swaps
4684 application.Render(0);
4685 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4686 application.Render(0);
4687 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4691 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4693 TestApplication application;
4695 Actor actor = Actor::New();
4696 application.GetScene().Add(actor);
4697 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4699 // Build the animation
4700 float durationSeconds(1.0f);
4701 Animation animation = Animation::New(durationSeconds);
4702 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4703 Vector3 relativePosition(targetPosition - Vector3::ZERO);
4704 animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
4705 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
4706 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
4708 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4709 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4711 // Start the animation
4714 // Target value should be retrievable straight away
4715 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4716 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
4717 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
4718 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
4720 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
4722 application.SendNotification();
4723 application.Render( 1000 ); // 1 second progress
4725 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4730 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4732 TestApplication application;
4734 Actor actor = Actor::New();
4735 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4736 actor.SetProperty( Actor::Property::POSITION, startPosition );
4737 application.GetScene().Add(actor);
4738 application.SendNotification();
4739 application.Render(0);
4740 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4742 // Build the animation
4743 float durationSeconds(1.0f);
4744 Animation animation = Animation::New(durationSeconds);
4745 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4746 Vector3 relativePosition(targetPosition - startPosition);
4747 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4749 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4751 // Start the animation
4754 bool signalReceived(false);
4755 AnimationFinishCheck finishCheck(signalReceived);
4756 animation.FinishedSignal().Connect(&application, finishCheck);
4758 application.SendNotification();
4759 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4761 // We didn't expect the animation to finish yet
4762 application.SendNotification();
4763 finishCheck.CheckSignalNotReceived();
4765 // The position should have moved more, than with a linear alpha function
4766 Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
4767 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4768 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4769 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4771 application.SendNotification();
4772 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4774 // We did expect the animation to finish
4775 application.SendNotification();
4776 finishCheck.CheckSignalReceived();
4777 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4779 // Check that nothing has changed after a couple of buffer swaps
4780 application.Render(0);
4781 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4782 application.Render(0);
4783 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4787 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4789 TestApplication application;
4791 Actor actor = Actor::New();
4792 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4793 actor.SetProperty( Actor::Property::POSITION, startPosition );
4794 application.GetScene().Add(actor);
4795 application.SendNotification();
4796 application.Render(0);
4797 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4799 // Build the animation
4800 float durationSeconds(1.0f);
4801 Animation animation = Animation::New(durationSeconds);
4802 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4803 Vector3 relativePosition(targetPosition - startPosition);
4805 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4807 TimePeriod(delay, durationSeconds - delay));
4809 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4811 // Start the animation
4814 bool signalReceived(false);
4815 AnimationFinishCheck finishCheck(signalReceived);
4816 animation.FinishedSignal().Connect(&application, finishCheck);
4818 application.SendNotification();
4819 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4821 // We didn't expect the animation to finish yet
4822 application.SendNotification();
4823 finishCheck.CheckSignalNotReceived();
4824 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4826 application.SendNotification();
4827 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4829 // We did expect the animation to finish
4830 application.SendNotification();
4831 finishCheck.CheckSignalReceived();
4832 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4834 // Check that nothing has changed after a couple of buffer swaps
4835 application.Render(0);
4836 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4837 application.Render(0);
4838 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4842 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4844 TestApplication application;
4846 Actor actor = Actor::New();
4847 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4848 actor.SetProperty( Actor::Property::POSITION, startPosition );
4849 application.GetScene().Add(actor);
4850 application.SendNotification();
4851 application.Render(0);
4852 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4854 // Build the animation
4855 float durationSeconds(1.0f);
4856 Animation animation = Animation::New(durationSeconds);
4857 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4858 Vector3 relativePosition(targetPosition - startPosition);
4860 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4862 AlphaFunction::LINEAR,
4863 TimePeriod(delay, durationSeconds - delay));
4865 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4867 // Start the animation
4870 bool signalReceived(false);
4871 AnimationFinishCheck finishCheck(signalReceived);
4872 animation.FinishedSignal().Connect(&application, finishCheck);
4874 application.SendNotification();
4875 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4877 // We didn't expect the animation to finish yet
4878 application.SendNotification();
4879 finishCheck.CheckSignalNotReceived();
4880 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
4882 application.SendNotification();
4883 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4885 // We did expect the animation to finish
4886 application.SendNotification();
4887 finishCheck.CheckSignalReceived();
4888 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4890 // Check that nothing has changed after a couple of buffer swaps
4891 application.Render(0);
4892 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4893 application.Render(0);
4894 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4898 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4900 TestApplication application;
4902 Actor actor = Actor::New();
4903 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4904 application.GetScene().Add(actor);
4905 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4907 // Build the animation
4908 float durationSeconds(1.0f);
4909 Animation animation = Animation::New(durationSeconds);
4910 Degree relativeRotationDegrees(360.0f);
4911 Radian relativeRotationRadians(relativeRotationDegrees);
4912 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4914 // Start the animation
4917 // Target value should be retrievable straight away
4918 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4920 bool signalReceived(false);
4921 AnimationFinishCheck finishCheck(signalReceived);
4922 animation.FinishedSignal().Connect(&application, finishCheck);
4924 application.SendNotification();
4925 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4927 // We didn't expect the animation to finish yet
4928 application.SendNotification();
4929 finishCheck.CheckSignalNotReceived();
4930 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4932 application.SendNotification();
4933 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4935 // We didn't expect the animation to finish yet
4936 application.SendNotification();
4937 finishCheck.CheckSignalNotReceived();
4938 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4940 application.SendNotification();
4941 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4943 // We didn't expect the animation to finish yet
4944 application.SendNotification();
4945 finishCheck.CheckSignalNotReceived();
4946 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4948 application.SendNotification();
4949 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4951 // We did expect the animation to finish
4952 application.SendNotification();
4953 finishCheck.CheckSignalReceived();
4954 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4958 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4960 TestApplication application;
4962 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4964 Actor actor = Actor::New();
4965 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4966 application.GetScene().Add(actor);
4967 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4969 // Build the animation
4970 float durationSeconds(1.0f);
4971 Animation animation = Animation::New(durationSeconds);
4972 Degree relativeRotationDegrees(710.0f);
4973 Radian relativeRotationRadians(relativeRotationDegrees);
4975 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4977 // Start the animation
4980 bool signalReceived(false);
4981 AnimationFinishCheck finishCheck(signalReceived);
4982 animation.FinishedSignal().Connect(&application, finishCheck);
4984 application.SendNotification();
4985 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4987 // We didn't expect the animation to finish yet
4988 application.SendNotification();
4989 finishCheck.CheckSignalNotReceived();
4990 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4992 application.SendNotification();
4993 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4995 // We didn't expect the animation to finish yet
4996 application.SendNotification();
4997 finishCheck.CheckSignalNotReceived();
4998 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5000 application.SendNotification();
5001 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5003 // We didn't expect the animation to finish yet
5004 application.SendNotification();
5005 finishCheck.CheckSignalNotReceived();
5006 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5008 application.SendNotification();
5009 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5011 // We did expect the animation to finish
5012 application.SendNotification();
5013 finishCheck.CheckSignalReceived();
5014 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5019 int UtcDaliAnimationAnimateByActorOrientationP3(void)
5021 TestApplication application;
5023 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
5025 Actor actor = Actor::New();
5026 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
5027 application.GetScene().Add(actor);
5028 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5030 // Build the animation
5031 float durationSeconds(1.0f);
5032 Animation animation = Animation::New(durationSeconds);
5033 Degree relativeRotationDegrees(730.0f);
5034 Radian relativeRotationRadians(relativeRotationDegrees);
5036 Radian actualRotationRadians( Degree(10.0f) );
5038 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
5040 // Start the animation
5043 bool signalReceived(false);
5044 AnimationFinishCheck finishCheck(signalReceived);
5045 animation.FinishedSignal().Connect(&application, finishCheck);
5047 application.SendNotification();
5048 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5050 // We didn't expect the animation to finish yet
5051 application.SendNotification();
5052 finishCheck.CheckSignalNotReceived();
5053 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5055 application.SendNotification();
5056 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5058 // We didn't expect the animation to finish yet
5059 application.SendNotification();
5060 finishCheck.CheckSignalNotReceived();
5061 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5063 application.SendNotification();
5064 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5066 // We didn't expect the animation to finish yet
5067 application.SendNotification();
5068 finishCheck.CheckSignalNotReceived();
5069 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5071 application.SendNotification();
5072 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5074 // We did expect the animation to finish
5075 application.SendNotification();
5076 finishCheck.CheckSignalReceived();
5077 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5078 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
5083 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
5085 TestApplication application;
5087 Actor actor = Actor::New();
5088 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5089 application.GetScene().Add(actor);
5090 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5092 // Build the animation
5093 float durationSeconds(1.0f);
5094 Animation animation = Animation::New(durationSeconds);
5095 Degree relativeRotationDegrees(360.0f);
5096 Radian relativeRotationRadians(relativeRotationDegrees);
5097 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
5099 // Start the animation
5102 bool signalReceived(false);
5103 AnimationFinishCheck finishCheck(signalReceived);
5104 animation.FinishedSignal().Connect(&application, finishCheck);
5106 application.SendNotification();
5107 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5109 // We didn't expect the animation to finish yet
5110 application.SendNotification();
5111 finishCheck.CheckSignalNotReceived();
5112 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5114 application.SendNotification();
5115 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5117 // We didn't expect the animation to finish yet
5118 application.SendNotification();
5119 finishCheck.CheckSignalNotReceived();
5120 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5122 application.SendNotification();
5123 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5125 // We didn't expect the animation to finish yet
5126 application.SendNotification();
5127 finishCheck.CheckSignalNotReceived();
5128 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5130 application.SendNotification();
5131 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5133 // We did expect the animation to finish
5134 application.SendNotification();
5135 finishCheck.CheckSignalReceived();
5136 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5140 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
5142 TestApplication application;
5144 Actor actor = Actor::New();
5145 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
5146 application.GetScene().Add(actor);
5147 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
5149 // Build the animation
5150 float durationSeconds(1.0f);
5151 Animation animation = Animation::New(durationSeconds);
5152 Degree relativeRotationDegrees(360.0f);
5153 Radian relativeRotationRadians(relativeRotationDegrees);
5155 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
5156 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
5158 // Start the animation
5161 bool signalReceived(false);
5162 AnimationFinishCheck finishCheck(signalReceived);
5163 animation.FinishedSignal().Connect(&application, finishCheck);
5165 application.SendNotification();
5166 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
5168 // We didn't expect the animation to finish yet
5169 application.SendNotification();
5170 finishCheck.CheckSignalNotReceived();
5171 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
5172 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5174 application.SendNotification();
5175 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
5177 // We didn't expect the animation to finish yet
5178 application.SendNotification();
5179 finishCheck.CheckSignalNotReceived();
5180 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
5181 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5183 application.SendNotification();
5184 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
5186 // We didn't expect the animation to finish yet
5187 application.SendNotification();
5188 finishCheck.CheckSignalNotReceived();
5189 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
5190 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5192 application.SendNotification();
5193 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5195 // We did expect the animation to finish
5196 application.SendNotification();
5197 finishCheck.CheckSignalReceived();
5198 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
5202 int UtcDaliAnimationAnimateByActorScaleP(void)
5204 TestApplication application;
5206 Actor actor = Actor::New();
5207 application.GetScene().Add(actor);
5208 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5210 // Build the animation
5211 float durationSeconds(1.0f);
5212 Animation animation = Animation::New(durationSeconds);
5213 Vector3 targetScale(2.0f, 2.0f, 2.0f);
5214 Vector3 relativeScale(targetScale - Vector3::ONE);
5215 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
5217 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
5219 // Start the animation
5222 // Target value should be retrievable straight away
5223 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5225 bool signalReceived(false);
5226 AnimationFinishCheck finishCheck(signalReceived);
5227 animation.FinishedSignal().Connect(&application, finishCheck);
5229 application.SendNotification();
5230 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5232 // We didn't expect the animation to finish yet
5233 application.SendNotification();
5234 finishCheck.CheckSignalNotReceived();
5235 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), ninetyNinePercentProgress, TEST_LOCATION );
5237 application.SendNotification();
5238 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5240 // We did expect the animation to finish
5241 application.SendNotification();
5242 finishCheck.CheckSignalReceived();
5243 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5246 finishCheck.Reset();
5247 actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
5248 application.SendNotification();
5249 application.Render(0);
5250 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5252 // Repeat with a different (ease-in) alpha function
5253 animation = Animation::New(durationSeconds);
5254 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
5255 animation.FinishedSignal().Connect(&application, finishCheck);
5258 application.SendNotification();
5259 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
5261 // We didn't expect the animation to finish yet
5262 application.SendNotification();
5263 finishCheck.CheckSignalNotReceived();
5265 // The scale should have grown less, than with a linear alpha function
5266 Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
5267 DALI_TEST_CHECK( current.x > 1.0f );
5268 DALI_TEST_CHECK( current.y > 1.0f );
5269 DALI_TEST_CHECK( current.z > 1.0f );
5270 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
5271 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
5272 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
5274 application.SendNotification();
5275 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
5277 // We did expect the animation to finish
5278 application.SendNotification();
5279 finishCheck.CheckSignalReceived();
5280 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5283 finishCheck.Reset();
5284 actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
5285 application.SendNotification();
5286 application.Render(0);
5287 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5289 // Repeat with a delay
5291 animation = Animation::New(durationSeconds);
5292 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
5293 animation.FinishedSignal().Connect(&application, finishCheck);
5296 application.SendNotification();
5297 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5299 // We didn't expect the animation to finish yet
5300 application.SendNotification();
5301 finishCheck.CheckSignalNotReceived();
5302 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5304 application.SendNotification();
5305 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
5307 // We did expect the animation to finish
5308 application.SendNotification();
5309 finishCheck.CheckSignalReceived();
5310 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5314 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
5316 TestApplication application;
5318 Actor actor = Actor::New();
5319 application.GetScene().Add(actor);
5320 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5322 // Build the animation
5323 float durationSeconds(1.0f);
5324 Animation animation = Animation::New(durationSeconds);
5325 Vector3 targetScale(2.0f, 3.0f, 4.0f);
5326 Vector3 relativeScale(targetScale - Vector3::ONE);
5327 animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
5328 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
5329 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
5331 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5332 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5334 // Start the animation
5337 // Target value should be retrievable straight away
5338 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5339 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
5340 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
5341 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
5343 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); // Not changed yet
5345 application.SendNotification();
5346 application.Render( 1000 ); // 1 second progress
5348 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5353 int UtcDaliAnimationAnimateByActorColorP(void)
5355 TestApplication application;
5357 Actor actor = Actor::New();
5358 application.GetScene().Add(actor);
5359 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5361 // Build the animation
5362 float durationSeconds(1.0f);
5363 Animation animation = Animation::New(durationSeconds);
5364 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5365 Vector4 relativeColor( targetColor - Color::WHITE );
5366 animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
5368 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5369 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5371 // Start the animation
5374 // Target value should be retrievable straight away
5375 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5376 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5377 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5378 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5379 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5381 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); // Not changed yet
5383 application.SendNotification();
5384 application.Render( 1000 ); // 1 second progress
5386 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5391 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5393 TestApplication application;
5395 Actor actor = Actor::New();
5396 application.GetScene().Add(actor);
5397 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5399 // Build the animation
5400 float durationSeconds(1.0f);
5401 Animation animation = Animation::New(durationSeconds);
5402 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5403 Vector4 relativeColor( targetColor - Color::WHITE );
5404 animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
5405 animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
5406 animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
5407 animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
5409 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5410 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5412 // Start the animation
5415 // Target value should be retrievable straight away
5416 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5417 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5418 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5419 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5420 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5422 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); // Not changed yet
5424 application.SendNotification();
5425 application.Render( 1000 ); // 1 second progress
5427 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5432 int UtcDaliAnimationAnimateByActorSizeP(void)
5434 TestApplication application;
5436 Actor actor = Actor::New();
5437 application.GetScene().Add(actor);
5438 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5440 // Build the animation
5441 float durationSeconds(1.0f);
5442 Animation animation = Animation::New(durationSeconds);
5443 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5444 Vector3 relativeSize( targetSize - Vector3::ZERO );
5445 animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
5447 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5448 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5450 // Start the animation
5453 // Target value should be retrievable straight away
5454 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5455 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5456 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5457 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5459 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5461 application.SendNotification();
5462 application.Render( 1000 ); // 1 second progress
5464 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5469 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5471 TestApplication application;
5473 Actor actor = Actor::New();
5474 application.GetScene().Add(actor);
5475 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5477 // Build the animation
5478 float durationSeconds(1.0f);
5479 Animation animation = Animation::New(durationSeconds);
5480 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5481 Vector3 relativeSize( targetSize - Vector3::ZERO );
5482 animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
5483 animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
5484 animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
5486 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5487 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5489 // Start the animation
5492 // Target value should be retrievable straight away
5493 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5494 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5495 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5496 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5498 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5500 application.SendNotification();
5501 application.Render( 1000 ); // 1 second progress
5503 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5508 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5510 TestApplication application;
5512 Actor actor = Actor::New();
5513 application.GetScene().Add(actor);
5514 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
5516 actor.SetProperty( Actor::Property::VISIBLE, false );
5518 application.SendNotification();
5519 application.Render();
5521 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5523 // Build the animation
5524 float durationSeconds(1.0f);
5525 Animation animation = Animation::New(durationSeconds);
5526 bool targetVisibility( true );
5527 bool relativeVisibility( targetVisibility );
5528 animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
5530 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5532 // Start the animation
5535 // Target value should be retrievable straight away
5536 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
5537 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); // Not changed yet
5539 application.SendNotification();
5540 application.Render( 1000 ); // 1 second progress
5542 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
5547 int UtcDaliAnimationAnimateToBooleanP(void)
5549 TestApplication application;
5551 Actor actor = Actor::New();
5553 // Register a boolean property
5554 const bool startValue(false);
5555 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5556 application.GetScene().Add(actor);
5557 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5558 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5560 // Build the animation
5561 float durationSeconds(2.0f);
5562 Animation animation = Animation::New(durationSeconds);
5563 const bool targetValue( !startValue );
5564 animation.AnimateTo(Property(actor, index), targetValue);
5566 // Start the animation
5569 bool signalReceived(false);
5570 AnimationFinishCheck finishCheck(signalReceived);
5571 animation.FinishedSignal().Connect(&application, finishCheck);
5573 application.SendNotification();
5574 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5576 // We didn't expect the animation to finish yet
5577 application.SendNotification();
5578 finishCheck.CheckSignalNotReceived();
5579 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5581 application.SendNotification();
5582 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5584 // We did expect the animation to finish
5585 application.SendNotification();
5586 finishCheck.CheckSignalReceived();
5587 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5589 // Check that nothing has changed after a couple of buffer swaps
5590 application.Render(0);
5591 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5592 application.Render(0);
5593 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5595 // Repeat with target value "false"
5596 animation = Animation::New(durationSeconds);
5597 const bool finalValue( !targetValue );
5598 animation.AnimateTo(Property(actor, index), finalValue);
5600 // Start the animation
5603 finishCheck.Reset();
5604 animation.FinishedSignal().Connect(&application, finishCheck);
5606 application.SendNotification();
5607 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5609 // We didn't expect the animation to finish yet
5610 application.SendNotification();
5611 finishCheck.CheckSignalNotReceived();
5612 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5614 application.SendNotification();
5615 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5617 // We did expect the animation to finish
5618 application.SendNotification();
5619 finishCheck.CheckSignalReceived();
5620 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5622 // Check that nothing has changed after a couple of buffer swaps
5623 application.Render(0);
5624 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5625 application.Render(0);
5626 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5630 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5632 TestApplication application;
5634 Actor actor = Actor::New();
5636 // Register a boolean property
5637 const bool startValue(false);
5638 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5639 application.GetScene().Add(actor);
5640 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5641 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5643 // Build the animation
5644 float durationSeconds(2.0f);
5645 Animation animation = Animation::New(durationSeconds);
5646 const bool targetValue( !startValue );
5647 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5649 // Start the animation
5652 bool signalReceived(false);
5653 AnimationFinishCheck finishCheck(signalReceived);
5654 animation.FinishedSignal().Connect(&application, finishCheck);
5656 application.SendNotification();
5657 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5659 // We didn't expect the animation to finish yet
5660 application.SendNotification();
5661 finishCheck.CheckSignalNotReceived();
5662 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5664 application.SendNotification();
5665 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5667 // We did expect the animation to finish
5668 application.SendNotification();
5669 finishCheck.CheckSignalReceived();
5670 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5672 // Check that nothing has changed after a couple of buffer swaps
5673 application.Render(0);
5674 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5675 application.Render(0);
5676 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5678 // Repeat with target value "false"
5679 animation = Animation::New(durationSeconds);
5680 const bool finalValue( !targetValue );
5681 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5683 // Start the animation
5686 finishCheck.Reset();
5687 animation.FinishedSignal().Connect(&application, finishCheck);
5689 application.SendNotification();
5690 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5692 // We didn't expect the animation to finish yet
5693 application.SendNotification();
5694 finishCheck.CheckSignalNotReceived();
5695 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5697 application.SendNotification();
5698 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5700 // We did expect the animation to finish
5701 application.SendNotification();
5702 finishCheck.CheckSignalReceived();
5703 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5705 // Check that nothing has changed after a couple of buffer swaps
5706 application.Render(0);
5707 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5708 application.Render(0);
5709 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5713 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5715 TestApplication application;
5717 Actor actor = Actor::New();
5719 // Register a boolean property
5720 bool startValue(false);
5721 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5722 application.GetScene().Add(actor);
5723 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5724 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5726 // Build the animation
5727 float durationSeconds(2.0f);
5728 Animation animation = Animation::New(durationSeconds);
5729 bool finalValue( !startValue );
5730 float animatorDurationSeconds(durationSeconds * 0.5f);
5731 animation.AnimateTo( Property(actor, index),
5733 TimePeriod( animatorDurationSeconds ) );
5735 // Start the animation
5738 bool signalReceived(false);
5739 AnimationFinishCheck finishCheck(signalReceived);
5740 animation.FinishedSignal().Connect(&application, finishCheck);
5742 application.SendNotification();
5743 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5745 // We didn't expect the animation to finish yet
5746 application.SendNotification();
5747 finishCheck.CheckSignalNotReceived();
5748 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5750 application.SendNotification();
5751 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5753 // We didn't expect the animation to finish yet...
5754 application.SendNotification();
5755 finishCheck.CheckSignalNotReceived();
5757 // ...however we should have reached the final value
5758 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5760 application.SendNotification();
5761 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5763 // We did expect the animation to finish
5764 application.SendNotification();
5765 finishCheck.CheckSignalReceived();
5766 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5768 // Check that nothing has changed after a couple of buffer swaps
5769 application.Render(0);
5770 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5771 application.Render(0);
5772 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5776 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5778 TestApplication application;
5780 Actor actor = Actor::New();
5782 // Register a boolean property
5783 bool startValue(false);
5784 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5785 application.GetScene().Add(actor);
5786 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5787 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5789 // Build the animation
5790 float durationSeconds(2.0f);
5791 Animation animation = Animation::New(durationSeconds);
5792 bool finalValue( !startValue );
5793 float animatorDurationSeconds(durationSeconds * 0.5f);
5794 animation.AnimateTo( Property(actor, index),
5796 AlphaFunction::LINEAR,
5797 TimePeriod( animatorDurationSeconds ) );
5799 // Start the animation
5802 bool signalReceived(false);
5803 AnimationFinishCheck finishCheck(signalReceived);
5804 animation.FinishedSignal().Connect(&application, finishCheck);
5806 application.SendNotification();
5807 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5809 // We didn't expect the animation to finish yet
5810 application.SendNotification();
5811 finishCheck.CheckSignalNotReceived();
5812 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5814 application.SendNotification();
5815 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5817 // We didn't expect the animation to finish yet...
5818 application.SendNotification();
5819 finishCheck.CheckSignalNotReceived();
5821 // ...however we should have reached the final value
5822 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5824 application.SendNotification();
5825 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5827 // We did expect the animation to finish
5828 application.SendNotification();
5829 finishCheck.CheckSignalReceived();
5830 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5832 // Check that nothing has changed after a couple of buffer swaps
5833 application.Render(0);
5834 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5835 application.Render(0);
5836 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5840 int UtcDaliAnimationAnimateToFloatP(void)
5842 TestApplication application;
5844 Actor actor = Actor::New();
5846 // Register a float property
5847 float startValue(10.0f);
5848 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5849 application.GetScene().Add(actor);
5850 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5851 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5853 // Build the animation
5854 float durationSeconds(2.0f);
5855 Animation animation = Animation::New(durationSeconds);
5856 float targetValue(50.0f);
5857 float relativeValue(targetValue - startValue);
5858 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5860 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5862 // Start the animation
5865 bool signalReceived(false);
5866 AnimationFinishCheck finishCheck(signalReceived);
5867 animation.FinishedSignal().Connect(&application, finishCheck);
5869 application.SendNotification();
5870 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5872 // We didn't expect the animation to finish yet
5873 application.SendNotification();
5874 finishCheck.CheckSignalNotReceived();
5875 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5877 application.SendNotification();
5878 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5880 // We did expect the animation to finish
5881 application.SendNotification();
5882 finishCheck.CheckSignalReceived();
5883 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5887 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5889 TestApplication application;
5891 Actor actor = Actor::New();
5893 // Register a float property
5894 float startValue(10.0f);
5895 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5896 application.GetScene().Add(actor);
5897 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5898 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5900 // Build the animation
5901 float durationSeconds(1.0f);
5902 Animation animation = Animation::New(durationSeconds);
5903 float targetValue(90.0f);
5904 float relativeValue(targetValue - startValue);
5905 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5907 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5909 // Start the animation
5912 bool signalReceived(false);
5913 AnimationFinishCheck finishCheck(signalReceived);
5914 animation.FinishedSignal().Connect(&application, finishCheck);
5916 application.SendNotification();
5917 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5919 // We didn't expect the animation to finish yet
5920 application.SendNotification();
5921 finishCheck.CheckSignalNotReceived();
5923 // The position should have moved more, than with a linear alpha function
5924 float current( actor.GetCurrentProperty< float >( index ) );
5925 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5927 application.SendNotification();
5928 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5930 // We did expect the animation to finish
5931 application.SendNotification();
5932 finishCheck.CheckSignalReceived();
5933 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5937 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5939 TestApplication application;
5941 Actor actor = Actor::New();
5943 // Register a float property
5944 float startValue(10.0f);
5945 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5946 application.GetScene().Add(actor);
5947 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5948 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5950 // Build the animation
5951 float durationSeconds(1.0f);
5952 Animation animation = Animation::New(durationSeconds);
5953 float targetValue(30.0f);
5954 float relativeValue(targetValue - startValue);
5956 animation.AnimateTo(Property(actor, index),
5958 TimePeriod(delay, durationSeconds - delay));
5960 // Start the animation
5963 bool signalReceived(false);
5964 AnimationFinishCheck finishCheck(signalReceived);
5965 animation.FinishedSignal().Connect(&application, finishCheck);
5967 application.SendNotification();
5968 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5970 // We didn't expect the animation to finish yet
5971 application.SendNotification();
5972 finishCheck.CheckSignalNotReceived();
5973 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5975 application.SendNotification();
5976 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5978 // We didn't expect the animation to finish yet
5979 application.SendNotification();
5980 finishCheck.CheckSignalNotReceived();
5981 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5983 application.SendNotification();
5984 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5986 // We did expect the animation to finish
5987 application.SendNotification();
5988 finishCheck.CheckSignalReceived();
5989 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5993 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5995 TestApplication application;
5997 Actor actor = Actor::New();
5999 // Register a float property
6000 float startValue(10.0f);
6001 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6002 application.GetScene().Add(actor);
6003 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
6004 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
6006 // Build the animation
6007 float durationSeconds(1.0f);
6008 Animation animation = Animation::New(durationSeconds);
6009 float targetValue(30.0f);
6010 float relativeValue(targetValue - startValue);
6012 animation.AnimateTo(Property(actor, index),
6014 AlphaFunction::LINEAR,
6015 TimePeriod(delay, durationSeconds - delay));
6017 // Start the animation
6020 bool signalReceived(false);
6021 AnimationFinishCheck finishCheck(signalReceived);
6022 animation.FinishedSignal().Connect(&application, finishCheck);
6024 application.SendNotification();
6025 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6027 // We didn't expect the animation to finish yet
6028 application.SendNotification();
6029 finishCheck.CheckSignalNotReceived();
6030 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
6032 application.SendNotification();
6033 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6035 // We didn't expect the animation to finish yet
6036 application.SendNotification();
6037 finishCheck.CheckSignalNotReceived();
6038 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6040 application.SendNotification();
6041 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6043 // We did expect the animation to finish
6044 application.SendNotification();
6045 finishCheck.CheckSignalReceived();
6046 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
6050 int UtcDaliAnimationAnimateToIntegerP(void)
6052 TestApplication application;
6054 Actor actor = Actor::New();
6056 // Register an integer property
6058 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6059 application.GetScene().Add(actor);
6060 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6061 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6063 // Build the animation
6064 float durationSeconds(2.0f);
6065 Animation animation = Animation::New(durationSeconds);
6066 int targetValue(50);
6067 int relativeValue(targetValue - startValue);
6068 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
6070 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
6072 // Start the animation
6075 bool signalReceived(false);
6076 AnimationFinishCheck finishCheck(signalReceived);
6077 animation.FinishedSignal().Connect(&application, finishCheck);
6079 application.SendNotification();
6080 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6082 // We didn't expect the animation to finish yet
6083 application.SendNotification();
6084 finishCheck.CheckSignalNotReceived();
6085 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6087 application.SendNotification();
6088 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6090 // We did expect the animation to finish
6091 application.SendNotification();
6092 finishCheck.CheckSignalReceived();
6093 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6097 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
6099 TestApplication application;
6101 Actor actor = Actor::New();
6103 // Register an integer property
6105 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6106 application.GetScene().Add(actor);
6107 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6108 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6110 // Build the animation
6111 float durationSeconds(1.0f);
6112 Animation animation = Animation::New(durationSeconds);
6113 int targetValue(90);
6114 int relativeValue(targetValue - startValue);
6115 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6117 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
6119 // Start the animation
6122 bool signalReceived(false);
6123 AnimationFinishCheck finishCheck(signalReceived);
6124 animation.FinishedSignal().Connect(&application, finishCheck);
6126 application.SendNotification();
6127 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6129 // We didn't expect the animation to finish yet
6130 application.SendNotification();
6131 finishCheck.CheckSignalNotReceived();
6133 // The position should have moved more, than with a linear alpha function
6134 int current( actor.GetCurrentProperty< int >( index ) );
6135 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
6137 application.SendNotification();
6138 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6140 // We did expect the animation to finish
6141 application.SendNotification();
6142 finishCheck.CheckSignalReceived();
6143 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6147 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
6149 TestApplication application;
6151 Actor actor = Actor::New();
6153 // Register an integer property
6155 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6156 application.GetScene().Add(actor);
6157 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6158 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6160 // Build the animation
6161 float durationSeconds(1.0f);
6162 Animation animation = Animation::New(durationSeconds);
6163 int targetValue(30);
6164 int relativeValue(targetValue - startValue);
6166 animation.AnimateTo(Property(actor, index),
6168 TimePeriod(delay, durationSeconds - delay));
6170 // Start the animation
6173 bool signalReceived(false);
6174 AnimationFinishCheck finishCheck(signalReceived);
6175 animation.FinishedSignal().Connect(&application, finishCheck);
6177 application.SendNotification();
6178 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6180 // We didn't expect the animation to finish yet
6181 application.SendNotification();
6182 finishCheck.CheckSignalNotReceived();
6183 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6185 application.SendNotification();
6186 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6188 // We didn't expect the animation to finish yet
6189 application.SendNotification();
6190 finishCheck.CheckSignalNotReceived();
6191 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6193 application.SendNotification();
6194 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6196 // We did expect the animation to finish
6197 application.SendNotification();
6198 finishCheck.CheckSignalReceived();
6199 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6203 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
6205 TestApplication application;
6207 Actor actor = Actor::New();
6209 // Register an integer property
6211 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6212 application.GetScene().Add(actor);
6213 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
6214 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6216 // Build the animation
6217 float durationSeconds(1.0f);
6218 Animation animation = Animation::New(durationSeconds);
6219 int targetValue(30);
6220 int relativeValue(targetValue - startValue);
6222 animation.AnimateTo(Property(actor, index),
6224 AlphaFunction::LINEAR,
6225 TimePeriod(delay, durationSeconds - delay));
6227 // Start the animation
6230 bool signalReceived(false);
6231 AnimationFinishCheck finishCheck(signalReceived);
6232 animation.FinishedSignal().Connect(&application, finishCheck);
6234 application.SendNotification();
6235 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6237 // We didn't expect the animation to finish yet
6238 application.SendNotification();
6239 finishCheck.CheckSignalNotReceived();
6240 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
6242 application.SendNotification();
6243 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6245 // We didn't expect the animation to finish yet
6246 application.SendNotification();
6247 finishCheck.CheckSignalNotReceived();
6248 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
6250 application.SendNotification();
6251 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6253 // We did expect the animation to finish
6254 application.SendNotification();
6255 finishCheck.CheckSignalReceived();
6256 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
6260 int UtcDaliAnimationAnimateToVector2P(void)
6262 TestApplication application;
6264 Actor actor = Actor::New();
6266 // Register a Vector2 property
6267 Vector2 startValue(-50.0f, -50.0f);
6268 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6269 application.GetScene().Add(actor);
6270 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6271 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6273 // Build the animation
6274 float durationSeconds(2.0f);
6275 Animation animation = Animation::New(durationSeconds);
6276 Vector2 targetValue(50.0f, 50.0f);
6277 Vector2 relativeValue(targetValue - startValue);
6278 animation.AnimateTo(Property(actor, index), targetValue);
6280 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6282 // Start the animation
6285 bool signalReceived(false);
6286 AnimationFinishCheck finishCheck(signalReceived);
6287 animation.FinishedSignal().Connect(&application, finishCheck);
6289 application.SendNotification();
6290 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6292 // We didn't expect the animation to finish yet
6293 application.SendNotification();
6294 finishCheck.CheckSignalNotReceived();
6295 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6297 application.SendNotification();
6298 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6300 // We did expect the animation to finish
6301 application.SendNotification();
6302 finishCheck.CheckSignalReceived();
6303 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6307 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
6309 TestApplication application;
6311 Actor actor = Actor::New();
6313 // Register a Vector2 property
6314 Vector2 startValue(1000.0f, 1000.0f);
6315 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6316 application.GetScene().Add(actor);
6317 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6318 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6320 // Build the animation
6321 float durationSeconds(1.0f);
6322 Animation animation = Animation::New(durationSeconds);
6323 Vector2 targetValue(9000.0f, 9000.0f);
6324 Vector2 relativeValue(targetValue - startValue);
6325 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6327 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6329 // Start the animation
6332 bool signalReceived(false);
6333 AnimationFinishCheck finishCheck(signalReceived);
6334 animation.FinishedSignal().Connect(&application, finishCheck);
6336 application.SendNotification();
6337 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6339 // We didn't expect the animation to finish yet
6340 application.SendNotification();
6341 finishCheck.CheckSignalNotReceived();
6343 // The position should have moved more, than with a linear alpha function
6344 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
6345 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6346 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6348 application.SendNotification();
6349 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6351 // We did expect the animation to finish
6352 application.SendNotification();
6353 finishCheck.CheckSignalReceived();
6354 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6358 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6360 TestApplication application;
6362 Actor actor = Actor::New();
6364 // Register a Vector2 property
6365 Vector2 startValue(10.0f, 10.0f);
6366 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6367 application.GetScene().Add(actor);
6368 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6369 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6371 // Build the animation
6372 float durationSeconds(1.0f);
6373 Animation animation = Animation::New(durationSeconds);
6374 Vector2 targetValue(-10.0f, 20.0f);
6375 Vector2 relativeValue(targetValue - startValue);
6377 animation.AnimateTo(Property(actor, index),
6379 TimePeriod(delay, durationSeconds - delay));
6381 // Start the animation
6384 bool signalReceived(false);
6385 AnimationFinishCheck finishCheck(signalReceived);
6386 animation.FinishedSignal().Connect(&application, finishCheck);
6388 application.SendNotification();
6389 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6391 // We didn't expect the animation to finish yet
6392 application.SendNotification();
6393 finishCheck.CheckSignalNotReceived();
6394 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6396 application.SendNotification();
6397 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6399 // We didn't expect the animation to finish yet
6400 application.SendNotification();
6401 finishCheck.CheckSignalNotReceived();
6402 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6404 application.SendNotification();
6405 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6407 // We did expect the animation to finish
6408 application.SendNotification();
6409 finishCheck.CheckSignalReceived();
6410 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6414 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6416 TestApplication application;
6418 Actor actor = Actor::New();
6420 // Register a Vector2 property
6421 Vector2 startValue(10.0f, 10.0f);
6422 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6423 application.GetScene().Add(actor);
6424 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6425 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6427 // Build the animation
6428 float durationSeconds(1.0f);
6429 Animation animation = Animation::New(durationSeconds);
6430 Vector2 targetValue(30.0f, 30.0f);
6431 Vector2 relativeValue(targetValue - startValue);
6433 animation.AnimateTo(Property(actor, index),
6435 AlphaFunction::LINEAR,
6436 TimePeriod(delay, durationSeconds - delay));
6438 // Start the animation
6441 bool signalReceived(false);
6442 AnimationFinishCheck finishCheck(signalReceived);
6443 animation.FinishedSignal().Connect(&application, finishCheck);
6445 application.SendNotification();
6446 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6448 // We didn't expect the animation to finish yet, but cached value should be the final one
6449 application.SendNotification();
6450 finishCheck.CheckSignalNotReceived();
6451 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6452 DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
6454 application.SendNotification();
6455 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6457 // We didn't expect the animation to finish yet
6458 application.SendNotification();
6459 finishCheck.CheckSignalNotReceived();
6460 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6462 application.SendNotification();
6463 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6465 // We did expect the animation to finish
6466 application.SendNotification();
6467 finishCheck.CheckSignalReceived();
6468 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6469 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6473 int UtcDaliAnimationAnimateToVector3P(void)
6475 TestApplication application;
6477 Actor actor = Actor::New();
6479 // Register a Vector3 property
6480 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6481 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6482 application.GetScene().Add(actor);
6483 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
6484 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6486 // Build the animation
6487 float durationSeconds(2.0f);
6488 Animation animation = Animation::New(durationSeconds);
6489 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6490 Vector3 relativeValue(targetValue - startValue);
6491 animation.AnimateTo(Property(actor, index), targetValue);
6493 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6495 // Start the animation
6498 bool signalReceived(false);
6499 AnimationFinishCheck finishCheck(signalReceived);
6500 animation.FinishedSignal().Connect(&application, finishCheck);
6502 application.SendNotification();
6503 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6505 // We didn't expect the animation to finish yet
6506 application.SendNotification();
6507 finishCheck.CheckSignalNotReceived();
6508 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6510 application.SendNotification();
6511 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6513 // We did expect the animation to finish
6514 application.SendNotification();
6515 finishCheck.CheckSignalReceived();
6516 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6520 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6522 TestApplication application;
6524 Actor actor = Actor::New();
6526 // Register a Vector3 property
6527 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6528 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6529 application.GetScene().Add(actor);
6530 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6531 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6533 // Build the animation
6534 float durationSeconds(1.0f);
6535 Animation animation = Animation::New(durationSeconds);
6536 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6537 Vector3 relativeValue(targetValue - startValue);
6538 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6540 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6542 // Start the animation
6545 bool signalReceived(false);
6546 AnimationFinishCheck finishCheck(signalReceived);
6547 animation.FinishedSignal().Connect(&application, finishCheck);
6549 application.SendNotification();
6550 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6552 // We didn't expect the animation to finish yet
6553 application.SendNotification();
6554 finishCheck.CheckSignalNotReceived();
6556 // The position should have moved more, than with a linear alpha function
6557 Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
6558 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6559 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6560 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6562 application.SendNotification();
6563 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6565 // We did expect the animation to finish
6566 application.SendNotification();
6567 finishCheck.CheckSignalReceived();
6568 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6572 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6574 TestApplication application;
6576 Actor actor = Actor::New();
6578 // Register a Vector3 property
6579 Vector3 startValue(10.0f, 10.0f, 10.0f);
6580 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6581 application.GetScene().Add(actor);
6582 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6583 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6585 // Build the animation
6586 float durationSeconds(1.0f);
6587 Animation animation = Animation::New(durationSeconds);
6588 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6589 Vector3 relativeValue(targetValue - startValue);
6591 animation.AnimateTo(Property(actor, index),
6593 TimePeriod(delay, durationSeconds - delay));
6595 // Start the animation
6598 bool signalReceived(false);
6599 AnimationFinishCheck finishCheck(signalReceived);
6600 animation.FinishedSignal().Connect(&application, finishCheck);
6602 application.SendNotification();
6603 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6605 // We didn't expect the animation to finish yet
6606 application.SendNotification();
6607 finishCheck.CheckSignalNotReceived();
6608 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6610 application.SendNotification();
6611 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6613 // We didn't expect the animation to finish yet
6614 application.SendNotification();
6615 finishCheck.CheckSignalNotReceived();
6616 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6618 application.SendNotification();
6619 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6621 // We did expect the animation to finish
6622 application.SendNotification();
6623 finishCheck.CheckSignalReceived();
6624 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6628 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6630 TestApplication application;
6632 Actor actor = Actor::New();
6634 // Register a Vector3 property
6635 Vector3 startValue(10.0f, 10.0f, 10.0f);
6636 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6637 application.GetScene().Add(actor);
6638 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6639 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6641 // Build the animation
6642 float durationSeconds(1.0f);
6643 Animation animation = Animation::New(durationSeconds);
6644 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6645 Vector3 relativeValue(targetValue - startValue);
6647 animation.AnimateTo(Property(actor, "testProperty"),
6649 AlphaFunction::LINEAR,
6650 TimePeriod(delay, durationSeconds - delay));
6652 // Start the animation
6655 bool signalReceived(false);
6656 AnimationFinishCheck finishCheck(signalReceived);
6657 animation.FinishedSignal().Connect(&application, finishCheck);
6659 application.SendNotification();
6660 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6662 // We didn't expect the animation to finish yet
6663 application.SendNotification();
6664 finishCheck.CheckSignalNotReceived();
6665 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6667 application.SendNotification();
6668 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6670 // We didn't expect the animation to finish yet
6671 application.SendNotification();
6672 finishCheck.CheckSignalNotReceived();
6673 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6675 application.SendNotification();
6676 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6678 // We did expect the animation to finish
6679 application.SendNotification();
6680 finishCheck.CheckSignalReceived();
6681 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6685 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6687 TestApplication application;
6689 Actor actor = Actor::New();
6691 // Register a Vector3 property
6692 Vector3 startValue(10.0f, 10.0f, 10.0f);
6693 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6694 application.GetScene().Add(actor);
6695 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6696 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6698 // Build the animation
6699 float durationSeconds(1.0f);
6700 Animation animation = Animation::New(durationSeconds);
6701 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6702 Vector3 relativeValue(targetValue - startValue);
6704 animation.AnimateTo(Property(actor, "testProperty", 0),
6706 AlphaFunction::LINEAR,
6707 TimePeriod(delay, durationSeconds - delay));
6708 animation.AnimateTo(Property(actor, index, 1),
6710 AlphaFunction::LINEAR,
6711 TimePeriod(delay, durationSeconds - delay));
6713 // Start the animation
6716 bool signalReceived(false);
6717 AnimationFinishCheck finishCheck(signalReceived);
6718 animation.FinishedSignal().Connect(&application, finishCheck);
6720 application.SendNotification();
6721 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6723 // We didn't expect the animation to finish yet
6724 application.SendNotification();
6725 finishCheck.CheckSignalNotReceived();
6726 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6728 application.SendNotification();
6729 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6731 // We didn't expect the animation to finish yet
6732 application.SendNotification();
6733 finishCheck.CheckSignalNotReceived();
6734 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6736 application.SendNotification();
6737 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6739 // We did expect the animation to finish
6740 application.SendNotification();
6741 finishCheck.CheckSignalReceived();
6742 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6746 int UtcDaliAnimationAnimateToVector4P(void)
6748 TestApplication application;
6750 Actor actor = Actor::New();
6752 // Register a Vector4 property
6753 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6754 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6755 application.GetScene().Add(actor);
6756 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6757 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6759 // Build the animation
6760 float durationSeconds(2.0f);
6761 Animation animation = Animation::New(durationSeconds);
6762 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6763 Vector4 relativeValue(targetValue - startValue);
6764 animation.AnimateTo(Property(actor, index), targetValue);
6766 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6768 // Start the animation
6771 bool signalReceived(false);
6772 AnimationFinishCheck finishCheck(signalReceived);
6773 animation.FinishedSignal().Connect(&application, finishCheck);
6775 application.SendNotification();
6776 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6778 // We didn't expect the animation to finish yet
6779 application.SendNotification();
6780 finishCheck.CheckSignalNotReceived();
6781 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6783 application.SendNotification();
6784 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6786 // We did expect the animation to finish
6787 application.SendNotification();
6788 finishCheck.CheckSignalReceived();
6789 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6793 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6795 TestApplication application;
6797 Actor actor = Actor::New();
6799 // Register a Vector4 property
6800 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6801 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6802 application.GetScene().Add(actor);
6803 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6804 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6806 // Build the animation
6807 float durationSeconds(1.0f);
6808 Animation animation = Animation::New(durationSeconds);
6809 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6810 Vector4 relativeValue(targetValue - startValue);
6811 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6813 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6815 // Start the animation
6818 bool signalReceived(false);
6819 AnimationFinishCheck finishCheck(signalReceived);
6820 animation.FinishedSignal().Connect(&application, finishCheck);
6822 application.SendNotification();
6823 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6825 // We didn't expect the animation to finish yet
6826 application.SendNotification();
6827 finishCheck.CheckSignalNotReceived();
6829 // The position should have moved more, than with a linear alpha function
6830 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6831 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6832 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6833 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6834 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6836 application.SendNotification();
6837 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6839 // We did expect the animation to finish
6840 application.SendNotification();
6841 finishCheck.CheckSignalReceived();
6842 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6846 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6848 TestApplication application;
6850 Actor actor = Actor::New();
6852 // Register a Vector4 property
6853 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6854 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6855 application.GetScene().Add(actor);
6856 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6857 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6859 // Build the animation
6860 float durationSeconds(1.0f);
6861 Animation animation = Animation::New(durationSeconds);
6862 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6863 Vector4 relativeValue(targetValue - startValue);
6865 animation.AnimateTo(Property(actor, index),
6867 TimePeriod(delay, durationSeconds - delay));
6869 // Start the animation
6872 bool signalReceived(false);
6873 AnimationFinishCheck finishCheck(signalReceived);
6874 animation.FinishedSignal().Connect(&application, finishCheck);
6876 application.SendNotification();
6877 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6879 // We didn't expect the animation to finish yet
6880 application.SendNotification();
6881 finishCheck.CheckSignalNotReceived();
6882 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6884 application.SendNotification();
6885 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6887 // We didn't expect the animation to finish yet
6888 application.SendNotification();
6889 finishCheck.CheckSignalNotReceived();
6890 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6892 application.SendNotification();
6893 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6895 // We did expect the animation to finish
6896 application.SendNotification();
6897 finishCheck.CheckSignalReceived();
6898 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6902 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6904 TestApplication application;
6906 Actor actor = Actor::New();
6908 // Register a Vector4 property
6909 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6910 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6911 application.GetScene().Add(actor);
6912 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6913 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6915 // Build the animation
6916 float durationSeconds(1.0f);
6917 Animation animation = Animation::New(durationSeconds);
6918 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6919 Vector4 relativeValue(targetValue - startValue);
6921 animation.AnimateTo(Property(actor, index),
6923 AlphaFunction::LINEAR,
6924 TimePeriod(delay, durationSeconds - delay));
6926 // Start the animation
6929 bool signalReceived(false);
6930 AnimationFinishCheck finishCheck(signalReceived);
6931 animation.FinishedSignal().Connect(&application, finishCheck);
6933 application.SendNotification();
6934 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6936 // We didn't expect the animation to finish yet
6937 application.SendNotification();
6938 finishCheck.CheckSignalNotReceived();
6939 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6941 application.SendNotification();
6942 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6944 // We didn't expect the animation to finish yet
6945 application.SendNotification();
6946 finishCheck.CheckSignalNotReceived();
6947 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6949 application.SendNotification();
6950 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6952 // We did expect the animation to finish
6953 application.SendNotification();
6954 finishCheck.CheckSignalReceived();
6955 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6959 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6961 TestApplication application;
6963 Actor actor = Actor::New();
6964 application.GetScene().Add(actor);
6965 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6967 // Build the animation
6968 float durationSeconds(1.0f);
6969 Animation animation = Animation::New(durationSeconds);
6970 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6972 DALI_TEST_ASSERTION(
6974 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6975 }, "Property is not animatable" );
6980 int UtcDaliAnimationAnimateToActorParentOriginXN(void)
6982 TestApplication application;
6984 Actor actor = Actor::New();
6985 application.GetScene().Add(actor);
6986 float startValue(0.0f);
6987 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).x, startValue, TEST_LOCATION );
6988 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6990 // Build the animation
6991 float durationSeconds(1.0f);
6992 Animation animation = Animation::New(durationSeconds);
6993 float targetX(1.0f);
6995 DALI_TEST_ASSERTION(
6997 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6998 }, "Property is not animatable" );
7003 int UtcDaliAnimationAnimateToActorParentOriginYN(void)
7005 TestApplication application;
7007 Actor actor = Actor::New();
7008 application.GetScene().Add(actor);
7009 float startValue(0.0f);
7010 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).y, startValue, TEST_LOCATION );
7011 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
7013 // Build the animation
7014 float durationSeconds(1.0f);
7015 Animation animation = Animation::New(durationSeconds);
7016 float targetY(1.0f);
7018 DALI_TEST_ASSERTION(
7020 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
7021 }, "Property is not animatable" );
7026 int UtcDaliAnimationAnimateToActorParentOriginZN(void)
7028 TestApplication application;
7030 Actor actor = Actor::New();
7031 application.GetScene().Add(actor);
7032 float startValue(0.5f);
7033 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).z, startValue, TEST_LOCATION );
7034 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
7036 // Build the animation
7037 float durationSeconds(1.0f);
7038 Animation animation = Animation::New(durationSeconds);
7039 float targetZ(1.0f);
7041 DALI_TEST_ASSERTION(
7043 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
7044 }, "Property is not animatable" );
7049 int UtcDaliAnimationAnimateToActorAnchorPointN(void)
7051 TestApplication application;
7053 Actor actor = Actor::New();
7054 application.GetScene().Add(actor);
7055 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::CENTER, TEST_LOCATION );
7057 // Build the animation
7058 float durationSeconds(1.0f);
7059 Animation animation = Animation::New(durationSeconds);
7060 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
7062 DALI_TEST_ASSERTION(
7064 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
7065 }, "Property is not animatable" );
7070 int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
7072 TestApplication application;
7074 Actor actor = Actor::New();
7075 application.GetScene().Add(actor);
7076 float startValue(0.5f);
7077 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).x, startValue, TEST_LOCATION );
7078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
7080 // Build the animation
7081 float durationSeconds(1.0f);
7082 Animation animation = Animation::New(durationSeconds);
7083 float targetX(1.0f);
7085 DALI_TEST_ASSERTION(
7087 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
7088 }, "Property is not animatable" );
7093 int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
7095 TestApplication application;
7097 Actor actor = Actor::New();
7098 application.GetScene().Add(actor);
7099 float startValue(0.5f);
7100 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).y, startValue, TEST_LOCATION );
7101 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
7103 // Build the animation
7104 float durationSeconds(1.0f);
7105 Animation animation = Animation::New(durationSeconds);
7106 float targetY(0.0f);
7108 DALI_TEST_ASSERTION(
7110 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
7111 }, "Property is not animatable" );
7116 int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
7118 TestApplication application;
7120 Actor actor = Actor::New();
7121 application.GetScene().Add(actor);
7122 float startValue(0.5f);
7123 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).z, startValue, TEST_LOCATION );
7124 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
7126 // Build the animation
7127 float durationSeconds(1.0f);
7128 Animation animation = Animation::New(durationSeconds);
7129 float targetZ(100.0f);
7131 DALI_TEST_ASSERTION(
7133 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
7134 }, "Property is not animatable" );
7139 int UtcDaliAnimationAnimateToActorSizeP(void)
7141 TestApplication application;
7143 Actor actor = Actor::New();
7144 application.GetScene().Add(actor);
7145 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7147 // Build the animation
7148 float durationSeconds(1.0f);
7149 Animation animation = Animation::New(durationSeconds);
7150 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7151 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
7153 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7155 // Should return the initial properties before play
7156 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7157 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
7158 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
7159 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
7161 // Start the animation
7164 // Should return the target property after play
7165 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7166 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
7167 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
7168 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
7170 bool signalReceived(false);
7171 AnimationFinishCheck finishCheck(signalReceived);
7172 animation.FinishedSignal().Connect(&application, finishCheck);
7174 application.SendNotification();
7175 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7177 // We didn't expect the animation to finish yet
7178 application.SendNotification();
7179 finishCheck.CheckSignalNotReceived();
7180 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), ninetyNinePercentProgress, TEST_LOCATION );
7182 application.SendNotification();
7183 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7185 // We did expect the animation to finish
7186 application.SendNotification();
7187 finishCheck.CheckSignalReceived();
7188 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7191 finishCheck.Reset();
7192 actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
7193 application.SendNotification();
7194 application.Render(0);
7195 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7197 // Repeat with a different (ease-in) alpha function
7198 animation = Animation::New(durationSeconds);
7199 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
7200 animation.FinishedSignal().Connect(&application, finishCheck);
7203 application.SendNotification();
7204 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7206 // We didn't expect the animation to finish yet
7207 application.SendNotification();
7208 finishCheck.CheckSignalNotReceived();
7210 // The size should have travelled less, than with a linear alpha function
7211 Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
7212 DALI_TEST_CHECK( current.x > 0.0f );
7213 DALI_TEST_CHECK( current.y > 0.0f );
7214 DALI_TEST_CHECK( current.z > 0.0f );
7215 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7216 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7217 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7219 application.SendNotification();
7220 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7222 // We did expect the animation to finish
7223 application.SendNotification();
7224 finishCheck.CheckSignalReceived();
7225 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7228 finishCheck.Reset();
7229 actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
7230 application.SendNotification();
7231 application.Render(0);
7232 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7234 // Repeat with a delay
7236 animation = Animation::New(durationSeconds);
7237 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7238 animation.FinishedSignal().Connect(&application, finishCheck);
7241 application.SendNotification();
7242 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7244 // We didn't expect the animation to finish yet
7245 application.SendNotification();
7246 finishCheck.CheckSignalNotReceived();
7247 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7249 application.SendNotification();
7250 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7252 // We did expect the animation to finish
7253 application.SendNotification();
7254 finishCheck.CheckSignalReceived();
7255 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7259 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
7261 TestApplication application;
7263 Actor actor = Actor::New();
7264 application.GetScene().Add(actor);
7265 float startValue(0.0f);
7266 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, startValue, TEST_LOCATION );
7267 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
7269 // Build the animation
7270 float durationSeconds(1.0f);
7271 Animation animation = Animation::New(durationSeconds);
7272 float targetWidth(10.0f);
7273 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
7275 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
7277 // Should return the initial properties before play
7278 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7279 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
7281 // Start the animation
7284 // Should return the target property after play
7285 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
7286 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
7288 bool signalReceived(false);
7289 AnimationFinishCheck finishCheck(signalReceived);
7290 animation.FinishedSignal().Connect(&application, finishCheck);
7292 application.SendNotification();
7293 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7295 // We didn't expect the animation to finish yet
7296 application.SendNotification();
7297 finishCheck.CheckSignalNotReceived();
7298 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, fiftyPercentProgress, TEST_LOCATION );
7300 application.SendNotification();
7301 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7303 // We did expect the animation to finish
7304 application.SendNotification();
7305 finishCheck.CheckSignalReceived();
7306 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, targetWidth, TEST_LOCATION );
7307 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
7311 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7313 TestApplication application;
7315 Actor actor = Actor::New();
7316 application.GetScene().Add(actor);
7317 float startValue(0.0f);
7318 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, startValue, TEST_LOCATION );
7319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
7321 // Build the animation
7322 float durationSeconds(1.0f);
7323 Animation animation = Animation::New(durationSeconds);
7324 float targetHeight(-10.0f);
7325 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
7327 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
7329 // Should return the initial properties before play
7330 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7331 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
7333 // Start the animation
7336 // Should return the target property after play
7337 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
7338 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
7340 bool signalReceived(false);
7341 AnimationFinishCheck finishCheck(signalReceived);
7342 animation.FinishedSignal().Connect(&application, finishCheck);
7344 application.SendNotification();
7345 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7347 // We didn't expect the animation to finish yet
7348 application.SendNotification();
7349 finishCheck.CheckSignalNotReceived();
7350 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, fiftyPercentProgress, TEST_LOCATION );
7352 application.SendNotification();
7353 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7355 // We did expect the animation to finish
7356 application.SendNotification();
7357 finishCheck.CheckSignalReceived();
7358 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, targetHeight, TEST_LOCATION );
7359 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
7363 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7365 TestApplication application;
7367 Actor actor = Actor::New();
7368 application.GetScene().Add(actor);
7369 float startValue(0.0f);
7370 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, startValue, TEST_LOCATION );
7371 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
7373 // Build the animation
7374 float durationSeconds(1.0f);
7375 Animation animation = Animation::New(durationSeconds);
7376 float targetDepth(-10.0f);
7377 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
7379 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
7381 // Should return the initial properties before play
7382 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7383 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
7385 // Start the animation
7388 // Should return the target property after play
7389 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
7390 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
7392 bool signalReceived(false);
7393 AnimationFinishCheck finishCheck(signalReceived);
7394 animation.FinishedSignal().Connect(&application, finishCheck);
7396 application.SendNotification();
7397 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7399 // We didn't expect the animation to finish yet
7400 application.SendNotification();
7401 finishCheck.CheckSignalNotReceived();
7402 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, fiftyPercentProgress, TEST_LOCATION );
7404 application.SendNotification();
7405 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7407 // We did expect the animation to finish
7408 application.SendNotification();
7409 finishCheck.CheckSignalReceived();
7410 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, targetDepth, TEST_LOCATION );
7411 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
7415 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7417 TestApplication application;
7419 Actor actor = Actor::New();
7420 application.GetScene().Add(actor);
7421 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7423 // Build the animation
7424 float durationSeconds(1.0f);
7425 Animation animation = Animation::New(durationSeconds);
7426 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7427 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
7429 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7431 // Start the animation
7434 bool signalReceived(false);
7435 AnimationFinishCheck finishCheck(signalReceived);
7436 animation.FinishedSignal().Connect(&application, finishCheck);
7438 application.SendNotification();
7439 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7441 // We didn't expect the animation to finish yet
7442 application.SendNotification();
7443 finishCheck.CheckSignalNotReceived();
7444 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), ninetyNinePercentProgress, TEST_LOCATION );
7446 application.SendNotification();
7447 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7449 // We did expect the animation to finish
7450 application.SendNotification();
7451 finishCheck.CheckSignalReceived();
7452 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
7455 finishCheck.Reset();
7456 actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
7457 application.SendNotification();
7458 application.Render(0);
7459 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7461 // Repeat with a different (ease-in) alpha function
7462 animation = Animation::New(durationSeconds);
7463 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
7464 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
7465 animation.FinishedSignal().Connect(&application, finishCheck);
7468 application.SendNotification();
7469 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7471 // We didn't expect the animation to finish yet
7472 application.SendNotification();
7473 finishCheck.CheckSignalNotReceived();
7475 // The size should have travelled less, than with a linear alpha function
7476 Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
7477 DALI_TEST_CHECK( current.x > 0.0f );
7478 DALI_TEST_CHECK( current.y > 0.0f );
7479 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7480 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7482 application.SendNotification();
7483 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7485 // We did expect the animation to finish
7486 application.SendNotification();
7487 finishCheck.CheckSignalReceived();
7488 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).x, targetSize.x, TEST_LOCATION );
7489 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, targetSize.y, TEST_LOCATION );
7492 finishCheck.Reset();
7493 actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
7494 application.SendNotification();
7495 application.Render(0);
7496 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7498 // Repeat with a delay
7500 animation = Animation::New(durationSeconds);
7501 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7502 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7503 animation.FinishedSignal().Connect(&application, finishCheck);
7506 application.SendNotification();
7507 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7509 // We didn't expect the animation to finish yet
7510 application.SendNotification();
7511 finishCheck.CheckSignalNotReceived();
7512 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7514 application.SendNotification();
7515 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7517 // We did expect the animation to finish
7518 application.SendNotification();
7519 finishCheck.CheckSignalReceived();
7520 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).x, targetSize.x, TEST_LOCATION );
7521 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, targetSize.y, TEST_LOCATION );
7525 int UtcDaliAnimationAnimateToActorPositionP(void)
7527 TestApplication application;
7529 Actor actor = Actor::New();
7530 application.GetScene().Add(actor);
7531 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7533 // Build the animation
7534 float durationSeconds(1.0f);
7535 Animation animation = Animation::New(durationSeconds);
7536 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7537 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7539 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7541 // Should return the initial properties before play
7542 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7543 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
7544 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
7545 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
7547 // Start the animation
7550 // Should return the target property after play
7551 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7552 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
7553 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
7554 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
7556 bool signalReceived(false);
7557 AnimationFinishCheck finishCheck(signalReceived);
7558 animation.FinishedSignal().Connect(&application, finishCheck);
7560 application.SendNotification();
7561 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7563 // We didn't expect the animation to finish yet
7564 application.SendNotification();
7565 finishCheck.CheckSignalNotReceived();
7566 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION );
7568 application.SendNotification();
7569 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7571 // We did expect the animation to finish
7572 application.SendNotification();
7573 finishCheck.CheckSignalReceived();
7574 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7578 int UtcDaliAnimationAnimateToActorPositionXP(void)
7580 TestApplication application;
7582 Actor actor = Actor::New();
7583 application.GetScene().Add(actor);
7584 float startValue(0.0f);
7585 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, startValue, TEST_LOCATION );
7586 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7587 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7588 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7590 // Build the animation
7591 float durationSeconds(1.0f);
7592 Animation animation = Animation::New(durationSeconds);
7593 float targetX(1.0f);
7594 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
7596 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7598 // Should return the initial properties before play
7599 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7600 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
7602 // Start the animation
7605 // Should return the target property after play
7606 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7607 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7609 bool signalReceived(false);
7610 AnimationFinishCheck finishCheck(signalReceived);
7611 animation.FinishedSignal().Connect(&application, finishCheck);
7613 application.SendNotification();
7614 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7616 // We didn't expect the animation to finish yet
7617 application.SendNotification();
7618 finishCheck.CheckSignalNotReceived();
7619 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, fiftyPercentProgress, TEST_LOCATION );
7621 application.SendNotification();
7622 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7624 // We did expect the animation to finish
7625 application.SendNotification();
7626 finishCheck.CheckSignalReceived();
7627 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, targetX, TEST_LOCATION );
7628 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7629 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7630 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7634 int UtcDaliAnimationAnimateToActorPositionYP(void)
7636 TestApplication application;
7638 Actor actor = Actor::New();
7639 application.GetScene().Add(actor);
7640 float startValue(0.0f);
7641 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, startValue, TEST_LOCATION );
7642 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7643 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7644 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7646 // Build the animation
7647 float durationSeconds(1.0f);
7648 Animation animation = Animation::New(durationSeconds);
7649 float targetY(10.0f);
7650 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7652 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7654 // Should return the initial properties before play
7655 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7656 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7658 // Start the animation
7661 // Should return the target property after play
7662 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7663 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7665 bool signalReceived(false);
7666 AnimationFinishCheck finishCheck(signalReceived);
7667 animation.FinishedSignal().Connect(&application, finishCheck);
7669 application.SendNotification();
7670 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7672 // We didn't expect the animation to finish yet
7673 application.SendNotification();
7674 finishCheck.CheckSignalNotReceived();
7675 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, fiftyPercentProgress, TEST_LOCATION );
7677 application.SendNotification();
7678 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7680 // We did expect the animation to finish
7681 application.SendNotification();
7682 finishCheck.CheckSignalReceived();
7683 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, targetY, TEST_LOCATION );
7684 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7685 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7686 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7690 int UtcDaliAnimationAnimateToActorPositionZP(void)
7692 TestApplication application;
7694 Actor actor = Actor::New();
7695 application.GetScene().Add(actor);
7696 float startValue(0.0f);
7697 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, startValue, TEST_LOCATION );
7698 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7699 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7700 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7702 // Build the animation
7703 float durationSeconds(1.0f);
7704 Animation animation = Animation::New(durationSeconds);
7705 float targetZ(-5.0f);
7706 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7708 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7710 // Should return the initial properties before play
7711 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7712 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7714 // Start the animation
7717 // Should return the target property after play
7718 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7719 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7721 bool signalReceived(false);
7722 AnimationFinishCheck finishCheck(signalReceived);
7723 animation.FinishedSignal().Connect(&application, finishCheck);
7725 application.SendNotification();
7726 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7728 // We didn't expect the animation to finish yet
7729 application.SendNotification();
7730 finishCheck.CheckSignalNotReceived();
7731 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, fiftyPercentProgress, TEST_LOCATION );
7733 application.SendNotification();
7734 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7736 // We did expect the animation to finish
7737 application.SendNotification();
7738 finishCheck.CheckSignalReceived();
7739 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, targetZ, TEST_LOCATION );
7740 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7741 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7742 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7746 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7748 TestApplication application;
7750 Actor actor = Actor::New();
7751 application.GetScene().Add(actor);
7752 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7754 // Build the animation
7755 float durationSeconds(1.0f);
7756 Animation animation = Animation::New(durationSeconds);
7757 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7758 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7760 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7762 // Start the animation
7765 bool signalReceived(false);
7766 AnimationFinishCheck finishCheck(signalReceived);
7767 animation.FinishedSignal().Connect(&application, finishCheck);
7769 application.SendNotification();
7770 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7772 // We didn't expect the animation to finish yet
7773 application.SendNotification();
7774 finishCheck.CheckSignalNotReceived();
7776 // The position should have moved less, than with a linear alpha function
7777 Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
7778 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7779 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7780 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7781 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7782 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7783 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7785 application.SendNotification();
7786 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7788 // We did expect the animation to finish
7789 application.SendNotification();
7790 finishCheck.CheckSignalReceived();
7791 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7795 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7797 TestApplication application;
7799 Actor actor = Actor::New();
7800 application.GetScene().Add(actor);
7801 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7803 // Build the animation
7804 float durationSeconds(1.0f);
7805 Animation animation = Animation::New(durationSeconds);
7806 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7808 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7810 TimePeriod( delay, durationSeconds - delay ) );
7812 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7814 // Start the animation
7817 bool signalReceived(false);
7818 AnimationFinishCheck finishCheck(signalReceived);
7819 animation.FinishedSignal().Connect(&application, finishCheck);
7821 application.SendNotification();
7822 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7824 // We didn't expect the animation to finish yet
7825 application.SendNotification();
7826 finishCheck.CheckSignalNotReceived();
7827 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7829 application.SendNotification();
7830 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7832 // We didn't expect the animation to finish yet
7833 application.SendNotification();
7834 finishCheck.CheckSignalNotReceived();
7835 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION );
7837 application.SendNotification();
7838 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7840 // We did expect the animation to finish
7841 application.SendNotification();
7842 finishCheck.CheckSignalReceived();
7843 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7847 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7849 TestApplication application;
7851 Actor actor = Actor::New();
7852 application.GetScene().Add(actor);
7853 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7855 // Build the animation
7856 float durationSeconds(1.0f);
7857 Animation animation = Animation::New(durationSeconds);
7858 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7860 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7862 AlphaFunction::LINEAR,
7863 TimePeriod( delay, durationSeconds - delay ) );
7865 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7867 // Start the animation
7870 bool signalReceived(false);
7871 AnimationFinishCheck finishCheck(signalReceived);
7872 animation.FinishedSignal().Connect(&application, finishCheck);
7874 application.SendNotification();
7875 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7877 // We didn't expect the animation to finish yet
7878 application.SendNotification();
7879 finishCheck.CheckSignalNotReceived();
7880 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7882 application.SendNotification();
7883 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7885 // We didn't expect the animation to finish yet
7886 application.SendNotification();
7887 finishCheck.CheckSignalNotReceived();
7888 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION );
7890 application.SendNotification();
7891 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7893 // We did expect the animation to finish
7894 application.SendNotification();
7895 finishCheck.CheckSignalReceived();
7896 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7900 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7902 TestApplication application;
7904 Actor actor = Actor::New();
7905 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7906 application.GetScene().Add(actor);
7907 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7909 // Build the animation
7910 float durationSeconds(1.0f);
7911 Animation animation = Animation::New(durationSeconds);
7912 Degree targetRotationDegrees(90.0f);
7913 Radian targetRotationRadians(targetRotationDegrees);
7914 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7916 // Start the animation
7919 // Target value should be retrievable straight away
7920 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7922 bool signalReceived(false);
7923 AnimationFinishCheck finishCheck(signalReceived);
7924 animation.FinishedSignal().Connect(&application, finishCheck);
7926 application.SendNotification();
7927 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7929 // We didn't expect the animation to finish yet
7930 application.SendNotification();
7931 finishCheck.CheckSignalNotReceived();
7932 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7934 application.SendNotification();
7935 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7937 // We didn't expect the animation to finish yet
7938 application.SendNotification();
7939 finishCheck.CheckSignalNotReceived();
7940 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7942 application.SendNotification();
7943 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7945 // We didn't expect the animation to finish yet
7946 application.SendNotification();
7947 finishCheck.CheckSignalNotReceived();
7948 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7950 application.SendNotification();
7951 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7953 // We did expect the animation to finish
7954 application.SendNotification();
7955 finishCheck.CheckSignalReceived();
7956 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7960 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7962 TestApplication application;
7964 Actor actor = Actor::New();
7965 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7966 application.GetScene().Add(actor);
7967 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7969 // Build the animation
7970 float durationSeconds(1.0f);
7971 Animation animation = Animation::New(durationSeconds);
7972 Degree targetRotationDegrees(90.0f);
7973 Radian targetRotationRadians(targetRotationDegrees);
7974 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7975 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7977 // Start the animation
7980 bool signalReceived(false);
7981 AnimationFinishCheck finishCheck(signalReceived);
7982 animation.FinishedSignal().Connect(&application, finishCheck);
7984 application.SendNotification();
7985 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7987 // We didn't expect the animation to finish yet
7988 application.SendNotification();
7989 finishCheck.CheckSignalNotReceived();
7990 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7992 application.SendNotification();
7993 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7995 // We didn't expect the animation to finish yet
7996 application.SendNotification();
7997 finishCheck.CheckSignalNotReceived();
7998 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8000 application.SendNotification();
8001 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8003 // We didn't expect the animation to finish yet
8004 application.SendNotification();
8005 finishCheck.CheckSignalNotReceived();
8006 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8008 application.SendNotification();
8009 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8011 // We did expect the animation to finish
8012 application.SendNotification();
8013 finishCheck.CheckSignalReceived();
8014 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8018 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
8020 TestApplication application;
8022 Actor actor = Actor::New();
8023 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8024 application.GetScene().Add(actor);
8025 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8027 // Build the animation
8028 float durationSeconds(1.0f);
8029 Animation animation = Animation::New(durationSeconds);
8030 Degree targetRotationDegrees(90.0f);
8031 Radian targetRotationRadians(targetRotationDegrees);
8032 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
8034 // Start the animation
8037 bool signalReceived(false);
8038 AnimationFinishCheck finishCheck(signalReceived);
8039 animation.FinishedSignal().Connect(&application, finishCheck);
8041 application.SendNotification();
8042 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8044 // We didn't expect the animation to finish yet
8045 application.SendNotification();
8046 finishCheck.CheckSignalNotReceived();
8047 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8049 application.SendNotification();
8050 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8052 // We didn't expect the animation to finish yet
8053 application.SendNotification();
8054 finishCheck.CheckSignalNotReceived();
8055 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8057 application.SendNotification();
8058 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8060 // We didn't expect the animation to finish yet
8061 application.SendNotification();
8062 finishCheck.CheckSignalNotReceived();
8063 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8065 application.SendNotification();
8066 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8068 // We did expect the animation to finish
8069 application.SendNotification();
8070 finishCheck.CheckSignalReceived();
8071 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8075 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
8077 TestApplication application;
8079 Actor actor = Actor::New();
8080 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8081 application.GetScene().Add(actor);
8082 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8084 // Build the animation
8085 float durationSeconds(1.0f);
8086 Animation animation = Animation::New(durationSeconds);
8087 Degree targetRotationDegrees(90.0f);
8088 Radian targetRotationRadians(targetRotationDegrees);
8090 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
8092 // Start the animation
8095 bool signalReceived(false);
8096 AnimationFinishCheck finishCheck(signalReceived);
8097 animation.FinishedSignal().Connect(&application, finishCheck);
8099 application.SendNotification();
8100 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8102 // We didn't expect the animation to finish yet
8103 application.SendNotification();
8104 finishCheck.CheckSignalNotReceived();
8105 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8106 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8108 application.SendNotification();
8109 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8111 // We didn't expect the animation to finish yet
8112 application.SendNotification();
8113 finishCheck.CheckSignalNotReceived();
8114 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8115 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8117 application.SendNotification();
8118 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8120 // We didn't expect the animation to finish yet
8121 application.SendNotification();
8122 finishCheck.CheckSignalNotReceived();
8123 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8124 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8126 application.SendNotification();
8127 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8129 // We did expect the animation to finish
8130 application.SendNotification();
8131 finishCheck.CheckSignalReceived();
8132 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8136 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
8138 TestApplication application;
8140 Actor actor = Actor::New();
8141 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
8142 application.GetScene().Add(actor);
8143 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
8145 // Build the animation
8146 float durationSeconds(1.0f);
8147 Animation animation = Animation::New(durationSeconds);
8148 Degree targetRotationDegrees(90.0f);
8149 Radian targetRotationRadians(targetRotationDegrees);
8151 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
8153 // Start the animation
8156 bool signalReceived(false);
8157 AnimationFinishCheck finishCheck(signalReceived);
8158 animation.FinishedSignal().Connect(&application, finishCheck);
8160 application.SendNotification();
8161 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8163 // We didn't expect the animation to finish yet
8164 application.SendNotification();
8165 finishCheck.CheckSignalNotReceived();
8166 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
8167 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8169 application.SendNotification();
8170 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8172 // We didn't expect the animation to finish yet
8173 application.SendNotification();
8174 finishCheck.CheckSignalNotReceived();
8175 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
8176 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8178 application.SendNotification();
8179 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8181 // We didn't expect the animation to finish yet
8182 application.SendNotification();
8183 finishCheck.CheckSignalNotReceived();
8184 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
8185 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8187 application.SendNotification();
8188 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
8190 // We did expect the animation to finish
8191 application.SendNotification();
8192 finishCheck.CheckSignalReceived();
8193 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
8197 int UtcDaliAnimationAnimateToActorScaleP(void)
8199 TestApplication application;
8201 Actor actor = Actor::New();
8202 application.GetScene().Add(actor);
8203 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
8205 // Build the animation
8206 float durationSeconds(1.0f);
8207 Animation animation = Animation::New(durationSeconds);
8208 Vector3 targetScale(2.0f, 2.0f, 2.0f);
8209 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
8211 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
8213 // Start the animation
8216 // Target value should be retrievable straight away
8217 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8218 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
8219 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
8220 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
8222 bool signalReceived(false);
8223 AnimationFinishCheck finishCheck(signalReceived);
8224 animation.FinishedSignal().Connect(&application, finishCheck);
8226 application.SendNotification();
8227 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8229 // We didn't expect the animation to finish yet
8230 application.SendNotification();
8231 finishCheck.CheckSignalNotReceived();
8232 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), ninetyNinePercentProgress, TEST_LOCATION );
8234 application.SendNotification();
8235 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8237 // We did expect the animation to finish
8238 application.SendNotification();
8239 finishCheck.CheckSignalReceived();
8240 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8243 finishCheck.Reset();
8244 actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
8245 application.SendNotification();
8246 application.Render(0);
8247 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
8249 // Repeat with a different (ease-in) alpha function
8250 animation = Animation::New(durationSeconds);
8251 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
8252 animation.FinishedSignal().Connect(&application, finishCheck);
8255 application.SendNotification();
8256 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
8258 // We didn't expect the animation to finish yet
8259 application.SendNotification();
8260 finishCheck.CheckSignalNotReceived();
8262 // The scale should have grown less, than with a linear alpha function
8263 Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
8264 DALI_TEST_CHECK( current.x > 1.0f );
8265 DALI_TEST_CHECK( current.y > 1.0f );
8266 DALI_TEST_CHECK( current.z > 1.0f );
8267 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
8268 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
8269 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
8271 application.SendNotification();
8272 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
8274 // We did expect the animation to finish
8275 application.SendNotification();
8276 finishCheck.CheckSignalReceived();
8277 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8280 finishCheck.Reset();
8281 actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
8282 application.SendNotification();
8283 application.Render(0);
8284 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
8286 // Repeat with a delay
8288 animation = Animation::New(durationSeconds);
8289 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
8290 animation.FinishedSignal().Connect(&application, finishCheck);
8293 application.SendNotification();
8294 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8296 // We didn't expect the animation to finish yet
8297 application.SendNotification();
8298 finishCheck.CheckSignalNotReceived();
8299 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
8301 application.SendNotification();
8302 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8304 // We did expect the animation to finish
8305 application.SendNotification();
8306 finishCheck.CheckSignalReceived();
8307 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
8311 int UtcDaliAnimationAnimateToActorScaleXP(void)
8313 TestApplication application;
8315 Actor actor = Actor::New();
8316 application.GetScene().Add(actor);
8317 float startValue(1.0f);
8318 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, startValue, TEST_LOCATION );
8319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8320 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8321 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8322 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8323 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8324 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8326 // Build the animation
8327 float durationSeconds(1.0f);
8328 Animation animation = Animation::New(durationSeconds);
8329 float targetX(10.0f);
8330 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
8332 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
8334 // Start the animation
8337 // Target value should be retrievable straight away
8338 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
8339 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8341 bool signalReceived(false);
8342 AnimationFinishCheck finishCheck(signalReceived);
8343 animation.FinishedSignal().Connect(&application, finishCheck);
8345 application.SendNotification();
8346 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8348 // We didn't expect the animation to finish yet
8349 application.SendNotification();
8350 finishCheck.CheckSignalNotReceived();
8351 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, fiftyPercentProgress, TEST_LOCATION );
8352 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
8353 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8354 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8356 application.SendNotification();
8357 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8359 // We did expect the animation to finish
8360 application.SendNotification();
8361 finishCheck.CheckSignalReceived();
8362 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, targetX, TEST_LOCATION );
8363 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8364 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8365 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8369 int UtcDaliAnimationAnimateToActorScaleYP(void)
8371 TestApplication application;
8373 Actor actor = Actor::New();
8374 application.GetScene().Add(actor);
8375 float startValue(1.0f);
8376 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, startValue, TEST_LOCATION );
8377 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8378 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8379 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8380 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8381 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8382 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8384 // Build the animation
8385 float durationSeconds(1.0f);
8386 Animation animation = Animation::New(durationSeconds);
8387 float targetY(1000.0f);
8388 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
8390 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
8392 // Start the animation
8395 // Target value should be retrievable straight away
8396 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
8397 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8399 bool signalReceived(false);
8400 AnimationFinishCheck finishCheck(signalReceived);
8401 animation.FinishedSignal().Connect(&application, finishCheck);
8403 application.SendNotification();
8404 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8406 // We didn't expect the animation to finish yet
8407 application.SendNotification();
8408 finishCheck.CheckSignalNotReceived();
8409 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, fiftyPercentProgress, TEST_LOCATION );
8410 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8411 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
8412 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8414 application.SendNotification();
8415 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8417 // We did expect the animation to finish
8418 application.SendNotification();
8419 finishCheck.CheckSignalReceived();
8420 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, targetY, TEST_LOCATION );
8421 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8422 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8423 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8427 int UtcDaliAnimationAnimateToActorScaleZP(void)
8429 TestApplication application;
8431 Actor actor = Actor::New();
8432 application.GetScene().Add(actor);
8433 float startValue(1.0f);
8434 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, startValue, TEST_LOCATION );
8435 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8436 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8437 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8438 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8439 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8440 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8442 // Build the animation
8443 float durationSeconds(1.0f);
8444 Animation animation = Animation::New(durationSeconds);
8445 float targetZ(-1000.0f);
8446 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
8448 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
8450 // Start the animation
8453 // Target value should be retrievable straight away
8454 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
8455 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8457 bool signalReceived(false);
8458 AnimationFinishCheck finishCheck(signalReceived);
8459 animation.FinishedSignal().Connect(&application, finishCheck);
8461 application.SendNotification();
8462 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8464 // We didn't expect the animation to finish yet
8465 application.SendNotification();
8466 finishCheck.CheckSignalNotReceived();
8467 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, fiftyPercentProgress, TEST_LOCATION );
8468 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8469 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8470 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
8472 application.SendNotification();
8473 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8475 // We did expect the animation to finish
8476 application.SendNotification();
8477 finishCheck.CheckSignalReceived();
8478 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, targetZ, TEST_LOCATION );
8479 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8480 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8481 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8485 int UtcDaliAnimationAnimateToActorColorP(void)
8487 TestApplication application;
8489 Actor actor = Actor::New();
8490 application.GetScene().Add(actor);
8491 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
8493 // Build the animation
8494 float durationSeconds(1.0f);
8495 Animation animation = Animation::New(durationSeconds);
8496 Vector4 targetColor(Color::RED);
8497 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
8499 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8500 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8502 // Start the animation
8505 // Target value should be retrievable straight away
8506 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8507 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
8508 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
8509 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
8510 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
8511 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
8513 bool signalReceived(false);
8514 AnimationFinishCheck finishCheck(signalReceived);
8515 animation.FinishedSignal().Connect(&application, finishCheck);
8517 application.SendNotification();
8518 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8520 // We didn't expect the animation to finish yet
8521 application.SendNotification();
8522 finishCheck.CheckSignalNotReceived();
8523 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), tenPercentProgress, TEST_LOCATION );
8525 application.SendNotification();
8526 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8528 // We did expect the animation to finish
8529 application.SendNotification();
8530 finishCheck.CheckSignalReceived();
8531 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8534 finishCheck.Reset();
8535 actor.SetProperty( Actor::Property::COLOR,Color::WHITE);
8536 application.SendNotification();
8537 application.Render(0);
8538 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
8540 // Repeat with a different (ease-in) alpha function
8541 animation = Animation::New(durationSeconds);
8542 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8543 animation.FinishedSignal().Connect(&application, finishCheck);
8546 application.SendNotification();
8547 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8549 // We didn't expect the animation to finish yet
8550 application.SendNotification();
8551 finishCheck.CheckSignalNotReceived();
8553 // The color should have changed less, than with a linear alpha function
8554 Vector4 current(actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
8555 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
8556 DALI_TEST_CHECK( current.y < 1.0f );
8557 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
8558 DALI_TEST_CHECK( current.z < 1.0f );
8559 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
8560 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8562 application.SendNotification();
8563 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8565 // We did expect the animation to finish
8566 application.SendNotification();
8567 finishCheck.CheckSignalReceived();
8568 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8571 finishCheck.Reset();
8572 actor.SetProperty( Actor::Property::COLOR,Color::WHITE);
8573 application.SendNotification();
8574 application.Render(0);
8575 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
8577 // Repeat with a shorter animator duration
8578 float animatorDuration = 0.5f;
8579 animation = Animation::New(durationSeconds);
8580 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8581 animation.FinishedSignal().Connect(&application, finishCheck);
8584 application.SendNotification();
8585 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8587 // We didn't expect the animation to finish yet
8588 application.SendNotification();
8589 finishCheck.CheckSignalNotReceived();
8590 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), twentyPercentProgress, TEST_LOCATION );
8592 application.SendNotification();
8593 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8595 // We didn't expect the animation to finish yet
8596 application.SendNotification();
8597 finishCheck.CheckSignalNotReceived();
8598 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8600 application.SendNotification();
8601 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8603 // We did expect the animation to finish
8604 application.SendNotification();
8605 finishCheck.CheckSignalReceived();
8606 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8610 int UtcDaliAnimationAnimateToActorColorRedP(void)
8612 TestApplication application;
8614 Actor actor = Actor::New();
8615 application.GetScene().Add(actor);
8616 float startValue(1.0f);
8617 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, startValue, TEST_LOCATION );
8618 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8619 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8620 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8621 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8622 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8623 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8624 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8625 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8627 // Build the animation
8628 float durationSeconds(1.0f);
8629 Animation animation = Animation::New(durationSeconds);
8630 float targetRed(0.5f);
8631 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8633 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8635 // Start the animation
8638 // Target value should be retrievable straight away
8639 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8640 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8642 bool signalReceived(false);
8643 AnimationFinishCheck finishCheck(signalReceived);
8644 animation.FinishedSignal().Connect(&application, finishCheck);
8646 application.SendNotification();
8647 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8649 // We didn't expect the animation to finish yet
8650 application.SendNotification();
8651 finishCheck.CheckSignalNotReceived();
8652 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, fiftyPercentProgress, TEST_LOCATION );
8653 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
8654 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8655 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8656 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8658 application.SendNotification();
8659 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8661 // We did expect the animation to finish
8662 application.SendNotification();
8663 finishCheck.CheckSignalReceived();
8664 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, targetRed, TEST_LOCATION );
8665 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
8666 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8667 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8668 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8672 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8674 TestApplication application;
8676 Actor actor = Actor::New();
8677 application.GetScene().Add(actor);
8678 float startValue(1.0f);
8679 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, startValue, TEST_LOCATION );
8680 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8681 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8682 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8683 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8684 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8685 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8686 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8687 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8689 // Build the animation
8690 float durationSeconds(1.0f);
8691 Animation animation = Animation::New(durationSeconds);
8692 float targetGreen(0.5f);
8693 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8695 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8697 // Start the animation
8700 // Target value should be retrievable straight away
8701 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8702 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8704 bool signalReceived(false);
8705 AnimationFinishCheck finishCheck(signalReceived);
8706 animation.FinishedSignal().Connect(&application, finishCheck);
8708 application.SendNotification();
8709 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8711 // We didn't expect the animation to finish yet
8712 application.SendNotification();
8713 finishCheck.CheckSignalNotReceived();
8714 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, fiftyPercentProgress, TEST_LOCATION );
8715 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8716 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8717 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8718 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8720 application.SendNotification();
8721 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8723 // We did expect the animation to finish
8724 application.SendNotification();
8725 finishCheck.CheckSignalReceived();
8726 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, targetGreen, TEST_LOCATION );
8727 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8728 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8729 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8730 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8734 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8736 TestApplication application;
8738 Actor actor = Actor::New();
8739 application.GetScene().Add(actor);
8740 float startValue(1.0f);
8741 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, startValue, TEST_LOCATION );
8742 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8743 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8744 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8745 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8746 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8747 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8748 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8749 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8751 // Build the animation
8752 float durationSeconds(1.0f);
8753 Animation animation = Animation::New(durationSeconds);
8754 float targetBlue(0.5f);
8755 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8757 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8759 // Start the animation
8762 // Target value should be retrievable straight away
8763 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8764 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8766 bool signalReceived(false);
8767 AnimationFinishCheck finishCheck(signalReceived);
8768 animation.FinishedSignal().Connect(&application, finishCheck);
8770 application.SendNotification();
8771 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8773 // We didn't expect the animation to finish yet
8774 application.SendNotification();
8775 finishCheck.CheckSignalNotReceived();
8776 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, fiftyPercentProgress, TEST_LOCATION );
8777 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8778 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8779 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8780 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8782 application.SendNotification();
8783 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8785 // We did expect the animation to finish
8786 application.SendNotification();
8787 finishCheck.CheckSignalReceived();
8788 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, targetBlue, TEST_LOCATION );
8789 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8790 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8791 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8792 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8796 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8798 TestApplication application;
8800 Actor actor = Actor::New();
8801 application.GetScene().Add(actor);
8802 float startValue(1.0f);
8803 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
8804 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8805 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8806 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8807 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8808 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8809 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8810 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8811 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8813 // Build the animation
8814 float durationSeconds(1.0f);
8815 Animation animation = Animation::New(durationSeconds);
8816 float targetAlpha(0.5f);
8817 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8819 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8821 // Start the animation
8824 // Target value should be retrievable straight away
8825 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8826 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8827 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8829 bool signalReceived(false);
8830 AnimationFinishCheck finishCheck(signalReceived);
8831 animation.FinishedSignal().Connect(&application, finishCheck);
8833 application.SendNotification();
8834 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8836 // We didn't expect the animation to finish yet
8837 application.SendNotification();
8838 finishCheck.CheckSignalNotReceived();
8839 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, fiftyPercentProgress, TEST_LOCATION );
8840 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8841 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8842 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8843 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8845 application.SendNotification();
8846 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8848 // We did expect the animation to finish
8849 application.SendNotification();
8850 finishCheck.CheckSignalReceived();
8851 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, targetAlpha, TEST_LOCATION );
8852 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8853 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8854 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8855 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8859 int UtcDaliAnimationKeyFrames01P(void)
8861 TestApplication application;
8863 KeyFrames keyFrames = KeyFrames::New();
8864 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8866 keyFrames.Add(0.0f, 0.1f);
8868 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8870 KeyFrames keyFrames2( keyFrames);
8871 DALI_TEST_CHECK( keyFrames2 );
8872 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8874 KeyFrames keyFrames3 = KeyFrames::New();
8875 keyFrames3.Add(0.6f, true);
8876 DALI_TEST_CHECK( keyFrames3 );
8877 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8879 keyFrames3 = keyFrames;
8880 DALI_TEST_CHECK( keyFrames3 );
8881 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8886 int UtcDaliAnimationKeyFrames02N(void)
8888 TestApplication application;
8890 KeyFrames keyFrames = KeyFrames::New();
8891 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8893 keyFrames.Add(0.0f, 0.1f);
8894 keyFrames.Add(0.2f, 0.5f);
8895 keyFrames.Add(0.4f, 0.0f);
8896 keyFrames.Add(0.6f, 1.0f);
8897 keyFrames.Add(0.8f, 0.7f);
8898 keyFrames.Add(1.0f, 0.9f);
8900 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8902 DALI_TEST_ASSERTION(
8904 keyFrames.Add(1.9f, false);
8905 }, "mType == value.GetType()" );
8910 int UtcDaliAnimationKeyFrames03N(void)
8912 TestApplication application;
8914 KeyFrames keyFrames = KeyFrames::New();
8915 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8917 keyFrames.Add(0.0f, true);
8918 keyFrames.Add(0.2f, false);
8919 keyFrames.Add(0.4f, false);
8920 keyFrames.Add(0.6f, true);
8921 keyFrames.Add(0.8f, true);
8922 keyFrames.Add(1.0f, false);
8924 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8926 DALI_TEST_ASSERTION(
8928 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8929 }, "mType == value.GetType()" );
8934 int UtcDaliAnimationKeyFrames04N(void)
8936 TestApplication application;
8938 KeyFrames keyFrames = KeyFrames::New();
8939 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8941 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8942 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8943 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8944 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8945 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8946 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8948 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8950 DALI_TEST_ASSERTION(
8952 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8953 }, "mType == value.GetType()" );
8958 int UtcDaliAnimationKeyFrames05N(void)
8960 TestApplication application;
8962 KeyFrames keyFrames = KeyFrames::New();
8963 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8965 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8966 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8967 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8968 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8969 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8970 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8972 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8974 DALI_TEST_ASSERTION(
8976 keyFrames.Add(0.7f, 1.0f);
8977 }, "mType == value.GetType()" );
8982 int UtcDaliAnimationKeyFrames06N(void)
8984 TestApplication application;
8986 KeyFrames keyFrames = KeyFrames::New();
8987 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8989 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8990 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8991 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8992 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8993 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8994 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8996 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8998 DALI_TEST_ASSERTION(
9000 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9001 }, "mType == value.GetType()" );
9006 int UtcDaliAnimationKeyFrames07N(void)
9008 TestApplication application;
9010 KeyFrames keyFrames = KeyFrames::New();
9011 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
9013 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
9014 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
9015 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
9016 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
9017 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
9018 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
9020 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
9022 DALI_TEST_ASSERTION(
9024 keyFrames.Add(0.7f, 1.1f);
9025 }, "mType == value.GetType()" );
9030 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
9032 TestApplication application;
9034 float startValue(1.0f);
9035 Actor actor = Actor::New();
9036 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9037 application.GetScene().Add(actor);
9039 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9040 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9041 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9042 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9043 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
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 ), startValue, TEST_LOCATION );
9049 // Build the animation
9050 float durationSeconds(1.0f);
9051 Animation animation = Animation::New(durationSeconds);
9053 KeyFrames keyFrames = KeyFrames::New();
9054 keyFrames.Add(0.0f, 0.1f);
9055 keyFrames.Add(0.2f, 0.5f);
9056 keyFrames.Add(0.4f, 0.0f);
9057 keyFrames.Add(0.6f, 1.0f);
9058 keyFrames.Add(0.8f, 0.7f);
9059 keyFrames.Add(1.0f, 0.9f);
9061 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
9063 // Start the animation
9066 // Final key frame value should be retrievable straight away
9067 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
9069 bool signalReceived(false);
9070 AnimationFinishCheck finishCheck(signalReceived);
9071 animation.FinishedSignal().Connect(&application, finishCheck);
9072 application.SendNotification();
9073 application.Render(0);
9074 application.SendNotification();
9075 finishCheck.CheckSignalNotReceived();
9076 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.1f, TEST_LOCATION );
9078 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9079 application.SendNotification();
9080 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9081 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9082 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9083 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
9084 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.3f, 0.01f, TEST_LOCATION );
9086 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9087 application.SendNotification();
9088 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9089 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9090 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9091 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
9092 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.25f, 0.01f, TEST_LOCATION );
9094 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9095 application.SendNotification();
9096 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9097 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9098 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9099 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
9100 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.0f, 0.01f, TEST_LOCATION );
9102 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9103 application.SendNotification();
9104 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9105 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9106 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9107 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
9108 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.7f, 0.01f, TEST_LOCATION );
9110 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9111 application.SendNotification();
9112 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9113 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9114 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9115 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
9116 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.8f, 0.01f, TEST_LOCATION );
9118 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9119 application.SendNotification();
9120 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9121 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9122 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9123 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
9124 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.9f, 0.01f, TEST_LOCATION );
9126 // We did expect the animation to finish
9128 finishCheck.CheckSignalReceived();
9132 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
9134 TestApplication application;
9136 float startValue(1.0f);
9137 Actor actor = Actor::New();
9138 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9139 application.GetScene().Add(actor);
9141 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9142 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9143 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9144 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9145 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9146 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9147 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9148 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9149 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9151 // Build the animation
9152 float durationSeconds(1.0f);
9153 Animation animation = Animation::New(durationSeconds);
9155 KeyFrames keyFrames = KeyFrames::New();
9156 keyFrames.Add(0.0f, 0.1f);
9157 keyFrames.Add(0.2f, 0.5f);
9158 keyFrames.Add(0.4f, 0.0f);
9159 keyFrames.Add(0.6f, 1.0f);
9160 keyFrames.Add(0.8f, 0.7f);
9161 keyFrames.Add(1.0f, 0.9f);
9163 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
9165 // Start the animation
9168 bool signalReceived(false);
9169 AnimationFinishCheck finishCheck(signalReceived);
9170 animation.FinishedSignal().Connect(&application, finishCheck);
9171 application.SendNotification();
9172 application.Render(0);
9173 application.SendNotification();
9174 finishCheck.CheckSignalNotReceived();
9175 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.1f, TEST_LOCATION );
9177 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
9178 application.SendNotification();
9179 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9180 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9181 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9182 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
9183 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.36f, 0.01f, TEST_LOCATION );
9185 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
9186 application.SendNotification();
9187 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9188 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9189 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9190 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
9191 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.21f, 0.01f, TEST_LOCATION );
9193 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
9194 application.SendNotification();
9195 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9196 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9197 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9198 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
9199 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.0f, 0.01f, TEST_LOCATION );
9201 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
9202 application.SendNotification();
9203 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9204 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9205 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9206 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
9207 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.7f, 0.01f, TEST_LOCATION );
9209 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
9210 application.SendNotification();
9211 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9212 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9213 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9214 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
9215 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.76f, 0.01f, TEST_LOCATION );
9217 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
9218 application.SendNotification();
9219 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9220 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9221 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9222 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
9223 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.9f, 0.01f, TEST_LOCATION );
9225 // We did expect the animation to finish
9227 finishCheck.CheckSignalReceived();
9231 int UtcDaliAnimationAnimateBetweenActorColorP(void)
9233 TestApplication application;
9235 float startValue(1.0f);
9236 Actor actor = Actor::New();
9237 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9238 application.GetScene().Add(actor);
9240 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9241 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9242 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9243 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9244 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9245 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9246 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9247 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9248 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9250 // Build the animation
9251 float durationSeconds(1.0f);
9252 Animation animation = Animation::New(durationSeconds);
9254 KeyFrames keyFrames = KeyFrames::New();
9255 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9256 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9257 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9259 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
9261 // Start the animation
9264 bool signalReceived(false);
9265 AnimationFinishCheck finishCheck(signalReceived);
9266 animation.FinishedSignal().Connect(&application, finishCheck);
9267 application.SendNotification();
9268 application.Render(0);
9269 application.SendNotification();
9270 finishCheck.CheckSignalNotReceived();
9271 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9272 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9273 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9274 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9276 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9277 application.SendNotification();
9278 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9279 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9280 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9281 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9283 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9284 application.SendNotification();
9285 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9286 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9287 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9288 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9290 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9291 application.SendNotification();
9292 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9293 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9294 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9295 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9297 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9298 application.SendNotification();
9299 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9300 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9301 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9302 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9304 // We did expect the animation to finish
9306 finishCheck.CheckSignalReceived();
9310 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9312 TestApplication application;
9314 float startValue(1.0f);
9315 Actor actor = Actor::New();
9316 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9317 application.GetScene().Add(actor);
9319 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9320 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9321 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9322 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9323 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9324 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9325 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9326 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9327 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9329 // Build the animation
9330 float durationSeconds(1.0f);
9331 Animation animation = Animation::New(durationSeconds);
9333 KeyFrames keyFrames = KeyFrames::New();
9334 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9335 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9336 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9338 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
9340 // Start the animation
9343 bool signalReceived(false);
9344 AnimationFinishCheck finishCheck(signalReceived);
9345 animation.FinishedSignal().Connect(&application, finishCheck);
9346 application.SendNotification();
9347 application.Render(0);
9348 application.SendNotification();
9349 finishCheck.CheckSignalNotReceived();
9350 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9351 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9352 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9353 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9355 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9356 application.SendNotification();
9357 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9358 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9359 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9360 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9362 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9363 application.SendNotification();
9364 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9365 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9366 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9367 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9369 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9370 application.SendNotification();
9371 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9372 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9373 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9374 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9376 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9377 application.SendNotification();
9378 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9379 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9380 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9381 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9383 // We did expect the animation to finish
9385 finishCheck.CheckSignalReceived();
9389 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9391 TestApplication application;
9393 Actor actor = Actor::New();
9394 AngleAxis aa(Degree(90), Vector3::XAXIS);
9395 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9396 application.GetScene().Add(actor);
9398 application.SendNotification();
9399 application.Render(0);
9401 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9403 // Build the animation
9404 float durationSeconds(1.0f);
9405 Animation animation = Animation::New(durationSeconds);
9407 KeyFrames keyFrames = KeyFrames::New();
9408 keyFrames.Add(0.0f, false);
9409 keyFrames.Add(0.2f, true);
9410 keyFrames.Add(0.4f, true);
9411 keyFrames.Add(0.8f, false);
9412 keyFrames.Add(1.0f, true);
9414 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
9416 // Start the animation
9419 // Final key frame value should be retrievable straight away
9420 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9422 bool signalReceived(false);
9423 AnimationFinishCheck finishCheck(signalReceived);
9424 animation.FinishedSignal().Connect(&application, finishCheck);
9425 application.SendNotification();
9426 application.SendNotification();
9427 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9428 application.SendNotification();
9429 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9430 application.SendNotification();
9432 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION);
9433 finishCheck.CheckSignalReceived();
9437 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9439 TestApplication application;
9441 Actor actor = Actor::New();
9442 AngleAxis aa(Degree(90), Vector3::XAXIS);
9443 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9444 application.GetScene().Add(actor);
9446 application.SendNotification();
9447 application.Render(0);
9449 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9451 // Build the animation
9452 float durationSeconds(1.0f);
9453 Animation animation = Animation::New(durationSeconds);
9455 KeyFrames keyFrames = KeyFrames::New();
9456 keyFrames.Add(0.0f, false);
9457 keyFrames.Add(0.2f, true);
9458 keyFrames.Add(0.4f, true);
9459 keyFrames.Add(0.8f, false);
9460 keyFrames.Add(1.0f, true);
9462 //Cubic interpolation for boolean values should be ignored
9463 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
9465 // Start the animation
9468 bool signalReceived(false);
9469 AnimationFinishCheck finishCheck(signalReceived);
9470 animation.FinishedSignal().Connect(&application, finishCheck);
9471 application.SendNotification();
9472 application.SendNotification();
9473 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9474 application.SendNotification();
9475 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9476 application.SendNotification();
9478 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION);
9479 finishCheck.CheckSignalReceived();
9483 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9485 TestApplication application;
9487 Actor actor = Actor::New();
9488 AngleAxis aa(Degree(90), Vector3::XAXIS);
9489 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9490 application.GetScene().Add(actor);
9492 application.SendNotification();
9493 application.Render(0);
9494 Quaternion start(Radian(aa.angle), aa.axis);
9495 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
9497 // Build the animation
9498 float durationSeconds(1.0f);
9499 Animation animation = Animation::New(durationSeconds);
9501 KeyFrames keyFrames = KeyFrames::New();
9502 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9504 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9506 // Start the animation
9509 // Final key frame value should be retrievable straight away
9510 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
9512 bool signalReceived(false);
9513 AnimationFinishCheck finishCheck(signalReceived);
9514 animation.FinishedSignal().Connect(&application, finishCheck);
9515 application.SendNotification();
9516 application.SendNotification();
9517 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9518 application.SendNotification();
9519 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9520 application.SendNotification();
9522 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9524 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9525 finishCheck.CheckSignalReceived();
9529 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9531 TestApplication application;
9533 Actor actor = Actor::New();
9534 AngleAxis aa(Degree(90), Vector3::XAXIS);
9535 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9536 application.SendNotification();
9537 application.Render(0);
9538 application.GetScene().Add(actor);
9540 Quaternion start(Radian(aa.angle), aa.axis);
9541 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
9543 // Build the animation
9544 float durationSeconds(1.0f);
9545 Animation animation = Animation::New(durationSeconds);
9547 KeyFrames keyFrames = KeyFrames::New();
9548 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9549 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9550 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9552 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9554 // Start the animation
9557 bool signalReceived(false);
9558 AnimationFinishCheck finishCheck(signalReceived);
9559 animation.FinishedSignal().Connect(&application, finishCheck);
9560 application.SendNotification();
9561 application.Render(0);
9562 application.SendNotification();
9563 finishCheck.CheckSignalNotReceived();
9565 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9566 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9568 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9569 application.SendNotification();
9570 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9571 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9573 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9574 application.SendNotification();
9575 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9576 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9578 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9579 application.SendNotification();
9580 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
9581 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9583 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9584 application.SendNotification();
9585 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9586 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9588 // We did expect the animation to finish
9590 finishCheck.CheckSignalReceived();
9594 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9596 TestApplication application;
9598 Actor actor = Actor::New();
9599 AngleAxis aa(Degree(90), Vector3::XAXIS);
9600 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9601 application.GetScene().Add(actor);
9603 application.SendNotification();
9604 application.Render(0);
9605 Quaternion start(Radian(aa.angle), aa.axis);
9606 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
9608 // Build the animation
9609 float durationSeconds(1.0f);
9610 Animation animation = Animation::New(durationSeconds);
9612 KeyFrames keyFrames = KeyFrames::New();
9613 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9615 //Cubic interpolation should be ignored for quaternions
9616 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9618 // Start the animation
9621 bool signalReceived(false);
9622 AnimationFinishCheck finishCheck(signalReceived);
9623 animation.FinishedSignal().Connect(&application, finishCheck);
9624 application.SendNotification();
9625 application.SendNotification();
9626 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9627 application.SendNotification();
9628 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9629 application.SendNotification();
9631 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9633 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9634 finishCheck.CheckSignalReceived();
9638 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9640 TestApplication application;
9642 Actor actor = Actor::New();
9643 AngleAxis aa(Degree(90), Vector3::XAXIS);
9644 actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
9645 application.SendNotification();
9646 application.Render(0);
9647 application.GetScene().Add(actor);
9649 Quaternion start(Radian(aa.angle), aa.axis);
9650 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
9652 // Build the animation
9653 float durationSeconds(1.0f);
9654 Animation animation = Animation::New(durationSeconds);
9656 KeyFrames keyFrames = KeyFrames::New();
9657 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9658 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9659 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9661 //Cubic interpolation should be ignored for quaternions
9662 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9664 // Start the animation
9667 bool signalReceived(false);
9668 AnimationFinishCheck finishCheck(signalReceived);
9669 animation.FinishedSignal().Connect(&application, finishCheck);
9670 application.SendNotification();
9671 application.Render(0);
9672 application.SendNotification();
9673 finishCheck.CheckSignalNotReceived();
9675 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9676 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9678 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9679 application.SendNotification();
9680 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9681 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9683 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9684 application.SendNotification();
9685 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9686 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9688 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9689 application.SendNotification();
9690 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9691 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9693 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9694 application.SendNotification();
9695 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9696 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
9698 // We did expect the animation to finish
9700 finishCheck.CheckSignalReceived();
9704 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9706 TestApplication application;
9708 float startValue(1.0f);
9709 Actor actor = Actor::New();
9710 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9711 application.GetScene().Add(actor);
9713 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9714 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9715 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9716 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9717 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9718 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9719 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9720 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9721 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9723 // Build the animation
9724 float durationSeconds(1.0f);
9725 Animation animation = Animation::New(durationSeconds);
9727 KeyFrames keyFrames = KeyFrames::New();
9728 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9729 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9730 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9732 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9734 // Start the animation
9737 bool signalReceived(false);
9738 AnimationFinishCheck finishCheck(signalReceived);
9739 animation.FinishedSignal().Connect(&application, finishCheck);
9740 application.SendNotification();
9741 application.Render(0);
9742 application.SendNotification();
9743 finishCheck.CheckSignalNotReceived();
9744 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9745 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9746 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9747 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9749 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9750 application.SendNotification();
9751 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9752 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9753 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9754 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9756 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9757 application.SendNotification();
9758 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9759 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9760 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9761 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9763 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9764 application.SendNotification();
9765 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9766 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9767 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9768 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9770 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9771 application.SendNotification();
9772 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9773 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9774 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9777 // We did expect the animation to finish
9779 finishCheck.CheckSignalReceived();
9783 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9785 TestApplication application;
9787 float startValue(1.0f);
9788 Actor actor = Actor::New();
9789 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9790 application.GetScene().Add(actor);
9792 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9793 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9794 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9795 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9796 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9797 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9798 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9799 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9800 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9802 // Build the animation
9803 float durationSeconds(1.0f);
9804 Animation animation = Animation::New(durationSeconds);
9806 KeyFrames keyFrames = KeyFrames::New();
9807 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9808 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9809 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9811 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9813 // Start the animation
9816 bool signalReceived(false);
9817 AnimationFinishCheck finishCheck(signalReceived);
9818 animation.FinishedSignal().Connect(&application, finishCheck);
9819 application.SendNotification();
9820 application.Render(0);
9821 application.SendNotification();
9822 finishCheck.CheckSignalNotReceived();
9823 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9824 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9825 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9826 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9828 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9829 application.SendNotification();
9830 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9831 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9832 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9833 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9835 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9836 application.SendNotification();
9837 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9838 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9839 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9840 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9842 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9843 application.SendNotification();
9844 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9845 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9846 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9847 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9849 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9850 application.SendNotification();
9851 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9852 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9853 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9854 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9856 // We did expect the animation to finish
9858 finishCheck.CheckSignalReceived();
9862 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9864 TestApplication application;
9866 float startValue(1.0f);
9867 Actor actor = Actor::New();
9868 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9869 application.GetScene().Add(actor);
9871 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9872 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9873 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9874 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9875 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9876 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9877 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9878 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9879 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9881 // Build the animation
9882 float durationSeconds(1.0f);
9884 Animation animation = Animation::New(durationSeconds);
9886 KeyFrames keyFrames = KeyFrames::New();
9887 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9888 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9889 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9891 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9893 // Start the animation
9896 bool signalReceived(false);
9897 AnimationFinishCheck finishCheck(signalReceived);
9898 animation.FinishedSignal().Connect(&application, finishCheck);
9899 application.SendNotification();
9901 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9902 application.SendNotification();
9903 finishCheck.CheckSignalNotReceived();
9904 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9905 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9906 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9907 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9909 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9910 application.SendNotification();
9911 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9912 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9913 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9914 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9916 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9917 application.SendNotification();
9918 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9919 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9920 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9921 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9923 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9924 application.SendNotification();
9925 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9926 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9927 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9928 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9930 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9931 application.SendNotification();
9932 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9933 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9934 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9935 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9937 // We did expect the animation to finish
9939 finishCheck.CheckSignalReceived();
9943 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9945 TestApplication application;
9947 float startValue(1.0f);
9948 Actor actor = Actor::New();
9949 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
9950 application.GetScene().Add(actor);
9952 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
9953 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9954 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9955 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9956 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9957 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9958 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9959 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9960 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9962 // Build the animation
9963 float durationSeconds(1.0f);
9965 Animation animation = Animation::New(durationSeconds);
9967 KeyFrames keyFrames = KeyFrames::New();
9968 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9969 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9970 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9972 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9974 // Start the animation
9977 bool signalReceived(false);
9978 AnimationFinishCheck finishCheck(signalReceived);
9979 animation.FinishedSignal().Connect(&application, finishCheck);
9980 application.SendNotification();
9982 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9983 application.SendNotification();
9984 finishCheck.CheckSignalNotReceived();
9985 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9986 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9987 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9988 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9990 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9991 application.SendNotification();
9992 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9993 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9994 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9995 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9997 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9998 application.SendNotification();
9999 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
10000 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
10001 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
10002 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10004 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10005 application.SendNotification();
10006 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
10007 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
10008 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
10009 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
10011 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10012 application.SendNotification();
10013 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
10014 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10015 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
10016 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10018 // We did expect the animation to finish
10020 finishCheck.CheckSignalReceived();
10024 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
10026 TestApplication application;
10028 float startValue(1.0f);
10029 float delay = 0.5f;
10030 Actor actor = Actor::New();
10031 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
10032 application.GetScene().Add(actor);
10034 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
10035 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
10036 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
10037 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
10038 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
10039 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
10040 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
10041 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
10042 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
10044 // Build the animation
10045 float durationSeconds(1.0f);
10046 Animation animation = Animation::New(durationSeconds);
10048 KeyFrames keyFrames = KeyFrames::New();
10049 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10050 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10051 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10053 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
10055 // Start the animation
10058 bool signalReceived(false);
10059 AnimationFinishCheck finishCheck(signalReceived);
10060 animation.FinishedSignal().Connect(&application, finishCheck);
10061 application.SendNotification();
10063 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
10064 application.SendNotification();
10065 finishCheck.CheckSignalNotReceived();
10066 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
10067 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
10068 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
10069 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
10071 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
10072 application.SendNotification();
10073 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
10074 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
10075 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
10076 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
10078 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10079 application.SendNotification();
10080 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
10081 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10082 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
10083 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10085 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10086 application.SendNotification();
10087 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
10088 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
10089 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
10090 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
10092 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10093 application.SendNotification();
10094 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
10095 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10096 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
10097 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10099 // We did expect the animation to finish
10101 finishCheck.CheckSignalReceived();
10105 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
10107 TestApplication application;
10109 float startValue(1.0f);
10110 Actor actor = Actor::New();
10111 actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
10112 application.GetScene().Add(actor);
10114 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
10115 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
10116 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
10117 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
10118 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
10119 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
10120 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
10121 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
10122 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
10125 // Build the animation
10126 float durationSeconds(1.0f);
10127 float delay = 0.5f;
10128 Animation animation = Animation::New(durationSeconds);
10130 KeyFrames keyFrames = KeyFrames::New();
10131 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
10132 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
10133 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
10135 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
10137 // Start the animation
10140 bool signalReceived(false);
10141 AnimationFinishCheck finishCheck(signalReceived);
10142 animation.FinishedSignal().Connect(&application, finishCheck);
10143 application.SendNotification();
10145 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
10146 application.SendNotification();
10147 finishCheck.CheckSignalNotReceived();
10148 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
10149 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
10150 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
10151 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
10153 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
10154 application.SendNotification();
10155 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
10156 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
10157 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
10158 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
10160 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
10161 application.SendNotification();
10162 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
10163 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
10164 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
10165 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
10167 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
10168 application.SendNotification();
10169 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
10170 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
10171 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
10172 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
10174 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
10175 application.SendNotification();
10176 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
10177 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
10178 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
10179 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
10181 // We did expect the animation to finish
10183 finishCheck.CheckSignalReceived();
10187 int UtcDaliAnimationAnimateP(void)
10189 TestApplication application;
10191 Actor actor = Actor::New();
10192 application.GetScene().Add(actor);
10195 Vector3 position0( 30.0, 80.0, 0.0);
10196 Vector3 position1( 70.0, 120.0, 0.0);
10197 Vector3 position2( 100.0, 100.0, 0.0);
10199 Dali::Path path = Dali::Path::New();
10200 path.AddPoint(position0);
10201 path.AddPoint(position1);
10202 path.AddPoint(position2);
10204 //Control points for first segment
10205 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10206 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10208 //Control points for second segment
10209 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10210 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10212 // Build the animation
10213 float durationSeconds( 1.0f );
10214 Animation animation = Animation::New(durationSeconds);
10215 animation.Animate(actor, path, Vector3::XAXIS);
10217 // Start the animation
10220 bool signalReceived(false);
10221 AnimationFinishCheck finishCheck(signalReceived);
10222 animation.FinishedSignal().Connect(&application, finishCheck);
10223 application.SendNotification();
10224 application.Render(0);
10225 application.SendNotification();
10226 finishCheck.CheckSignalNotReceived();
10227 Vector3 position, tangent;
10228 Quaternion rotation;
10229 path.Sample( 0.0f, position, tangent );
10230 rotation = Quaternion( Vector3::XAXIS, tangent );
10231 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10232 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10234 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10235 application.SendNotification();
10236 path.Sample( 0.25f, position, tangent );
10237 rotation = Quaternion( Vector3::XAXIS, tangent );
10238 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10239 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10241 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10242 application.SendNotification();
10243 path.Sample( 0.5f, position, tangent );
10244 rotation = Quaternion( Vector3::XAXIS, tangent );
10245 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10246 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10248 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10249 application.SendNotification();
10250 path.Sample( 0.75f, position, tangent );
10251 rotation = Quaternion( Vector3::XAXIS, tangent );
10252 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10253 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10255 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10256 application.SendNotification();
10257 path.Sample( 1.0f, position, tangent );
10258 rotation = Quaternion( Vector3::XAXIS, tangent );
10259 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10260 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10262 finishCheck.CheckSignalReceived();
10266 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10268 TestApplication application;
10270 Actor actor = Actor::New();
10271 application.GetScene().Add(actor);
10274 Vector3 position0( 30.0, 80.0, 0.0);
10275 Vector3 position1( 70.0, 120.0, 0.0);
10276 Vector3 position2( 100.0, 100.0, 0.0);
10278 Dali::Path path = Dali::Path::New();
10279 path.AddPoint(position0);
10280 path.AddPoint(position1);
10281 path.AddPoint(position2);
10283 //Control points for first segment
10284 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10285 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10287 //Control points for second segment
10288 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10289 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10291 // Build the animation
10292 float durationSeconds( 1.0f );
10293 Animation animation = Animation::New(durationSeconds);
10294 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10296 // Start the animation
10299 bool signalReceived(false);
10300 AnimationFinishCheck finishCheck(signalReceived);
10301 animation.FinishedSignal().Connect(&application, finishCheck);
10302 application.SendNotification();
10303 application.Render(0);
10304 application.SendNotification();
10305 finishCheck.CheckSignalNotReceived();
10306 Vector3 position, tangent;
10307 Quaternion rotation;
10308 path.Sample( 0.0f, position, tangent );
10309 rotation = Quaternion( Vector3::XAXIS, tangent );
10310 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10311 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10313 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10314 application.SendNotification();
10315 path.Sample( 0.25f, position, tangent );
10316 rotation = Quaternion( Vector3::XAXIS, tangent );
10317 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10318 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10320 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10321 application.SendNotification();
10322 path.Sample( 0.5f, position, tangent );
10323 rotation = Quaternion( Vector3::XAXIS, tangent );
10324 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10325 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10327 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10328 application.SendNotification();
10329 path.Sample( 0.75f, position, tangent );
10330 rotation = Quaternion( Vector3::XAXIS, tangent );
10331 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10332 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10334 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10335 application.SendNotification();
10336 path.Sample( 1.0f, position, tangent );
10337 rotation = Quaternion( Vector3::XAXIS, tangent );
10338 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10339 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10341 finishCheck.CheckSignalReceived();
10345 int UtcDaliAnimationAnimateTimePeriodP(void)
10347 TestApplication application;
10349 Actor actor = Actor::New();
10350 application.GetScene().Add(actor);
10353 Vector3 position0( 30.0, 80.0, 0.0);
10354 Vector3 position1( 70.0, 120.0, 0.0);
10355 Vector3 position2( 100.0, 100.0, 0.0);
10357 Dali::Path path = Dali::Path::New();
10358 path.AddPoint(position0);
10359 path.AddPoint(position1);
10360 path.AddPoint(position2);
10362 //Control points for first segment
10363 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10364 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10366 //Control points for second segment
10367 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10368 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10370 // Build the animation
10371 float durationSeconds( 1.0f );
10372 Animation animation = Animation::New(durationSeconds);
10373 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10375 // Start the animation
10378 bool signalReceived(false);
10379 AnimationFinishCheck finishCheck(signalReceived);
10380 animation.FinishedSignal().Connect(&application, finishCheck);
10381 application.SendNotification();
10382 application.Render(0);
10383 application.SendNotification();
10384 finishCheck.CheckSignalNotReceived();
10385 Vector3 position, tangent;
10386 Quaternion rotation;
10387 path.Sample( 0.0f, position, tangent );
10388 rotation = Quaternion( Vector3::XAXIS, tangent );
10389 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10390 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10392 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10393 application.SendNotification();
10394 path.Sample( 0.25f, position, tangent );
10395 rotation = Quaternion( Vector3::XAXIS, tangent );
10396 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10397 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10399 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10400 application.SendNotification();
10401 path.Sample( 0.5f, position, tangent );
10402 rotation = Quaternion( Vector3::XAXIS, tangent );
10403 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10404 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10406 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10407 application.SendNotification();
10408 path.Sample( 0.75f, position, tangent );
10409 rotation = Quaternion( Vector3::XAXIS, tangent );
10410 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10411 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10413 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10414 application.SendNotification();
10415 path.Sample( 1.0f, position, tangent );
10416 rotation = Quaternion( Vector3::XAXIS, tangent );
10417 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10418 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10420 finishCheck.CheckSignalReceived();
10424 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10426 TestApplication application;
10428 Actor actor = Actor::New();
10429 application.GetScene().Add(actor);
10432 Vector3 position0( 30.0, 80.0, 0.0);
10433 Vector3 position1( 70.0, 120.0, 0.0);
10434 Vector3 position2( 100.0, 100.0, 0.0);
10436 Dali::Path path = Dali::Path::New();
10437 path.AddPoint(position0);
10438 path.AddPoint(position1);
10439 path.AddPoint(position2);
10441 //Control points for first segment
10442 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10443 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10445 //Control points for second segment
10446 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10447 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10449 // Build the animation
10450 float durationSeconds( 1.0f );
10451 Animation animation = Animation::New(durationSeconds);
10452 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10454 // Start the animation
10457 bool signalReceived(false);
10458 AnimationFinishCheck finishCheck(signalReceived);
10459 animation.FinishedSignal().Connect(&application, finishCheck);
10460 application.SendNotification();
10461 application.Render(0);
10462 application.SendNotification();
10463 finishCheck.CheckSignalNotReceived();
10464 Vector3 position, tangent;
10465 Quaternion rotation;
10466 path.Sample( 0.0f, position, tangent );
10467 rotation = Quaternion( Vector3::XAXIS, tangent );
10468 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10469 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10471 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10472 application.SendNotification();
10473 path.Sample( 0.25f, position, tangent );
10474 rotation = Quaternion( Vector3::XAXIS, tangent );
10475 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10476 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10478 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10479 application.SendNotification();
10480 path.Sample( 0.5f, position, tangent );
10481 rotation = Quaternion( Vector3::XAXIS, tangent );
10482 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10483 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10485 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10486 application.SendNotification();
10487 path.Sample( 0.75f, position, tangent );
10488 rotation = Quaternion( Vector3::XAXIS, tangent );
10489 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10490 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10492 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10493 application.SendNotification();
10494 path.Sample( 1.0f, position, tangent );
10495 rotation = Quaternion( Vector3::XAXIS, tangent );
10496 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
10497 DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
10499 finishCheck.CheckSignalReceived();
10503 int UtcDaliAnimationShowP(void)
10505 TestApplication application;
10507 Actor actor = Actor::New();
10508 actor.SetProperty( Actor::Property::VISIBLE,false);
10509 application.SendNotification();
10510 application.Render(0);
10511 DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10512 application.GetScene().Add(actor);
10514 // Start the animation
10515 float durationSeconds(10.0f);
10516 Animation animation = Animation::New(durationSeconds);
10517 animation.Show(actor, durationSeconds*0.5f);
10520 bool signalReceived(false);
10521 AnimationFinishCheck finishCheck(signalReceived);
10522 animation.FinishedSignal().Connect(&application, finishCheck);
10524 application.SendNotification();
10525 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10527 // We didn't expect the animation to finish yet
10528 application.SendNotification();
10529 finishCheck.CheckSignalNotReceived();
10530 DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10532 application.SendNotification();
10533 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
10535 // We didn't expect the animation to finish yet
10536 application.SendNotification();
10537 finishCheck.CheckSignalNotReceived();
10538 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10540 application.SendNotification();
10541 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10543 // We did expect the animation to finish
10544 application.SendNotification();
10545 finishCheck.CheckSignalReceived();
10546 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10550 int UtcDaliAnimationHideP(void)
10552 TestApplication application;
10554 Actor actor = Actor::New();
10555 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10556 application.GetScene().Add(actor);
10558 // Start the animation
10559 float durationSeconds(10.0f);
10560 Animation animation = Animation::New(durationSeconds);
10561 animation.Hide(actor, durationSeconds*0.5f);
10564 bool signalReceived(false);
10565 AnimationFinishCheck finishCheck(signalReceived);
10566 animation.FinishedSignal().Connect(&application, finishCheck);
10568 application.SendNotification();
10569 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10571 // We didn't expect the animation to finish yet
10572 application.SendNotification();
10573 finishCheck.CheckSignalNotReceived();
10574 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10576 application.SendNotification();
10577 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
10579 // We didn't expect the animation to finish yet
10580 application.SendNotification();
10581 finishCheck.CheckSignalNotReceived();
10582 DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10584 application.SendNotification();
10585 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10587 // We did expect the animation to finish
10588 application.SendNotification();
10589 finishCheck.CheckSignalReceived();
10590 DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10594 int UtcDaliAnimationShowHideAtEndP(void)
10596 // Test that show/hide delay can be the same as animation duration
10597 // i.e. to show/hide at the end of the animation
10599 TestApplication application;
10601 Actor actor = Actor::New();
10602 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10603 application.GetScene().Add(actor);
10605 // Start Hide animation
10606 float durationSeconds(10.0f);
10607 Animation animation = Animation::New(durationSeconds);
10608 animation.Hide(actor, durationSeconds/*Hide at end*/);
10611 bool signalReceived(false);
10612 AnimationFinishCheck finishCheck(signalReceived);
10613 animation.FinishedSignal().Connect(&application, finishCheck);
10615 application.SendNotification();
10616 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10618 // We did expect the animation to finish
10619 application.SendNotification();
10620 finishCheck.CheckSignalReceived();
10621 DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10623 // Start Show animation
10624 animation = Animation::New(durationSeconds);
10625 animation.Show(actor, durationSeconds/*Show at end*/);
10626 animation.FinishedSignal().Connect(&application, finishCheck);
10629 application.SendNotification();
10630 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10632 // We did expect the animation to finish
10633 application.SendNotification();
10634 finishCheck.CheckSignalReceived();
10635 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
10639 int UtcDaliKeyFramesCreateDestroyP(void)
10641 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10643 KeyFrames* keyFrames = new KeyFrames;
10645 DALI_TEST_CHECK( true );
10649 int UtcDaliKeyFramesDownCastP(void)
10651 TestApplication application;
10652 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10654 KeyFrames keyFrames = KeyFrames::New();
10655 BaseHandle object(keyFrames);
10657 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10658 DALI_TEST_CHECK(keyFrames2);
10660 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10661 DALI_TEST_CHECK(keyFrames3);
10663 BaseHandle unInitializedObject;
10664 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10665 DALI_TEST_CHECK(!keyFrames4);
10667 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10668 DALI_TEST_CHECK(!keyFrames5);
10672 int UtcDaliAnimationCreateDestroyP(void)
10674 TestApplication application;
10675 Animation* animation = new Animation;
10676 DALI_TEST_CHECK( animation );
10681 struct UpdateManagerTestConstraint
10683 UpdateManagerTestConstraint(TestApplication& application)
10684 : mApplication(application)
10688 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10690 mApplication.SendNotification(); // Process events
10693 TestApplication& mApplication;
10696 int UtcDaliAnimationUpdateManagerP(void)
10698 TestApplication application;
10700 Actor actor = Actor::New();
10701 application.GetScene().Add( actor );
10703 // Build the animation
10704 Animation animation = Animation::New( 0.0f );
10706 bool signalReceived = false;
10707 AnimationFinishCheck finishCheck( signalReceived );
10708 animation.FinishedSignal().Connect( &application, finishCheck );
10710 Vector3 startValue(1.0f, 1.0f, 1.0f);
10711 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10712 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10713 constraint.Apply();
10715 // Apply animation to actor
10716 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10717 animation.AnimateTo( Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10721 application.SendNotification();
10722 application.UpdateOnly( 16 );
10724 finishCheck.CheckSignalNotReceived();
10726 application.SendNotification(); // Process events
10728 finishCheck.CheckSignalReceived();
10733 int UtcDaliAnimationSignalOrderP(void)
10735 TestApplication application;
10737 Actor actor = Actor::New();
10738 application.GetScene().Add( actor );
10740 // Build the animations
10741 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10742 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10744 bool signal1Received = false;
10745 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10747 bool signal2Received = false;
10748 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10750 // Apply animations to actor
10751 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10753 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10756 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10757 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10759 application.SendNotification();
10760 application.UpdateOnly( 10 ); // 10ms progress
10762 // no notifications yet
10763 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10764 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10766 application.SendNotification();
10769 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10770 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10771 signal1Received = false;
10773 // 1st animation is complete now, do another update with no ProcessEvents in between
10774 application.UpdateOnly( 20 ); // 20ms progress
10777 application.SendNotification();
10779 // 2nd should complete now
10780 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10781 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10786 int UtcDaliAnimationExtendDurationP(void)
10788 TestApplication application;
10790 Actor actor = Actor::New();
10792 // Register a float property
10793 float startValue(10.0f);
10794 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10795 application.GetScene().Add(actor);
10796 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10797 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10799 // Build the animation
10800 float initialDurationSeconds(1.0f);
10801 float animatorDelay = 5.0f;
10802 float animatorDurationSeconds(5.0f);
10803 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10804 Animation animation = Animation::New(initialDurationSeconds);
10805 float targetValue(30.0f);
10806 float relativeValue(targetValue - startValue);
10808 animation.AnimateTo(Property(actor, index),
10810 TimePeriod(animatorDelay, animatorDurationSeconds));
10812 // The duration should have been extended
10813 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10815 // Start the animation
10818 bool signalReceived(false);
10819 AnimationFinishCheck finishCheck(signalReceived);
10820 animation.FinishedSignal().Connect(&application, finishCheck);
10822 application.SendNotification();
10823 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10825 // We didn't expect the animation to finish yet, but cached value should be the final one
10826 application.SendNotification();
10827 finishCheck.CheckSignalNotReceived();
10828 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10829 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10831 application.SendNotification();
10832 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10834 // We didn't expect the animation to finish yet
10835 application.SendNotification();
10836 finishCheck.CheckSignalNotReceived();
10837 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10839 application.SendNotification();
10840 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10842 // We did expect the animation to finish
10843 application.SendNotification();
10844 finishCheck.CheckSignalReceived();
10845 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10846 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10850 int UtcDaliAnimationCustomIntProperty(void)
10852 TestApplication application;
10854 Actor actor = Actor::New();
10855 application.GetScene().Add(actor);
10856 int startValue(0u);
10858 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10859 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10860 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10862 // Build the animation
10863 float durationSeconds(1.0f);
10864 Animation animation = Animation::New(durationSeconds);
10865 animation.AnimateTo( Property(actor, index), 20 );
10867 // Start the animation
10870 // Target value should be retrievable straight away
10871 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10873 bool signalReceived(false);
10874 AnimationFinishCheck finishCheck(signalReceived);
10875 animation.FinishedSignal().Connect(&application, finishCheck);
10877 application.SendNotification();
10878 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10880 // We didn't expect the animation to finish yet
10881 application.SendNotification();
10882 finishCheck.CheckSignalNotReceived();
10883 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10885 application.SendNotification();
10886 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10888 // We did expect the animation to finish
10889 application.SendNotification();
10890 finishCheck.CheckSignalReceived();
10891 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10892 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10896 int UtcDaliAnimationDuration(void)
10898 TestApplication application;
10900 Actor actor = Actor::New();
10901 application.GetScene().Add(actor);
10903 Animation animation = Animation::New( 0.0f );
10904 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10906 // The animation duration should automatically increase depending on the animator time period
10908 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10909 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10911 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10912 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10917 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10919 TestApplication application;
10921 Actor actor = Actor::New();
10923 // Register an integer property
10925 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10926 application.GetScene().Add(actor);
10927 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10929 DALI_TEST_ASSERTION(
10931 // Build the animation
10932 Animation animation = Animation::New( 2.0f );
10933 std::string relativeValue = "relative string";
10934 animation.AnimateBy( Property(actor, index), relativeValue );
10935 tet_result(TET_FAIL);
10936 }, "Target value is not animatable" );
10942 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10944 TestApplication application;
10946 Actor actor = Actor::New();
10948 // Register an integer property
10950 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10951 application.GetScene().Add(actor);
10952 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10954 DALI_TEST_ASSERTION(
10956 // Build the animation
10957 Animation animation = Animation::New( 2.0f );
10958 std::string relativeValue = "relative string";
10959 animation.AnimateTo( Property(actor, index), relativeValue );
10960 }, "Target value is not animatable" );
10965 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10967 TestApplication application;
10969 Actor actor = Actor::New();
10971 // Register an integer property
10973 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10974 application.GetScene().Add(actor);
10975 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10977 DALI_TEST_ASSERTION(
10979 // Build the animation
10980 KeyFrames keyFrames = KeyFrames::New();
10981 keyFrames.Add( 0.0f, std::string("relative string1") );
10982 keyFrames.Add( 1.0f, std::string("relative string2") );
10983 // no need to really create the animation as keyframes do the check
10984 }, "Property type is not animatable" );
10989 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10991 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10993 TestApplication application;
10995 tet_infoline("Set initial position and set up animation to re-position actor");
10997 Actor actor = Actor::New();
10998 application.GetScene().Add(actor);
10999 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11000 actor.SetProperty( Actor::Property::POSITION, initialPosition );
11002 // Build the animation
11003 Animation animation = Animation::New(2.0f);
11005 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11006 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
11007 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
11009 tet_infoline("Set target position in animation without intiating play");
11011 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11012 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11014 application.SendNotification();
11015 application.Render();
11017 tet_infoline("Ensure position of actor is still at intial value");
11019 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
11020 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
11021 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
11023 tet_infoline("Play animation and ensure actor position is now target");
11026 application.SendNotification();
11027 application.Render(1000u);
11029 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11031 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
11032 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
11033 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
11035 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x );
11037 application.Render(2000u);
11039 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11041 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
11042 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
11043 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
11048 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
11050 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
11052 TestApplication application;
11054 std::vector<Vector3> targetPositions;
11056 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11057 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
11058 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
11060 tet_infoline("Set initial position and set up animation to re-position actor");
11062 Actor actor = Actor::New();
11063 application.GetScene().Add(actor);
11064 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
11065 actor.SetProperty( Actor::Property::POSITION, initialPosition );
11067 // Build the animation
11068 Animation animation = Animation::New(2.0f);
11070 //Test GetCurrentProgress return 0.0 as the duration is 0.0
11071 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
11072 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
11074 tet_infoline("Set target position in animation without intiating play");
11076 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
11078 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
11081 application.SendNotification();
11082 application.Render();
11084 tet_infoline("Ensure position of actor is still at intial value");
11086 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
11087 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
11088 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
11090 tet_infoline("Play animation and ensure actor position is now target");
11093 application.SendNotification();
11094 application.Render(1000u);
11096 tet_infoline("Ensure position of actor is at target value when aninmation half way");
11098 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11099 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11100 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11102 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x );
11104 application.Render(2000u);
11106 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
11108 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
11109 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
11110 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
11115 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
11117 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");
11119 TestApplication application;
11121 std::vector<Vector3> targetSizes;
11122 std::vector<Vector3> targetPositions;
11124 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11125 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
11127 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
11129 tet_infoline("Set initial position and set up animation to re-position actor");
11131 Actor actor = Actor::New();
11132 application.GetScene().Add(actor);
11133 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
11134 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
11136 actor.SetProperty( Actor::Property::SIZE, initialSize );
11137 actor.SetProperty( Actor::Property::POSITION, initialPosition );
11139 // Build the animation
11140 Animation animation = Animation::New(2.0f);
11142 tet_infoline("Set target size in animation without intiating play");
11143 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11144 tet_infoline("Set target position in animation without intiating play");
11145 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
11146 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11148 application.SendNotification();
11149 application.Render();
11151 tet_infoline("Ensure position of actor is still at intial size and position");
11153 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11154 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11155 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11157 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
11158 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
11159 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
11161 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11164 application.SendNotification();
11165 application.Render(2000u);
11167 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
11169 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11171 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11173 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
11174 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
11175 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
11180 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
11182 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
11184 TestApplication application;
11186 std::vector<Vector3> targetSizes;
11187 std::vector<float> targetColors;
11189 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
11190 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
11192 targetColors.push_back( 1.0f );
11194 tet_infoline("Set initial position and set up animation to re-position actor");
11196 Actor actor = Actor::New();
11197 application.GetScene().Add(actor);
11198 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
11200 actor.SetProperty( Actor::Property::SIZE, initialSize );
11202 // Build the animation
11203 Animation animation = Animation::New(2.0f);
11205 tet_infoline("Set target size in animation without initiating play");
11206 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
11207 tet_infoline("Set target position in animation without intiating play");
11208 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
11209 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
11211 application.SendNotification();
11212 application.Render();
11214 tet_infoline("Ensure position of actor is still at initial size and position");
11216 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
11217 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
11218 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
11220 tet_infoline("Play animation and ensure actor position and size is now matches targets");
11223 application.SendNotification();
11224 application.Render(2000u);
11226 tet_infoline("Ensure position and size of actor is at target value when animation playing");
11228 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
11229 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
11230 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
11232 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
11237 int UtcDaliAnimationTimePeriodOrder(void)
11239 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
11241 TestApplication application;
11243 Actor actor = Actor::New();
11244 application.GetScene().Add( actor );
11246 application.SendNotification();
11247 application.Render();
11249 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11250 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11251 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11252 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11253 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11255 //////////////////////////////////////////////////////////////////////////////////
11257 tet_infoline( "With two AnimateTo calls" );
11259 Animation animation = Animation::New( 0.0f );
11260 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11261 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11264 tet_infoline( "The target position should change instantly" );
11265 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11266 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11268 application.SendNotification();
11269 application.Render(5000); // After the animation is complete
11271 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11272 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11273 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11275 //////////////////////////////////////////////////////////////////////////////////
11277 tet_infoline( "Same animation again but in a different order - should yield the same result" );
11279 actor.SetProperty( Actor::Property::POSITION_X, 0.0f );
11280 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11281 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11283 application.SendNotification();
11284 application.Render();
11286 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11287 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11288 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11290 animation = Animation::New( 0.0f );
11291 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11292 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11295 tet_infoline( "The target position should change instantly" );
11296 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11297 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11299 application.SendNotification();
11300 application.Render(5000); // After the animation is complete
11302 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11303 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11304 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11309 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11311 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" );
11313 TestApplication application;
11315 Actor actor = Actor::New();
11316 application.GetScene().Add( actor );
11318 application.SendNotification();
11319 application.Render();
11321 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11322 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11323 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11324 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11325 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11327 //////////////////////////////////////////////////////////////////////////////////
11329 tet_infoline( "" );
11331 Animation animation = Animation::New( 0.0f );
11332 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11333 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11334 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11335 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11336 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11337 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11340 tet_infoline( "The target position should change instantly" );
11341 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11342 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11344 application.SendNotification();
11345 application.Render(14000); // After the animation is complete
11347 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11348 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11349 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11351 //////////////////////////////////////////////////////////////////////////////////
11353 tet_infoline( "Same animation again but in a different order - should end up at the same point" );
11355 actor.SetProperty( Actor::Property::POSITION_X, 0.0f );
11357 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11358 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11360 application.SendNotification();
11361 application.Render();
11363 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11364 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11365 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11367 animation = Animation::New( 0.0f );
11368 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11369 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11370 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11371 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11372 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11373 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11376 tet_infoline( "The target position should change instantly" );
11377 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11378 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11380 application.SendNotification();
11381 application.Render(14000); // After the animation is complete
11383 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11384 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11385 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11390 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11392 TestApplication application;
11395 Actor actor = Actor::New();
11396 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11397 application.GetScene().Add(actor);
11399 application.Render();
11400 application.SendNotification();
11402 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
11404 // Build the animation
11405 float durationSeconds(1.0f);
11406 Animation animation = Animation::New(durationSeconds);
11408 KeyFrames keyFrames = KeyFrames::New();
11409 keyFrames.Add(0.0f, 10);
11410 keyFrames.Add(0.2f, 20);
11411 keyFrames.Add(0.4f, 30);
11412 keyFrames.Add(0.6f, 40);
11413 keyFrames.Add(0.8f, 50);
11414 keyFrames.Add(1.0f, 60);
11416 animation.AnimateBetween( Property(actor, index ), keyFrames );
11418 // Start the animation
11421 // Target value should change to the last key-frame's value straight away
11422 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
11427 int UtcDaliAnimationAnimateBetweenVector2P(void)
11429 TestApplication application;
11431 Vector2 startValue( 10.0f, 20.0f );
11432 Actor actor = Actor::New();
11433 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11434 application.GetScene().Add(actor);
11436 application.Render();
11437 application.SendNotification();
11439 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
11441 // Build the animation
11442 float durationSeconds(1.0f);
11443 Animation animation = Animation::New(durationSeconds);
11445 KeyFrames keyFrames = KeyFrames::New();
11446 keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
11447 keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
11448 keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
11449 keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
11450 keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
11451 keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
11453 animation.AnimateBetween( Property(actor, index ), keyFrames );
11455 // Start the animation
11458 // Target value should change to the last key-frame's value straight away
11459 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );
11464 int UtcDaliAnimationProgressCallbackP(void)
11466 TestApplication application;
11468 Actor actor = Actor::New();
11469 application.GetScene().Add(actor);
11471 // Build the animation
11472 Animation animation = Animation::New(0.0f);
11475 float durationSeconds(1.0f);
11476 animation.SetDuration(durationSeconds);
11478 bool finishedSignalReceived(false);
11479 bool progressSignalReceived(false);
11481 AnimationFinishCheck finishCheck(finishedSignalReceived);
11482 animation.FinishedSignal().Connect(&application, finishCheck);
11484 AnimationProgressCheck progressCheck(progressSignalReceived);
11485 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
11486 application.SendNotification();
11488 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11489 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
11491 tet_infoline( "Animation Progress notification set to 30%" );
11492 DevelAnimation::SetProgressNotification( animation, 0.3f );
11494 application.SendNotification();
11495 application.Render( );
11497 DALI_TEST_EQUALS( 0.3f, DevelAnimation::GetProgressNotification( animation ), TEST_LOCATION );
11499 progressCheck.CheckSignalNotReceived();
11501 // Start the animation from 10% progress
11502 animation.SetCurrentProgress( 0.1f );
11505 tet_infoline( "Animation Playing from 10%" );
11507 application.SendNotification();
11508 application.Render(0); // start animation
11509 application.Render(durationSeconds*100.0f ); // 20% progress
11511 tet_infoline( "Animation at 20%" );
11513 progressCheck.CheckSignalNotReceived();
11515 application.SendNotification();
11516 application.Render(durationSeconds*200.0f ); // 40% progress
11517 application.SendNotification();
11518 tet_infoline( "Animation at 40%" );
11519 DALI_TEST_EQUALS( 0.4f, animation.GetCurrentProgress(), TEST_LOCATION );
11521 progressCheck.CheckSignalReceived();
11523 tet_infoline( "Progress check reset" );
11524 progressCheck.Reset();
11526 application.Render(durationSeconds*100.0f ); // 50% progress
11527 tet_infoline( "Animation at 50%" );
11528 application.SendNotification();
11530 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
11532 progressCheck.CheckSignalNotReceived();
11534 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
11535 application.SendNotification();
11537 tet_infoline( "Animation at 60%" );
11539 finishCheck.CheckSignalNotReceived();
11541 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
11542 application.SendNotification();
11543 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
11544 tet_infoline( "Animation at 80%" );
11546 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
11547 // We did expect the animation to finish
11548 application.SendNotification();
11549 finishCheck.CheckSignalReceived();
11550 tet_infoline( "Animation finished" );
11551 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11556 int UtcDaliAnimationPlayAfterP(void)
11558 TestApplication application;
11560 tet_printf("Testing that playing after 2 seconds\n");
11563 Actor actor = Actor::New();
11564 application.GetScene().Add(actor);
11566 // Build the animation
11567 float durationSeconds(1.0f);
11568 Animation animation = Animation::New(durationSeconds);
11570 bool signalReceived( false );
11571 AnimationFinishCheck finishCheck( signalReceived );
11572 animation.FinishedSignal().Connect( &application, finishCheck );
11573 application.SendNotification();
11575 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11576 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11578 // Play animation after the initial delay time
11579 animation.PlayAfter( 0.2f );
11580 application.SendNotification();
11581 application.Render(0); // start animation
11583 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11584 application.SendNotification();
11585 finishCheck.CheckSignalNotReceived();
11586 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11588 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11590 // We didn't expect the animation to finish yet
11591 application.SendNotification();
11592 finishCheck.CheckSignalNotReceived();
11593 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11595 application.SendNotification();
11596 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11598 application.SendNotification();
11599 finishCheck.CheckSignalNotReceived();
11600 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11602 application.SendNotification();
11603 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11605 // We did expect the animation to finish
11606 application.SendNotification();
11607 finishCheck.CheckSignalReceived();
11608 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11610 // Check that nothing has changed after a couple of buffer swaps
11611 application.Render(0);
11612 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11615 tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
11618 Actor actor = Actor::New();
11619 application.GetScene().Add(actor);
11621 // Build the animation
11622 float durationSeconds(1.0f);
11623 Animation animation = Animation::New(durationSeconds);
11624 animation.SetSpeedFactor( -1.0f ); // Set SpeedFactor as < 0
11626 bool signalReceived( false );
11627 AnimationFinishCheck finishCheck( signalReceived );
11628 animation.FinishedSignal().Connect( &application, finishCheck );
11629 application.SendNotification();
11631 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11632 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11634 // Play animation after the initial delay time
11635 animation.PlayAfter( 0.2f );
11636 application.SendNotification();
11637 application.Render(0); // start animation
11639 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11640 application.SendNotification();
11641 finishCheck.CheckSignalNotReceived();
11642 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11644 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11646 // We didn't expect the animation to finish yet
11647 application.SendNotification();
11648 finishCheck.CheckSignalNotReceived();
11649 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11651 application.SendNotification();
11652 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11654 application.SendNotification();
11655 finishCheck.CheckSignalNotReceived();
11656 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION );
11658 application.SendNotification();
11659 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) + 1u/*just beyond the animation duration*/ );
11661 // We did expect the animation to finish
11662 application.SendNotification();
11663 finishCheck.CheckSignalReceived();
11664 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of Timeperiod in seconds
11666 // Check that nothing has changed after a couple of buffer swaps
11667 application.Render(0);
11668 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11674 int UtcDaliAnimationPlayAfterP2(void)
11676 TestApplication application;
11678 tet_printf("Testing that playing after 2 seconds before looping\n");
11681 Actor actor = Actor::New();
11682 application.GetScene().Add(actor);
11684 // Build the animation
11685 float durationSeconds(1.0f);
11686 Animation animation = Animation::New(durationSeconds);
11687 animation.SetLooping( true );
11689 bool signalReceived( false );
11690 AnimationFinishCheck finishCheck( signalReceived );
11691 animation.FinishedSignal().Connect( &application, finishCheck );
11692 application.SendNotification();
11694 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11695 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11697 // Play animation after the initial delay time
11698 animation.PlayAfter( 0.2f );
11699 application.SendNotification();
11700 application.Render(0); // start animation
11702 for( int iterations = 0; iterations < 3; ++iterations )
11704 // The initial delay time of PlayAfter() applies only once in looping mode.
11705 if( iterations == 0 )
11707 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11708 application.SendNotification();
11709 finishCheck.CheckSignalNotReceived();
11710 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
11713 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11715 // We didn't expect the animation to finish yet
11716 application.SendNotification();
11717 finishCheck.CheckSignalNotReceived();
11718 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11720 application.SendNotification();
11721 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11723 application.SendNotification();
11724 finishCheck.CheckSignalNotReceived();
11725 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11727 application.SendNotification();
11728 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) /* 100% progress */ );
11730 // We did expect the animation to finish
11731 application.SendNotification();
11732 finishCheck.CheckSignalNotReceived();
11733 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11736 animation.SetLooping(false);
11737 application.SendNotification();
11738 application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11740 application.SendNotification();
11741 finishCheck.CheckSignalReceived();
11742 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11745 tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
11748 Actor actor = Actor::New();
11749 application.GetScene().Add(actor);
11751 // Build the animation
11752 float durationSeconds(1.0f);
11753 Animation animation = Animation::New(durationSeconds);
11754 animation.SetLooping( true );
11755 animation.SetSpeedFactor( -1.0f ); //Set SpeedFactor as < 0
11757 bool signalReceived( false );
11758 AnimationFinishCheck finishCheck( signalReceived );
11759 animation.FinishedSignal().Connect( &application, finishCheck );
11760 application.SendNotification();
11762 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11763 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11765 // Play animation after the initial delay time
11766 animation.PlayAfter( 0.2f );
11767 application.SendNotification();
11768 application.Render(0); // start animation
11770 for( int iterations = 0; iterations < 3; ++iterations )
11772 // The initial delay time of PlayAfter() applies only once in looping mode.
11773 if( iterations == 0 )
11775 application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
11776 application.SendNotification();
11777 finishCheck.CheckSignalNotReceived();
11778 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
11781 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
11783 // We didn't expect the animation to finish yet
11784 application.SendNotification();
11785 finishCheck.CheckSignalNotReceived();
11786 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11788 application.SendNotification();
11789 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
11791 application.SendNotification();
11792 finishCheck.CheckSignalNotReceived();
11793 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION );
11795 application.SendNotification();
11796 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) /* 100% progress */ );
11798 // We did expect the animation to finish
11799 application.SendNotification();
11800 finishCheck.CheckSignalNotReceived();
11801 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in second
11804 animation.SetLooping(false);
11805 application.SendNotification();
11806 application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
11808 application.SendNotification();
11809 finishCheck.CheckSignalReceived();
11810 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
11816 int UtcDaliAnimationPlayAfterP3(void)
11818 TestApplication application;
11820 tet_printf("Testing that PlayAfter with the negative delay seconds\n");
11822 Actor actor = Actor::New();
11823 application.GetScene().Add(actor);
11825 // Build the animation
11826 float durationSeconds(1.0f);
11827 Animation animation = Animation::New(durationSeconds);
11829 bool signalReceived( false );
11830 AnimationFinishCheck finishCheck( signalReceived );
11831 animation.FinishedSignal().Connect( &application, finishCheck );
11832 application.SendNotification();
11834 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11835 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11837 // When the delay time is negative value, it would treat as play immediately.
11838 animation.PlayAfter( -2.0f );
11839 application.SendNotification();
11840 application.Render(0); // start animation
11842 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
11844 // We didn't expect the animation to finish yet
11845 application.SendNotification();
11846 finishCheck.CheckSignalNotReceived();
11847 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11849 application.SendNotification();
11850 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
11852 application.SendNotification();
11853 finishCheck.CheckSignalNotReceived();
11854 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
11856 application.SendNotification();
11857 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
11859 // We did expect the animation to finish
11860 application.SendNotification();
11861 finishCheck.CheckSignalReceived();
11862 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11864 // Check that nothing has changed after a couple of buffer swaps
11865 application.Render(0);
11866 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11870 int UtcDaliAnimationPlayAfterP4(void)
11872 TestApplication application;
11874 tet_printf("Testing that PlayAfter with progress value\n");
11876 Actor actor = Actor::New();
11877 application.GetScene().Add(actor);
11879 // Build the animation
11880 float durationSeconds(1.0f);
11881 Animation animation = Animation::New(durationSeconds);
11883 bool signalReceived( false );
11884 AnimationFinishCheck finishCheck( signalReceived );
11885 animation.FinishedSignal().Connect( &application, finishCheck );
11886 application.SendNotification();
11888 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
11889 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
11891 // Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
11892 animation.PlayAfter( durationSeconds * 0.3f );
11893 application.SendNotification();
11894 application.Render(0); // start animation
11896 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 5/6 delay progress, 0% animation progress, 0% animator progress */ );
11898 // We didn't expect the animation to finish yet
11899 application.SendNotification();
11900 finishCheck.CheckSignalNotReceived();
11901 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of PlayAfter
11903 application.SendNotification();
11904 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 20% animation progress, 0% animator progress */ );
11906 application.SendNotification();
11907 finishCheck.CheckSignalNotReceived();
11908 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11910 application.SendNotification();
11911 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 45% animation progress, 0% animator progress */ );
11913 application.SendNotification();
11914 finishCheck.CheckSignalNotReceived();
11915 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
11917 application.SendNotification();
11918 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 70% animation progress, 40% animator progress */ );
11920 application.SendNotification();
11921 finishCheck.CheckSignalNotReceived();
11922 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.4f ), TEST_LOCATION ); // 40% of animator progress
11924 application.SendNotification();
11925 application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 95% animation progress, 90% animator progress */ );
11927 application.SendNotification();
11928 finishCheck.CheckSignalNotReceived();
11929 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.9f ), TEST_LOCATION ); // 90% of animator progress
11931 application.SendNotification();
11932 application.Render( static_cast< unsigned int >( durationSeconds * 50.0f ) + 1u/*just beyond the animation duration*/ );
11934 // We did expect the animation to finish
11935 application.SendNotification();
11936 finishCheck.CheckSignalReceived();
11937 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11939 // Check that nothing has changed after a couple of buffer swaps
11940 application.Render(0);
11941 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11945 int UtcDaliAnimationSetLoopingModeP(void)
11947 // Test Loop forever and Loop mode being set
11948 TestApplication application;
11949 Integration::Scene stage( application.GetScene() );
11951 // Default: LoopingMode::RESTART
11953 Actor actor = Actor::New();
11954 stage.Add( actor );
11956 float durationSeconds( 1.0f );
11957 Animation animation = Animation::New( durationSeconds );
11958 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
11960 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
11961 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11963 // Start the animation
11965 application.SendNotification();
11966 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
11970 application.SendNotification();
11971 application.Render();
11972 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
11975 // LoopingMode::AUTO_REVERSE
11977 Actor actor = Actor::New();
11978 stage.Add( actor );
11980 float durationSeconds( 1.0f );
11981 Animation animation = Animation::New( durationSeconds );
11982 animation.SetLooping( true );
11984 bool signalReceived( false );
11985 AnimationFinishCheck finishCheck( signalReceived );
11986 animation.FinishedSignal().Connect( &application, finishCheck );
11987 application.SendNotification();
11989 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
11990 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
11992 animation.SetLoopingMode( Animation::LoopingMode::AUTO_REVERSE );
11993 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
11995 // Start the animation
11997 application.SendNotification();
11998 application.Render(0);
12000 for( int iterations = 0; iterations < 3; ++iterations )
12002 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
12003 application.SendNotification();
12004 finishCheck.CheckSignalNotReceived();
12006 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12007 // and arrives at the beginning.
12008 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12010 application.SendNotification();
12011 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
12013 // We did expect the animation to finish
12014 application.SendNotification();
12015 finishCheck.CheckSignalNotReceived();
12016 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12019 animation.SetLooping( false );
12020 application.SendNotification();
12021 application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
12023 application.SendNotification();
12024 finishCheck.CheckSignalReceived();
12026 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12029 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12031 Actor actor = Actor::New();
12032 stage.Add( actor );
12034 float durationSeconds( 1.0f );
12035 Animation animation = Animation::New( durationSeconds );
12036 animation.SetLooping( true );
12038 bool signalReceived( false );
12039 AnimationFinishCheck finishCheck( signalReceived );
12040 animation.FinishedSignal().Connect( &application, finishCheck );
12041 application.SendNotification();
12043 // Specify a negative multiplier to play the animation in reverse
12044 animation.SetSpeedFactor( -1.0f );
12046 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12047 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12049 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12050 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12052 // Start the animation
12054 application.SendNotification();
12055 application.Render(0);
12057 for( int iterations = 0; iterations < 3; ++iterations )
12059 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
12060 application.SendNotification();
12061 finishCheck.CheckSignalNotReceived();
12063 // Setting a negative speed factor is to play the animation in reverse.
12064 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12065 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12066 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12068 application.SendNotification();
12069 application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
12071 // We did expect the animation to finish
12072 application.SendNotification();
12073 finishCheck.CheckSignalNotReceived();
12074 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12077 animation.SetLooping( false );
12078 application.SendNotification();
12079 application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
12081 application.SendNotification();
12082 finishCheck.CheckSignalReceived();
12084 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12090 int UtcDaliAnimationSetLoopingModeP2(void)
12092 // Test Loop Count and Loop mode being set
12093 TestApplication application;
12094 Integration::Scene stage( application.GetScene() );
12096 // LoopingMode::AUTO_REVERSE
12098 Actor actor = Actor::New();
12099 stage.Add( actor );
12101 float durationSeconds( 1.0f );
12102 Animation animation = Animation::New( durationSeconds );
12103 animation.SetLoopCount(3);
12104 DALI_TEST_CHECK(animation.IsLooping());
12106 bool signalReceived( false );
12107 AnimationFinishCheck finishCheck( signalReceived );
12108 animation.FinishedSignal().Connect( &application, finishCheck );
12109 application.SendNotification();
12111 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12112 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12114 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12115 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12117 // Start the animation
12120 application.Render(0);
12121 application.SendNotification();
12122 application.Render(0);
12123 application.SendNotification();
12124 application.Render(0);
12125 application.SendNotification();
12126 application.Render(0);
12127 application.SendNotification();
12130 float intervalSeconds = 3.0f;
12132 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12133 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12134 // and arrives at the beginning.
12135 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12137 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12139 application.Render(0);
12140 application.SendNotification();
12141 application.Render(0);
12142 application.SendNotification();
12143 application.Render(0);
12144 application.SendNotification();
12145 application.Render(0);
12146 application.SendNotification();
12147 finishCheck.CheckSignalNotReceived();
12149 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12151 application.SendNotification();
12152 finishCheck.CheckSignalReceived();
12153 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12155 finishCheck.Reset();
12158 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12160 Actor actor = Actor::New();
12161 stage.Add( actor );
12163 float durationSeconds( 1.0f );
12164 Animation animation = Animation::New( durationSeconds );
12165 animation.SetLoopCount(3);
12166 DALI_TEST_CHECK(animation.IsLooping());
12168 bool signalReceived( false );
12169 AnimationFinishCheck finishCheck( signalReceived );
12170 animation.FinishedSignal().Connect( &application, finishCheck );
12171 application.SendNotification();
12173 // Specify a negative multiplier to play the animation in reverse
12174 animation.SetSpeedFactor( -1.0f );
12176 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12177 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12179 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12180 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12182 // Start the animation
12185 application.Render(0);
12186 application.SendNotification();
12187 application.Render(0);
12188 application.SendNotification();
12189 application.Render(0);
12190 application.SendNotification();
12191 application.Render(0);
12192 application.SendNotification();
12195 float intervalSeconds = 3.0f;
12197 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12198 // Setting a negative speed factor is to play the animation in reverse.
12199 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12200 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12201 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12203 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12205 application.Render(0);
12206 application.SendNotification();
12207 application.Render(0);
12208 application.SendNotification();
12209 application.Render(0);
12210 application.SendNotification();
12211 application.Render(0);
12212 application.SendNotification();
12213 finishCheck.CheckSignalNotReceived();
12215 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
12217 application.SendNotification();
12218 finishCheck.CheckSignalReceived();
12219 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12221 finishCheck.Reset();
12227 int UtcDaliAnimationSetLoopingModeP3(void)
12229 // Test Loop Count is 1 (== default) and Loop mode being set
12230 TestApplication application;
12231 Integration::Scene stage( application.GetScene() );
12233 // LoopingMode::AUTO_REVERSE
12235 Actor actor = Actor::New();
12236 stage.Add( actor );
12238 float durationSeconds( 1.0f );
12239 Animation animation = Animation::New( durationSeconds );
12240 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12242 bool signalReceived( false );
12243 AnimationFinishCheck finishCheck( signalReceived );
12244 animation.FinishedSignal().Connect( &application, finishCheck );
12245 application.SendNotification();
12247 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12248 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12250 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12251 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12253 // Start the animation
12255 application.Render(0);
12256 application.SendNotification();
12258 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12259 application.SendNotification();
12260 finishCheck.CheckSignalNotReceived();
12262 // AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
12263 // and arrives at the beginning.
12264 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12266 application.SendNotification();
12267 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12269 application.SendNotification();
12270 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12272 application.SendNotification();
12273 application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12275 application.SendNotification();
12276 application.Render(0);
12277 application.SendNotification();
12278 finishCheck.CheckSignalReceived();
12280 // After all animation finished, arrives at the beginning.
12281 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12283 finishCheck.Reset();
12286 // LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
12288 Actor actor = Actor::New();
12289 stage.Add( actor );
12291 float durationSeconds( 1.0f );
12292 Animation animation = Animation::New( durationSeconds );
12293 DALI_TEST_CHECK(1 == animation.GetLoopCount());
12295 bool signalReceived( false );
12296 AnimationFinishCheck finishCheck( signalReceived );
12297 animation.FinishedSignal().Connect( &application, finishCheck );
12298 application.SendNotification();
12300 // Specify a negative multiplier to play the animation in reverse
12301 animation.SetSpeedFactor( -1.0f );
12303 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12304 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
12306 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12307 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12309 // Start the animation
12311 application.Render(0);
12312 application.SendNotification();
12314 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
12315 application.SendNotification();
12316 finishCheck.CheckSignalNotReceived();
12318 // Setting a negative speed factor is to play the animation in reverse.
12319 // So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
12320 // the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
12321 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
12323 application.SendNotification();
12324 application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
12326 application.SendNotification();
12327 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12329 application.SendNotification();
12330 application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
12332 application.SendNotification();
12333 application.Render(0);
12334 application.SendNotification();
12335 finishCheck.CheckSignalReceived();
12337 // After all animation finished, arrives at the target.
12338 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12340 finishCheck.Reset();
12346 int UtcDaliAnimationGetLoopingModeP(void)
12348 TestApplication application;
12350 Animation animation = Animation::New(1.0f);
12353 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
12355 animation.SetLoopingMode( Animation::AUTO_REVERSE );
12356 DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
12361 int UtcDaliAnimationProgressSignalConnectionWithoutProgressMarkerP(void)
12363 TestApplication application;
12365 tet_infoline( "Connect to ProgressReachedSignal but do not set a required Progress marker" );
12367 Actor actor = Actor::New();
12368 application.GetScene().Add(actor);
12370 // Build the animation
12371 Animation animation = Animation::New(0.0f);
12374 float durationSeconds(1.0f);
12375 animation.SetDuration(durationSeconds);
12377 bool finishedSignalReceived(false);
12378 bool progressSignalReceived(false);
12380 AnimationFinishCheck finishCheck(finishedSignalReceived);
12381 animation.FinishedSignal().Connect(&application, finishCheck);
12383 AnimationProgressCheck progressCheck( progressSignalReceived );
12384 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12385 application.SendNotification();
12387 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12388 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12390 progressCheck.CheckSignalNotReceived();
12394 application.SendNotification();
12395 application.Render(0); // start animation
12396 application.Render(durationSeconds*100.0f ); // 10% progress
12397 application.SendNotification();
12399 tet_infoline( "Ensure after animation has started playing that ProgressReachedSignal not emitted" );
12400 progressCheck.CheckSignalNotReceived();
12402 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
12404 application.SendNotification();
12405 finishCheck.CheckSignalReceived();
12406 tet_infoline( "Animation finished" );
12407 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
12412 int UtcDaliAnimationMultipleProgressSignalsP(void)
12414 tet_infoline( "Multiple animations with different progress markers" );
12416 TestApplication application;
12418 Actor actor = Actor::New();
12419 application.GetScene().Add(actor);
12421 // Build the animation
12422 Animation animationAlpha = Animation::New(0.0f);
12423 Animation animationBeta = Animation::New(0.0f);
12426 float durationSeconds(1.0f);
12427 animationAlpha.SetDuration(durationSeconds);
12428 animationBeta.SetDuration(durationSeconds);
12430 bool progressSignalReceivedAlpha(false);
12431 bool progressSignalReceivedBeta(false);
12433 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12434 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12436 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12437 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12438 application.SendNotification();
12440 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12441 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12442 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12444 tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12445 DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12447 tet_infoline( "AnimationBeta Progress notification set to 50%" );
12448 DevelAnimation::SetProgressNotification( animationBeta, 0.5f );
12450 application.SendNotification();
12451 application.Render( );
12453 progressCheckAlpha.CheckSignalNotReceived();
12454 progressCheckBeta.CheckSignalNotReceived();
12456 // Start the animations from 10% progress
12457 animationAlpha.SetCurrentProgress( 0.1f );
12458 animationBeta.SetCurrentProgress( 0.1f );
12459 animationAlpha.Play();
12460 animationBeta.Play();
12462 tet_infoline( "Animation Playing from 10%" );
12464 application.SendNotification();
12465 application.Render(0); // start animation
12466 application.Render(durationSeconds*100.0f ); // 20% progress
12468 tet_infoline( "Animation at 20% - No signals to be received" );
12470 progressCheckAlpha.CheckSignalNotReceived();
12471 progressCheckBeta.CheckSignalNotReceived();
12473 application.SendNotification();
12474 application.Render(durationSeconds*200.0f ); // 40% progress
12475 application.SendNotification();
12476 tet_infoline( "Animation at 40% - Alpha signal should be received" );
12477 DALI_TEST_EQUALS( 0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12479 progressCheckAlpha.CheckSignalReceived();
12480 progressCheckBeta.CheckSignalNotReceived();
12482 tet_infoline( "Progress check reset" );
12483 progressCheckAlpha.Reset();
12484 progressCheckBeta.Reset();
12486 application.Render(durationSeconds*100.0f ); // 50% progress
12487 tet_infoline( "Animation at 50% - Beta should receive signal, Alpha should not" );
12488 application.SendNotification();
12490 DALI_TEST_EQUALS( 0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12492 progressCheckAlpha.CheckSignalNotReceived();
12493 progressCheckBeta.CheckSignalReceived();
12494 tet_infoline( "Progress check reset" );
12495 progressCheckAlpha.Reset();
12496 progressCheckBeta.Reset();
12498 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
12499 application.SendNotification();
12501 tet_infoline( "Animation at 60%" );
12503 progressCheckAlpha.CheckSignalNotReceived();
12504 progressCheckBeta.CheckSignalNotReceived();
12506 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12507 application.SendNotification();
12508 tet_infoline( "Animation at 80%" );
12510 progressCheckAlpha.CheckSignalNotReceived();
12511 progressCheckBeta.CheckSignalNotReceived();
12513 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12514 // We did expect the animation to finish
12515 tet_infoline( "Animation finished" );
12520 int UtcDaliAnimationMultipleProgressSignalsP2(void)
12522 tet_infoline( "Multiple animations with different progress markers and big step time" );
12524 TestApplication application;
12526 Actor actor = Actor::New();
12527 application.GetScene().Add(actor);
12529 // Build the animation
12530 Animation animationAlpha = Animation::New(0.0f);
12531 Animation animationBeta = Animation::New(0.0f);
12534 const float durationSeconds(1.0f);
12535 animationAlpha.SetDuration(durationSeconds);
12536 animationBeta.SetDuration(durationSeconds);
12538 bool progressSignalReceivedAlpha(false);
12539 bool progressSignalReceivedBeta(false);
12541 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12542 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12544 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12545 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12546 application.SendNotification();
12548 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12549 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12550 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12552 tet_infoline( "AnimationAlpha Progress notification set to 1%" );
12553 DevelAnimation::SetProgressNotification( animationAlpha, 0.01f );
12555 tet_infoline( "AnimationBeta Progress notification set to 99%" );
12556 DevelAnimation::SetProgressNotification( animationBeta, 0.99f );
12558 application.SendNotification();
12559 application.Render( );
12561 progressCheckAlpha.CheckSignalNotReceived();
12562 progressCheckBeta.CheckSignalNotReceived();
12564 // Start the animations unlimited looping
12565 animationAlpha.SetLooping( true );
12566 animationBeta.SetLooping( true );
12567 animationAlpha.Play();
12568 animationBeta.Play();
12570 application.SendNotification();
12571 application.Render(0); // start animation
12572 application.Render(durationSeconds*20.0f ); // 2% progress
12573 application.SendNotification();
12574 DALI_TEST_EQUALS( 0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12576 tet_infoline( "Animation at 2% - Alpha signals should be received, Beta should not." );
12578 progressCheckAlpha.CheckSignalReceived();
12579 progressCheckBeta.CheckSignalNotReceived();
12581 tet_infoline( "Progress check reset" );
12582 progressCheckAlpha.Reset();
12583 progressCheckBeta.Reset();
12585 application.SendNotification();
12586 application.Render(durationSeconds*960.0f ); // 98% progress
12587 application.SendNotification();
12588 tet_infoline( "Animation at 98% - No signal received" );
12589 DALI_TEST_EQUALS( 0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12591 progressCheckAlpha.CheckSignalNotReceived();
12592 progressCheckBeta.CheckSignalNotReceived();
12594 application.SendNotification();
12595 application.Render(durationSeconds*40.0f ); // 2% progress
12596 application.SendNotification();
12597 tet_infoline( "Animation loop once and now 2% - Alpha and Beta should receive signal" );
12598 application.SendNotification();
12600 DALI_TEST_EQUALS( 0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12602 progressCheckAlpha.CheckSignalReceived();
12603 progressCheckBeta.CheckSignalReceived();
12605 tet_infoline( "Progress check reset" );
12606 progressCheckAlpha.Reset();
12607 progressCheckBeta.Reset();
12609 application.SendNotification();
12610 application.Render(durationSeconds*980.0f ); // 100% progress
12611 application.SendNotification();
12612 tet_infoline( "Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not" );
12613 application.SendNotification();
12615 progressCheckAlpha.CheckSignalNotReceived();
12616 progressCheckBeta.CheckSignalReceived();
12618 tet_infoline( "Progress check reset" );
12619 progressCheckAlpha.Reset();
12620 progressCheckBeta.Reset();
12622 animationAlpha.SetLooping( false );
12623 animationBeta.SetLooping( false );
12625 application.SendNotification();
12626 application.Render(static_cast<unsigned int>(durationSeconds*2000.0f) + 1u/*just beyond the animation duration*/);
12627 application.SendNotification();
12629 // We did expect the animation to finish
12630 tet_infoline( "Animation finished" );
12635 int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
12637 tet_infoline( "Multiple animations with different progress markers" );
12639 TestApplication application;
12641 Actor actor = Actor::New();
12642 application.GetScene().Add(actor);
12644 // Build the animation
12645 Animation animationAlpha = Animation::New(0.0f);
12646 Animation animationBeta = Animation::New(0.0f);
12649 float durationSeconds(1.0f);
12650 float delaySeconds(0.5f);
12651 animationAlpha.SetDuration(durationSeconds);
12652 animationBeta.SetDuration(durationSeconds);
12654 bool progressSignalReceivedAlpha(false);
12655 bool progressSignalReceivedBeta(false);
12657 AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
12658 AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
12660 DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
12661 DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
12662 application.SendNotification();
12664 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12665 animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12666 animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12668 tet_infoline( "AnimationAlpha Progress notification set to 30%" );
12669 DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
12671 tet_infoline( "AnimationBeta Progress notification set to ~0% (==Notify when delay is done)" );
12672 DevelAnimation::SetProgressNotification( animationBeta, Math::MACHINE_EPSILON_1 );
12674 application.SendNotification();
12675 application.Render( );
12677 progressCheckAlpha.CheckSignalNotReceived();
12678 progressCheckBeta.CheckSignalNotReceived();
12680 // Start the animations from 10% progress
12681 animationAlpha.PlayAfter(delaySeconds);
12682 animationBeta.PlayAfter(delaySeconds);
12684 application.SendNotification();
12685 application.Render(0); // start animation
12686 application.Render(delaySeconds * 500.0f ); // 50% wait progress
12688 tet_infoline( "Delay at 50% - No signals to be received" );
12690 progressCheckAlpha.CheckSignalNotReceived();
12691 progressCheckBeta.CheckSignalNotReceived();
12693 application.SendNotification();
12694 application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f ); // 100% wait, 5% progress
12695 application.SendNotification();
12696 tet_infoline( "Delay at 100%, Animation at 5% - Beta signal should be received" );
12697 DALI_TEST_EQUALS( 0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
12699 progressCheckBeta.CheckSignalReceived();
12700 progressCheckAlpha.CheckSignalNotReceived();
12702 tet_infoline( "Progress check reset" );
12703 progressCheckAlpha.Reset();
12704 progressCheckBeta.Reset();
12706 application.Render(durationSeconds * 200.0f ); // 25% progress
12707 tet_infoline( "Animation at 25% - No signals to be received" );
12708 application.SendNotification();
12710 progressCheckAlpha.CheckSignalNotReceived();
12711 progressCheckBeta.CheckSignalNotReceived();
12713 application.Render(durationSeconds * 200.0f ); // 45% progress
12714 tet_infoline( "Animation at 45% - Alpha should receive signal, Beta should not" );
12715 application.SendNotification();
12717 DALI_TEST_EQUALS( 0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
12719 progressCheckAlpha.CheckSignalReceived();
12720 progressCheckBeta.CheckSignalNotReceived();
12722 tet_infoline( "Progress check reset" );
12723 progressCheckAlpha.Reset();
12724 progressCheckBeta.Reset();
12726 application.Render(static_cast<unsigned int>(durationSeconds*150.0f)/* 60% progress */);
12727 application.SendNotification();
12729 tet_infoline( "Animation at 60%" );
12731 progressCheckAlpha.CheckSignalNotReceived();
12732 progressCheckBeta.CheckSignalNotReceived();
12734 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
12735 application.SendNotification();
12736 tet_infoline( "Animation at 80%" );
12738 progressCheckAlpha.CheckSignalNotReceived();
12739 progressCheckBeta.CheckSignalNotReceived();
12741 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
12742 // We did expect the animation to finish
12743 tet_infoline( "Animation finished" );
12748 int UtcDaliAnimationProgressCallbackWithLoopingP(void)
12750 TestApplication application;
12752 Actor actor = Actor::New();
12753 application.GetScene().Add(actor);
12755 // Build the animation
12756 Animation animation = Animation::New(0.0f);
12759 const float durationSeconds(1.0f);
12760 animation.SetDuration(durationSeconds);
12762 // Set Looping Count
12763 const int loopCount( 4 );
12764 animation.SetLoopCount( loopCount );
12766 bool finishedSignalReceived(false);
12767 bool progressSignalReceived(false);
12769 AnimationFinishCheck finishCheck(finishedSignalReceived);
12770 animation.FinishedSignal().Connect(&application, finishCheck);
12772 AnimationProgressCheck progressCheck(progressSignalReceived);
12773 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12774 application.SendNotification();
12776 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12777 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12779 tet_infoline( "Animation Progress notification set to 50% with looping count 4" );
12780 DevelAnimation::SetProgressNotification( animation, 0.5f );
12782 application.SendNotification();
12783 application.Render( );
12785 progressCheck.CheckSignalNotReceived();
12789 for(int count = 0; count < loopCount; count++)
12791 application.SendNotification();
12792 application.Render(0); // start animation
12793 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12794 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12796 tet_infoline( "Animation at 25%" );
12798 progressCheck.CheckSignalNotReceived();
12800 application.SendNotification();
12801 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12802 application.SendNotification();
12803 tet_infoline( "Animation at 50%" );
12804 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12806 progressCheck.CheckSignalReceived();
12808 tet_infoline( "Progress check reset" );
12809 progressCheck.Reset();
12811 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12812 tet_infoline( "Animation at 75%" );
12813 application.SendNotification();
12815 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12817 progressCheck.CheckSignalNotReceived();
12819 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12820 tet_infoline( "Animation at 100%" );
12821 application.SendNotification();
12823 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12824 application.SendNotification();
12826 application.Render(10u);
12827 application.SendNotification();
12828 application.Render(0u);
12829 application.SendNotification();
12831 finishCheck.CheckSignalReceived();
12836 int UtcDaliAnimationProgressCallbackWithLoopingP2(void)
12838 TestApplication application;
12840 Actor actor = Actor::New();
12841 application.GetScene().Add(actor);
12843 // Build the animation
12844 Animation animation = Animation::New(0.0f);
12847 const float durationSeconds(1.0f);
12848 animation.SetDuration(durationSeconds);
12850 // Set Looping Unlmited
12851 animation.SetLooping( true );
12853 bool finishedSignalReceived(false);
12854 bool progressSignalReceived(false);
12856 AnimationFinishCheck finishCheck(finishedSignalReceived);
12857 animation.FinishedSignal().Connect(&application, finishCheck);
12859 AnimationProgressCheck progressCheck(progressSignalReceived);
12860 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12861 application.SendNotification();
12863 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12864 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12866 tet_infoline( "Animation Progress notification set to 50% with unlimited looping" );
12867 DevelAnimation::SetProgressNotification( animation, 0.5f );
12869 application.SendNotification();
12870 application.Render( );
12872 progressCheck.CheckSignalNotReceived();
12876 for(int count = 0; count < 4; count++)
12878 application.SendNotification();
12879 application.Render(0); // start animation
12880 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12881 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
12883 tet_infoline( "Animation at 25%" );
12885 progressCheck.CheckSignalNotReceived();
12887 application.SendNotification();
12888 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12889 application.SendNotification();
12890 tet_infoline( "Animation at 50%" );
12891 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12893 progressCheck.CheckSignalReceived();
12895 tet_infoline( "Progress check reset" );
12896 progressCheck.Reset();
12898 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12899 tet_infoline( "Animation at 75%" );
12900 application.SendNotification();
12902 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12904 progressCheck.CheckSignalNotReceived();
12906 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
12907 tet_infoline( "Animation at 100%" );
12908 application.SendNotification();
12910 //Nothing check at 100% progress. cause It can be both 100% and 0%.
12911 finishCheck.CheckSignalNotReceived();
12912 application.SendNotification();
12914 finishCheck.CheckSignalNotReceived();
12916 animation.SetLooping( false );
12917 application.Render(0u);
12918 application.SendNotification();
12919 application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
12920 application.SendNotification();
12921 application.Render(0u);
12922 application.SendNotification();
12924 finishCheck.CheckSignalReceived();
12929 int UtcDaliAnimationProgressCallbackNegativeSpeed(void)
12931 TestApplication application;
12933 Actor actor = Actor::New();
12934 application.GetScene().Add(actor);
12936 // Build the animation
12937 Animation animation = Animation::New(0.0f);
12940 const float durationSeconds(1.0f);
12941 animation.SetDuration(durationSeconds);
12943 //Set speed negative
12944 animation.SetSpeedFactor( -1.0f );
12946 // Set Looping Unlmited
12947 animation.SetLooping( true );
12949 bool finishedSignalReceived(false);
12950 bool progressSignalReceived(false);
12952 AnimationFinishCheck finishCheck(finishedSignalReceived);
12953 animation.FinishedSignal().Connect(&application, finishCheck);
12955 AnimationProgressCheck progressCheck(progressSignalReceived);
12956 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
12957 application.SendNotification();
12959 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
12960 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
12962 tet_infoline( "Animation Progress notification set to 50%" );
12963 DevelAnimation::SetProgressNotification( animation, 0.5f );
12965 application.SendNotification();
12966 application.Render( );
12968 progressCheck.CheckSignalNotReceived();
12972 for(int count = 0; count < 4; count++)
12974 application.SendNotification();
12975 application.Render(0); // start animation
12976 progressCheck.CheckSignalNotReceived();
12978 application.SendNotification();
12979 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
12980 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
12982 tet_infoline( "Animation at 25%" );
12984 progressCheck.CheckSignalNotReceived();
12986 application.SendNotification();
12987 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
12988 application.SendNotification();
12989 tet_infoline( "Animation at 50%" );
12990 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
12992 progressCheck.CheckSignalReceived();
12994 tet_infoline( "Progress check reset" );
12995 progressCheck.Reset();
12997 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
12998 tet_infoline( "Animation at 75%" );
12999 application.SendNotification();
13001 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
13003 progressCheck.CheckSignalNotReceived();
13005 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
13006 tet_infoline( "Animation at 100%" );
13007 application.SendNotification();
13009 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13010 finishCheck.CheckSignalNotReceived();
13011 application.SendNotification();
13013 finishCheck.CheckSignalNotReceived();
13016 animation.SetLooping( false );
13017 animation.SetLoopCount( 4 );
13019 application.Render(0u);
13020 application.SendNotification();
13022 for(int count = 0; count < 4; count++)
13024 application.SendNotification();
13025 application.Render(0); // start animation
13026 progressCheck.CheckSignalNotReceived();
13028 application.SendNotification();
13029 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
13030 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
13032 tet_infoline( "Animation at 25%" );
13034 progressCheck.CheckSignalNotReceived();
13036 application.SendNotification();
13037 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
13038 application.SendNotification();
13039 tet_infoline( "Animation at 50%" );
13040 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
13042 progressCheck.CheckSignalReceived();
13044 tet_infoline( "Progress check reset" );
13045 progressCheck.Reset();
13047 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
13048 tet_infoline( "Animation at 75%" );
13049 application.SendNotification();
13051 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
13053 progressCheck.CheckSignalNotReceived();
13055 application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
13056 tet_infoline( "Animation at 100%" );
13057 application.SendNotification();
13059 //Nothing check at 100% progress. cause It can be both 100% and 0%.
13060 application.SendNotification();
13062 application.Render(10u);
13063 application.SendNotification();
13064 application.Render(0u);
13065 application.SendNotification();
13067 finishCheck.CheckSignalReceived();
13072 int UtcDaliAnimationProgressCallbackInvalidSignalN(void)
13074 TestApplication application;
13076 Actor actor = Actor::New();
13077 application.GetScene().Add(actor);
13079 // Build the animation
13080 Animation animation = Animation::New(0.0f);
13083 const float durationSeconds(1.0f);
13084 animation.SetDuration(durationSeconds);
13086 bool finishedSignalReceived(false);
13087 bool progressSignalReceived(false);
13089 AnimationFinishCheck finishCheck(finishedSignalReceived);
13090 animation.FinishedSignal().Connect(&application, finishCheck);
13092 AnimationProgressCheck progressCheck(progressSignalReceived);
13093 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13094 application.SendNotification();
13096 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13097 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13099 tet_infoline( "Animation Progress PlayRange as 10% ~ 90%" );
13100 animation.SetPlayRange( Vector2( 0.1f, 0.9f ) );
13102 tet_infoline( "Animation Progress notification set to >90% that never can notificated" );
13103 DevelAnimation::SetProgressNotification( animation, 0.9f + Math::MACHINE_EPSILON_1 );
13105 application.SendNotification();
13106 application.Render( );
13108 progressCheck.CheckSignalNotReceived();
13112 application.SendNotification();
13113 application.Render(0); // start animation
13114 application.Render(durationSeconds*0.25*1000.0f ); // 35% progress
13115 DALI_TEST_EQUALS( 0.35f, animation.GetCurrentProgress(), TEST_LOCATION );
13117 tet_infoline( "Animation at 35%" );
13119 progressCheck.CheckSignalNotReceived();
13121 application.SendNotification();
13122 application.Render(durationSeconds*0.25*1000.0f ); // 60% progress
13123 application.SendNotification();
13124 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
13126 tet_infoline( "Animation at 60%" );
13128 progressCheck.CheckSignalNotReceived();
13130 application.Render(durationSeconds*0.25*1000.0f ); // 85% progress
13131 tet_infoline( "Animation at 85%" );
13132 application.SendNotification();
13133 DALI_TEST_EQUALS( 0.85f, animation.GetCurrentProgress(), TEST_LOCATION );
13135 progressCheck.CheckSignalNotReceived();
13137 application.Render(durationSeconds*0.25*1000.0f ); // 90% progress
13138 tet_infoline( "Animation over 90%" );
13139 application.SendNotification();
13141 // progress never signaled because playrange is 90%
13142 progressCheck.CheckSignalNotReceived();
13147 int UtcDaliAnimationProgressCallbackLongDurationP(void)
13149 TestApplication application;
13151 Actor actor = Actor::New();
13152 application.GetScene().Add(actor);
13154 // Build the animation
13155 Animation animation = Animation::New(0.0f);
13158 float durationSeconds(5.0f);
13159 animation.SetDuration(durationSeconds);
13161 bool finishedSignalReceived(false);
13162 bool progressSignalReceived(false);
13164 AnimationFinishCheck finishCheck(finishedSignalReceived);
13165 animation.FinishedSignal().Connect(&application, finishCheck);
13167 AnimationProgressCheck progressCheck(progressSignalReceived);
13168 DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
13169 application.SendNotification();
13171 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
13172 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
13174 tet_infoline( "Animation Progress notification set to 50%" );
13175 DevelAnimation::SetProgressNotification( animation, 0.5f );
13177 application.SendNotification();
13178 application.Render( );
13180 progressCheck.CheckSignalNotReceived();
13184 application.SendNotification();
13185 application.Render(0); // start animation
13186 application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
13187 DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
13189 tet_infoline( "Animation at 25%" );
13191 progressCheck.CheckSignalNotReceived();
13193 application.SendNotification();
13194 application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
13195 application.SendNotification();
13196 tet_infoline( "Animation at 50%" );
13197 DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
13199 progressCheck.CheckSignalReceived();
13201 tet_infoline( "Progress check reset" );
13202 progressCheck.Reset();
13204 application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
13205 tet_infoline( "Animation at 75%" );
13206 application.SendNotification();
13208 DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
13210 progressCheck.CheckSignalNotReceived();
13215 int UtcDaliAnimationAnimateByInvalidParameters(void)
13217 TestApplication application;
13219 Actor actor = Actor::New();
13220 application.GetScene().Add(actor);
13222 // Create the animation
13223 Animation animation = Animation::New(1.0f);
13225 DALI_TEST_ASSERTION(
13227 // non animateable property (STRING)
13228 animation.AnimateBy( Property( actor, Actor::Property::LAYOUT_DIRECTION ), Property::Value( "new direction" ) );
13229 }, "Property type is not animatable" );
13231 DALI_TEST_ASSERTION(
13233 // non animateable property (MATRIX)
13234 Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Dali::Matrix() ), Property::ANIMATABLE );
13235 animation.AnimateBy( Property( actor, index ), Property::Value( Property::MATRIX ) );
13236 }, "Property type is not animatable" );
13239 DALI_TEST_ASSERTION(
13241 // non animateable target (NONE)
13242 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value() );
13243 }, "Target value is not animatable" );
13245 DALI_TEST_ASSERTION(
13247 // non animateable target (STRING)
13248 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value("foo") );
13249 }, "Target value is not animatable" );
13251 DALI_TEST_ASSERTION(
13253 // not mathing properties (VECTOR3, FLOAT)
13254 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( 10.f ) );
13255 }, "Property and target types don't match" );
13257 DALI_TEST_ASSERTION(
13259 // not mathing properties (VECTOR3.A, VECTOR2)
13260 animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), Property::Value( Property::VECTOR2 ) );
13261 }, "Property and target types don't match" );
13263 DALI_TEST_ASSERTION(
13265 // negative duration
13266 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13267 }, "Duration must be >=0" );
13272 int UtcDaliAnimationAnimateToInvalidParameters(void)
13274 TestApplication application;
13276 Actor actor = Actor::New();
13277 application.GetScene().Add(actor);
13279 // Create the animation
13280 Animation animation = Animation::New(1.0f);
13283 DALI_TEST_ASSERTION(
13285 // non animateable property (MAP)
13286 Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::MAP ), Property::ANIMATABLE );
13287 animation.AnimateTo( Property( actor, index ), Property::Value( Property::MAP ) );
13288 }, "Property type is not animatable" );
13290 DALI_TEST_ASSERTION(
13292 // non animateable target (NONE)
13293 animation.AnimateTo( Property( actor, Actor::Property::CLIPPING_MODE ), Property::Value() );
13294 }, "Property type is not animatable" );
13296 DALI_TEST_ASSERTION(
13298 // non animateable target (ARRAY)
13299 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Property::ARRAY ) );
13300 }, "Target value is not animatable" );
13302 DALI_TEST_ASSERTION(
13304 // non animateable target (RECTANGLE)
13305 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Rect<int32_t>() ) );
13306 }, "Target value is not animatable" );
13308 DALI_TEST_ASSERTION(
13310 // not mathing properties (FLOAT, INT)
13311 animation.AnimateTo( Property( actor, Actor::Property::SCALE_Y ), Property::Value(10) );
13312 }, "Property and target types don't match" );
13314 DALI_TEST_ASSERTION(
13316 // not mathing properties (VECTOR3, VECTOR2)
13317 animation.AnimateTo( Property( actor, Actor::Property::COLOR ), Property::Value( Property::VECTOR2 ) );
13318 }, "Property and target types don't match" );
13320 DALI_TEST_ASSERTION(
13322 // negative duration
13323 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
13324 }, "Duration must be >=0" );
13329 int UtcDaliAnimationAnimateBetweenInvalidParameters(void)
13331 TestApplication application;
13333 Actor actor = Actor::New();
13334 application.GetScene().Add(actor);
13336 // Create the animation
13337 Animation animation = Animation::New(1.0f);
13340 DALI_TEST_ASSERTION(
13342 // non animateable property (ARRAY)
13343 Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::ARRAY ), Property::ANIMATABLE );
13344 KeyFrames keyframes = KeyFrames::New();
13345 keyframes.Add( 0.5f, Property::Value( Property::ARRAY ) );
13346 animation.AnimateBetween( Property( actor, index ), keyframes );
13347 }, "Property type is not animatable" );
13349 DALI_TEST_ASSERTION(
13351 // non animateable target (NONE)
13352 KeyFrames keyframes = KeyFrames::New();
13353 keyframes.Add( 0.5f, Property::Value() );
13354 animation.AnimateBetween( Property( actor, Actor::Property::CLIPPING_MODE ), keyframes );
13355 }, "Property type is not animatable" );
13357 DALI_TEST_ASSERTION(
13359 // non animateable target (EXTENTS)
13360 KeyFrames keyframes = KeyFrames::New();
13361 keyframes.Add( 0.5f, Property::Value( Property::EXTENTS ) ); // throws
13362 animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13363 }, "Property type is not animatable" );
13365 DALI_TEST_ASSERTION(
13367 // non animateable target (RECTANGLE)
13368 KeyFrames keyframes = KeyFrames::New();
13369 keyframes.Add( 0.5f, Property::Value( Property::MAP ) ); // throws
13370 animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
13371 }, "Property type is not animatable" );
13373 DALI_TEST_ASSERTION(
13375 // not mathing properties (VECTOR2, VECTOR4)
13376 KeyFrames keyframes = KeyFrames::New();
13377 keyframes.Add( 0.5f, Property::Value( Vector4( 1, 2, 3, 4 ) ) );
13378 animation.AnimateBetween( Property( actor, Actor::Property::MAXIMUM_SIZE ), keyframes );
13379 }, "Property and target types don't match" );
13381 DALI_TEST_ASSERTION(
13383 // negative duration
13384 KeyFrames keyframes = KeyFrames::New();
13385 keyframes.Add( 0.5f, Property::Value(Vector3( 1, 2, 3 ) ) );
13386 animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes, TimePeriod(-1) );
13387 }, "Duration must be >=0" );
13392 namespace // Purposefully left this in the middle as the values in this namespace are only used for the subsequent two test cases
13400 void CheckPropertyValuesWhenCallingAnimationMethod( TestFunction functionToTest, const char * testName )
13402 tet_printf( "Testing %s\n", testName );
13404 // When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
13405 // This test checks that that is being done
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 struct ExpectedValue
13415 Animation::EndAction endAction;
13416 Vector3 expectedGetPropertyValue;
13419 ExpectedValue expectedValueTable[] =
13421 { Animation::Bake, halfWayToTarget }, // When baking, the current value is the final value.
13422 { Animation::BakeFinal, targetPosition }, // When BakeFinal, we should jump to the final value when clearing or stopping.
13423 { Animation::Discard, originalPosition }, // When discarding, we should jump back to the original value when clearing or stopping.
13425 const auto expectedValueTableCount = sizeof( expectedValueTable ) / sizeof( ExpectedValue );
13427 for( auto i = 0u; i < expectedValueTableCount; ++i )
13429 TestApplication application;
13431 Actor actor = Actor::New();
13432 application.GetScene().Add(actor);
13434 // Build the animation
13435 Animation animation = Animation::New( durationSeconds );
13436 animation.SetEndAction( expectedValueTable[ i ].endAction );
13437 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
13439 // Start the animation
13442 application.SendNotification();
13443 application.Render( halfAnimationDuration );
13445 // Stop or Clear the animation early, both have the same effect
13446 if( functionToTest == TestFunction::STOP )
13455 // 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
13456 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
13457 DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13459 // After one frame, both values should match regardless of the End Action
13460 application.SendNotification();
13461 application.Render();
13463 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
13464 DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
13467 } // unnamed namespace
13469 int UtcDaliAnimationStopPropertyValue(void)
13471 CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::STOP, "UtcDaliAnimationStopPropertyValue" );
13475 int UtcDaliAnimationClearPropertyValue(void)
13477 CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue" );
13481 int UtcDaliAnimationPausePropertyValue(void)
13483 const float durationSeconds( 1.0f );
13484 unsigned int halfAnimationDuration( static_cast< unsigned int >( durationSeconds * 1000.0f * 0.5f ) );
13485 const Vector3 originalPosition( Vector3::ZERO );
13486 const Vector3 targetPosition( 10.0f, 10.0f, 10.0f );
13487 const Vector3 halfWayToTarget( targetPosition * 0.5f );
13489 Animation::EndAction endActions[] =
13492 Animation::BakeFinal,
13493 Animation::Discard,
13495 const auto endActionCount = sizeof( endActions ) / sizeof( endActions[0] );
13497 // For all end actions, when pausing, we stay at the current value
13498 for( auto i = 0u; i < endActionCount; ++i )
13500 TestApplication application;
13502 Actor actor = Actor::New();
13503 application.GetScene().Add(actor);
13505 // Build the animation
13506 Animation animation = Animation::New( durationSeconds );
13507 animation.SetEndAction( endActions[ i ] );
13508 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
13510 // Start the animation
13513 application.SendNotification();
13514 application.Render( halfAnimationDuration );
13516 // Puase the animation early
13519 // The event side property should be set the current value immediately, the update side property will still only be halfway
13520 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13521 DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13523 // After one frame, both values should match regardless of the End Action
13524 application.SendNotification();
13525 application.Render();
13527 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13528 DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
13534 int UtcDaliAnimationPlayFromWithLoopCount(void)
13536 TestApplication application;
13538 auto actor = Actor::New();
13539 application.GetScene().Add( actor );
13541 auto animation = Animation::New( 1.0f );
13542 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f );
13543 animation.SetLoopCount( 2 );
13546 application.SendNotification();
13547 application.Render( 1001 );
13549 // One loop completed
13551 application.Render( 2005 );
13552 application.SendNotification();
13554 // 2 loops should have completed
13555 DALI_TEST_EQUALS( animation.GetCurrentLoop(), 2u, TEST_LOCATION );
13557 // Another render needs to occur after all the loops end
13558 application.SendNotification();
13559 application.Render( 1000 );
13561 // Stop the animation and use PlayFrom, previously we got an Assert here
13563 animation.PlayFrom( 0.5f );
13565 application.SendNotification();
13566 application.Render( 1000 );
13568 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
13573 int UtcDaliAnimationCombineToAndByWithStop(void)
13575 tet_infoline( "Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
13577 TestApplication application;
13579 auto actor = Actor::New();
13580 actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
13581 application.GetScene().Add( actor );
13583 auto animation = Animation::New( 1.0f );
13584 const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >();
13585 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) );
13586 animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Vector3( -30.0f, 0.0f, 0.0f ), TimePeriod( 1.0f, 1.0f ) );
13589 application.SendNotification();
13590 application.Render( 500 );
13592 application.SendNotification();
13593 application.Render( 500 );
13595 application.SendNotification();
13596 application.Render( 500 );
13598 // Stop and clear the animation using the current values
13602 // Check the y position, it should be the same as before
13603 DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION_Y).Get< float >(), origY, TEST_LOCATION );
13608 int UtcDaliAnimationCountAndGetAnimationAt(void)
13610 tet_infoline( "UtcDaliAnimationCountAndGetAnimationAt");
13612 TestApplication application;
13614 auto actor = Actor::New();
13615 actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
13616 application.GetScene().Add( actor );
13618 auto animation = Animation::New( 1.0f );
13619 const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >();
13620 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) );
13623 application.SendNotification();
13624 application.Render( 500 );
13626 uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
13627 DALI_TEST_EQUALS( animationCount, 1, TEST_LOCATION );
13629 DALI_TEST_CHECK( !Dali::DevelAnimation::GetAnimationAt( 5 ) );
13631 Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt( 0 );
13632 DALI_TEST_EQUALS( animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION );
13634 DALI_TEST_EQUALS( animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION );
13635 DALI_TEST_EQUALS( animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION );
13636 DALI_TEST_EQUALS( animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION );
13637 DALI_TEST_EQUALS( animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION );
13638 DALI_TEST_EQUALS( animation.GetState(), animationReturned.GetState(), TEST_LOCATION );
13640 // Stop and clear the animation using the current values