2 * Copyright (c) 2016 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>
29 void utc_dali_animation_startuP(void)
31 test_return_value = TET_UNDEF;
34 void utc_dali_animation_cleanuP(void)
36 test_return_value = TET_PASS;
42 static const float ROTATION_EPSILON = 0.0001f;
43 static const float VECTOR4_EPSILON = 0.0001f;
45 // Functor to test whether a Finish signal is emitted
46 struct AnimationFinishCheck
48 AnimationFinishCheck(bool& signalReceived)
49 : mSignalReceived(signalReceived)
53 void operator()(Animation& animation)
55 mSignalReceived = true;
60 mSignalReceived = false;
63 void CheckSignalReceived()
67 tet_printf("Expected Finish signal was not received\n");
76 void CheckSignalNotReceived()
80 tet_printf("Unexpected Finish signal was received\n");
89 bool& mSignalReceived; // owned by individual tests
94 int UtcDaliAnimationConstructorP(void)
96 TestApplication application;
100 DALI_TEST_CHECK( !animation );
104 int UtcDaliAnimationNewP(void)
106 TestApplication application;
108 Animation animation = Animation::New( 1.0f );
110 DALI_TEST_CHECK(animation);
114 int UtcDaliAnimationNewN(void)
116 TestApplication application;
118 Animation animation = Animation::New( -1.0f );
120 DALI_TEST_CHECK(animation);
121 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
125 int UtcDaliAnimationDownCastP(void)
127 TestApplication application;
129 tet_infoline("Testing Dali::Animation::DownCast()");
131 float durationSeconds(1.0f);
132 Animation animation = Animation::New(durationSeconds);
134 BaseHandle object(animation);
136 Animation animation2 = Animation::DownCast(object);
137 DALI_TEST_CHECK(animation2);
139 Animation animation3 = DownCast< Animation >(object);
140 DALI_TEST_CHECK(animation3);
144 int UtcDaliAnimationDownCastN(void)
146 TestApplication application;
148 BaseHandle unInitializedObject;
150 Animation animation1 = Animation::DownCast( unInitializedObject );
151 DALI_TEST_CHECK( !animation1 );
153 Animation animation2 = DownCast< Animation >( unInitializedObject );
154 DALI_TEST_CHECK( !animation2 );
158 int UtcDaliAnimationCopyConstructorP(void)
160 TestApplication application;
162 // Initialize an object, ref count == 1
163 Animation animation = Animation::New( 1.0f );
165 Animation copy( animation );
166 DALI_TEST_CHECK( copy );
168 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
172 int UtcDaliAnimationAssignmentOperatorP(void)
174 TestApplication application;
176 Animation animation = Animation::New( 1.0f );
178 Animation copy = animation;
179 DALI_TEST_CHECK( copy );
181 DALI_TEST_CHECK( animation == copy );
183 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
187 int UtcDaliAnimationSetDurationP(void)
189 TestApplication application;
191 Actor actor = Actor::New();
192 Stage::GetCurrent().Add(actor);
194 // Build the animation
195 float durationSeconds(1.0f);
196 Animation animation = Animation::New(durationSeconds);
197 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
199 // Start the animation
200 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
201 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
204 bool signalReceived(false);
205 AnimationFinishCheck finishCheck(signalReceived);
206 animation.FinishedSignal().Connect(&application, finishCheck);
208 application.SendNotification();
209 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
211 // We didn't expect the animation to finish yet
212 application.SendNotification();
213 finishCheck.CheckSignalNotReceived();
215 application.Render(2u/*just beyond the animation duration*/);
217 // We did expect the animation to finish
218 application.SendNotification();
219 finishCheck.CheckSignalReceived();
220 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
222 // Restart the animation, with a different duration
224 actor.SetPosition(Vector3::ZERO);
225 durationSeconds = 3.5f;
226 animation.SetDuration(durationSeconds);
227 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
230 application.SendNotification();
231 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
233 // We didn't expect the animation to finish yet
234 application.SendNotification();
235 finishCheck.CheckSignalNotReceived();
237 application.Render(2u/*just beyond the animation duration*/);
239 // We did expect the animation to finish
240 application.SendNotification();
241 finishCheck.CheckSignalReceived();
242 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
244 // Check that nothing has changed after a couple of buffer swaps
245 application.Render(0);
246 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
247 application.Render(0);
248 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
252 int UtcDaliAnimationSetDurationN(void)
254 TestApplication application;
256 Animation animation = Animation::New( 1.0f );
257 DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
259 animation.SetDuration( -1.0f );
260 DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
264 int UtcDaliAnimationGetDurationP(void)
266 TestApplication application;
268 Animation animation = Animation::New(1.0f);
269 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
271 animation.SetDuration(2.0f);
272 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
276 int UtcDaliAnimationSetLoopingP(void)
278 TestApplication application;
280 Actor actor = Actor::New();
281 Stage::GetCurrent().Add(actor);
283 // Build the animation
284 float durationSeconds(1.0f);
285 Animation animation = Animation::New(durationSeconds);
286 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
287 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
289 // Start the animation
290 animation.SetLooping(true);
291 DALI_TEST_CHECK(animation.IsLooping());
294 bool signalReceived(false);
295 AnimationFinishCheck finishCheck(signalReceived);
296 animation.FinishedSignal().Connect(&application, finishCheck);
298 application.SendNotification();
301 float intervalSeconds = 0.25f;
302 float progress = 0.0f;
303 for (int iterations = 0; iterations < 5;)
305 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
307 progress += intervalSeconds;
308 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
310 if (progress >= 1.0f)
312 progress = progress - 1.0f;
317 // We didn't expect the animation to finish yet
318 application.SendNotification();
319 finishCheck.CheckSignalNotReceived();
321 animation.SetLooping(false);
322 DALI_TEST_CHECK(!animation.IsLooping());
324 application.SendNotification();
325 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
327 // We did expect the animation to finish
328 application.SendNotification();
329 finishCheck.CheckSignalReceived();
330 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
332 // Check that nothing has changed after a couple of buffer swaps
333 application.Render(0);
334 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
335 application.Render(0);
336 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
340 int UtcDaliAnimationSetLoopCountP(void)
342 TestApplication application;
344 Actor actor = Actor::New();
345 Stage::GetCurrent().Add(actor);
347 // Build the animation
348 float durationSeconds(1.0f);
349 Animation animation = Animation::New(durationSeconds);
350 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
351 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
353 // Start the animation
354 animation.SetLoopCount(3);
355 DALI_TEST_CHECK(animation.IsLooping());
358 bool signalReceived(false);
359 AnimationFinishCheck finishCheck(signalReceived);
360 animation.FinishedSignal().Connect(&application, finishCheck);
362 application.Render(0);
363 application.SendNotification();
364 application.Render(0);
365 application.SendNotification();
366 application.Render(0);
367 application.SendNotification();
368 application.Render(0);
369 application.SendNotification();
372 float intervalSeconds = 3.0f;
374 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
375 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
377 application.Render(0);
378 application.SendNotification();
379 application.Render(0);
380 application.SendNotification();
381 application.Render(0);
382 application.SendNotification();
383 application.Render(0);
384 application.SendNotification();
385 finishCheck.CheckSignalNotReceived();
387 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
389 application.SendNotification();
390 finishCheck.CheckSignalReceived();
391 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
395 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
396 application.SendNotification();
397 finishCheck.CheckSignalNotReceived();
399 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
400 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
401 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
402 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
403 application.SendNotification();
404 finishCheck.CheckSignalNotReceived();
409 int UtcDaliAnimationSetLoopCountP2(void)
411 TestApplication application;
414 // switching between forever and loop count
417 Actor actor = Actor::New();
418 Stage::GetCurrent().Add(actor);
420 // Build the animation
421 float durationSeconds(1.0f);
422 Animation animation = Animation::New(durationSeconds);
423 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
424 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
425 animation.SetEndAction(Animation::Discard);
427 // Start the animation
428 animation.SetLoopCount(3);
429 DALI_TEST_CHECK(animation.IsLooping());
432 bool signalReceived(false);
433 AnimationFinishCheck finishCheck(signalReceived);
434 animation.FinishedSignal().Connect(&application, finishCheck);
436 float intervalSeconds = 3.0f;
438 application.SendNotification();
439 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
440 application.SendNotification();
441 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
442 application.SendNotification();
443 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
444 application.SendNotification();
446 application.SendNotification();
447 finishCheck.CheckSignalReceived();
452 animation.SetLooping(true);
453 DALI_TEST_CHECK(animation.IsLooping());
455 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
456 application.SendNotification();
457 finishCheck.CheckSignalNotReceived();
459 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
460 application.SendNotification();
461 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
462 application.SendNotification();
463 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
464 application.SendNotification();
465 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
466 application.SendNotification();
467 application.SendNotification();
468 finishCheck.CheckSignalNotReceived();
473 animation.SetLoopCount(3);
474 DALI_TEST_CHECK(animation.IsLooping());
477 application.SendNotification();
478 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
479 application.SendNotification();
480 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
481 application.SendNotification();
482 finishCheck.CheckSignalNotReceived();
484 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
485 application.SendNotification();
486 finishCheck.CheckSignalReceived();
491 animation.SetLooping(true);
492 DALI_TEST_CHECK(animation.IsLooping());
494 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
495 application.SendNotification();
496 finishCheck.CheckSignalNotReceived();
498 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
499 application.SendNotification();
500 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
501 application.SendNotification();
502 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
503 application.SendNotification();
504 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
505 application.SendNotification();
506 finishCheck.CheckSignalNotReceived();
511 animation.SetLoopCount(3);
512 DALI_TEST_CHECK(animation.IsLooping());
514 application.SendNotification();
515 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
516 application.SendNotification();
517 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
518 application.SendNotification();
519 finishCheck.CheckSignalNotReceived();
521 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
522 application.SendNotification();
523 finishCheck.CheckSignalNotReceived(); // we never hit play
531 int UtcDaliAnimationSetLoopCountP3(void)
533 TestApplication application;
536 // switching between forever and loop count
538 Actor actor = Actor::New();
539 Stage::GetCurrent().Add(actor);
541 // Build the animation
542 float durationSeconds(1.0f);
543 Animation animation = Animation::New(durationSeconds);
544 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
545 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
546 animation.SetEndAction(Animation::Discard);
548 float intervalSeconds = 3.0f;
550 bool signalReceived(false);
551 AnimationFinishCheck finishCheck(signalReceived);
552 animation.FinishedSignal().Connect(&application, finishCheck);
555 animation.SetLooping(true);
556 DALI_TEST_CHECK(animation.IsLooping());
558 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
559 application.SendNotification();
560 finishCheck.CheckSignalNotReceived();
562 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
563 application.SendNotification();
564 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.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 finishCheck.CheckSignalNotReceived();
575 animation.SetLoopCount(3);
576 DALI_TEST_CHECK(animation.IsLooping());
578 application.SendNotification();
579 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
580 application.SendNotification();
581 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
582 application.SendNotification();
583 finishCheck.CheckSignalNotReceived();
585 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
586 application.SendNotification();
587 finishCheck.CheckSignalNotReceived(); // we never hit play
595 int UtcDaliAnimationSetLoopCountP4(void)
597 TestApplication application;
602 Actor actor = Actor::New();
603 Stage::GetCurrent().Add(actor);
605 // Build the animation
606 float durationSeconds(1.0f);
607 Animation animation = Animation::New(durationSeconds);
608 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
609 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
610 animation.SetEndAction(Animation::Bake);
612 float intervalSeconds = 3.0f;
614 bool signalReceived(false);
615 AnimationFinishCheck finishCheck(signalReceived);
616 animation.FinishedSignal().Connect(&application, finishCheck);
618 animation.SetLoopCount(1);
620 DALI_TEST_CHECK(!animation.IsLooping());
622 application.SendNotification();
623 finishCheck.CheckSignalNotReceived();
624 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
625 application.SendNotification();
626 finishCheck.CheckSignalReceived();
628 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
629 actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
633 animation.Play(); // again
634 DALI_TEST_CHECK(!animation.IsLooping());
636 application.SendNotification();
637 finishCheck.CheckSignalNotReceived();
638 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
639 application.SendNotification();
640 finishCheck.CheckSignalReceived();
642 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
647 int UtcDaliAnimationGetLoopCountP(void)
649 TestApplication application;
651 Actor actor = Actor::New();
652 Stage::GetCurrent().Add(actor);
654 // Build the animation
655 float durationSeconds(1.0f);
656 Animation animation = Animation::New(durationSeconds);
657 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
658 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
660 DALI_TEST_CHECK(1 == animation.GetLoopCount());
662 // Start the animation
663 animation.SetLoopCount(3);
664 DALI_TEST_CHECK(animation.IsLooping());
665 DALI_TEST_CHECK(3 == animation.GetLoopCount());
669 application.Render(0);
670 application.SendNotification();
673 float intervalSeconds = 3.0f;
675 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
676 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
678 application.Render(0);
679 application.SendNotification();
681 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
682 application.SendNotification();
684 animation.SetLoopCount(0);
685 DALI_TEST_CHECK(animation.IsLooping());
686 DALI_TEST_CHECK(0 == animation.GetLoopCount());
688 animation.SetLoopCount(1);
689 DALI_TEST_CHECK(!animation.IsLooping());
690 DALI_TEST_CHECK(1 == animation.GetLoopCount());
696 int UtcDaliAnimationGetCurrentLoopP(void)
698 TestApplication application;
700 Actor actor = Actor::New();
701 Stage::GetCurrent().Add(actor);
703 // Build the animation
704 float durationSeconds(1.0f);
705 Animation animation = Animation::New(durationSeconds);
706 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
707 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
709 // Start the animation
710 animation.SetLoopCount(3);
711 DALI_TEST_CHECK(animation.IsLooping());
712 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
715 bool signalReceived(false);
716 AnimationFinishCheck finishCheck(signalReceived);
717 animation.FinishedSignal().Connect(&application, finishCheck);
719 application.SendNotification();
722 float intervalSeconds = 3.0f;
724 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
725 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
727 application.SendNotification();
728 finishCheck.CheckSignalNotReceived();
729 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
731 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
733 application.SendNotification();
734 finishCheck.CheckSignalReceived();
735 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
736 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
740 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
741 application.SendNotification();
742 finishCheck.CheckSignalNotReceived();
743 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
745 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
746 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
747 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
748 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
749 application.SendNotification();
750 finishCheck.CheckSignalNotReceived();
751 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
756 int UtcDaliAnimationIsLoopingP(void)
758 TestApplication application;
760 Animation animation = Animation::New(1.0f);
761 DALI_TEST_CHECK(!animation.IsLooping());
763 animation.SetLooping(true);
764 DALI_TEST_CHECK(animation.IsLooping());
768 int UtcDaliAnimationSetEndActioN(void)
770 TestApplication application;
772 Actor actor = Actor::New();
773 Stage::GetCurrent().Add(actor);
775 // Build the animation
776 float durationSeconds(1.0f);
777 Animation animation = Animation::New(durationSeconds);
778 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
780 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
781 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
783 // Start the animation
786 bool signalReceived(false);
787 AnimationFinishCheck finishCheck(signalReceived);
788 animation.FinishedSignal().Connect(&application, finishCheck);
790 application.SendNotification();
791 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
793 // We did expect the animation to finish
794 application.SendNotification();
795 finishCheck.CheckSignalReceived();
796 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
798 // Go back to the start
799 actor.SetPosition(Vector3::ZERO);
800 application.SendNotification();
801 application.Render(0);
802 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
804 // Test BakeFinal, animate again, for half the duration
806 animation.SetEndAction(Animation::BakeFinal);
807 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
810 application.SendNotification();
811 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
813 // Stop the animation early
816 // We did NOT expect the animation to finish
817 application.SendNotification();
818 finishCheck.CheckSignalNotReceived();
819 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
821 // The position should be same with target position in the next frame
822 application.Render(0);
823 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
825 // Go back to the start
826 actor.SetPosition(Vector3::ZERO);
827 application.SendNotification();
828 application.Render(0);
829 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
831 // Test EndAction::Discard, animate again, but don't bake this time
833 animation.SetEndAction(Animation::Discard);
834 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
837 application.SendNotification();
838 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
840 // We did expect the animation to finish
841 application.SendNotification();
842 finishCheck.CheckSignalReceived();
843 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
845 // The position should be discarded in the next frame
846 application.Render(0);
847 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
849 // Check that nothing has changed after a couple of buffer swaps
850 application.Render(0);
851 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
852 application.Render(0);
853 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
857 int UtcDaliAnimationGetEndActionP(void)
859 TestApplication application;
861 Animation animation = Animation::New(1.0f);
862 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
864 animation.SetEndAction(Animation::Discard);
865 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
867 animation.SetEndAction(Animation::BakeFinal);
868 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
873 int UtcDaliAnimationSetDisconnectActionP(void)
875 TestApplication application;
876 Stage stage( Stage::GetCurrent() );
878 // Default: BakeFinal
880 Actor actor = Actor::New();
883 // Build the animation
884 float durationSeconds(1.0f);
885 Animation animation = Animation::New(durationSeconds);
886 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
888 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
889 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
891 // Start the animation
894 application.SendNotification();
895 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
899 application.SendNotification();
900 application.Render();
902 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
907 Actor actor = Actor::New();
910 // Build the animation
911 float durationSeconds(1.0f);
912 Animation animation = Animation::New(durationSeconds);
913 animation.SetDisconnectAction( Animation::Bake );
915 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
916 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
918 // Start the animation
921 application.SendNotification();
922 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
926 application.SendNotification();
927 application.Render();
929 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
934 Actor actor = Actor::New();
937 // Build the animation
938 float durationSeconds(1.0f);
939 Animation animation = Animation::New(durationSeconds);
940 animation.SetDisconnectAction( Animation::Discard );
942 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
943 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
945 // Start the animation
948 application.SendNotification();
949 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
953 application.SendNotification();
954 application.Render();
956 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
959 // Don't play the animation: disconnect action should not be applied
961 Actor actor = Actor::New();
964 // Build the animation
965 float durationSeconds(1.0f);
966 Animation animation = Animation::New(durationSeconds);
968 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
969 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
971 application.SendNotification();
972 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
976 application.SendNotification();
977 application.Render();
979 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
985 int UtcDaliAnimationGetDisconnectActionP(void)
987 TestApplication application;
988 Animation animation = Animation::New(1.0f);
989 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
991 animation.SetDisconnectAction(Animation::Discard);
992 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
994 animation.SetDisconnectAction(Animation::Bake);
995 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
1000 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1002 TestApplication application;
1004 Animation animation = Animation::New(1.0f);
1005 AlphaFunction func = animation.GetDefaultAlphaFunction();
1006 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1008 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1009 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1010 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1014 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1016 TestApplication application;
1018 Animation animation = Animation::New(1.0f);
1019 AlphaFunction func = animation.GetDefaultAlphaFunction();
1021 // Test that the default is linear
1022 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1024 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1025 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1026 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1031 int UtcDaliAnimationSetCurrentProgressP(void)
1033 TestApplication application;
1035 Actor actor = Actor::New();
1036 Stage::GetCurrent().Add(actor);
1038 // Build the animation
1039 Animation animation = Animation::New(0.0f);
1042 float durationSeconds(1.0f);
1043 animation.SetDuration(durationSeconds);
1045 bool signalReceived(false);
1046 AnimationFinishCheck finishCheck(signalReceived);
1047 animation.FinishedSignal().Connect(&application, finishCheck);
1048 application.SendNotification();
1050 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1051 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1053 // Start the animation from 40% progress
1054 animation.SetCurrentProgress( 0.4f );
1057 application.SendNotification();
1058 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1060 // We didn't expect the animation to finish yet
1061 application.SendNotification();
1062 finishCheck.CheckSignalNotReceived();
1063 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1064 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1066 animation.Play(); // Test that calling play has no effect, when animation is already playing
1067 application.SendNotification();
1069 //Set the progress to 70%
1070 animation.SetCurrentProgress( 0.7f );
1071 application.SendNotification();
1072 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1073 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1075 application.SendNotification();
1076 finishCheck.CheckSignalNotReceived();
1077 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1078 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1080 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1081 // We did expect the animation to finish
1082 application.SendNotification();
1083 finishCheck.CheckSignalReceived();
1084 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1086 // Check that nothing has changed after a couple of buffer swaps
1087 application.Render(0);
1088 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1089 application.Render(0);
1090 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1094 int UtcDaliAnimationSetCurrentProgressN(void)
1096 TestApplication application;
1098 Actor actor = Actor::New();
1099 Stage::GetCurrent().Add(actor);
1101 // Build the animation
1102 Animation animation = Animation::New(0.0f);
1105 float durationSeconds(1.0f);
1106 animation.SetDuration(durationSeconds);
1108 bool signalReceived(false);
1109 AnimationFinishCheck finishCheck(signalReceived);
1110 animation.FinishedSignal().Connect(&application, finishCheck);
1111 application.SendNotification();
1113 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1114 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1116 //Trying to set the current cursor outside the range [0..1] is ignored
1117 animation.SetCurrentProgress( -1.0f);
1118 application.SendNotification();
1119 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1121 animation.SetCurrentProgress( 100.0f);
1122 application.SendNotification();
1123 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1127 int UtcDaliAnimationGetCurrentProgressP(void)
1129 TestApplication application;
1131 Actor actor = Actor::New();
1132 Stage::GetCurrent().Add(actor);
1134 // Build the animation
1135 Animation animation = Animation::New(0.0f);
1138 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1139 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1141 animation.SetCurrentProgress( 0.5f );
1142 application.SendNotification();
1143 application.Render(static_cast<unsigned int>(100.0f));
1145 //Progress should still be 0.0
1146 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1149 float durationSeconds(1.0f);
1150 animation.SetDuration(durationSeconds);
1151 application.SendNotification();
1153 bool signalReceived(false);
1154 AnimationFinishCheck finishCheck(signalReceived);
1155 animation.FinishedSignal().Connect(&application, finishCheck);
1156 application.SendNotification();
1158 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1159 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1161 // Start the animation from 40% progress
1162 animation.SetCurrentProgress( 0.4f );
1165 application.SendNotification();
1166 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1168 // We didn't expect the animation to finish yet
1169 application.SendNotification();
1170 finishCheck.CheckSignalNotReceived();
1171 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1173 animation.Play(); // Test that calling play has no effect, when animation is already playing
1174 application.SendNotification();
1176 //Set the progress to 70%
1177 animation.SetCurrentProgress( 0.7f );
1178 application.SendNotification();
1179 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1180 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1182 application.SendNotification();
1183 finishCheck.CheckSignalNotReceived();
1184 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1186 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1187 // We did expect the animation to finish
1188 application.SendNotification();
1189 finishCheck.CheckSignalReceived();
1193 int UtcDaliAnimationSetSpeedFactorP1(void)
1195 TestApplication application;
1197 tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1199 Actor actor = Actor::New();
1200 Stage::GetCurrent().Add(actor);
1202 // Build the animation
1203 float durationSeconds(1.0f);
1204 Animation animation = Animation::New(durationSeconds);
1206 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1207 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1209 KeyFrames keyframes = KeyFrames::New();
1210 keyframes.Add( 0.0f, initialPosition);
1211 keyframes.Add( 1.0f, targetPosition );
1212 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1214 //Set speed to be x2
1215 animation.SetSpeedFactor(2.0f);
1217 // Start the animation
1220 bool signalReceived(false);
1221 AnimationFinishCheck finishCheck(signalReceived);
1222 animation.FinishedSignal().Connect(&application, finishCheck);
1224 application.SendNotification();
1225 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1227 // We didn't expect the animation to finish yet
1228 application.SendNotification();
1229 finishCheck.CheckSignalNotReceived();
1230 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1232 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1234 // We didn't expect the animation to finish yet
1235 application.SendNotification();
1236 finishCheck.CheckSignalNotReceived();
1237 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1239 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1241 // We did expect the animation to finish
1242 application.SendNotification();
1243 finishCheck.CheckSignalReceived();
1244 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1246 // Check that nothing has changed after a couple of buffer swaps
1247 application.Render(0);
1248 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1249 application.Render(0);
1250 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1255 int UtcDaliAnimationSetSpeedFactorP2(void)
1257 TestApplication application;
1259 Actor actor = Actor::New();
1260 Stage::GetCurrent().Add(actor);
1262 // Build the animation
1263 float durationSeconds(1.0f);
1264 Animation animation = Animation::New(durationSeconds);
1266 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1267 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1269 KeyFrames keyframes = KeyFrames::New();
1270 keyframes.Add( 0.0f, initialPosition);
1271 keyframes.Add( 1.0f, targetPosition );
1272 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1274 tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1275 animation.SetSpeedFactor( -1.0f );
1277 // Start the animation
1280 bool signalReceived(false);
1281 AnimationFinishCheck finishCheck(signalReceived);
1282 animation.FinishedSignal().Connect(&application, finishCheck);
1284 application.SendNotification();
1285 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1287 // We didn't expect the animation to finish yet
1288 application.SendNotification();
1289 finishCheck.CheckSignalNotReceived();
1290 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1292 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1294 // We didn't expect the animation to finish yet
1295 application.SendNotification();
1296 finishCheck.CheckSignalNotReceived();
1297 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1299 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1301 // We didn't expect the animation to finish yet
1302 application.SendNotification();
1303 finishCheck.CheckSignalNotReceived();
1304 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1306 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1308 // We didn't expect the animation to finish yet
1309 application.SendNotification();
1310 finishCheck.CheckSignalNotReceived();
1311 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1313 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1315 // We did expect the animation to finish
1316 application.SendNotification();
1317 finishCheck.CheckSignalReceived();
1318 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1320 // Check that nothing has changed after a couple of buffer swaps
1321 application.Render(0);
1322 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1323 application.Render(0);
1324 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1329 int UtcDaliAnimationSetSpeedFactorP3(void)
1331 TestApplication application;
1333 Actor actor = Actor::New();
1334 Stage::GetCurrent().Add(actor);
1336 // Build the animation
1337 float durationSeconds(1.0f);
1338 Animation animation = Animation::New(durationSeconds);
1340 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1341 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1343 KeyFrames keyframes = KeyFrames::New();
1344 keyframes.Add( 0.0f, initialPosition);
1345 keyframes.Add( 1.0f, targetPosition );
1346 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1348 bool signalReceived(false);
1349 AnimationFinishCheck finishCheck(signalReceived);
1350 animation.FinishedSignal().Connect(&application, finishCheck);
1352 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1354 //Set speed to be half of normal speed
1355 animation.SetSpeedFactor( 0.5f );
1357 // Start the animation
1360 application.SendNotification();
1361 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1363 // We didn't expect the animation to finish yet
1364 application.SendNotification();
1365 finishCheck.CheckSignalNotReceived();
1366 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1368 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1370 // We didn't expect the animation to finish yet
1371 application.SendNotification();
1372 finishCheck.CheckSignalNotReceived();
1373 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1375 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1377 // We didn't expect the animation to finish yet
1378 application.SendNotification();
1379 finishCheck.CheckSignalNotReceived();
1380 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1382 application.SendNotification();
1383 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1385 // We didn't expect the animation to finish yet
1386 application.SendNotification();
1387 finishCheck.CheckSignalNotReceived();
1388 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1390 application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1392 // We did expect the animation to finish
1393 application.SendNotification();
1394 finishCheck.CheckSignalReceived();
1395 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1397 // Check that nothing has changed after a couple of buffer swaps
1398 application.Render(0);
1399 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1400 application.Render(0);
1401 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1406 int UtcDaliAnimationSetSpeedFactorP4(void)
1408 TestApplication application;
1410 Actor actor = Actor::New();
1411 Stage::GetCurrent().Add(actor);
1413 // Build the animation
1414 float durationSeconds(1.0f);
1415 Animation animation = Animation::New(durationSeconds);
1417 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1418 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1420 KeyFrames keyframes = KeyFrames::New();
1421 keyframes.Add( 0.0f, initialPosition);
1422 keyframes.Add( 1.0f, targetPosition );
1423 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1425 bool signalReceived(false);
1426 AnimationFinishCheck finishCheck(signalReceived);
1427 animation.FinishedSignal().Connect(&application, finishCheck);
1429 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1431 tet_printf("Set speed to be half of normal speed\n");
1432 tet_printf("SetSpeedFactor(0.5f)\n");
1433 animation.SetSpeedFactor( 0.5f );
1435 // Start the animation
1438 application.SendNotification();
1439 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1441 // We didn't expect the animation to finish yet
1442 application.SendNotification();
1443 finishCheck.CheckSignalNotReceived();
1444 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1446 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1448 // We didn't expect the animation to finish yet
1449 application.SendNotification();
1450 finishCheck.CheckSignalNotReceived();
1451 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1453 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1455 // We didn't expect the animation to finish yet
1456 application.SendNotification();
1457 finishCheck.CheckSignalNotReceived();
1458 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1460 tet_printf("Reverse direction of animation whilst playing\n");
1461 tet_printf("SetSpeedFactor(-0.5f)\n");
1462 animation.SetSpeedFactor(-0.5f);
1464 application.SendNotification();
1465 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1467 // We didn't expect the animation to finish yet
1468 application.SendNotification();
1469 finishCheck.CheckSignalNotReceived();
1470 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1472 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1474 // We didn't expect the animation to finish yet
1475 application.SendNotification();
1476 finishCheck.CheckSignalNotReceived();
1477 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1479 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1481 // We did expect the animation to finish
1482 application.SendNotification();
1483 finishCheck.CheckSignalReceived();
1484 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1486 // Check that nothing has changed after a couple of buffer swaps
1487 application.Render(0);
1488 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1489 application.Render(0);
1490 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1494 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1496 TestApplication application;
1498 const unsigned int NUM_FRAMES(15);
1506 float expected[NUM_FRAMES];
1509 TestData testData[] = {
1511 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1512 /* |----------PlayRange---------------| */
1514 { 0.0f, 1.0f, // TimePeriod
1515 0.0f, 100.0f, // POS
1516 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1517 /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1528 // ACTOR 1 - Across start of range
1529 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1530 /* |----------PlayRange---------------| */
1532 { 0.2f, 0.5f, // TimePeriod
1533 20.0f, 50.0f, // POS
1534 {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1535 /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1545 // ACTOR 2 - Across end of range
1546 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1547 /* |----------PlayRange---------------| */
1549 {/**/ 0.5f, 0.9f, // TimePeriod
1550 /**/ 50.0f, 90.0f, // POS
1551 { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1552 /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1561 // ACTOR 3 - Before beginning of range
1562 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1563 /* |----------PlayRange---------------| */
1565 {/**/ 0.1f, 0.25f, // TimePeriod
1566 /**/ 10.0f, 25.0f, // POS
1568 /**/ 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
1573 // ACTOR 4 - After end of range
1574 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1575 /* |----------PlayRange---------------| */
1577 {/**/ 0.85f, 1.0f, // TimePeriod
1578 /**/ 85.0f, 100.0f, // POS
1580 /**/ 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
1584 // Actor 5 - Middle of range
1585 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1586 /* |----------PlayRange---------------| */
1588 {/**/ 0.4f, 0.65f, // Time Period
1589 /**/ 40.0f, 65.0f, // Position
1590 { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1591 /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1602 const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1604 // Build the animation
1605 float durationSeconds(1.0f);
1606 Animation animation = Animation::New(durationSeconds);
1607 bool signalReceived(false);
1608 AnimationFinishCheck finishCheck(signalReceived);
1609 animation.FinishedSignal().Connect(&application, finishCheck);
1611 std::vector<Dali::Actor> actors;
1613 for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1615 Actor actor = Actor::New();
1616 actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
1617 actors.push_back(actor);
1618 Stage::GetCurrent().Add(actor);
1620 if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1622 KeyFrames keyframes = KeyFrames::New();
1623 keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1624 keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1625 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1629 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1633 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1634 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1635 tet_printf("SetSpeedFactor(0.5f)\n");
1636 animation.SetSpeedFactor( 0.5f );
1637 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1638 animation.SetLooping(true);
1640 // Start the animation
1642 application.SendNotification();
1643 application.Render(0); // Frame 0 tests initial values
1645 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1647 unsigned int actorIndex = 0u;
1648 for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1650 DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1651 if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
1653 tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1659 tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1660 tet_printf("SetSpeedFactor(-0.5f)\n");
1661 animation.SetSpeedFactor(-0.5f);
1662 application.SendNotification();
1664 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1666 // We didn't expect the animation to finish yet
1667 application.SendNotification();
1668 finishCheck.CheckSignalNotReceived();
1674 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1676 TestApplication application;
1678 const unsigned int NUM_FRAMES(15);
1686 float expected[NUM_FRAMES];
1691 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1692 /* |----------PlayRange---------------| */
1693 { 0.0f, 1.0f, // TimePeriod
1694 0.0f, 100.0f, // POS
1695 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1696 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1697 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1703 // Build the animation
1704 float durationSeconds(1.0f);
1705 Animation animation = Animation::New(durationSeconds);
1706 bool signalReceived(false);
1707 AnimationFinishCheck finishCheck(signalReceived);
1708 animation.FinishedSignal().Connect(&application, finishCheck);
1710 std::vector<Dali::Actor> actors;
1712 Actor actor = Actor::New();
1713 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1714 actors.push_back(actor);
1715 Stage::GetCurrent().Add(actor);
1717 KeyFrames keyframes = KeyFrames::New();
1718 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1719 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1720 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1722 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1723 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1724 tet_printf("SetSpeedFactor(0.5f)\n");
1725 tet_printf("SetLoopCount(3)\n");
1726 animation.SetSpeedFactor( 0.5f );
1727 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1728 animation.SetLoopCount(3);
1730 // Start the animation
1732 application.SendNotification();
1733 application.Render(0); // Frame 0 tests initial values
1735 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1737 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1739 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1741 if( frame < NUM_FRAMES-1 )
1743 // We didn't expect the animation to finish yet
1744 application.SendNotification();
1745 finishCheck.CheckSignalNotReceived();
1749 // We did expect the animation to finish
1750 application.SendNotification();
1751 finishCheck.CheckSignalReceived();
1752 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
1757 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1759 TestApplication application;
1761 const unsigned int NUM_FRAMES(15);
1769 float expected[NUM_FRAMES];
1774 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1775 /* |----------PlayRange---------------| */
1776 { 0.0f, 1.0f, // TimePeriod
1777 0.0f, 100.0f, // POS
1778 {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1779 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1780 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1785 // Build the animation
1786 float durationSeconds(1.0f);
1787 Animation animation = Animation::New(durationSeconds);
1788 bool signalReceived(false);
1789 AnimationFinishCheck finishCheck(signalReceived);
1790 animation.FinishedSignal().Connect(&application, finishCheck);
1792 std::vector<Dali::Actor> actors;
1794 Actor actor = Actor::New();
1795 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1796 actors.push_back(actor);
1797 Stage::GetCurrent().Add(actor);
1799 KeyFrames keyframes = KeyFrames::New();
1800 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1801 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1802 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1804 tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1805 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1806 tet_printf("SetSpeedFactor(-0.5f)\n");
1807 tet_printf("SetLoopCount(3)\n");
1808 animation.SetSpeedFactor( -0.5f );
1809 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1810 animation.SetLoopCount(3);
1812 // Start the animation
1814 application.SendNotification();
1815 application.Render(0); // Frame 0 tests initial values
1817 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1819 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1821 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1823 if( frame < NUM_FRAMES-1 )
1825 // We didn't expect the animation to finish yet
1826 application.SendNotification();
1827 finishCheck.CheckSignalNotReceived();
1831 // We did expect the animation to finish
1832 application.SendNotification();
1833 finishCheck.CheckSignalReceived();
1834 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
1840 int UtcDaliAnimationGetSpeedFactorP(void)
1842 TestApplication application;
1844 Animation animation = Animation::New(1.0f);
1845 animation.SetSpeedFactor(0.5f);
1846 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1848 animation.SetSpeedFactor(-2.5f);
1849 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1853 int UtcDaliAnimationSetPlayRangeP(void)
1855 TestApplication application;
1857 Actor actor = Actor::New();
1858 Stage::GetCurrent().Add( actor );
1860 // Build the animation
1861 float durationSeconds( 1.0f );
1862 Animation animation = Animation::New( durationSeconds );
1864 bool signalReceived( false );
1865 AnimationFinishCheck finishCheck( signalReceived );
1866 animation.FinishedSignal().Connect( &application, finishCheck );
1867 application.SendNotification();
1869 // Set range between 0.4 and 0.8
1870 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1871 application.SendNotification();
1872 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1874 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1875 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1877 // Start the animation from 40% progress
1880 application.SendNotification();
1881 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1883 // We didn't expect the animation to finish yet
1884 application.SendNotification();
1885 finishCheck.CheckSignalNotReceived();
1886 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1888 application.SendNotification();
1889 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1891 application.SendNotification();
1892 finishCheck.CheckSignalNotReceived();
1893 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1895 application.SendNotification();
1896 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1898 // We did expect the animation to finish
1899 application.SendNotification();
1900 finishCheck.CheckSignalReceived();
1901 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1905 int UtcDaliAnimationSetPlayRangeN(void)
1907 TestApplication application;
1909 Actor actor = Actor::New();
1910 Stage::GetCurrent().Add(actor);
1912 // Build the animation
1913 Animation animation = Animation::New(0);
1914 application.SendNotification();
1916 //PlayRange out of bounds
1917 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1918 application.SendNotification();
1919 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1920 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1921 application.SendNotification();
1922 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1924 //If playRange is not in the correct order it has to be ordered
1925 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1926 application.SendNotification();
1927 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1932 int UtcDaliAnimationGetPlayRangeP(void)
1934 TestApplication application;
1936 Actor actor = Actor::New();
1937 Stage::GetCurrent().Add( actor );
1939 // Build the animation
1940 Animation animation = Animation::New( 1.0f );
1941 application.SendNotification();
1943 //If PlayRange not specified it should be 0.0-1.0 by default
1944 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1946 // Set range between 0.4 and 0.8
1947 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1948 application.SendNotification();
1949 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1954 int UtcDaliAnimationPlayP(void)
1956 TestApplication application;
1958 Actor actor = Actor::New();
1959 Stage::GetCurrent().Add(actor);
1961 // Build the animation
1962 float durationSeconds(1.0f);
1963 Animation animation = Animation::New(durationSeconds);
1964 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1965 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1967 // Start the animation
1970 bool signalReceived(false);
1971 AnimationFinishCheck finishCheck(signalReceived);
1972 animation.FinishedSignal().Connect(&application, finishCheck);
1974 application.SendNotification();
1975 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1977 // We didn't expect the animation to finish yet
1978 application.SendNotification();
1979 finishCheck.CheckSignalNotReceived();
1980 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1982 animation.Play(); // Test that calling play has no effect, when animation is already playing
1983 application.SendNotification();
1984 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1986 // We didn't expect the animation to finish yet
1987 application.SendNotification();
1988 finishCheck.CheckSignalNotReceived();
1989 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1991 animation.Play(); // Test that calling play has no effect, when animation is already playing
1992 application.SendNotification();
1993 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1995 // We didn't expect the animation to finish yet
1996 application.SendNotification();
1997 finishCheck.CheckSignalNotReceived();
1998 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2000 animation.Play(); // Test that calling play has no effect, when animation is already playing
2001 application.SendNotification();
2002 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2004 // We didn't expect the animation to finish yet
2005 application.SendNotification();
2006 finishCheck.CheckSignalNotReceived();
2007 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2009 animation.Play(); // Test that calling play has no effect, when animation is already playing
2010 application.SendNotification();
2011 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2013 // We did expect the animation to finish
2014 application.SendNotification();
2015 finishCheck.CheckSignalReceived();
2016 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2018 // Check that nothing has changed after a couple of buffer swaps
2019 application.Render(0);
2020 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2021 application.Render(0);
2022 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2026 int UtcDaliAnimationPlayOffStageP(void)
2028 // Test that an animation can be played, when the actor is off-stage.
2029 // When the actor is added to the stage, it should appear at the current position
2030 // i.e. where it would have been anyway, if on-stage from the beginning.
2032 TestApplication application;
2034 Actor actor = Actor::New();
2035 Vector3 basePosition(Vector3::ZERO);
2036 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2037 // Not added to the stage!
2039 // Build the animation
2040 float durationSeconds(1.0f);
2041 Animation animation = Animation::New(durationSeconds);
2042 animation.SetDisconnectAction( Animation::Discard );
2043 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2044 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2046 // Start the animation
2049 bool signalReceived(false);
2050 AnimationFinishCheck finishCheck(signalReceived);
2051 animation.FinishedSignal().Connect(&application, finishCheck);
2053 application.SendNotification();
2054 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2056 // We didn't expect the animation to finish yet
2057 application.SendNotification();
2058 finishCheck.CheckSignalNotReceived();
2059 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
2062 Stage::GetCurrent().Add(actor);
2064 application.SendNotification();
2065 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2067 // We didn't expect the animation to finish yet
2068 application.SendNotification();
2069 finishCheck.CheckSignalNotReceived();
2070 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
2071 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
2073 // Remove from the stage
2074 Stage::GetCurrent().Remove(actor);
2076 application.SendNotification();
2077 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2079 // We didn't expect the animation to finish yet
2080 application.SendNotification();
2081 finishCheck.CheckSignalNotReceived();
2082 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
2085 Stage::GetCurrent().Add(actor);
2087 application.SendNotification();
2088 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2090 // We didn't expect the animation to finish yet
2091 application.SendNotification();
2092 finishCheck.CheckSignalNotReceived();
2093 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
2094 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
2096 application.SendNotification();
2097 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2099 // We did expect the animation to finish
2100 application.SendNotification();
2101 finishCheck.CheckSignalReceived();
2102 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2104 // Check that nothing has changed after a couple of buffer swaps
2105 application.Render(0);
2106 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2107 application.Render(0);
2108 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2112 int UtcDaliAnimationPlayDiscardHandleP(void)
2114 TestApplication application;
2116 Actor actor = Actor::New();
2117 Stage::GetCurrent().Add(actor);
2119 // Build the animation
2120 float durationSeconds(1.0f);
2121 Animation animation = Animation::New(durationSeconds);
2122 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2123 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2125 bool signalReceived(false);
2126 AnimationFinishCheck finishCheck(signalReceived);
2127 animation.FinishedSignal().Connect(&application, finishCheck);
2129 // Start the animation
2132 // This is a test of the "Fire and Forget" behaviour
2133 // Discard the animation handle!
2135 DALI_TEST_CHECK( !animation );
2137 application.SendNotification();
2138 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2140 // We didn't expect the animation to finish yet
2141 application.SendNotification();
2142 finishCheck.CheckSignalNotReceived();
2143 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2145 application.SendNotification();
2146 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2148 // We didn't expect the animation to finish yet
2149 application.SendNotification();
2150 finishCheck.CheckSignalNotReceived();
2151 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2153 application.SendNotification();
2154 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2156 // We didn't expect the animation to finish yet
2157 application.SendNotification();
2158 finishCheck.CheckSignalNotReceived();
2159 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2161 application.SendNotification();
2162 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2164 // We didn't expect the animation to finish yet
2165 application.SendNotification();
2166 finishCheck.CheckSignalNotReceived();
2167 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2169 application.SendNotification();
2170 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2172 // We did expect the animation to finish
2173 application.SendNotification();
2174 finishCheck.CheckSignalReceived();
2175 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2177 // Check that nothing has changed after a couple of buffer swaps
2178 application.Render(0);
2179 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2180 application.Render(0);
2181 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2185 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2187 TestApplication application;
2189 Actor actor = Actor::New();
2190 Stage::GetCurrent().Add(actor);
2192 // Build the animation
2193 float durationSeconds(1.0f);
2194 Animation animation = Animation::New(durationSeconds);
2195 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2196 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2198 // Start the animation
2201 bool signalReceived(false);
2202 AnimationFinishCheck finishCheck(signalReceived);
2203 animation.FinishedSignal().Connect(&application, finishCheck);
2205 application.SendNotification();
2206 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2208 // We didn't expect the animation to finish yet
2209 application.SendNotification();
2210 finishCheck.CheckSignalNotReceived();
2211 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2213 // This is a test of the "Fire and Forget" behaviour
2214 // Stop the animation, and Discard the animation handle!
2217 DALI_TEST_CHECK( !animation );
2219 application.SendNotification();
2220 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2222 // We expect the animation to finish at 20% progress
2223 application.SendNotification();
2224 finishCheck.CheckSignalReceived();
2225 finishCheck.Reset();
2226 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2228 application.SendNotification();
2229 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2231 // Check that nothing has changed
2232 application.SendNotification();
2233 finishCheck.CheckSignalNotReceived();
2234 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2236 application.SendNotification();
2237 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2239 // Check that nothing has changed
2240 application.SendNotification();
2241 finishCheck.CheckSignalNotReceived();
2242 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2244 application.SendNotification();
2245 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2247 // Check that nothing has changed
2248 application.SendNotification();
2249 finishCheck.CheckSignalNotReceived();
2250 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2254 int UtcDaliAnimationPlayRangeP(void)
2256 TestApplication application;
2258 Actor actor = Actor::New();
2259 Stage::GetCurrent().Add(actor);
2261 // Build the animation
2262 float durationSeconds(1.0f);
2263 Animation animation = Animation::New(durationSeconds);
2264 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2265 KeyFrames keyframes = KeyFrames::New();
2266 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2267 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2269 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2271 // Set range between 0.4 and 0.8
2272 animation.SetPlayRange( Vector2(0.4f,0.8f) );
2275 bool signalReceived(false);
2276 AnimationFinishCheck finishCheck(signalReceived);
2277 animation.FinishedSignal().Connect(&application, finishCheck);
2279 //Test that setting progress outside the range doesn't work
2280 animation.SetCurrentProgress( 0.9f );
2281 application.SendNotification();
2282 application.Render(0);
2283 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2284 animation.SetCurrentProgress( 0.2f );
2285 application.SendNotification();
2286 application.Render(0);
2287 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2289 application.SendNotification();
2290 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2292 // We didn't expect the animation to finish yet
2293 application.SendNotification();
2294 finishCheck.CheckSignalNotReceived();
2295 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2297 animation.Play(); // Test that calling play has no effect, when animation is already playing
2298 application.SendNotification();
2299 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2301 // We did expect the animation to finish
2302 application.SendNotification();
2303 finishCheck.CheckSignalReceived();
2304 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2306 // Check that nothing has changed after a couple of buffer swaps
2307 application.Render(0);
2308 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2309 application.Render(0);
2310 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2313 //Loop inside the range
2314 finishCheck.Reset();
2315 animation.SetLooping( true );
2317 application.SendNotification();
2318 float intervalSeconds = 0.1f;
2319 float progress = 0.4f;
2320 for (int iterations = 0; iterations < 10; ++iterations )
2322 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2324 progress += intervalSeconds;
2325 if (progress > 0.8f)
2327 progress = progress - 0.4f;
2330 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2333 // We didn't expect the animation to finish yet
2334 application.SendNotification();
2335 finishCheck.CheckSignalNotReceived();
2338 //Test change range on the fly
2339 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2340 application.SendNotification();
2342 for (int iterations = 0; iterations < 10; ++iterations )
2344 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2346 progress += intervalSeconds;
2347 if (progress > 0.9f)
2349 progress = progress - 0.7f;
2352 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2358 int UtcDaliAnimationPlayFromP(void)
2360 TestApplication application;
2362 Actor actor = Actor::New();
2363 Stage::GetCurrent().Add(actor);
2365 // Build the animation
2366 float durationSeconds(1.0f);
2367 Animation animation = Animation::New(durationSeconds);
2368 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2369 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2371 // Start the animation from 40% progress
2372 animation.PlayFrom( 0.4f );
2374 bool signalReceived(false);
2375 AnimationFinishCheck finishCheck(signalReceived);
2376 animation.FinishedSignal().Connect(&application, finishCheck);
2378 application.SendNotification();
2379 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2381 // We didn't expect the animation to finish yet
2382 application.SendNotification();
2383 finishCheck.CheckSignalNotReceived();
2384 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2386 animation.Play(); // Test that calling play has no effect, when animation is already playing
2387 application.SendNotification();
2388 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2390 // We didn't expect the animation to finish yet
2391 application.SendNotification();
2392 finishCheck.CheckSignalNotReceived();
2393 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2395 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2396 // We did expect the animation to finish
2397 application.SendNotification();
2398 finishCheck.CheckSignalReceived();
2399 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2401 // Check that nothing has changed after a couple of buffer swaps
2402 application.Render(0);
2403 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2404 application.Render(0);
2405 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2409 int UtcDaliAnimationPlayFromN(void)
2411 TestApplication application;
2413 Actor actor = Actor::New();
2414 Stage::GetCurrent().Add(actor);
2416 // Build the animation
2417 float durationSeconds(1.0f);
2418 Animation animation = Animation::New(durationSeconds);
2419 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2420 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2422 //PlayFrom with an argument outside the range [0..1] will be ignored
2423 animation.PlayFrom(-1.0f);
2424 application.SendNotification();
2425 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2427 animation.PlayFrom(100.0f);
2428 application.SendNotification();
2429 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2433 int UtcDaliAnimationPauseP(void)
2435 TestApplication application;
2437 Actor actor = Actor::New();
2438 Stage::GetCurrent().Add(actor);
2440 // Build the animation
2441 float durationSeconds(1.0f);
2442 Animation animation = Animation::New(durationSeconds);
2443 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2444 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2446 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2448 // Start the animation
2451 bool signalReceived(false);
2452 AnimationFinishCheck finishCheck(signalReceived);
2453 animation.FinishedSignal().Connect(&application, finishCheck);
2455 application.SendNotification();
2456 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2458 // We didn't expect the animation to finish yet
2459 application.SendNotification();
2460 finishCheck.CheckSignalNotReceived();
2461 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2463 // Pause the animation
2465 application.SendNotification();
2468 for (int i=0; i<5; ++i)
2470 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2472 // We didn't expect the animation to finish yet
2473 application.SendNotification();
2474 finishCheck.CheckSignalNotReceived();
2475 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2480 application.SendNotification();
2481 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2483 // We didn't expect the animation to finish yet
2484 application.SendNotification();
2485 finishCheck.CheckSignalNotReceived();
2487 application.SendNotification();
2488 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2490 // We did expect the animation to finish
2491 application.SendNotification();
2492 finishCheck.CheckSignalReceived();
2493 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2495 // Check that nothing has changed after a couple of buffer swaps
2496 application.Render(0);
2497 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2498 application.Render(0);
2499 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2504 int UtcDaliAnimationGetStateP(void)
2506 TestApplication application;
2508 Actor actor = Actor::New();
2509 Stage::GetCurrent().Add(actor);
2511 // Build the animation
2512 float durationSeconds(1.0f);
2513 Animation animation = Animation::New(durationSeconds);
2514 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2515 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2516 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2518 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2520 // Start the animation
2523 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2525 bool signalReceived(false);
2526 AnimationFinishCheck finishCheck(signalReceived);
2527 animation.FinishedSignal().Connect(&application, finishCheck);
2529 application.SendNotification();
2530 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2532 // We didn't expect the animation to finish yet
2533 application.SendNotification();
2534 finishCheck.CheckSignalNotReceived();
2535 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2536 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2538 // Pause the animation
2540 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2541 application.SendNotification();
2542 application.Render(0.f);
2545 for (int i=0; i<5; ++i)
2547 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2549 // We didn't expect the animation to finish yet
2550 application.SendNotification();
2551 finishCheck.CheckSignalNotReceived();
2552 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2553 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2557 finishCheck.Reset();
2559 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2560 application.SendNotification();
2561 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2562 // We didn't expect the animation to finish yet
2563 application.SendNotification();
2564 finishCheck.CheckSignalNotReceived();
2565 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2567 application.SendNotification();
2568 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2570 // We did expect the animation to finish
2571 application.SendNotification();
2572 finishCheck.CheckSignalReceived();
2573 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2574 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2576 // Check that nothing has changed after a couple of buffer swaps
2577 application.Render(0);
2578 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2579 application.Render(0);
2580 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2581 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2584 finishCheck.Reset();
2586 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2587 application.SendNotification();
2588 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2589 application.SendNotification();
2590 finishCheck.CheckSignalNotReceived();
2591 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2597 int UtcDaliAnimationStopP(void)
2599 TestApplication application;
2601 Actor actor = Actor::New();
2602 Stage::GetCurrent().Add(actor);
2604 // Build the animation
2605 float durationSeconds(1.0f);
2606 Animation animation = Animation::New(durationSeconds);
2607 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2608 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2610 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2612 // Start the animation
2615 bool signalReceived(false);
2616 AnimationFinishCheck finishCheck(signalReceived);
2617 animation.FinishedSignal().Connect(&application, finishCheck);
2619 application.SendNotification();
2620 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2622 // We didn't expect the animation to finish yet
2623 application.SendNotification();
2624 finishCheck.CheckSignalNotReceived();
2625 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2627 // Stop the animation
2629 application.SendNotification();
2632 for (int i=0; i<5; ++i)
2634 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2636 // We did expect the animation to finish
2637 application.SendNotification();
2638 finishCheck.CheckSignalReceived();
2639 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2644 int UtcDaliAnimationStopSetPositionP(void)
2646 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2647 // i.e. to check that the animation does not interfere with the position set.
2649 TestApplication application;
2651 Actor actor = Actor::New();
2652 Stage::GetCurrent().Add(actor);
2654 // Build the animation
2655 float durationSeconds(1.0f);
2656 Animation animation = Animation::New(durationSeconds);
2657 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2658 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2660 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2662 // Start the animation
2665 bool signalReceived(false);
2666 AnimationFinishCheck finishCheck(signalReceived);
2667 animation.FinishedSignal().Connect(&application, finishCheck);
2669 application.SendNotification();
2670 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2672 // We didn't expect the animation to finish yet
2673 application.SendNotification();
2674 finishCheck.CheckSignalNotReceived();
2675 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2677 // Stop the animation
2679 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2680 actor.SetPosition(positionSet);
2681 application.SendNotification();
2684 for (int i=0; i<5; ++i)
2686 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2688 // We did expect the animation to finish
2689 application.SendNotification();
2690 finishCheck.CheckSignalReceived();
2691 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2696 int UtcDaliAnimationClearP(void)
2698 TestApplication application;
2700 Actor actor = Actor::New();
2701 Stage::GetCurrent().Add(actor);
2703 // Build the animation
2704 float durationSeconds(1.0f);
2705 Animation animation = Animation::New(durationSeconds);
2706 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2707 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2709 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2711 // Start the animation
2714 bool signalReceived(false);
2715 AnimationFinishCheck finishCheck(signalReceived);
2716 animation.FinishedSignal().Connect(&application, finishCheck);
2718 application.SendNotification();
2719 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2721 // We didn't expect the animation to finish yet
2722 application.SendNotification();
2723 finishCheck.CheckSignalNotReceived();
2724 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2726 // Clear the animation
2728 application.SendNotification();
2730 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2732 // We don't expect the animation to finish now
2733 application.SendNotification();
2734 finishCheck.CheckSignalNotReceived();
2735 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2737 // Restart as a scale animation; this should not move the actor's position
2738 finishCheck.Reset();
2739 actor.SetPosition(Vector3::ZERO);
2740 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2741 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2744 application.SendNotification();
2745 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2747 // We didn't expect the animation to finish yet
2748 application.SendNotification();
2749 finishCheck.CheckSignalNotReceived();
2750 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2751 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2753 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2755 // We did expect the animation to finish
2756 application.SendNotification();
2757 finishCheck.CheckSignalReceived();
2758 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2759 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2763 int UtcDaliAnimationFinishedSignalP(void)
2765 TestApplication application;
2767 // Start the empty animation
2768 float durationSeconds(1.0f);
2769 Animation animation = Animation::New(durationSeconds);
2772 bool signalReceived(false);
2773 AnimationFinishCheck finishCheck(signalReceived);
2774 animation.FinishedSignal().Connect(&application, finishCheck);
2776 application.SendNotification();
2777 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2779 // We did expect the animation to finish
2780 application.SendNotification();
2781 finishCheck.CheckSignalReceived();
2785 int UtcDaliAnimationAnimateByBooleanP(void)
2787 TestApplication application;
2789 Actor actor = Actor::New();
2791 // Register a boolean property
2792 bool startValue(false);
2793 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2794 Stage::GetCurrent().Add(actor);
2795 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2797 // Build the animation
2798 float durationSeconds(2.0f);
2799 Animation animation = Animation::New(durationSeconds);
2800 const bool relativeValue(true);
2801 const bool finalValue( false || relativeValue );
2802 animation.AnimateBy(Property(actor, index), relativeValue);
2804 // Start the animation
2807 bool signalReceived(false);
2808 AnimationFinishCheck finishCheck(signalReceived);
2809 animation.FinishedSignal().Connect(&application, finishCheck);
2811 application.SendNotification();
2812 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2814 // We didn't expect the animation to finish yet
2815 application.SendNotification();
2816 finishCheck.CheckSignalNotReceived();
2817 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2819 application.SendNotification();
2820 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2822 // We did expect the animation to finish
2823 application.SendNotification();
2824 finishCheck.CheckSignalReceived();
2825 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2827 // Check that nothing has changed after a couple of buffer swaps
2828 application.Render(0);
2829 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2830 application.Render(0);
2831 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2833 // Repeat with relative value "false" - this should be an NOOP
2834 animation = Animation::New(durationSeconds);
2835 bool noOpValue(false);
2836 animation.AnimateBy(Property(actor, index), noOpValue);
2838 // Start the animation
2841 finishCheck.Reset();
2842 animation.FinishedSignal().Connect(&application, finishCheck);
2844 application.SendNotification();
2845 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2847 // We didn't expect the animation to finish yet
2848 application.SendNotification();
2849 finishCheck.CheckSignalNotReceived();
2850 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2852 application.SendNotification();
2853 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2855 // We did expect the animation to finish
2856 application.SendNotification();
2857 finishCheck.CheckSignalReceived();
2858 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2860 // Check that nothing has changed after a couple of buffer swaps
2861 application.Render(0);
2862 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2863 application.Render(0);
2864 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2868 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2870 TestApplication application;
2872 Actor actor = Actor::New();
2874 // Register a boolean property
2875 bool startValue(false);
2876 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2877 Stage::GetCurrent().Add(actor);
2878 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2880 // Build the animation
2881 float durationSeconds(2.0f);
2882 Animation animation = Animation::New(durationSeconds);
2883 bool relativeValue(true);
2884 bool finalValue( false || relativeValue );
2885 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2887 // Start the animation
2890 bool signalReceived(false);
2891 AnimationFinishCheck finishCheck(signalReceived);
2892 animation.FinishedSignal().Connect(&application, finishCheck);
2894 application.SendNotification();
2895 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2897 // We didn't expect the animation to finish yet
2898 application.SendNotification();
2899 finishCheck.CheckSignalNotReceived();
2900 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2902 application.SendNotification();
2903 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2905 // We did expect the animation to finish
2906 application.SendNotification();
2907 finishCheck.CheckSignalReceived();
2908 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2910 // Check that nothing has changed after a couple of buffer swaps
2911 application.Render(0);
2912 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2913 application.Render(0);
2914 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2916 // Repeat with relative value "false" - this should be an NOOP
2917 animation = Animation::New(durationSeconds);
2918 bool noOpValue(false);
2919 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2921 // Start the animation
2924 finishCheck.Reset();
2925 animation.FinishedSignal().Connect(&application, finishCheck);
2927 application.SendNotification();
2928 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2930 // We didn't expect the animation to finish yet
2931 application.SendNotification();
2932 finishCheck.CheckSignalNotReceived();
2933 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2935 application.SendNotification();
2936 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2938 // We did expect the animation to finish
2939 application.SendNotification();
2940 finishCheck.CheckSignalReceived();
2941 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2945 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2947 TestApplication application;
2949 Actor actor = Actor::New();
2951 // Register a boolean property
2952 bool startValue(false);
2953 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2954 Stage::GetCurrent().Add(actor);
2955 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2957 // Build the animation
2958 float durationSeconds(2.0f);
2959 Animation animation = Animation::New(durationSeconds);
2960 bool relativeValue(true);
2961 bool finalValue( false || relativeValue );
2962 float animatorDurationSeconds(durationSeconds * 0.5f);
2963 animation.AnimateBy( Property(actor, index),
2965 TimePeriod( animatorDurationSeconds ) );
2967 // Start the animation
2970 bool signalReceived(false);
2971 AnimationFinishCheck finishCheck(signalReceived);
2972 animation.FinishedSignal().Connect(&application, finishCheck);
2974 application.SendNotification();
2975 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2977 // We didn't expect the animation to finish yet
2978 application.SendNotification();
2979 finishCheck.CheckSignalNotReceived();
2980 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2982 application.SendNotification();
2983 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2985 // We didn't expect the animation to finish yet...
2986 application.SendNotification();
2987 finishCheck.CheckSignalNotReceived();
2989 // ...however we should have reached the final value
2990 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2992 application.SendNotification();
2993 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2995 // We did expect the animation to finish
2996 application.SendNotification();
2997 finishCheck.CheckSignalReceived();
2998 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3000 // Check that nothing has changed after a couple of buffer swaps
3001 application.Render(0);
3002 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3003 application.Render(0);
3004 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3008 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3010 TestApplication application;
3012 Actor actor = Actor::New();
3014 // Register a boolean property
3015 bool startValue(false);
3016 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3017 Stage::GetCurrent().Add(actor);
3018 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3020 // Build the animation
3021 float durationSeconds(2.0f);
3022 Animation animation = Animation::New(durationSeconds);
3023 bool relativeValue(true);
3024 bool finalValue( false || relativeValue );
3025 float animatorDurationSeconds(durationSeconds * 0.5f);
3026 animation.AnimateBy( Property(actor, index),
3028 AlphaFunction::EASE_IN_OUT,
3029 TimePeriod( animatorDurationSeconds ) );
3031 // Start the animation
3034 bool signalReceived(false);
3035 AnimationFinishCheck finishCheck(signalReceived);
3036 animation.FinishedSignal().Connect(&application, finishCheck);
3038 application.SendNotification();
3039 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3041 // We didn't expect the animation to finish yet
3042 application.SendNotification();
3043 finishCheck.CheckSignalNotReceived();
3044 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3046 application.SendNotification();
3047 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3049 // We didn't expect the animation to finish yet...
3050 application.SendNotification();
3051 finishCheck.CheckSignalNotReceived();
3053 // ...however we should have reached the final value
3054 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3056 application.SendNotification();
3057 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3059 // We did expect the animation to finish
3060 application.SendNotification();
3061 finishCheck.CheckSignalReceived();
3062 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3064 // Check that nothing has changed after a couple of buffer swaps
3065 application.Render(0);
3066 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3067 application.Render(0);
3068 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3072 int UtcDaliAnimationAnimateByFloatP(void)
3074 TestApplication application;
3076 Actor actor = Actor::New();
3078 // Register a float property
3079 float startValue(10.0f);
3080 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3081 Stage::GetCurrent().Add(actor);
3082 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3084 // Build the animation
3085 float durationSeconds(2.0f);
3086 Animation animation = Animation::New(durationSeconds);
3087 float targetValue(50.0f);
3088 float relativeValue(targetValue - startValue);
3089 animation.AnimateBy(Property(actor, index), relativeValue);
3091 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3093 // Start the animation
3096 bool signalReceived(false);
3097 AnimationFinishCheck finishCheck(signalReceived);
3098 animation.FinishedSignal().Connect(&application, finishCheck);
3100 application.SendNotification();
3101 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3103 // We didn't expect the animation to finish yet
3104 application.SendNotification();
3105 finishCheck.CheckSignalNotReceived();
3106 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
3108 application.SendNotification();
3109 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3111 // We did expect the animation to finish
3112 application.SendNotification();
3113 finishCheck.CheckSignalReceived();
3114 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3116 // Check that nothing has changed after a couple of buffer swaps
3117 application.Render(0);
3118 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3119 application.Render(0);
3120 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3124 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3126 TestApplication application;
3128 Actor actor = Actor::New();
3130 // Register a float property
3131 float startValue(10.0f);
3132 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3133 Stage::GetCurrent().Add(actor);
3134 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3136 // Build the animation
3137 float durationSeconds(1.0f);
3138 Animation animation = Animation::New(durationSeconds);
3139 float targetValue(90.0f);
3140 float relativeValue(targetValue - startValue);
3141 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3143 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3145 // Start the animation
3148 bool signalReceived(false);
3149 AnimationFinishCheck finishCheck(signalReceived);
3150 animation.FinishedSignal().Connect(&application, finishCheck);
3152 application.SendNotification();
3153 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3155 // We didn't expect the animation to finish yet
3156 application.SendNotification();
3157 finishCheck.CheckSignalNotReceived();
3159 // The position should have moved more, than with a linear alpha function
3160 float current(actor.GetProperty<float>(index));
3161 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3163 application.SendNotification();
3164 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3166 // We did expect the animation to finish
3167 application.SendNotification();
3168 finishCheck.CheckSignalReceived();
3169 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3171 // Check that nothing has changed after a couple of buffer swaps
3172 application.Render(0);
3173 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3174 application.Render(0);
3175 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3179 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3181 TestApplication application;
3183 Actor actor = Actor::New();
3185 // Register a float property
3186 float startValue(10.0f);
3187 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3188 Stage::GetCurrent().Add(actor);
3189 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3191 // Build the animation
3192 float durationSeconds(1.0f);
3193 Animation animation = Animation::New(durationSeconds);
3194 float targetValue(30.0f);
3195 float relativeValue(targetValue - startValue);
3197 animation.AnimateBy(Property(actor, index),
3199 TimePeriod(delay, durationSeconds - delay));
3201 // Start the animation
3204 bool signalReceived(false);
3205 AnimationFinishCheck finishCheck(signalReceived);
3206 animation.FinishedSignal().Connect(&application, finishCheck);
3208 application.SendNotification();
3209 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3211 // We didn't expect the animation to finish yet
3212 application.SendNotification();
3213 finishCheck.CheckSignalNotReceived();
3214 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3216 application.SendNotification();
3217 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3219 // We didn't expect the animation to finish yet
3220 application.SendNotification();
3221 finishCheck.CheckSignalNotReceived();
3222 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3224 application.SendNotification();
3225 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3227 // We did expect the animation to finish
3228 application.SendNotification();
3229 finishCheck.CheckSignalReceived();
3230 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3232 // Check that nothing has changed after a couple of buffer swaps
3233 application.Render(0);
3234 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3235 application.Render(0);
3236 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3240 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3242 TestApplication application;
3244 Actor actor = Actor::New();
3246 // Register a float property
3247 float startValue(10.0f);
3248 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3249 Stage::GetCurrent().Add(actor);
3250 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3252 // Build the animation
3253 float durationSeconds(1.0f);
3254 Animation animation = Animation::New(durationSeconds);
3255 float targetValue(30.0f);
3256 float relativeValue(targetValue - startValue);
3258 animation.AnimateBy(Property(actor, index),
3260 AlphaFunction::LINEAR,
3261 TimePeriod(delay, durationSeconds - delay));
3263 // Start the animation
3266 bool signalReceived(false);
3267 AnimationFinishCheck finishCheck(signalReceived);
3268 animation.FinishedSignal().Connect(&application, finishCheck);
3270 application.SendNotification();
3271 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3273 // We didn't expect the animation to finish yet
3274 application.SendNotification();
3275 finishCheck.CheckSignalNotReceived();
3276 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3278 application.SendNotification();
3279 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3281 // We didn't expect the animation to finish yet
3282 application.SendNotification();
3283 finishCheck.CheckSignalNotReceived();
3284 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3286 application.SendNotification();
3287 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3289 // We did expect the animation to finish
3290 application.SendNotification();
3291 finishCheck.CheckSignalReceived();
3292 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3294 // Check that nothing has changed after a couple of buffer swaps
3295 application.Render(0);
3296 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3297 application.Render(0);
3298 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3302 int UtcDaliAnimationAnimateByIntegerP(void)
3304 TestApplication application;
3306 Actor actor = Actor::New();
3308 // Register an integer property
3310 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3311 Stage::GetCurrent().Add(actor);
3312 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3314 // Build the animation
3315 float durationSeconds(2.0f);
3316 Animation animation = Animation::New(durationSeconds);
3317 int targetValue(50);
3318 int relativeValue(targetValue - startValue);
3319 animation.AnimateBy(Property(actor, index), relativeValue);
3321 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3323 // Start the animation
3326 bool signalReceived(false);
3327 AnimationFinishCheck finishCheck(signalReceived);
3328 animation.FinishedSignal().Connect(&application, finishCheck);
3330 application.SendNotification();
3331 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3333 // We didn't expect the animation to finish yet
3334 application.SendNotification();
3335 finishCheck.CheckSignalNotReceived();
3336 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
3338 application.SendNotification();
3339 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3341 // We did expect the animation to finish
3342 application.SendNotification();
3343 finishCheck.CheckSignalReceived();
3344 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3346 // Check that nothing has changed after a couple of buffer swaps
3347 application.Render(0);
3348 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3349 application.Render(0);
3350 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3354 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3356 TestApplication application;
3358 Actor actor = Actor::New();
3360 // Register an integer property
3362 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3363 Stage::GetCurrent().Add(actor);
3364 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3366 // Build the animation
3367 float durationSeconds(1.0f);
3368 Animation animation = Animation::New(durationSeconds);
3369 int targetValue(90);
3370 int relativeValue(targetValue - startValue);
3371 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3373 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3375 // Start the animation
3378 bool signalReceived(false);
3379 AnimationFinishCheck finishCheck(signalReceived);
3380 animation.FinishedSignal().Connect(&application, finishCheck);
3382 application.SendNotification();
3383 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3385 // We didn't expect the animation to finish yet
3386 application.SendNotification();
3387 finishCheck.CheckSignalNotReceived();
3389 // The position should have moved more, than with a linear alpha function
3390 int current(actor.GetProperty<int>(index));
3391 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3393 application.SendNotification();
3394 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3396 // We did expect the animation to finish
3397 application.SendNotification();
3398 finishCheck.CheckSignalReceived();
3399 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3401 // Check that nothing has changed after a couple of buffer swaps
3402 application.Render(0);
3403 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3404 application.Render(0);
3405 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3409 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3411 TestApplication application;
3413 Actor actor = Actor::New();
3415 // Register an integer property
3417 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3418 Stage::GetCurrent().Add(actor);
3419 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3421 // Build the animation
3422 float durationSeconds(1.0f);
3423 Animation animation = Animation::New(durationSeconds);
3424 int targetValue(30);
3425 int relativeValue(targetValue - startValue);
3427 animation.AnimateBy(Property(actor, index),
3429 TimePeriod(delay, durationSeconds - delay));
3431 // Start the animation
3434 bool signalReceived(false);
3435 AnimationFinishCheck finishCheck(signalReceived);
3436 animation.FinishedSignal().Connect(&application, finishCheck);
3438 application.SendNotification();
3439 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3441 // We didn't expect the animation to finish yet
3442 application.SendNotification();
3443 finishCheck.CheckSignalNotReceived();
3444 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3446 application.SendNotification();
3447 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3449 // We didn't expect the animation to finish yet
3450 application.SendNotification();
3451 finishCheck.CheckSignalNotReceived();
3452 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3454 application.SendNotification();
3455 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3457 // We did expect the animation to finish
3458 application.SendNotification();
3459 finishCheck.CheckSignalReceived();
3460 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3462 // Check that nothing has changed after a couple of buffer swaps
3463 application.Render(0);
3464 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3465 application.Render(0);
3466 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3470 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3472 TestApplication application;
3474 Actor actor = Actor::New();
3476 // Register an integer property
3478 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3479 Stage::GetCurrent().Add(actor);
3480 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3482 // Build the animation
3483 float durationSeconds(1.0f);
3484 Animation animation = Animation::New(durationSeconds);
3485 int targetValue(30);
3486 int relativeValue(targetValue - startValue);
3488 animation.AnimateBy(Property(actor, index),
3490 AlphaFunction::LINEAR,
3491 TimePeriod(delay, durationSeconds - delay));
3493 // Start the animation
3496 bool signalReceived(false);
3497 AnimationFinishCheck finishCheck(signalReceived);
3498 animation.FinishedSignal().Connect(&application, finishCheck);
3500 application.SendNotification();
3501 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3503 // We didn't expect the animation to finish yet
3504 application.SendNotification();
3505 finishCheck.CheckSignalNotReceived();
3506 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3508 application.SendNotification();
3509 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3511 // We didn't expect the animation to finish yet
3512 application.SendNotification();
3513 finishCheck.CheckSignalNotReceived();
3514 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3516 application.SendNotification();
3517 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3519 // We did expect the animation to finish
3520 application.SendNotification();
3521 finishCheck.CheckSignalReceived();
3522 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3524 // Check that nothing has changed after a couple of buffer swaps
3525 application.Render(0);
3526 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3527 application.Render(0);
3528 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3532 int UtcDaliAnimationAnimateByVector2P(void)
3534 TestApplication application;
3536 Actor actor = Actor::New();
3538 // Register a Vector2 property
3539 Vector2 startValue(10.0f, 10.0f);
3540 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3541 Stage::GetCurrent().Add(actor);
3542 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3544 // Build the animation
3545 float durationSeconds(2.0f);
3546 Animation animation = Animation::New(durationSeconds);
3547 Vector2 targetValue(60.0f, 60.0f);
3548 Vector2 relativeValue(targetValue - startValue);
3549 animation.AnimateBy(Property(actor, index), relativeValue);
3551 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3553 // Start the animation
3556 bool signalReceived(false);
3557 AnimationFinishCheck finishCheck(signalReceived);
3558 animation.FinishedSignal().Connect(&application, finishCheck);
3560 application.SendNotification();
3561 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3563 // We didn't expect the animation to finish yet
3564 application.SendNotification();
3565 finishCheck.CheckSignalNotReceived();
3566 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
3568 application.SendNotification();
3569 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3571 // We did expect the animation to finish
3572 application.SendNotification();
3573 finishCheck.CheckSignalReceived();
3574 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3576 // Check that nothing has changed after a couple of buffer swaps
3577 application.Render(0);
3578 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3579 application.Render(0);
3580 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3584 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3586 TestApplication application;
3588 Actor actor = Actor::New();
3590 // Register a Vector2 property
3591 Vector2 startValue(100.0f, 100.0f);
3592 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3593 Stage::GetCurrent().Add(actor);
3594 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3596 // Build the animation
3597 float durationSeconds(1.0f);
3598 Animation animation = Animation::New(durationSeconds);
3599 Vector2 targetValue(20.0f, 20.0f);
3600 Vector2 relativeValue(targetValue - startValue);
3601 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3603 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
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*950.0f)/* 95% progress */);
3615 // We didn't expect the animation to finish yet
3616 application.SendNotification();
3617 finishCheck.CheckSignalNotReceived();
3619 // The position should have moved more, than with a linear alpha function
3620 Vector2 current(actor.GetProperty<Vector2>(index));
3621 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3622 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3624 application.SendNotification();
3625 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3627 // We did expect the animation to finish
3628 application.SendNotification();
3629 finishCheck.CheckSignalReceived();
3630 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3632 // Check that nothing has changed after a couple of buffer swaps
3633 application.Render(0);
3634 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3635 application.Render(0);
3636 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3640 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3642 TestApplication application;
3644 Actor actor = Actor::New();
3646 // Register a Vector2 property
3647 Vector2 startValue(10.0f, 10.0f);
3648 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3649 Stage::GetCurrent().Add(actor);
3650 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3652 // Build the animation
3653 float durationSeconds(1.0f);
3654 Animation animation = Animation::New(durationSeconds);
3655 Vector2 targetValue(30.0f, 30.0f);
3656 Vector2 relativeValue(targetValue - startValue);
3658 animation.AnimateBy(Property(actor, index),
3660 TimePeriod(delay, durationSeconds - delay));
3662 // Start the animation
3665 bool signalReceived(false);
3666 AnimationFinishCheck finishCheck(signalReceived);
3667 animation.FinishedSignal().Connect(&application, finishCheck);
3669 application.SendNotification();
3670 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3672 // We didn't expect the animation to finish yet
3673 application.SendNotification();
3674 finishCheck.CheckSignalNotReceived();
3675 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3677 application.SendNotification();
3678 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3680 // We didn't expect the animation to finish yet
3681 application.SendNotification();
3682 finishCheck.CheckSignalNotReceived();
3683 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3685 application.SendNotification();
3686 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3688 // We did expect the animation to finish
3689 application.SendNotification();
3690 finishCheck.CheckSignalReceived();
3691 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3693 // Check that nothing has changed after a couple of buffer swaps
3694 application.Render(0);
3695 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3696 application.Render(0);
3697 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3701 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3703 TestApplication application;
3705 Actor actor = Actor::New();
3707 // Register a Vector2 property
3708 Vector2 startValue(5.0f, 5.0f);
3709 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3710 Stage::GetCurrent().Add(actor);
3711 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3713 // Build the animation
3714 float durationSeconds(1.0f);
3715 Animation animation = Animation::New(durationSeconds);
3716 Vector2 targetValue(10.0f, 10.0f);
3717 Vector2 relativeValue(targetValue - startValue);
3719 animation.AnimateBy(Property(actor, index),
3721 AlphaFunction::LINEAR,
3722 TimePeriod(delay, durationSeconds - delay));
3724 // Start the animation
3727 bool signalReceived(false);
3728 AnimationFinishCheck finishCheck(signalReceived);
3729 animation.FinishedSignal().Connect(&application, finishCheck);
3731 application.SendNotification();
3732 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3734 // We didn't expect the animation to finish yet
3735 application.SendNotification();
3736 finishCheck.CheckSignalNotReceived();
3737 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3739 application.SendNotification();
3740 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3742 // We didn't expect the animation to finish yet
3743 application.SendNotification();
3744 finishCheck.CheckSignalNotReceived();
3745 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3747 application.SendNotification();
3748 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3750 // We did expect the animation to finish
3751 application.SendNotification();
3752 finishCheck.CheckSignalReceived();
3753 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3755 // Check that nothing has changed after a couple of buffer swaps
3756 application.Render(0);
3757 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3758 application.Render(0);
3759 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3763 int UtcDaliAnimationAnimateByVector3P(void)
3765 TestApplication application;
3767 Actor actor = Actor::New();
3769 // Register a Vector3 property
3770 Vector3 startValue(10.0f, 10.0f, 10.0f);
3771 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3772 Stage::GetCurrent().Add(actor);
3773 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3775 // Build the animation
3776 float durationSeconds(2.0f);
3777 Animation animation = Animation::New(durationSeconds);
3778 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3779 Vector3 relativeValue(targetValue - startValue);
3780 animation.AnimateBy(Property(actor, index), relativeValue);
3782 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3784 // Start the animation
3787 bool signalReceived(false);
3788 AnimationFinishCheck finishCheck(signalReceived);
3789 animation.FinishedSignal().Connect(&application, finishCheck);
3791 application.SendNotification();
3792 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3794 // We didn't expect the animation to finish yet
3795 application.SendNotification();
3796 finishCheck.CheckSignalNotReceived();
3797 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
3799 application.SendNotification();
3800 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3802 // We did expect the animation to finish
3803 application.SendNotification();
3804 finishCheck.CheckSignalReceived();
3805 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3807 // Check that nothing has changed after a couple of buffer swaps
3808 application.Render(0);
3809 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3810 application.Render(0);
3811 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3815 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3817 TestApplication application;
3819 Actor actor = Actor::New();
3821 // Register a Vector3 property
3822 Vector3 startValue(100.0f, 100.0f, 100.0f);
3823 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3824 Stage::GetCurrent().Add(actor);
3825 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3827 // Build the animation
3828 float durationSeconds(1.0f);
3829 Animation animation = Animation::New(durationSeconds);
3830 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3831 Vector3 relativeValue(targetValue - startValue);
3832 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3834 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3836 // Start the animation
3839 bool signalReceived(false);
3840 AnimationFinishCheck finishCheck(signalReceived);
3841 animation.FinishedSignal().Connect(&application, finishCheck);
3843 application.SendNotification();
3844 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3846 // We didn't expect the animation to finish yet
3847 application.SendNotification();
3848 finishCheck.CheckSignalNotReceived();
3850 // The position should have moved more, than with a linear alpha function
3851 Vector3 current(actor.GetProperty<Vector3>(index));
3852 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3853 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3854 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3856 application.SendNotification();
3857 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3859 // We did expect the animation to finish
3860 application.SendNotification();
3861 finishCheck.CheckSignalReceived();
3862 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3864 // Check that nothing has changed after a couple of buffer swaps
3865 application.Render(0);
3866 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3867 application.Render(0);
3868 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3872 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3874 TestApplication application;
3876 Actor actor = Actor::New();
3878 // Register a Vector3 property
3879 Vector3 startValue(10.0f, 10.0f, 10.0f);
3880 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3881 Stage::GetCurrent().Add(actor);
3882 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3884 // Build the animation
3885 float durationSeconds(1.0f);
3886 Animation animation = Animation::New(durationSeconds);
3887 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3888 Vector3 relativeValue(targetValue - startValue);
3890 animation.AnimateBy(Property(actor, index),
3892 TimePeriod(delay, durationSeconds - delay));
3894 // Start the animation
3897 bool signalReceived(false);
3898 AnimationFinishCheck finishCheck(signalReceived);
3899 animation.FinishedSignal().Connect(&application, finishCheck);
3901 application.SendNotification();
3902 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3904 // We didn't expect the animation to finish yet
3905 application.SendNotification();
3906 finishCheck.CheckSignalNotReceived();
3907 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3909 application.SendNotification();
3910 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3912 // We didn't expect the animation to finish yet
3913 application.SendNotification();
3914 finishCheck.CheckSignalNotReceived();
3915 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3917 application.SendNotification();
3918 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3920 // We did expect the animation to finish
3921 application.SendNotification();
3922 finishCheck.CheckSignalReceived();
3923 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3925 // Check that nothing has changed after a couple of buffer swaps
3926 application.Render(0);
3927 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3928 application.Render(0);
3929 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3933 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3935 TestApplication application;
3937 Actor actor = Actor::New();
3939 // Register a Vector3 property
3940 Vector3 startValue(5.0f, 5.0f, 5.0f);
3941 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3942 Stage::GetCurrent().Add(actor);
3943 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3945 // Build the animation
3946 float durationSeconds(1.0f);
3947 Animation animation = Animation::New(durationSeconds);
3948 Vector3 targetValue(10.0f, 10.0f, 10.0f);
3949 Vector3 relativeValue(targetValue - startValue);
3951 animation.AnimateBy(Property(actor, index),
3953 AlphaFunction::LINEAR,
3954 TimePeriod(delay, durationSeconds - delay));
3956 // Start the animation
3959 bool signalReceived(false);
3960 AnimationFinishCheck finishCheck(signalReceived);
3961 animation.FinishedSignal().Connect(&application, finishCheck);
3963 application.SendNotification();
3964 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3966 // We didn't expect the animation to finish yet
3967 application.SendNotification();
3968 finishCheck.CheckSignalNotReceived();
3969 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3971 application.SendNotification();
3972 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3974 // We didn't expect the animation to finish yet
3975 application.SendNotification();
3976 finishCheck.CheckSignalNotReceived();
3977 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3979 application.SendNotification();
3980 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3982 // We did expect the animation to finish
3983 application.SendNotification();
3984 finishCheck.CheckSignalReceived();
3985 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3987 // Check that nothing has changed after a couple of buffer swaps
3988 application.Render(0);
3989 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3990 application.Render(0);
3991 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3995 int UtcDaliAnimationAnimateByVector4P(void)
3997 TestApplication application;
3999 Actor actor = Actor::New();
4001 // Register a Vector4 property
4002 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4003 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4004 Stage::GetCurrent().Add(actor);
4005 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4007 // Build the animation
4008 float durationSeconds(2.0f);
4009 Animation animation = Animation::New(durationSeconds);
4010 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4011 Vector4 relativeValue(targetValue - startValue);
4012 animation.AnimateBy(Property(actor, index), relativeValue);
4014 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4016 // Start the animation
4019 bool signalReceived(false);
4020 AnimationFinishCheck finishCheck(signalReceived);
4021 animation.FinishedSignal().Connect(&application, finishCheck);
4023 application.SendNotification();
4024 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4026 // We didn't expect the animation to finish yet
4027 application.SendNotification();
4028 finishCheck.CheckSignalNotReceived();
4029 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
4031 application.SendNotification();
4032 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4034 // We did expect the animation to finish
4035 application.SendNotification();
4036 finishCheck.CheckSignalReceived();
4037 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4039 // Check that nothing has changed after a couple of buffer swaps
4040 application.Render(0);
4041 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4042 application.Render(0);
4043 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4047 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4049 TestApplication application;
4051 Actor actor = Actor::New();
4053 // Register a Vector4 property
4054 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4055 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4056 Stage::GetCurrent().Add(actor);
4057 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4059 // Build the animation
4060 float durationSeconds(1.0f);
4061 Animation animation = Animation::New(durationSeconds);
4062 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4063 Vector4 relativeValue(targetValue - startValue);
4064 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4066 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4068 // Start the animation
4071 bool signalReceived(false);
4072 AnimationFinishCheck finishCheck(signalReceived);
4073 animation.FinishedSignal().Connect(&application, finishCheck);
4075 application.SendNotification();
4076 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4078 // We didn't expect the animation to finish yet
4079 application.SendNotification();
4080 finishCheck.CheckSignalNotReceived();
4082 // The position should have moved more, than with a linear alpha function
4083 Vector4 current(actor.GetProperty<Vector4>(index));
4084 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4085 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4086 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4087 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4089 application.SendNotification();
4090 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4092 // We did expect the animation to finish
4093 application.SendNotification();
4094 finishCheck.CheckSignalReceived();
4095 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4097 // Check that nothing has changed after a couple of buffer swaps
4098 application.Render(0);
4099 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4100 application.Render(0);
4101 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4105 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4107 TestApplication application;
4109 Actor actor = Actor::New();
4111 // Register a Vector4 property
4112 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4113 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4114 Stage::GetCurrent().Add(actor);
4115 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4117 // Build the animation
4118 float durationSeconds(1.0f);
4119 Animation animation = Animation::New(durationSeconds);
4120 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4121 Vector4 relativeValue(targetValue - startValue);
4123 animation.AnimateBy(Property(actor, index),
4125 TimePeriod(delay, durationSeconds - delay));
4127 // Start the animation
4130 bool signalReceived(false);
4131 AnimationFinishCheck finishCheck(signalReceived);
4132 animation.FinishedSignal().Connect(&application, finishCheck);
4134 application.SendNotification();
4135 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4137 // We didn't expect the animation to finish yet
4138 application.SendNotification();
4139 finishCheck.CheckSignalNotReceived();
4140 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4142 application.SendNotification();
4143 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4145 // We didn't expect the animation to finish yet
4146 application.SendNotification();
4147 finishCheck.CheckSignalNotReceived();
4148 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4150 application.SendNotification();
4151 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4153 // We did expect the animation to finish
4154 application.SendNotification();
4155 finishCheck.CheckSignalReceived();
4156 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4158 // Check that nothing has changed after a couple of buffer swaps
4159 application.Render(0);
4160 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4161 application.Render(0);
4162 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4166 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4168 TestApplication application;
4170 Actor actor = Actor::New();
4172 // Register a Vector4 property
4173 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4174 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4175 Stage::GetCurrent().Add(actor);
4176 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4178 // Build the animation
4179 float durationSeconds(1.0f);
4180 Animation animation = Animation::New(durationSeconds);
4181 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4182 Vector4 relativeValue(targetValue - startValue);
4184 animation.AnimateBy(Property(actor, index),
4186 AlphaFunction::LINEAR,
4187 TimePeriod(delay, durationSeconds - delay));
4189 // Start the animation
4192 bool signalReceived(false);
4193 AnimationFinishCheck finishCheck(signalReceived);
4194 animation.FinishedSignal().Connect(&application, finishCheck);
4196 application.SendNotification();
4197 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4199 // We didn't expect the animation to finish yet
4200 application.SendNotification();
4201 finishCheck.CheckSignalNotReceived();
4202 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4204 application.SendNotification();
4205 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4207 // We didn't expect the animation to finish yet
4208 application.SendNotification();
4209 finishCheck.CheckSignalNotReceived();
4210 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4212 application.SendNotification();
4213 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4215 // We did expect the animation to finish
4216 application.SendNotification();
4217 finishCheck.CheckSignalReceived();
4218 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4220 // Check that nothing has changed after a couple of buffer swaps
4221 application.Render(0);
4222 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4223 application.Render(0);
4224 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4228 int UtcDaliAnimationAnimateByActorPositionP(void)
4230 TestApplication application;
4232 Actor actor = Actor::New();
4233 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4234 actor.SetPosition(startPosition);
4235 Stage::GetCurrent().Add(actor);
4236 application.SendNotification();
4237 application.Render(0);
4238 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4240 // Build the animation
4241 float durationSeconds(1.0f);
4242 Animation animation = Animation::New(durationSeconds);
4243 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4244 Vector3 relativePosition(targetPosition - startPosition);
4245 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4247 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4249 // Start the animation
4252 bool signalReceived(false);
4253 AnimationFinishCheck finishCheck(signalReceived);
4254 animation.FinishedSignal().Connect(&application, finishCheck);
4256 application.SendNotification();
4257 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4259 // We didn't expect the animation to finish yet
4260 application.SendNotification();
4261 finishCheck.CheckSignalNotReceived();
4262 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4264 application.SendNotification();
4265 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4267 // We did expect the animation to finish
4268 application.SendNotification();
4269 finishCheck.CheckSignalReceived();
4270 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4272 // Check that nothing has changed after a couple of buffer swaps
4273 application.Render(0);
4274 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4275 application.Render(0);
4276 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4280 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4282 TestApplication application;
4284 Actor actor = Actor::New();
4285 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4286 actor.SetPosition(startPosition);
4287 Stage::GetCurrent().Add(actor);
4288 application.SendNotification();
4289 application.Render(0);
4290 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4292 // Build the animation
4293 float durationSeconds(1.0f);
4294 Animation animation = Animation::New(durationSeconds);
4295 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4296 Vector3 relativePosition(targetPosition - startPosition);
4297 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4299 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4301 // Start the animation
4304 bool signalReceived(false);
4305 AnimationFinishCheck finishCheck(signalReceived);
4306 animation.FinishedSignal().Connect(&application, finishCheck);
4308 application.SendNotification();
4309 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4311 // We didn't expect the animation to finish yet
4312 application.SendNotification();
4313 finishCheck.CheckSignalNotReceived();
4315 // The position should have moved more, than with a linear alpha function
4316 Vector3 current(actor.GetCurrentPosition());
4317 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4318 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4319 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4321 application.SendNotification();
4322 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4324 // We did expect the animation to finish
4325 application.SendNotification();
4326 finishCheck.CheckSignalReceived();
4327 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4329 // Check that nothing has changed after a couple of buffer swaps
4330 application.Render(0);
4331 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4332 application.Render(0);
4333 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4337 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4339 TestApplication application;
4341 Actor actor = Actor::New();
4342 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4343 actor.SetPosition(startPosition);
4344 Stage::GetCurrent().Add(actor);
4345 application.SendNotification();
4346 application.Render(0);
4347 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4349 // Build the animation
4350 float durationSeconds(1.0f);
4351 Animation animation = Animation::New(durationSeconds);
4352 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4353 Vector3 relativePosition(targetPosition - startPosition);
4355 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4357 TimePeriod(delay, durationSeconds - delay));
4359 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4361 // Start the animation
4364 bool signalReceived(false);
4365 AnimationFinishCheck finishCheck(signalReceived);
4366 animation.FinishedSignal().Connect(&application, finishCheck);
4368 application.SendNotification();
4369 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4371 // We didn't expect the animation to finish yet
4372 application.SendNotification();
4373 finishCheck.CheckSignalNotReceived();
4374 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4376 application.SendNotification();
4377 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4379 // We did expect the animation to finish
4380 application.SendNotification();
4381 finishCheck.CheckSignalReceived();
4382 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4384 // Check that nothing has changed after a couple of buffer swaps
4385 application.Render(0);
4386 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4387 application.Render(0);
4388 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4392 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4394 TestApplication application;
4396 Actor actor = Actor::New();
4397 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4398 actor.SetPosition(startPosition);
4399 Stage::GetCurrent().Add(actor);
4400 application.SendNotification();
4401 application.Render(0);
4402 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4404 // Build the animation
4405 float durationSeconds(1.0f);
4406 Animation animation = Animation::New(durationSeconds);
4407 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4408 Vector3 relativePosition(targetPosition - startPosition);
4410 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4412 AlphaFunction::LINEAR,
4413 TimePeriod(delay, durationSeconds - delay));
4415 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4417 // Start the animation
4420 bool signalReceived(false);
4421 AnimationFinishCheck finishCheck(signalReceived);
4422 animation.FinishedSignal().Connect(&application, finishCheck);
4424 application.SendNotification();
4425 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4427 // We didn't expect the animation to finish yet
4428 application.SendNotification();
4429 finishCheck.CheckSignalNotReceived();
4430 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4432 application.SendNotification();
4433 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4435 // We did expect the animation to finish
4436 application.SendNotification();
4437 finishCheck.CheckSignalReceived();
4438 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4440 // Check that nothing has changed after a couple of buffer swaps
4441 application.Render(0);
4442 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4443 application.Render(0);
4444 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4448 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4450 TestApplication application;
4452 Actor actor = Actor::New();
4453 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4454 Stage::GetCurrent().Add(actor);
4455 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4457 // Build the animation
4458 float durationSeconds(1.0f);
4459 Animation animation = Animation::New(durationSeconds);
4460 Degree relativeRotationDegrees(360.0f);
4461 Radian relativeRotationRadians(relativeRotationDegrees);
4462 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4464 // Start the animation
4467 bool signalReceived(false);
4468 AnimationFinishCheck finishCheck(signalReceived);
4469 animation.FinishedSignal().Connect(&application, finishCheck);
4471 application.SendNotification();
4472 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4474 // We didn't expect the animation to finish yet
4475 application.SendNotification();
4476 finishCheck.CheckSignalNotReceived();
4477 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4479 application.SendNotification();
4480 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4482 // We didn't expect the animation to finish yet
4483 application.SendNotification();
4484 finishCheck.CheckSignalNotReceived();
4485 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4487 application.SendNotification();
4488 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4490 // We didn't expect the animation to finish yet
4491 application.SendNotification();
4492 finishCheck.CheckSignalNotReceived();
4493 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4495 application.SendNotification();
4496 application.Render(static_cast<unsigned int>(durationSeconds*250.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.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4505 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4507 TestApplication application;
4509 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4511 Actor actor = Actor::New();
4512 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4513 Stage::GetCurrent().Add(actor);
4514 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4516 // Build the animation
4517 float durationSeconds(1.0f);
4518 Animation animation = Animation::New(durationSeconds);
4519 Degree relativeRotationDegrees(710.0f);
4520 Radian relativeRotationRadians(relativeRotationDegrees);
4522 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4524 // Start the animation
4527 bool signalReceived(false);
4528 AnimationFinishCheck finishCheck(signalReceived);
4529 animation.FinishedSignal().Connect(&application, finishCheck);
4531 application.SendNotification();
4532 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4534 // We didn't expect the animation to finish yet
4535 application.SendNotification();
4536 finishCheck.CheckSignalNotReceived();
4537 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4539 application.SendNotification();
4540 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4542 // We didn't expect the animation to finish yet
4543 application.SendNotification();
4544 finishCheck.CheckSignalNotReceived();
4545 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4547 application.SendNotification();
4548 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4550 // We didn't expect the animation to finish yet
4551 application.SendNotification();
4552 finishCheck.CheckSignalNotReceived();
4553 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4555 application.SendNotification();
4556 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4558 // We did expect the animation to finish
4559 application.SendNotification();
4560 finishCheck.CheckSignalReceived();
4561 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4566 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4568 TestApplication application;
4570 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4572 Actor actor = Actor::New();
4573 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4574 Stage::GetCurrent().Add(actor);
4575 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4577 // Build the animation
4578 float durationSeconds(1.0f);
4579 Animation animation = Animation::New(durationSeconds);
4580 Degree relativeRotationDegrees(730.0f);
4581 Radian relativeRotationRadians(relativeRotationDegrees);
4583 Radian actualRotationRadians( Degree(10.0f) );
4585 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4587 // Start the animation
4590 bool signalReceived(false);
4591 AnimationFinishCheck finishCheck(signalReceived);
4592 animation.FinishedSignal().Connect(&application, finishCheck);
4594 application.SendNotification();
4595 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4597 // We didn't expect the animation to finish yet
4598 application.SendNotification();
4599 finishCheck.CheckSignalNotReceived();
4600 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4602 application.SendNotification();
4603 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4605 // We didn't expect the animation to finish yet
4606 application.SendNotification();
4607 finishCheck.CheckSignalNotReceived();
4608 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4610 application.SendNotification();
4611 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4613 // We didn't expect the animation to finish yet
4614 application.SendNotification();
4615 finishCheck.CheckSignalNotReceived();
4616 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4618 application.SendNotification();
4619 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4621 // We did expect the animation to finish
4622 application.SendNotification();
4623 finishCheck.CheckSignalReceived();
4624 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4625 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4630 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4632 TestApplication application;
4634 Actor actor = Actor::New();
4635 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4636 Stage::GetCurrent().Add(actor);
4637 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4639 // Build the animation
4640 float durationSeconds(1.0f);
4641 Animation animation = Animation::New(durationSeconds);
4642 Degree relativeRotationDegrees(360.0f);
4643 Radian relativeRotationRadians(relativeRotationDegrees);
4644 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4646 // Start the animation
4649 bool signalReceived(false);
4650 AnimationFinishCheck finishCheck(signalReceived);
4651 animation.FinishedSignal().Connect(&application, finishCheck);
4653 application.SendNotification();
4654 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4656 // We didn't expect the animation to finish yet
4657 application.SendNotification();
4658 finishCheck.CheckSignalNotReceived();
4659 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4661 application.SendNotification();
4662 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4664 // We didn't expect the animation to finish yet
4665 application.SendNotification();
4666 finishCheck.CheckSignalNotReceived();
4667 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4669 application.SendNotification();
4670 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4672 // We didn't expect the animation to finish yet
4673 application.SendNotification();
4674 finishCheck.CheckSignalNotReceived();
4675 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4677 application.SendNotification();
4678 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4680 // We did expect the animation to finish
4681 application.SendNotification();
4682 finishCheck.CheckSignalReceived();
4683 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4687 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4689 TestApplication application;
4691 Actor actor = Actor::New();
4692 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4693 Stage::GetCurrent().Add(actor);
4694 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4696 // Build the animation
4697 float durationSeconds(1.0f);
4698 Animation animation = Animation::New(durationSeconds);
4699 Degree relativeRotationDegrees(360.0f);
4700 Radian relativeRotationRadians(relativeRotationDegrees);
4702 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4703 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4705 // Start the animation
4708 bool signalReceived(false);
4709 AnimationFinishCheck finishCheck(signalReceived);
4710 animation.FinishedSignal().Connect(&application, finishCheck);
4712 application.SendNotification();
4713 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4715 // We didn't expect the animation to finish yet
4716 application.SendNotification();
4717 finishCheck.CheckSignalNotReceived();
4718 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4719 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4721 application.SendNotification();
4722 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4724 // We didn't expect the animation to finish yet
4725 application.SendNotification();
4726 finishCheck.CheckSignalNotReceived();
4727 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4728 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4730 application.SendNotification();
4731 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4733 // We didn't expect the animation to finish yet
4734 application.SendNotification();
4735 finishCheck.CheckSignalNotReceived();
4736 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4737 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4739 application.SendNotification();
4740 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4742 // We did expect the animation to finish
4743 application.SendNotification();
4744 finishCheck.CheckSignalReceived();
4745 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4749 int UtcDaliAnimationAnimateByActorScaleP(void)
4751 TestApplication application;
4753 Actor actor = Actor::New();
4754 Stage::GetCurrent().Add(actor);
4755 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4757 // Build the animation
4758 float durationSeconds(1.0f);
4759 Animation animation = Animation::New(durationSeconds);
4760 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4761 Vector3 relativeScale(targetScale - Vector3::ONE);
4762 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4764 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4766 // Start the animation
4769 bool signalReceived(false);
4770 AnimationFinishCheck finishCheck(signalReceived);
4771 animation.FinishedSignal().Connect(&application, finishCheck);
4773 application.SendNotification();
4774 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4776 // We didn't expect the animation to finish yet
4777 application.SendNotification();
4778 finishCheck.CheckSignalNotReceived();
4779 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4781 application.SendNotification();
4782 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4784 // We did expect the animation to finish
4785 application.SendNotification();
4786 finishCheck.CheckSignalReceived();
4787 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4790 finishCheck.Reset();
4791 actor.SetScale(Vector3::ONE);
4792 application.SendNotification();
4793 application.Render(0);
4794 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4796 // Repeat with a different (ease-in) alpha function
4797 animation = Animation::New(durationSeconds);
4798 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4799 animation.FinishedSignal().Connect(&application, finishCheck);
4802 application.SendNotification();
4803 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4805 // We didn't expect the animation to finish yet
4806 application.SendNotification();
4807 finishCheck.CheckSignalNotReceived();
4809 // The scale should have grown less, than with a linear alpha function
4810 Vector3 current(actor.GetCurrentScale());
4811 DALI_TEST_CHECK( current.x > 1.0f );
4812 DALI_TEST_CHECK( current.y > 1.0f );
4813 DALI_TEST_CHECK( current.z > 1.0f );
4814 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4815 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4816 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4818 application.SendNotification();
4819 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4821 // We did expect the animation to finish
4822 application.SendNotification();
4823 finishCheck.CheckSignalReceived();
4824 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4827 finishCheck.Reset();
4828 actor.SetScale(Vector3::ONE);
4829 application.SendNotification();
4830 application.Render(0);
4831 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4833 // Repeat with a delay
4835 animation = Animation::New(durationSeconds);
4836 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4837 animation.FinishedSignal().Connect(&application, finishCheck);
4840 application.SendNotification();
4841 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4843 // We didn't expect the animation to finish yet
4844 application.SendNotification();
4845 finishCheck.CheckSignalNotReceived();
4846 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4848 application.SendNotification();
4849 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4851 // We did expect the animation to finish
4852 application.SendNotification();
4853 finishCheck.CheckSignalReceived();
4854 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4858 int UtcDaliAnimationAnimateToBooleanP(void)
4860 TestApplication application;
4862 Actor actor = Actor::New();
4864 // Register a boolean property
4865 const bool startValue(false);
4866 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4867 Stage::GetCurrent().Add(actor);
4868 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4870 // Build the animation
4871 float durationSeconds(2.0f);
4872 Animation animation = Animation::New(durationSeconds);
4873 const bool targetValue( !startValue );
4874 animation.AnimateTo(Property(actor, index), targetValue);
4876 // Start the animation
4879 bool signalReceived(false);
4880 AnimationFinishCheck finishCheck(signalReceived);
4881 animation.FinishedSignal().Connect(&application, finishCheck);
4883 application.SendNotification();
4884 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4886 // We didn't expect the animation to finish yet
4887 application.SendNotification();
4888 finishCheck.CheckSignalNotReceived();
4889 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4891 application.SendNotification();
4892 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4894 // We did expect the animation to finish
4895 application.SendNotification();
4896 finishCheck.CheckSignalReceived();
4897 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4899 // Check that nothing has changed after a couple of buffer swaps
4900 application.Render(0);
4901 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4902 application.Render(0);
4903 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4905 // Repeat with target value "false"
4906 animation = Animation::New(durationSeconds);
4907 const bool finalValue( !targetValue );
4908 animation.AnimateTo(Property(actor, index), finalValue);
4910 // Start the animation
4913 finishCheck.Reset();
4914 animation.FinishedSignal().Connect(&application, finishCheck);
4916 application.SendNotification();
4917 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4919 // We didn't expect the animation to finish yet
4920 application.SendNotification();
4921 finishCheck.CheckSignalNotReceived();
4922 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4924 application.SendNotification();
4925 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4927 // We did expect the animation to finish
4928 application.SendNotification();
4929 finishCheck.CheckSignalReceived();
4930 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4932 // Check that nothing has changed after a couple of buffer swaps
4933 application.Render(0);
4934 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4935 application.Render(0);
4936 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4940 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4942 TestApplication application;
4944 Actor actor = Actor::New();
4946 // Register a boolean property
4947 const bool startValue(false);
4948 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4949 Stage::GetCurrent().Add(actor);
4950 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4952 // Build the animation
4953 float durationSeconds(2.0f);
4954 Animation animation = Animation::New(durationSeconds);
4955 const bool targetValue( !startValue );
4956 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4958 // Start the animation
4961 bool signalReceived(false);
4962 AnimationFinishCheck finishCheck(signalReceived);
4963 animation.FinishedSignal().Connect(&application, finishCheck);
4965 application.SendNotification();
4966 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4968 // We didn't expect the animation to finish yet
4969 application.SendNotification();
4970 finishCheck.CheckSignalNotReceived();
4971 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4973 application.SendNotification();
4974 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4976 // We did expect the animation to finish
4977 application.SendNotification();
4978 finishCheck.CheckSignalReceived();
4979 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4981 // Check that nothing has changed after a couple of buffer swaps
4982 application.Render(0);
4983 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4984 application.Render(0);
4985 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4987 // Repeat with target value "false"
4988 animation = Animation::New(durationSeconds);
4989 const bool finalValue( !targetValue );
4990 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
4992 // Start the animation
4995 finishCheck.Reset();
4996 animation.FinishedSignal().Connect(&application, finishCheck);
4998 application.SendNotification();
4999 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5001 // We didn't expect the animation to finish yet
5002 application.SendNotification();
5003 finishCheck.CheckSignalNotReceived();
5004 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
5006 application.SendNotification();
5007 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5009 // We did expect the animation to finish
5010 application.SendNotification();
5011 finishCheck.CheckSignalReceived();
5012 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5014 // Check that nothing has changed after a couple of buffer swaps
5015 application.Render(0);
5016 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5017 application.Render(0);
5018 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5022 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5024 TestApplication application;
5026 Actor actor = Actor::New();
5028 // Register a boolean property
5029 bool startValue(false);
5030 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5031 Stage::GetCurrent().Add(actor);
5032 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5034 // Build the animation
5035 float durationSeconds(2.0f);
5036 Animation animation = Animation::New(durationSeconds);
5037 bool finalValue( !startValue );
5038 float animatorDurationSeconds(durationSeconds * 0.5f);
5039 animation.AnimateTo( Property(actor, index),
5041 TimePeriod( animatorDurationSeconds ) );
5043 // Start the animation
5046 bool signalReceived(false);
5047 AnimationFinishCheck finishCheck(signalReceived);
5048 animation.FinishedSignal().Connect(&application, finishCheck);
5050 application.SendNotification();
5051 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5053 // We didn't expect the animation to finish yet
5054 application.SendNotification();
5055 finishCheck.CheckSignalNotReceived();
5056 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5058 application.SendNotification();
5059 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5061 // We didn't expect the animation to finish yet...
5062 application.SendNotification();
5063 finishCheck.CheckSignalNotReceived();
5065 // ...however we should have reached the final value
5066 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5068 application.SendNotification();
5069 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5071 // We did expect the animation to finish
5072 application.SendNotification();
5073 finishCheck.CheckSignalReceived();
5074 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5076 // Check that nothing has changed after a couple of buffer swaps
5077 application.Render(0);
5078 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5079 application.Render(0);
5080 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5084 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5086 TestApplication application;
5088 Actor actor = Actor::New();
5090 // Register a boolean property
5091 bool startValue(false);
5092 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5093 Stage::GetCurrent().Add(actor);
5094 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5096 // Build the animation
5097 float durationSeconds(2.0f);
5098 Animation animation = Animation::New(durationSeconds);
5099 bool finalValue( !startValue );
5100 float animatorDurationSeconds(durationSeconds * 0.5f);
5101 animation.AnimateTo( Property(actor, index),
5103 AlphaFunction::LINEAR,
5104 TimePeriod( animatorDurationSeconds ) );
5106 // Start the animation
5109 bool signalReceived(false);
5110 AnimationFinishCheck finishCheck(signalReceived);
5111 animation.FinishedSignal().Connect(&application, finishCheck);
5113 application.SendNotification();
5114 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5116 // We didn't expect the animation to finish yet
5117 application.SendNotification();
5118 finishCheck.CheckSignalNotReceived();
5119 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5121 application.SendNotification();
5122 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5124 // We didn't expect the animation to finish yet...
5125 application.SendNotification();
5126 finishCheck.CheckSignalNotReceived();
5128 // ...however we should have reached the final value
5129 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5131 application.SendNotification();
5132 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5134 // We did expect the animation to finish
5135 application.SendNotification();
5136 finishCheck.CheckSignalReceived();
5137 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5139 // Check that nothing has changed after a couple of buffer swaps
5140 application.Render(0);
5141 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5142 application.Render(0);
5143 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5147 int UtcDaliAnimationAnimateToFloatP(void)
5149 TestApplication application;
5151 Actor actor = Actor::New();
5153 // Register a float property
5154 float startValue(10.0f);
5155 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5156 Stage::GetCurrent().Add(actor);
5157 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5159 // Build the animation
5160 float durationSeconds(2.0f);
5161 Animation animation = Animation::New(durationSeconds);
5162 float targetValue(50.0f);
5163 float relativeValue(targetValue - startValue);
5164 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5166 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5168 // Start the animation
5171 bool signalReceived(false);
5172 AnimationFinishCheck finishCheck(signalReceived);
5173 animation.FinishedSignal().Connect(&application, finishCheck);
5175 application.SendNotification();
5176 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5178 // We didn't expect the animation to finish yet
5179 application.SendNotification();
5180 finishCheck.CheckSignalNotReceived();
5181 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
5183 application.SendNotification();
5184 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5186 // We did expect the animation to finish
5187 application.SendNotification();
5188 finishCheck.CheckSignalReceived();
5189 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5193 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5195 TestApplication application;
5197 Actor actor = Actor::New();
5199 // Register a float property
5200 float startValue(10.0f);
5201 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5202 Stage::GetCurrent().Add(actor);
5203 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5205 // Build the animation
5206 float durationSeconds(1.0f);
5207 Animation animation = Animation::New(durationSeconds);
5208 float targetValue(90.0f);
5209 float relativeValue(targetValue - startValue);
5210 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5212 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5214 // Start the animation
5217 bool signalReceived(false);
5218 AnimationFinishCheck finishCheck(signalReceived);
5219 animation.FinishedSignal().Connect(&application, finishCheck);
5221 application.SendNotification();
5222 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5224 // We didn't expect the animation to finish yet
5225 application.SendNotification();
5226 finishCheck.CheckSignalNotReceived();
5228 // The position should have moved more, than with a linear alpha function
5229 float current(actor.GetProperty<float>(index));
5230 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5232 application.SendNotification();
5233 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5235 // We did expect the animation to finish
5236 application.SendNotification();
5237 finishCheck.CheckSignalReceived();
5238 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5242 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5244 TestApplication application;
5246 Actor actor = Actor::New();
5248 // Register a float property
5249 float startValue(10.0f);
5250 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5251 Stage::GetCurrent().Add(actor);
5252 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5254 // Build the animation
5255 float durationSeconds(1.0f);
5256 Animation animation = Animation::New(durationSeconds);
5257 float targetValue(30.0f);
5258 float relativeValue(targetValue - startValue);
5260 animation.AnimateTo(Property(actor, index),
5262 TimePeriod(delay, durationSeconds - delay));
5264 // Start the animation
5267 bool signalReceived(false);
5268 AnimationFinishCheck finishCheck(signalReceived);
5269 animation.FinishedSignal().Connect(&application, finishCheck);
5271 application.SendNotification();
5272 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5274 // We didn't expect the animation to finish yet
5275 application.SendNotification();
5276 finishCheck.CheckSignalNotReceived();
5277 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5279 application.SendNotification();
5280 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5282 // We didn't expect the animation to finish yet
5283 application.SendNotification();
5284 finishCheck.CheckSignalNotReceived();
5285 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5287 application.SendNotification();
5288 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5290 // We did expect the animation to finish
5291 application.SendNotification();
5292 finishCheck.CheckSignalReceived();
5293 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5297 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5299 TestApplication application;
5301 Actor actor = Actor::New();
5303 // Register a float property
5304 float startValue(10.0f);
5305 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5306 Stage::GetCurrent().Add(actor);
5307 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5309 // Build the animation
5310 float durationSeconds(1.0f);
5311 Animation animation = Animation::New(durationSeconds);
5312 float targetValue(30.0f);
5313 float relativeValue(targetValue - startValue);
5315 animation.AnimateTo(Property(actor, index),
5317 AlphaFunction::LINEAR,
5318 TimePeriod(delay, durationSeconds - delay));
5320 // Start the animation
5323 bool signalReceived(false);
5324 AnimationFinishCheck finishCheck(signalReceived);
5325 animation.FinishedSignal().Connect(&application, finishCheck);
5327 application.SendNotification();
5328 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5330 // We didn't expect the animation to finish yet
5331 application.SendNotification();
5332 finishCheck.CheckSignalNotReceived();
5333 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5335 application.SendNotification();
5336 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5338 // We didn't expect the animation to finish yet
5339 application.SendNotification();
5340 finishCheck.CheckSignalNotReceived();
5341 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5343 application.SendNotification();
5344 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5346 // We did expect the animation to finish
5347 application.SendNotification();
5348 finishCheck.CheckSignalReceived();
5349 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5353 int UtcDaliAnimationAnimateToIntegerP(void)
5355 TestApplication application;
5357 Actor actor = Actor::New();
5359 // Register an integer property
5361 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5362 Stage::GetCurrent().Add(actor);
5363 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5365 // Build the animation
5366 float durationSeconds(2.0f);
5367 Animation animation = Animation::New(durationSeconds);
5368 int targetValue(50);
5369 int relativeValue(targetValue - startValue);
5370 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5372 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5374 // Start the animation
5377 bool signalReceived(false);
5378 AnimationFinishCheck finishCheck(signalReceived);
5379 animation.FinishedSignal().Connect(&application, finishCheck);
5381 application.SendNotification();
5382 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5384 // We didn't expect the animation to finish yet
5385 application.SendNotification();
5386 finishCheck.CheckSignalNotReceived();
5387 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
5389 application.SendNotification();
5390 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5392 // We did expect the animation to finish
5393 application.SendNotification();
5394 finishCheck.CheckSignalReceived();
5395 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5399 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5401 TestApplication application;
5403 Actor actor = Actor::New();
5405 // Register an integer property
5407 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5408 Stage::GetCurrent().Add(actor);
5409 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5411 // Build the animation
5412 float durationSeconds(1.0f);
5413 Animation animation = Animation::New(durationSeconds);
5414 int targetValue(90);
5415 int relativeValue(targetValue - startValue);
5416 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5418 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5420 // Start the animation
5423 bool signalReceived(false);
5424 AnimationFinishCheck finishCheck(signalReceived);
5425 animation.FinishedSignal().Connect(&application, finishCheck);
5427 application.SendNotification();
5428 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5430 // We didn't expect the animation to finish yet
5431 application.SendNotification();
5432 finishCheck.CheckSignalNotReceived();
5434 // The position should have moved more, than with a linear alpha function
5435 int current(actor.GetProperty<int>(index));
5436 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5438 application.SendNotification();
5439 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5441 // We did expect the animation to finish
5442 application.SendNotification();
5443 finishCheck.CheckSignalReceived();
5444 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5448 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5450 TestApplication application;
5452 Actor actor = Actor::New();
5454 // Register an integer property
5456 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5457 Stage::GetCurrent().Add(actor);
5458 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5460 // Build the animation
5461 float durationSeconds(1.0f);
5462 Animation animation = Animation::New(durationSeconds);
5463 int targetValue(30);
5464 int relativeValue(targetValue - startValue);
5466 animation.AnimateTo(Property(actor, index),
5468 TimePeriod(delay, durationSeconds - delay));
5470 // Start the animation
5473 bool signalReceived(false);
5474 AnimationFinishCheck finishCheck(signalReceived);
5475 animation.FinishedSignal().Connect(&application, finishCheck);
5477 application.SendNotification();
5478 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5480 // We didn't expect the animation to finish yet
5481 application.SendNotification();
5482 finishCheck.CheckSignalNotReceived();
5483 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5485 application.SendNotification();
5486 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5488 // We didn't expect the animation to finish yet
5489 application.SendNotification();
5490 finishCheck.CheckSignalNotReceived();
5491 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5493 application.SendNotification();
5494 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5496 // We did expect the animation to finish
5497 application.SendNotification();
5498 finishCheck.CheckSignalReceived();
5499 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5503 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5505 TestApplication application;
5507 Actor actor = Actor::New();
5509 // Register an integer property
5511 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5512 Stage::GetCurrent().Add(actor);
5513 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5515 // Build the animation
5516 float durationSeconds(1.0f);
5517 Animation animation = Animation::New(durationSeconds);
5518 int targetValue(30);
5519 int relativeValue(targetValue - startValue);
5521 animation.AnimateTo(Property(actor, index),
5523 AlphaFunction::LINEAR,
5524 TimePeriod(delay, durationSeconds - delay));
5526 // Start the animation
5529 bool signalReceived(false);
5530 AnimationFinishCheck finishCheck(signalReceived);
5531 animation.FinishedSignal().Connect(&application, finishCheck);
5533 application.SendNotification();
5534 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5536 // We didn't expect the animation to finish yet
5537 application.SendNotification();
5538 finishCheck.CheckSignalNotReceived();
5539 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5541 application.SendNotification();
5542 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5544 // We didn't expect the animation to finish yet
5545 application.SendNotification();
5546 finishCheck.CheckSignalNotReceived();
5547 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5549 application.SendNotification();
5550 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5552 // We did expect the animation to finish
5553 application.SendNotification();
5554 finishCheck.CheckSignalReceived();
5555 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5559 int UtcDaliAnimationAnimateToVector2P(void)
5561 TestApplication application;
5563 Actor actor = Actor::New();
5565 // Register a Vector2 property
5566 Vector2 startValue(-50.0f, -50.0f);
5567 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5568 Stage::GetCurrent().Add(actor);
5569 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5571 // Build the animation
5572 float durationSeconds(2.0f);
5573 Animation animation = Animation::New(durationSeconds);
5574 Vector2 targetValue(50.0f, 50.0f);
5575 Vector2 relativeValue(targetValue - startValue);
5576 animation.AnimateTo(Property(actor, index), targetValue);
5578 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5580 // Start the animation
5583 bool signalReceived(false);
5584 AnimationFinishCheck finishCheck(signalReceived);
5585 animation.FinishedSignal().Connect(&application, finishCheck);
5587 application.SendNotification();
5588 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5590 // We didn't expect the animation to finish yet
5591 application.SendNotification();
5592 finishCheck.CheckSignalNotReceived();
5593 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
5595 application.SendNotification();
5596 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5598 // We did expect the animation to finish
5599 application.SendNotification();
5600 finishCheck.CheckSignalReceived();
5601 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5605 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5607 TestApplication application;
5609 Actor actor = Actor::New();
5611 // Register a Vector2 property
5612 Vector2 startValue(1000.0f, 1000.0f);
5613 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5614 Stage::GetCurrent().Add(actor);
5615 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5617 // Build the animation
5618 float durationSeconds(1.0f);
5619 Animation animation = Animation::New(durationSeconds);
5620 Vector2 targetValue(9000.0f, 9000.0f);
5621 Vector2 relativeValue(targetValue - startValue);
5622 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5624 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5626 // Start the animation
5629 bool signalReceived(false);
5630 AnimationFinishCheck finishCheck(signalReceived);
5631 animation.FinishedSignal().Connect(&application, finishCheck);
5633 application.SendNotification();
5634 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5636 // We didn't expect the animation to finish yet
5637 application.SendNotification();
5638 finishCheck.CheckSignalNotReceived();
5640 // The position should have moved more, than with a linear alpha function
5641 Vector2 current(actor.GetProperty<Vector2>(index));
5642 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5643 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5645 application.SendNotification();
5646 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5648 // We did expect the animation to finish
5649 application.SendNotification();
5650 finishCheck.CheckSignalReceived();
5651 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5655 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5657 TestApplication application;
5659 Actor actor = Actor::New();
5661 // Register a Vector2 property
5662 Vector2 startValue(10.0f, 10.0f);
5663 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5664 Stage::GetCurrent().Add(actor);
5665 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5667 // Build the animation
5668 float durationSeconds(1.0f);
5669 Animation animation = Animation::New(durationSeconds);
5670 Vector2 targetValue(-10.0f, 20.0f);
5671 Vector2 relativeValue(targetValue - startValue);
5673 animation.AnimateTo(Property(actor, index),
5675 TimePeriod(delay, durationSeconds - delay));
5677 // Start the animation
5680 bool signalReceived(false);
5681 AnimationFinishCheck finishCheck(signalReceived);
5682 animation.FinishedSignal().Connect(&application, finishCheck);
5684 application.SendNotification();
5685 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5687 // We didn't expect the animation to finish yet
5688 application.SendNotification();
5689 finishCheck.CheckSignalNotReceived();
5690 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5692 application.SendNotification();
5693 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5695 // We didn't expect the animation to finish yet
5696 application.SendNotification();
5697 finishCheck.CheckSignalNotReceived();
5698 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5700 application.SendNotification();
5701 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5703 // We did expect the animation to finish
5704 application.SendNotification();
5705 finishCheck.CheckSignalReceived();
5706 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5710 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5712 TestApplication application;
5714 Actor actor = Actor::New();
5716 // Register a Vector2 property
5717 Vector2 startValue(10.0f, 10.0f);
5718 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5719 Stage::GetCurrent().Add(actor);
5720 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5722 // Build the animation
5723 float durationSeconds(1.0f);
5724 Animation animation = Animation::New(durationSeconds);
5725 Vector2 targetValue(30.0f, 30.0f);
5726 Vector2 relativeValue(targetValue - startValue);
5728 animation.AnimateTo(Property(actor, index),
5730 AlphaFunction::LINEAR,
5731 TimePeriod(delay, durationSeconds - delay));
5733 // Start the animation
5736 bool signalReceived(false);
5737 AnimationFinishCheck finishCheck(signalReceived);
5738 animation.FinishedSignal().Connect(&application, finishCheck);
5740 application.SendNotification();
5741 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5743 // We didn't expect the animation to finish yet
5744 application.SendNotification();
5745 finishCheck.CheckSignalNotReceived();
5746 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5748 application.SendNotification();
5749 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5751 // We didn't expect the animation to finish yet
5752 application.SendNotification();
5753 finishCheck.CheckSignalNotReceived();
5754 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5756 application.SendNotification();
5757 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5759 // We did expect the animation to finish
5760 application.SendNotification();
5761 finishCheck.CheckSignalReceived();
5762 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5766 int UtcDaliAnimationAnimateToVector3P(void)
5768 TestApplication application;
5770 Actor actor = Actor::New();
5772 // Register a Vector3 property
5773 Vector3 startValue(-50.0f, -50.0f, -50.0f);
5774 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5775 Stage::GetCurrent().Add(actor);
5776 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5778 // Build the animation
5779 float durationSeconds(2.0f);
5780 Animation animation = Animation::New(durationSeconds);
5781 Vector3 targetValue(50.0f, 50.0f, 50.0f);
5782 Vector3 relativeValue(targetValue - startValue);
5783 animation.AnimateTo(Property(actor, index), targetValue);
5785 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5787 // Start the animation
5790 bool signalReceived(false);
5791 AnimationFinishCheck finishCheck(signalReceived);
5792 animation.FinishedSignal().Connect(&application, finishCheck);
5794 application.SendNotification();
5795 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5797 // We didn't expect the animation to finish yet
5798 application.SendNotification();
5799 finishCheck.CheckSignalNotReceived();
5800 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
5802 application.SendNotification();
5803 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5805 // We did expect the animation to finish
5806 application.SendNotification();
5807 finishCheck.CheckSignalReceived();
5808 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5812 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5814 TestApplication application;
5816 Actor actor = Actor::New();
5818 // Register a Vector3 property
5819 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5820 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5821 Stage::GetCurrent().Add(actor);
5822 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5824 // Build the animation
5825 float durationSeconds(1.0f);
5826 Animation animation = Animation::New(durationSeconds);
5827 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5828 Vector3 relativeValue(targetValue - startValue);
5829 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5831 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5833 // Start the animation
5836 bool signalReceived(false);
5837 AnimationFinishCheck finishCheck(signalReceived);
5838 animation.FinishedSignal().Connect(&application, finishCheck);
5840 application.SendNotification();
5841 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5843 // We didn't expect the animation to finish yet
5844 application.SendNotification();
5845 finishCheck.CheckSignalNotReceived();
5847 // The position should have moved more, than with a linear alpha function
5848 Vector3 current(actor.GetProperty<Vector3>(index));
5849 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5850 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5851 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5853 application.SendNotification();
5854 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5856 // We did expect the animation to finish
5857 application.SendNotification();
5858 finishCheck.CheckSignalReceived();
5859 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5863 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5865 TestApplication application;
5867 Actor actor = Actor::New();
5869 // Register a Vector3 property
5870 Vector3 startValue(10.0f, 10.0f, 10.0f);
5871 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5872 Stage::GetCurrent().Add(actor);
5873 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5875 // Build the animation
5876 float durationSeconds(1.0f);
5877 Animation animation = Animation::New(durationSeconds);
5878 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5879 Vector3 relativeValue(targetValue - startValue);
5881 animation.AnimateTo(Property(actor, index),
5883 TimePeriod(delay, durationSeconds - delay));
5885 // Start the animation
5888 bool signalReceived(false);
5889 AnimationFinishCheck finishCheck(signalReceived);
5890 animation.FinishedSignal().Connect(&application, finishCheck);
5892 application.SendNotification();
5893 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5895 // We didn't expect the animation to finish yet
5896 application.SendNotification();
5897 finishCheck.CheckSignalNotReceived();
5898 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5900 application.SendNotification();
5901 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5903 // We didn't expect the animation to finish yet
5904 application.SendNotification();
5905 finishCheck.CheckSignalNotReceived();
5906 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5908 application.SendNotification();
5909 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5911 // We did expect the animation to finish
5912 application.SendNotification();
5913 finishCheck.CheckSignalReceived();
5914 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5918 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5920 TestApplication application;
5922 Actor actor = Actor::New();
5924 // Register a Vector3 property
5925 Vector3 startValue(10.0f, 10.0f, 10.0f);
5926 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5927 Stage::GetCurrent().Add(actor);
5928 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5930 // Build the animation
5931 float durationSeconds(1.0f);
5932 Animation animation = Animation::New(durationSeconds);
5933 Vector3 targetValue(30.0f, 30.0f, 30.0f);
5934 Vector3 relativeValue(targetValue - startValue);
5936 animation.AnimateTo(Property(actor, "testProperty"),
5938 AlphaFunction::LINEAR,
5939 TimePeriod(delay, durationSeconds - delay));
5941 // Start the animation
5944 bool signalReceived(false);
5945 AnimationFinishCheck finishCheck(signalReceived);
5946 animation.FinishedSignal().Connect(&application, finishCheck);
5948 application.SendNotification();
5949 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5951 // We didn't expect the animation to finish yet
5952 application.SendNotification();
5953 finishCheck.CheckSignalNotReceived();
5954 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5956 application.SendNotification();
5957 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5959 // We didn't expect the animation to finish yet
5960 application.SendNotification();
5961 finishCheck.CheckSignalNotReceived();
5962 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5964 application.SendNotification();
5965 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5967 // We did expect the animation to finish
5968 application.SendNotification();
5969 finishCheck.CheckSignalReceived();
5970 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5974 int UtcDaliAnimationAnimateToVector3ComponentP(void)
5976 TestApplication application;
5978 Actor actor = Actor::New();
5980 // Register a Vector3 property
5981 Vector3 startValue(10.0f, 10.0f, 10.0f);
5982 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5983 Stage::GetCurrent().Add(actor);
5984 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5986 // Build the animation
5987 float durationSeconds(1.0f);
5988 Animation animation = Animation::New(durationSeconds);
5989 Vector3 targetValue(30.0f, 30.0f, 10.0f);
5990 Vector3 relativeValue(targetValue - startValue);
5992 animation.AnimateTo(Property(actor, "testProperty", 0),
5994 AlphaFunction::LINEAR,
5995 TimePeriod(delay, durationSeconds - delay));
5996 animation.AnimateTo(Property(actor, index, 1),
5998 AlphaFunction::LINEAR,
5999 TimePeriod(delay, durationSeconds - delay));
6001 // Start the animation
6004 bool signalReceived(false);
6005 AnimationFinishCheck finishCheck(signalReceived);
6006 animation.FinishedSignal().Connect(&application, finishCheck);
6008 application.SendNotification();
6009 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6011 // We didn't expect the animation to finish yet
6012 application.SendNotification();
6013 finishCheck.CheckSignalNotReceived();
6014 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6016 application.SendNotification();
6017 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6019 // We didn't expect the animation to finish yet
6020 application.SendNotification();
6021 finishCheck.CheckSignalNotReceived();
6022 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
6024 application.SendNotification();
6025 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6027 // We did expect the animation to finish
6028 application.SendNotification();
6029 finishCheck.CheckSignalReceived();
6030 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
6034 int UtcDaliAnimationAnimateToVector4P(void)
6036 TestApplication application;
6038 Actor actor = Actor::New();
6040 // Register a Vector4 property
6041 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6042 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6043 Stage::GetCurrent().Add(actor);
6044 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6046 // Build the animation
6047 float durationSeconds(2.0f);
6048 Animation animation = Animation::New(durationSeconds);
6049 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6050 Vector4 relativeValue(targetValue - startValue);
6051 animation.AnimateTo(Property(actor, index), targetValue);
6053 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6055 // Start the animation
6058 bool signalReceived(false);
6059 AnimationFinishCheck finishCheck(signalReceived);
6060 animation.FinishedSignal().Connect(&application, finishCheck);
6062 application.SendNotification();
6063 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6065 // We didn't expect the animation to finish yet
6066 application.SendNotification();
6067 finishCheck.CheckSignalNotReceived();
6068 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
6070 application.SendNotification();
6071 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6073 // We did expect the animation to finish
6074 application.SendNotification();
6075 finishCheck.CheckSignalReceived();
6076 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
6080 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6082 TestApplication application;
6084 Actor actor = Actor::New();
6086 // Register a Vector4 property
6087 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6088 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6089 Stage::GetCurrent().Add(actor);
6090 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6092 // Build the animation
6093 float durationSeconds(1.0f);
6094 Animation animation = Animation::New(durationSeconds);
6095 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6096 Vector4 relativeValue(targetValue - startValue);
6097 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6099 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6101 // Start the animation
6104 bool signalReceived(false);
6105 AnimationFinishCheck finishCheck(signalReceived);
6106 animation.FinishedSignal().Connect(&application, finishCheck);
6108 application.SendNotification();
6109 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6111 // We didn't expect the animation to finish yet
6112 application.SendNotification();
6113 finishCheck.CheckSignalNotReceived();
6115 // The position should have moved more, than with a linear alpha function
6116 Vector4 current(actor.GetProperty<Vector4>(index));
6117 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6118 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6119 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6120 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6122 application.SendNotification();
6123 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6125 // We did expect the animation to finish
6126 application.SendNotification();
6127 finishCheck.CheckSignalReceived();
6128 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
6132 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6134 TestApplication application;
6136 Actor actor = Actor::New();
6138 // Register a Vector4 property
6139 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6140 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6141 Stage::GetCurrent().Add(actor);
6142 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6144 // Build the animation
6145 float durationSeconds(1.0f);
6146 Animation animation = Animation::New(durationSeconds);
6147 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6148 Vector4 relativeValue(targetValue - startValue);
6150 animation.AnimateTo(Property(actor, index),
6152 TimePeriod(delay, durationSeconds - delay));
6154 // Start the animation
6157 bool signalReceived(false);
6158 AnimationFinishCheck finishCheck(signalReceived);
6159 animation.FinishedSignal().Connect(&application, finishCheck);
6161 application.SendNotification();
6162 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6164 // We didn't expect the animation to finish yet
6165 application.SendNotification();
6166 finishCheck.CheckSignalNotReceived();
6167 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6169 application.SendNotification();
6170 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6172 // We didn't expect the animation to finish yet
6173 application.SendNotification();
6174 finishCheck.CheckSignalNotReceived();
6175 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6177 application.SendNotification();
6178 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6180 // We did expect the animation to finish
6181 application.SendNotification();
6182 finishCheck.CheckSignalReceived();
6183 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6187 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6189 TestApplication application;
6191 Actor actor = Actor::New();
6193 // Register a Vector4 property
6194 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6195 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6196 Stage::GetCurrent().Add(actor);
6197 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6199 // Build the animation
6200 float durationSeconds(1.0f);
6201 Animation animation = Animation::New(durationSeconds);
6202 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6203 Vector4 relativeValue(targetValue - startValue);
6205 animation.AnimateTo(Property(actor, index),
6207 AlphaFunction::LINEAR,
6208 TimePeriod(delay, durationSeconds - delay));
6210 // Start the animation
6213 bool signalReceived(false);
6214 AnimationFinishCheck finishCheck(signalReceived);
6215 animation.FinishedSignal().Connect(&application, finishCheck);
6217 application.SendNotification();
6218 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6220 // We didn't expect the animation to finish yet
6221 application.SendNotification();
6222 finishCheck.CheckSignalNotReceived();
6223 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6225 application.SendNotification();
6226 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6228 // We didn't expect the animation to finish yet
6229 application.SendNotification();
6230 finishCheck.CheckSignalNotReceived();
6231 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
6233 application.SendNotification();
6234 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6236 // We did expect the animation to finish
6237 application.SendNotification();
6238 finishCheck.CheckSignalReceived();
6239 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
6243 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6245 TestApplication application;
6247 Actor actor = Actor::New();
6248 Stage::GetCurrent().Add(actor);
6249 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6251 // Build the animation
6252 float durationSeconds(1.0f);
6253 Animation animation = Animation::New(durationSeconds);
6254 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6258 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6260 catch (Dali::DaliException& e)
6262 DALI_TEST_PRINT_ASSERT( e );
6263 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6268 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6270 TestApplication application;
6272 Actor actor = Actor::New();
6273 Stage::GetCurrent().Add(actor);
6274 float startValue(0.0f);
6275 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6276 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6278 // Build the animation
6279 float durationSeconds(1.0f);
6280 Animation animation = Animation::New(durationSeconds);
6281 float targetX(1.0f);
6285 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6287 catch (Dali::DaliException& e)
6289 DALI_TEST_PRINT_ASSERT( e );
6290 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6295 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6297 TestApplication application;
6299 Actor actor = Actor::New();
6300 Stage::GetCurrent().Add(actor);
6301 float startValue(0.0f);
6302 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6305 // Build the animation
6306 float durationSeconds(1.0f);
6307 Animation animation = Animation::New(durationSeconds);
6308 float targetY(1.0f);
6312 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6314 catch (Dali::DaliException& e)
6316 DALI_TEST_PRINT_ASSERT( e );
6317 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6322 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6324 TestApplication application;
6326 Actor actor = Actor::New();
6327 Stage::GetCurrent().Add(actor);
6328 float startValue(0.5f);
6329 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6330 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6332 // Build the animation
6333 float durationSeconds(1.0f);
6334 Animation animation = Animation::New(durationSeconds);
6335 float targetZ(1.0f);
6339 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6341 catch (Dali::DaliException& e)
6343 DALI_TEST_PRINT_ASSERT( e );
6344 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6349 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6351 TestApplication application;
6353 Actor actor = Actor::New();
6354 Stage::GetCurrent().Add(actor);
6355 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6357 // Build the animation
6358 float durationSeconds(1.0f);
6359 Animation animation = Animation::New(durationSeconds);
6360 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6364 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6366 catch (Dali::DaliException& e)
6368 DALI_TEST_PRINT_ASSERT( e );
6369 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6374 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6376 TestApplication application;
6378 Actor actor = Actor::New();
6379 Stage::GetCurrent().Add(actor);
6380 float startValue(0.5f);
6381 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6382 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6384 // Build the animation
6385 float durationSeconds(1.0f);
6386 Animation animation = Animation::New(durationSeconds);
6387 float targetX(1.0f);
6391 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6393 catch (Dali::DaliException& e)
6395 DALI_TEST_PRINT_ASSERT( e );
6396 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6401 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6403 TestApplication application;
6405 Actor actor = Actor::New();
6406 Stage::GetCurrent().Add(actor);
6407 float startValue(0.5f);
6408 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6409 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6411 // Build the animation
6412 float durationSeconds(1.0f);
6413 Animation animation = Animation::New(durationSeconds);
6414 float targetY(0.0f);
6418 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6420 catch (Dali::DaliException& e)
6422 DALI_TEST_PRINT_ASSERT( e );
6423 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6428 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6430 TestApplication application;
6432 Actor actor = Actor::New();
6433 Stage::GetCurrent().Add(actor);
6434 float startValue(0.5f);
6435 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6436 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6438 // Build the animation
6439 float durationSeconds(1.0f);
6440 Animation animation = Animation::New(durationSeconds);
6441 float targetZ(100.0f);
6445 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6447 catch (Dali::DaliException& e)
6449 DALI_TEST_PRINT_ASSERT( e );
6450 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6455 int UtcDaliAnimationAnimateToActorSizeP(void)
6457 TestApplication application;
6459 Actor actor = Actor::New();
6460 Stage::GetCurrent().Add(actor);
6461 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6463 // Build the animation
6464 float durationSeconds(1.0f);
6465 Animation animation = Animation::New(durationSeconds);
6466 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6467 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6469 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6471 // Start the animation
6474 bool signalReceived(false);
6475 AnimationFinishCheck finishCheck(signalReceived);
6476 animation.FinishedSignal().Connect(&application, finishCheck);
6478 application.SendNotification();
6479 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6481 // We didn't expect the animation to finish yet
6482 application.SendNotification();
6483 finishCheck.CheckSignalNotReceived();
6484 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6486 application.SendNotification();
6487 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6489 // We did expect the animation to finish
6490 application.SendNotification();
6491 finishCheck.CheckSignalReceived();
6492 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6495 finishCheck.Reset();
6496 actor.SetSize(Vector3::ZERO);
6497 application.SendNotification();
6498 application.Render(0);
6499 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6501 // Repeat with a different (ease-in) alpha function
6502 animation = Animation::New(durationSeconds);
6503 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6504 animation.FinishedSignal().Connect(&application, finishCheck);
6507 application.SendNotification();
6508 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6510 // We didn't expect the animation to finish yet
6511 application.SendNotification();
6512 finishCheck.CheckSignalNotReceived();
6514 // The size should have travelled less, than with a linear alpha function
6515 Vector3 current(actor.GetCurrentSize());
6516 DALI_TEST_CHECK( current.x > 0.0f );
6517 DALI_TEST_CHECK( current.y > 0.0f );
6518 DALI_TEST_CHECK( current.z > 0.0f );
6519 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6520 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6521 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6523 application.SendNotification();
6524 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6526 // We did expect the animation to finish
6527 application.SendNotification();
6528 finishCheck.CheckSignalReceived();
6529 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6532 finishCheck.Reset();
6533 actor.SetSize(Vector3::ZERO);
6534 application.SendNotification();
6535 application.Render(0);
6536 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6538 // Repeat with a delay
6540 animation = Animation::New(durationSeconds);
6541 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6542 animation.FinishedSignal().Connect(&application, finishCheck);
6545 application.SendNotification();
6546 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6548 // We didn't expect the animation to finish yet
6549 application.SendNotification();
6550 finishCheck.CheckSignalNotReceived();
6551 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6553 application.SendNotification();
6554 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6556 // We did expect the animation to finish
6557 application.SendNotification();
6558 finishCheck.CheckSignalReceived();
6559 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6563 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6565 TestApplication application;
6567 Actor actor = Actor::New();
6568 Stage::GetCurrent().Add(actor);
6569 float startValue(0.0f);
6570 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6571 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6573 // Build the animation
6574 float durationSeconds(1.0f);
6575 Animation animation = Animation::New(durationSeconds);
6576 float targetWidth(10.0f);
6577 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6579 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6581 // Start the animation
6584 bool signalReceived(false);
6585 AnimationFinishCheck finishCheck(signalReceived);
6586 animation.FinishedSignal().Connect(&application, finishCheck);
6588 application.SendNotification();
6589 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6591 // We didn't expect the animation to finish yet
6592 application.SendNotification();
6593 finishCheck.CheckSignalNotReceived();
6594 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
6596 application.SendNotification();
6597 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6599 // We did expect the animation to finish
6600 application.SendNotification();
6601 finishCheck.CheckSignalReceived();
6602 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
6603 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
6607 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
6609 TestApplication application;
6611 Actor actor = Actor::New();
6612 Stage::GetCurrent().Add(actor);
6613 float startValue(0.0f);
6614 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6615 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6617 // Build the animation
6618 float durationSeconds(1.0f);
6619 Animation animation = Animation::New(durationSeconds);
6620 float targetHeight(-10.0f);
6621 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6623 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6625 // Start the animation
6628 bool signalReceived(false);
6629 AnimationFinishCheck finishCheck(signalReceived);
6630 animation.FinishedSignal().Connect(&application, finishCheck);
6632 application.SendNotification();
6633 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6635 // We didn't expect the animation to finish yet
6636 application.SendNotification();
6637 finishCheck.CheckSignalNotReceived();
6638 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6640 application.SendNotification();
6641 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6643 // We did expect the animation to finish
6644 application.SendNotification();
6645 finishCheck.CheckSignalReceived();
6646 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6647 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6651 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6653 TestApplication application;
6655 Actor actor = Actor::New();
6656 Stage::GetCurrent().Add(actor);
6657 float startValue(0.0f);
6658 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6659 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6661 // Build the animation
6662 float durationSeconds(1.0f);
6663 Animation animation = Animation::New(durationSeconds);
6664 float targetDepth(-10.0f);
6665 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6667 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6669 // Start the animation
6672 bool signalReceived(false);
6673 AnimationFinishCheck finishCheck(signalReceived);
6674 animation.FinishedSignal().Connect(&application, finishCheck);
6676 application.SendNotification();
6677 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6679 // We didn't expect the animation to finish yet
6680 application.SendNotification();
6681 finishCheck.CheckSignalNotReceived();
6682 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6684 application.SendNotification();
6685 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6687 // We did expect the animation to finish
6688 application.SendNotification();
6689 finishCheck.CheckSignalReceived();
6690 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6691 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6695 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6697 TestApplication application;
6699 Actor actor = Actor::New();
6700 Stage::GetCurrent().Add(actor);
6701 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6703 // Build the animation
6704 float durationSeconds(1.0f);
6705 Animation animation = Animation::New(durationSeconds);
6706 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6707 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6709 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6711 // Start the animation
6714 bool signalReceived(false);
6715 AnimationFinishCheck finishCheck(signalReceived);
6716 animation.FinishedSignal().Connect(&application, finishCheck);
6718 application.SendNotification();
6719 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6721 // We didn't expect the animation to finish yet
6722 application.SendNotification();
6723 finishCheck.CheckSignalNotReceived();
6724 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6726 application.SendNotification();
6727 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6729 // We did expect the animation to finish
6730 application.SendNotification();
6731 finishCheck.CheckSignalReceived();
6732 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6735 finishCheck.Reset();
6736 actor.SetSize(Vector3::ZERO);
6737 application.SendNotification();
6738 application.Render(0);
6739 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6741 // Repeat with a different (ease-in) alpha function
6742 animation = Animation::New(durationSeconds);
6743 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6744 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6745 animation.FinishedSignal().Connect(&application, finishCheck);
6748 application.SendNotification();
6749 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6751 // We didn't expect the animation to finish yet
6752 application.SendNotification();
6753 finishCheck.CheckSignalNotReceived();
6755 // The size should have travelled less, than with a linear alpha function
6756 Vector3 current(actor.GetCurrentSize());
6757 DALI_TEST_CHECK( current.x > 0.0f );
6758 DALI_TEST_CHECK( current.y > 0.0f );
6759 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6760 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6762 application.SendNotification();
6763 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6765 // We did expect the animation to finish
6766 application.SendNotification();
6767 finishCheck.CheckSignalReceived();
6768 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6769 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6772 finishCheck.Reset();
6773 actor.SetSize(Vector3::ZERO);
6774 application.SendNotification();
6775 application.Render(0);
6776 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6778 // Repeat with a delay
6780 animation = Animation::New(durationSeconds);
6781 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6782 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6783 animation.FinishedSignal().Connect(&application, finishCheck);
6786 application.SendNotification();
6787 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6789 // We didn't expect the animation to finish yet
6790 application.SendNotification();
6791 finishCheck.CheckSignalNotReceived();
6792 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6794 application.SendNotification();
6795 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6797 // We did expect the animation to finish
6798 application.SendNotification();
6799 finishCheck.CheckSignalReceived();
6800 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6801 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6805 int UtcDaliAnimationAnimateToActorPositionP(void)
6807 TestApplication application;
6809 Actor actor = Actor::New();
6810 Stage::GetCurrent().Add(actor);
6811 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6813 // Build the animation
6814 float durationSeconds(1.0f);
6815 Animation animation = Animation::New(durationSeconds);
6816 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6817 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6819 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6821 // Start the animation
6824 bool signalReceived(false);
6825 AnimationFinishCheck finishCheck(signalReceived);
6826 animation.FinishedSignal().Connect(&application, finishCheck);
6828 application.SendNotification();
6829 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6831 // We didn't expect the animation to finish yet
6832 application.SendNotification();
6833 finishCheck.CheckSignalNotReceived();
6834 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6836 application.SendNotification();
6837 application.Render(static_cast<unsigned int>(durationSeconds*250.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.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6846 int UtcDaliAnimationAnimateToActorPositionXP(void)
6848 TestApplication application;
6850 Actor actor = Actor::New();
6851 Stage::GetCurrent().Add(actor);
6852 float startValue(0.0f);
6853 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6854 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6855 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6856 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6858 // Build the animation
6859 float durationSeconds(1.0f);
6860 Animation animation = Animation::New(durationSeconds);
6861 float targetX(1.0f);
6862 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6864 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6866 // Start the animation
6869 bool signalReceived(false);
6870 AnimationFinishCheck finishCheck(signalReceived);
6871 animation.FinishedSignal().Connect(&application, finishCheck);
6873 application.SendNotification();
6874 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6876 // We didn't expect the animation to finish yet
6877 application.SendNotification();
6878 finishCheck.CheckSignalNotReceived();
6879 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
6881 application.SendNotification();
6882 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6884 // We did expect the animation to finish
6885 application.SendNotification();
6886 finishCheck.CheckSignalReceived();
6887 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
6888 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
6889 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6890 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6894 int UtcDaliAnimationAnimateToActorPositionYP(void)
6896 TestApplication application;
6898 Actor actor = Actor::New();
6899 Stage::GetCurrent().Add(actor);
6900 float startValue(0.0f);
6901 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
6902 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6903 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6904 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6906 // Build the animation
6907 float durationSeconds(1.0f);
6908 Animation animation = Animation::New(durationSeconds);
6909 float targetY(10.0f);
6910 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
6912 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
6914 // Start the animation
6917 bool signalReceived(false);
6918 AnimationFinishCheck finishCheck(signalReceived);
6919 animation.FinishedSignal().Connect(&application, finishCheck);
6921 application.SendNotification();
6922 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6924 // We didn't expect the animation to finish yet
6925 application.SendNotification();
6926 finishCheck.CheckSignalNotReceived();
6927 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
6929 application.SendNotification();
6930 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6932 // We did expect the animation to finish
6933 application.SendNotification();
6934 finishCheck.CheckSignalReceived();
6935 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
6936 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6937 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
6938 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6942 int UtcDaliAnimationAnimateToActorPositionZP(void)
6944 TestApplication application;
6946 Actor actor = Actor::New();
6947 Stage::GetCurrent().Add(actor);
6948 float startValue(0.0f);
6949 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
6950 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6951 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6952 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6954 // Build the animation
6955 float durationSeconds(1.0f);
6956 Animation animation = Animation::New(durationSeconds);
6957 float targetZ(-5.0f);
6958 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
6960 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
6962 // Start the animation
6965 bool signalReceived(false);
6966 AnimationFinishCheck finishCheck(signalReceived);
6967 animation.FinishedSignal().Connect(&application, finishCheck);
6969 application.SendNotification();
6970 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6972 // We didn't expect the animation to finish yet
6973 application.SendNotification();
6974 finishCheck.CheckSignalNotReceived();
6975 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
6977 application.SendNotification();
6978 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6980 // We did expect the animation to finish
6981 application.SendNotification();
6982 finishCheck.CheckSignalReceived();
6983 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
6984 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6985 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6986 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
6990 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
6992 TestApplication application;
6994 Actor actor = Actor::New();
6995 Stage::GetCurrent().Add(actor);
6996 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6998 // Build the animation
6999 float durationSeconds(1.0f);
7000 Animation animation = Animation::New(durationSeconds);
7001 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7002 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7004 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7006 // Start the animation
7009 bool signalReceived(false);
7010 AnimationFinishCheck finishCheck(signalReceived);
7011 animation.FinishedSignal().Connect(&application, finishCheck);
7013 application.SendNotification();
7014 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7016 // We didn't expect the animation to finish yet
7017 application.SendNotification();
7018 finishCheck.CheckSignalNotReceived();
7020 // The position should have moved less, than with a linear alpha function
7021 Vector3 current(actor.GetCurrentPosition());
7022 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7023 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7024 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7025 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7026 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7027 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7029 application.SendNotification();
7030 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7032 // We did expect the animation to finish
7033 application.SendNotification();
7034 finishCheck.CheckSignalReceived();
7035 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7039 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7041 TestApplication application;
7043 Actor actor = Actor::New();
7044 Stage::GetCurrent().Add(actor);
7045 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7047 // Build the animation
7048 float durationSeconds(1.0f);
7049 Animation animation = Animation::New(durationSeconds);
7050 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7052 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7054 TimePeriod( delay, durationSeconds - delay ) );
7056 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7058 // Start the animation
7061 bool signalReceived(false);
7062 AnimationFinishCheck finishCheck(signalReceived);
7063 animation.FinishedSignal().Connect(&application, finishCheck);
7065 application.SendNotification();
7066 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7068 // We didn't expect the animation to finish yet
7069 application.SendNotification();
7070 finishCheck.CheckSignalNotReceived();
7071 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7073 application.SendNotification();
7074 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7076 // We didn't expect the animation to finish yet
7077 application.SendNotification();
7078 finishCheck.CheckSignalNotReceived();
7079 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7081 application.SendNotification();
7082 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7084 // We did expect the animation to finish
7085 application.SendNotification();
7086 finishCheck.CheckSignalReceived();
7087 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7091 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7093 TestApplication application;
7095 Actor actor = Actor::New();
7096 Stage::GetCurrent().Add(actor);
7097 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7099 // Build the animation
7100 float durationSeconds(1.0f);
7101 Animation animation = Animation::New(durationSeconds);
7102 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7104 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7106 AlphaFunction::LINEAR,
7107 TimePeriod( delay, durationSeconds - delay ) );
7109 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7111 // Start the animation
7114 bool signalReceived(false);
7115 AnimationFinishCheck finishCheck(signalReceived);
7116 animation.FinishedSignal().Connect(&application, finishCheck);
7118 application.SendNotification();
7119 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7121 // We didn't expect the animation to finish yet
7122 application.SendNotification();
7123 finishCheck.CheckSignalNotReceived();
7124 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7126 application.SendNotification();
7127 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7129 // We didn't expect the animation to finish yet
7130 application.SendNotification();
7131 finishCheck.CheckSignalNotReceived();
7132 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7134 application.SendNotification();
7135 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7137 // We did expect the animation to finish
7138 application.SendNotification();
7139 finishCheck.CheckSignalReceived();
7140 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7144 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7146 TestApplication application;
7148 Actor actor = Actor::New();
7149 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7150 Stage::GetCurrent().Add(actor);
7151 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7153 // Build the animation
7154 float durationSeconds(1.0f);
7155 Animation animation = Animation::New(durationSeconds);
7156 Degree targetRotationDegrees(90.0f);
7157 Radian targetRotationRadians(targetRotationDegrees);
7158 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7160 // Start the animation
7163 bool signalReceived(false);
7164 AnimationFinishCheck finishCheck(signalReceived);
7165 animation.FinishedSignal().Connect(&application, finishCheck);
7167 application.SendNotification();
7168 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7170 // We didn't expect the animation to finish yet
7171 application.SendNotification();
7172 finishCheck.CheckSignalNotReceived();
7173 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7175 application.SendNotification();
7176 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7178 // We didn't expect the animation to finish yet
7179 application.SendNotification();
7180 finishCheck.CheckSignalNotReceived();
7181 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7183 application.SendNotification();
7184 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7186 // We didn't expect the animation to finish yet
7187 application.SendNotification();
7188 finishCheck.CheckSignalNotReceived();
7189 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7191 application.SendNotification();
7192 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7194 // We did expect the animation to finish
7195 application.SendNotification();
7196 finishCheck.CheckSignalReceived();
7197 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7201 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7203 TestApplication application;
7205 Actor actor = Actor::New();
7206 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7207 Stage::GetCurrent().Add(actor);
7208 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7210 // Build the animation
7211 float durationSeconds(1.0f);
7212 Animation animation = Animation::New(durationSeconds);
7213 Degree targetRotationDegrees(90.0f);
7214 Radian targetRotationRadians(targetRotationDegrees);
7215 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7216 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7218 // Start the animation
7221 bool signalReceived(false);
7222 AnimationFinishCheck finishCheck(signalReceived);
7223 animation.FinishedSignal().Connect(&application, finishCheck);
7225 application.SendNotification();
7226 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7228 // We didn't expect the animation to finish yet
7229 application.SendNotification();
7230 finishCheck.CheckSignalNotReceived();
7231 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7233 application.SendNotification();
7234 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7236 // We didn't expect the animation to finish yet
7237 application.SendNotification();
7238 finishCheck.CheckSignalNotReceived();
7239 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7241 application.SendNotification();
7242 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7244 // We didn't expect the animation to finish yet
7245 application.SendNotification();
7246 finishCheck.CheckSignalNotReceived();
7247 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7249 application.SendNotification();
7250 application.Render(static_cast<unsigned int>(durationSeconds*250.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.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7259 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7261 TestApplication application;
7263 Actor actor = Actor::New();
7264 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7265 Stage::GetCurrent().Add(actor);
7266 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7268 // Build the animation
7269 float durationSeconds(1.0f);
7270 Animation animation = Animation::New(durationSeconds);
7271 Degree targetRotationDegrees(90.0f);
7272 Radian targetRotationRadians(targetRotationDegrees);
7273 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7275 // Start the animation
7278 bool signalReceived(false);
7279 AnimationFinishCheck finishCheck(signalReceived);
7280 animation.FinishedSignal().Connect(&application, finishCheck);
7282 application.SendNotification();
7283 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7285 // We didn't expect the animation to finish yet
7286 application.SendNotification();
7287 finishCheck.CheckSignalNotReceived();
7288 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7290 application.SendNotification();
7291 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7293 // We didn't expect the animation to finish yet
7294 application.SendNotification();
7295 finishCheck.CheckSignalNotReceived();
7296 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7298 application.SendNotification();
7299 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7301 // We didn't expect the animation to finish yet
7302 application.SendNotification();
7303 finishCheck.CheckSignalNotReceived();
7304 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7306 application.SendNotification();
7307 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7309 // We did expect the animation to finish
7310 application.SendNotification();
7311 finishCheck.CheckSignalReceived();
7312 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7316 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7318 TestApplication application;
7320 Actor actor = Actor::New();
7321 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7322 Stage::GetCurrent().Add(actor);
7323 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7325 // Build the animation
7326 float durationSeconds(1.0f);
7327 Animation animation = Animation::New(durationSeconds);
7328 Degree targetRotationDegrees(90.0f);
7329 Radian targetRotationRadians(targetRotationDegrees);
7331 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7333 // Start the animation
7336 bool signalReceived(false);
7337 AnimationFinishCheck finishCheck(signalReceived);
7338 animation.FinishedSignal().Connect(&application, finishCheck);
7340 application.SendNotification();
7341 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7343 // We didn't expect the animation to finish yet
7344 application.SendNotification();
7345 finishCheck.CheckSignalNotReceived();
7346 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7347 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7349 application.SendNotification();
7350 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7352 // We didn't expect the animation to finish yet
7353 application.SendNotification();
7354 finishCheck.CheckSignalNotReceived();
7355 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7356 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7358 application.SendNotification();
7359 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7361 // We didn't expect the animation to finish yet
7362 application.SendNotification();
7363 finishCheck.CheckSignalNotReceived();
7364 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7365 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7367 application.SendNotification();
7368 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7370 // We did expect the animation to finish
7371 application.SendNotification();
7372 finishCheck.CheckSignalReceived();
7373 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7377 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7379 TestApplication application;
7381 Actor actor = Actor::New();
7382 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7383 Stage::GetCurrent().Add(actor);
7384 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7386 // Build the animation
7387 float durationSeconds(1.0f);
7388 Animation animation = Animation::New(durationSeconds);
7389 Degree targetRotationDegrees(90.0f);
7390 Radian targetRotationRadians(targetRotationDegrees);
7392 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7394 // Start the animation
7397 bool signalReceived(false);
7398 AnimationFinishCheck finishCheck(signalReceived);
7399 animation.FinishedSignal().Connect(&application, finishCheck);
7401 application.SendNotification();
7402 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7404 // We didn't expect the animation to finish yet
7405 application.SendNotification();
7406 finishCheck.CheckSignalNotReceived();
7407 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7408 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7410 application.SendNotification();
7411 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7413 // We didn't expect the animation to finish yet
7414 application.SendNotification();
7415 finishCheck.CheckSignalNotReceived();
7416 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7417 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7419 application.SendNotification();
7420 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7422 // We didn't expect the animation to finish yet
7423 application.SendNotification();
7424 finishCheck.CheckSignalNotReceived();
7425 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7426 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7428 application.SendNotification();
7429 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7431 // We did expect the animation to finish
7432 application.SendNotification();
7433 finishCheck.CheckSignalReceived();
7434 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7438 int UtcDaliAnimationAnimateToActorScaleP(void)
7440 TestApplication application;
7442 Actor actor = Actor::New();
7443 Stage::GetCurrent().Add(actor);
7444 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7446 // Build the animation
7447 float durationSeconds(1.0f);
7448 Animation animation = Animation::New(durationSeconds);
7449 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7450 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7452 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7454 // Start the animation
7457 bool signalReceived(false);
7458 AnimationFinishCheck finishCheck(signalReceived);
7459 animation.FinishedSignal().Connect(&application, finishCheck);
7461 application.SendNotification();
7462 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7464 // We didn't expect the animation to finish yet
7465 application.SendNotification();
7466 finishCheck.CheckSignalNotReceived();
7467 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7469 application.SendNotification();
7470 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7472 // We did expect the animation to finish
7473 application.SendNotification();
7474 finishCheck.CheckSignalReceived();
7475 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7478 finishCheck.Reset();
7479 actor.SetScale(Vector3::ONE);
7480 application.SendNotification();
7481 application.Render(0);
7482 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7484 // Repeat with a different (ease-in) alpha function
7485 animation = Animation::New(durationSeconds);
7486 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7487 animation.FinishedSignal().Connect(&application, finishCheck);
7490 application.SendNotification();
7491 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7493 // We didn't expect the animation to finish yet
7494 application.SendNotification();
7495 finishCheck.CheckSignalNotReceived();
7497 // The scale should have grown less, than with a linear alpha function
7498 Vector3 current(actor.GetCurrentScale());
7499 DALI_TEST_CHECK( current.x > 1.0f );
7500 DALI_TEST_CHECK( current.y > 1.0f );
7501 DALI_TEST_CHECK( current.z > 1.0f );
7502 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7503 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7504 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7506 application.SendNotification();
7507 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7509 // We did expect the animation to finish
7510 application.SendNotification();
7511 finishCheck.CheckSignalReceived();
7512 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7515 finishCheck.Reset();
7516 actor.SetScale(Vector3::ONE);
7517 application.SendNotification();
7518 application.Render(0);
7519 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7521 // Repeat with a delay
7523 animation = Animation::New(durationSeconds);
7524 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7525 animation.FinishedSignal().Connect(&application, finishCheck);
7528 application.SendNotification();
7529 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7531 // We didn't expect the animation to finish yet
7532 application.SendNotification();
7533 finishCheck.CheckSignalNotReceived();
7534 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7536 application.SendNotification();
7537 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7539 // We did expect the animation to finish
7540 application.SendNotification();
7541 finishCheck.CheckSignalReceived();
7542 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7546 int UtcDaliAnimationAnimateToActorScaleXP(void)
7548 TestApplication application;
7550 Actor actor = Actor::New();
7551 Stage::GetCurrent().Add(actor);
7552 float startValue(1.0f);
7553 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
7554 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7555 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7556 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7558 // Build the animation
7559 float durationSeconds(1.0f);
7560 Animation animation = Animation::New(durationSeconds);
7561 float targetX(10.0f);
7562 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
7564 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7566 // Start the animation
7569 bool signalReceived(false);
7570 AnimationFinishCheck finishCheck(signalReceived);
7571 animation.FinishedSignal().Connect(&application, finishCheck);
7573 application.SendNotification();
7574 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7576 // We didn't expect the animation to finish yet
7577 application.SendNotification();
7578 finishCheck.CheckSignalNotReceived();
7579 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
7580 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
7581 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7582 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7584 application.SendNotification();
7585 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7587 // We did expect the animation to finish
7588 application.SendNotification();
7589 finishCheck.CheckSignalReceived();
7590 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
7591 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION );
7592 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7593 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7597 int UtcDaliAnimationAnimateToActorScaleYP(void)
7599 TestApplication application;
7601 Actor actor = Actor::New();
7602 Stage::GetCurrent().Add(actor);
7603 float startValue(1.0f);
7604 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
7605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7607 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7609 // Build the animation
7610 float durationSeconds(1.0f);
7611 Animation animation = Animation::New(durationSeconds);
7612 float targetY(1000.0f);
7613 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7615 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7617 // Start the animation
7620 bool signalReceived(false);
7621 AnimationFinishCheck finishCheck(signalReceived);
7622 animation.FinishedSignal().Connect(&application, finishCheck);
7624 application.SendNotification();
7625 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7627 // We didn't expect the animation to finish yet
7628 application.SendNotification();
7629 finishCheck.CheckSignalNotReceived();
7630 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7631 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7632 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
7633 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7635 application.SendNotification();
7636 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7638 // We did expect the animation to finish
7639 application.SendNotification();
7640 finishCheck.CheckSignalReceived();
7641 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7642 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7643 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION );
7644 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7648 int UtcDaliAnimationAnimateToActorScaleZP(void)
7650 TestApplication application;
7652 Actor actor = Actor::New();
7653 Stage::GetCurrent().Add(actor);
7654 float startValue(1.0f);
7655 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7656 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7657 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7660 // Build the animation
7661 float durationSeconds(1.0f);
7662 Animation animation = Animation::New(durationSeconds);
7663 float targetZ(-1000.0f);
7664 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7666 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7668 // Start the animation
7671 bool signalReceived(false);
7672 AnimationFinishCheck finishCheck(signalReceived);
7673 animation.FinishedSignal().Connect(&application, finishCheck);
7675 application.SendNotification();
7676 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7678 // We didn't expect the animation to finish yet
7679 application.SendNotification();
7680 finishCheck.CheckSignalNotReceived();
7681 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7682 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7683 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7684 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
7686 application.SendNotification();
7687 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7689 // We did expect the animation to finish
7690 application.SendNotification();
7691 finishCheck.CheckSignalReceived();
7692 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7693 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7694 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7695 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION );
7699 int UtcDaliAnimationAnimateToActorColorP(void)
7701 TestApplication application;
7703 Actor actor = Actor::New();
7704 Stage::GetCurrent().Add(actor);
7705 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7707 // Build the animation
7708 float durationSeconds(1.0f);
7709 Animation animation = Animation::New(durationSeconds);
7710 Vector4 targetColor(Color::RED);
7711 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7713 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7714 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7716 // Start the animation
7719 bool signalReceived(false);
7720 AnimationFinishCheck finishCheck(signalReceived);
7721 animation.FinishedSignal().Connect(&application, finishCheck);
7723 application.SendNotification();
7724 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7726 // We didn't expect the animation to finish yet
7727 application.SendNotification();
7728 finishCheck.CheckSignalNotReceived();
7729 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7731 application.SendNotification();
7732 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7734 // We did expect the animation to finish
7735 application.SendNotification();
7736 finishCheck.CheckSignalReceived();
7737 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7740 finishCheck.Reset();
7741 actor.SetColor(Color::WHITE);
7742 application.SendNotification();
7743 application.Render(0);
7744 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7746 // Repeat with a different (ease-in) alpha function
7747 animation = Animation::New(durationSeconds);
7748 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7749 animation.FinishedSignal().Connect(&application, finishCheck);
7752 application.SendNotification();
7753 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7755 // We didn't expect the animation to finish yet
7756 application.SendNotification();
7757 finishCheck.CheckSignalNotReceived();
7759 // The color should have changed less, than with a linear alpha function
7760 Vector4 current(actor.GetCurrentColor());
7761 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7762 DALI_TEST_CHECK( current.y < 1.0f );
7763 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7764 DALI_TEST_CHECK( current.z < 1.0f );
7765 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7766 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7768 application.SendNotification();
7769 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7771 // We did expect the animation to finish
7772 application.SendNotification();
7773 finishCheck.CheckSignalReceived();
7774 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7777 finishCheck.Reset();
7778 actor.SetColor(Color::WHITE);
7779 application.SendNotification();
7780 application.Render(0);
7781 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7783 // Repeat with a shorter animator duration
7784 float animatorDuration = 0.5f;
7785 animation = Animation::New(durationSeconds);
7786 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7787 animation.FinishedSignal().Connect(&application, finishCheck);
7790 application.SendNotification();
7791 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7793 // We didn't expect the animation to finish yet
7794 application.SendNotification();
7795 finishCheck.CheckSignalNotReceived();
7796 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7798 application.SendNotification();
7799 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7801 // We didn't expect the animation to finish yet
7802 application.SendNotification();
7803 finishCheck.CheckSignalNotReceived();
7804 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7806 application.SendNotification();
7807 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7809 // We did expect the animation to finish
7810 application.SendNotification();
7811 finishCheck.CheckSignalReceived();
7812 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7816 int UtcDaliAnimationAnimateToActorColorRedP(void)
7818 TestApplication application;
7820 Actor actor = Actor::New();
7821 Stage::GetCurrent().Add(actor);
7822 float startValue(1.0f);
7823 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
7824 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7825 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7827 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7829 // Build the animation
7830 float durationSeconds(1.0f);
7831 Animation animation = Animation::New(durationSeconds);
7832 float targetRed(0.5f);
7833 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
7835 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
7837 // Start the animation
7840 bool signalReceived(false);
7841 AnimationFinishCheck finishCheck(signalReceived);
7842 animation.FinishedSignal().Connect(&application, finishCheck);
7844 application.SendNotification();
7845 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7847 // We didn't expect the animation to finish yet
7848 application.SendNotification();
7849 finishCheck.CheckSignalNotReceived();
7850 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
7851 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
7852 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7853 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7854 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7856 application.SendNotification();
7857 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7859 // We did expect the animation to finish
7860 application.SendNotification();
7861 finishCheck.CheckSignalReceived();
7862 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
7863 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
7864 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7865 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7866 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7870 int UtcDaliAnimationAnimateToActorColorGreenP(void)
7872 TestApplication application;
7874 Actor actor = Actor::New();
7875 Stage::GetCurrent().Add(actor);
7876 float startValue(1.0f);
7877 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
7878 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7879 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7880 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7881 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7883 // Build the animation
7884 float durationSeconds(1.0f);
7885 Animation animation = Animation::New(durationSeconds);
7886 float targetGreen(0.5f);
7887 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
7889 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
7891 // Start the animation
7894 bool signalReceived(false);
7895 AnimationFinishCheck finishCheck(signalReceived);
7896 animation.FinishedSignal().Connect(&application, finishCheck);
7898 application.SendNotification();
7899 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7901 // We didn't expect the animation to finish yet
7902 application.SendNotification();
7903 finishCheck.CheckSignalNotReceived();
7904 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
7905 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7906 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
7907 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7908 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7910 application.SendNotification();
7911 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7913 // We did expect the animation to finish
7914 application.SendNotification();
7915 finishCheck.CheckSignalReceived();
7916 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
7917 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7918 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
7919 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7920 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7924 int UtcDaliAnimationAnimateToActorColorBlueP(void)
7926 TestApplication application;
7928 Actor actor = Actor::New();
7929 Stage::GetCurrent().Add(actor);
7930 float startValue(1.0f);
7931 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
7932 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7933 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7934 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7935 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7937 // Build the animation
7938 float durationSeconds(1.0f);
7939 Animation animation = Animation::New(durationSeconds);
7940 float targetBlue(0.5f);
7941 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
7943 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
7945 // Start the animation
7948 bool signalReceived(false);
7949 AnimationFinishCheck finishCheck(signalReceived);
7950 animation.FinishedSignal().Connect(&application, finishCheck);
7952 application.SendNotification();
7953 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7955 // We didn't expect the animation to finish yet
7956 application.SendNotification();
7957 finishCheck.CheckSignalNotReceived();
7958 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
7959 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7960 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7961 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
7962 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7964 application.SendNotification();
7965 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7967 // We did expect the animation to finish
7968 application.SendNotification();
7969 finishCheck.CheckSignalReceived();
7970 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
7971 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7972 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7973 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION );
7974 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7978 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
7980 TestApplication application;
7982 Actor actor = Actor::New();
7983 Stage::GetCurrent().Add(actor);
7984 float startValue(1.0f);
7985 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7986 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7988 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7989 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7991 // Build the animation
7992 float durationSeconds(1.0f);
7993 Animation animation = Animation::New(durationSeconds);
7994 float targetAlpha(0.5f);
7995 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
7997 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
7999 // Start the animation
8002 bool signalReceived(false);
8003 AnimationFinishCheck finishCheck(signalReceived);
8004 animation.FinishedSignal().Connect(&application, finishCheck);
8006 application.SendNotification();
8007 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8009 // We didn't expect the animation to finish yet
8010 application.SendNotification();
8011 finishCheck.CheckSignalNotReceived();
8012 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8013 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8014 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8015 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
8018 application.SendNotification();
8019 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8021 // We did expect the animation to finish
8022 application.SendNotification();
8023 finishCheck.CheckSignalReceived();
8024 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8025 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8026 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8027 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8028 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
8032 int UtcDaliAnimationKeyFrames01P(void)
8034 TestApplication application;
8036 KeyFrames keyFrames = KeyFrames::New();
8037 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8039 keyFrames.Add(0.0f, 0.1f);
8041 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8043 KeyFrames keyFrames2( keyFrames);
8044 DALI_TEST_CHECK( keyFrames2 );
8045 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8047 KeyFrames keyFrames3 = KeyFrames::New();
8048 keyFrames3.Add(0.6f, true);
8049 DALI_TEST_CHECK( keyFrames3 );
8050 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8052 keyFrames3 = keyFrames;
8053 DALI_TEST_CHECK( keyFrames3 );
8054 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8059 int UtcDaliAnimationKeyFrames02P(void)
8061 TestApplication application;
8063 KeyFrames keyFrames = KeyFrames::New();
8064 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8066 keyFrames.Add(0.0f, 0.1f);
8067 keyFrames.Add(0.2f, 0.5f);
8068 keyFrames.Add(0.4f, 0.0f);
8069 keyFrames.Add(0.6f, 1.0f);
8070 keyFrames.Add(0.8f, 0.7f);
8071 keyFrames.Add(1.0f, 0.9f);
8073 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8077 keyFrames.Add(1.9f, false);
8079 catch (Dali::DaliException& e)
8081 DALI_TEST_PRINT_ASSERT( e );
8082 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8087 int UtcDaliAnimationKeyFrames03P(void)
8089 TestApplication application;
8091 KeyFrames keyFrames = KeyFrames::New();
8092 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8094 keyFrames.Add(0.0f, true);
8095 keyFrames.Add(0.2f, false);
8096 keyFrames.Add(0.4f, false);
8097 keyFrames.Add(0.6f, true);
8098 keyFrames.Add(0.8f, true);
8099 keyFrames.Add(1.0f, false);
8101 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8105 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8107 catch (Dali::DaliException& e)
8109 DALI_TEST_PRINT_ASSERT( e );
8110 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8115 int UtcDaliAnimationKeyFrames04P(void)
8117 TestApplication application;
8119 KeyFrames keyFrames = KeyFrames::New();
8120 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8122 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8123 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8124 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8125 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8126 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8127 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8129 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8133 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8135 catch (Dali::DaliException& e)
8137 DALI_TEST_PRINT_ASSERT( e );
8138 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8143 int UtcDaliAnimationKeyFrames05P(void)
8145 TestApplication application;
8147 KeyFrames keyFrames = KeyFrames::New();
8148 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8150 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8151 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8152 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8153 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8154 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8155 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8157 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8161 keyFrames.Add(0.7f, 1.0f);
8163 catch (Dali::DaliException& e)
8165 DALI_TEST_PRINT_ASSERT( e );
8166 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8171 int UtcDaliAnimationKeyFrames06P(void)
8173 TestApplication application;
8175 KeyFrames keyFrames = KeyFrames::New();
8176 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8178 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8179 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8180 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8181 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8182 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8183 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8185 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8189 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8191 catch (Dali::DaliException& e)
8193 DALI_TEST_PRINT_ASSERT( e );
8194 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8199 int UtcDaliAnimationKeyFrames07P(void)
8201 TestApplication application;
8203 KeyFrames keyFrames = KeyFrames::New();
8204 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8206 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8207 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8208 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8209 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8210 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8211 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8213 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8217 keyFrames.Add(0.7f, 1.1f);
8219 catch (Dali::DaliException& e)
8221 DALI_TEST_PRINT_ASSERT( e );
8222 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8227 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8229 TestApplication application;
8231 float startValue(1.0f);
8232 Actor actor = Actor::New();
8233 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8234 Stage::GetCurrent().Add(actor);
8236 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8237 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8238 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8239 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8240 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8242 // Build the animation
8243 float durationSeconds(1.0f);
8244 Animation animation = Animation::New(durationSeconds);
8246 KeyFrames keyFrames = KeyFrames::New();
8247 keyFrames.Add(0.0f, 0.1f);
8248 keyFrames.Add(0.2f, 0.5f);
8249 keyFrames.Add(0.4f, 0.0f);
8250 keyFrames.Add(0.6f, 1.0f);
8251 keyFrames.Add(0.8f, 0.7f);
8252 keyFrames.Add(1.0f, 0.9f);
8254 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8256 // Start the animation
8259 bool signalReceived(false);
8260 AnimationFinishCheck finishCheck(signalReceived);
8261 animation.FinishedSignal().Connect(&application, finishCheck);
8262 application.SendNotification();
8263 application.Render(0);
8264 application.SendNotification();
8265 finishCheck.CheckSignalNotReceived();
8266 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8268 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8269 application.SendNotification();
8270 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8271 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8272 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8273 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8274 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8276 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8277 application.SendNotification();
8278 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8279 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8280 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8281 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8282 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8284 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8285 application.SendNotification();
8286 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8287 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8288 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8289 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8290 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8292 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8293 application.SendNotification();
8294 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8295 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8296 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8297 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8298 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8300 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8301 application.SendNotification();
8302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8305 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8306 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8308 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8309 application.SendNotification();
8310 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8311 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8312 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8313 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8314 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8316 // We did expect the animation to finish
8318 finishCheck.CheckSignalReceived();
8322 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8324 TestApplication application;
8326 float startValue(1.0f);
8327 Actor actor = Actor::New();
8328 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8329 Stage::GetCurrent().Add(actor);
8331 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8332 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8333 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8334 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8335 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8337 // Build the animation
8338 float durationSeconds(1.0f);
8339 Animation animation = Animation::New(durationSeconds);
8341 KeyFrames keyFrames = KeyFrames::New();
8342 keyFrames.Add(0.0f, 0.1f);
8343 keyFrames.Add(0.2f, 0.5f);
8344 keyFrames.Add(0.4f, 0.0f);
8345 keyFrames.Add(0.6f, 1.0f);
8346 keyFrames.Add(0.8f, 0.7f);
8347 keyFrames.Add(1.0f, 0.9f);
8349 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8351 // Start the animation
8354 bool signalReceived(false);
8355 AnimationFinishCheck finishCheck(signalReceived);
8356 animation.FinishedSignal().Connect(&application, finishCheck);
8357 application.SendNotification();
8358 application.Render(0);
8359 application.SendNotification();
8360 finishCheck.CheckSignalNotReceived();
8361 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8363 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8364 application.SendNotification();
8365 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8366 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8367 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8368 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION );
8369 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8371 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8372 application.SendNotification();
8373 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8374 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8375 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8376 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION );
8377 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8379 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8380 application.SendNotification();
8381 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8382 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8383 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8384 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8385 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8387 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8388 application.SendNotification();
8389 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8390 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8391 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8392 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8393 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8395 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8396 application.SendNotification();
8397 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8398 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8399 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8400 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION );
8401 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8403 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8404 application.SendNotification();
8405 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8406 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8407 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8408 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8409 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8411 // We did expect the animation to finish
8413 finishCheck.CheckSignalReceived();
8417 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8419 TestApplication application;
8421 float startValue(1.0f);
8422 Actor actor = Actor::New();
8423 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8424 Stage::GetCurrent().Add(actor);
8426 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8427 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8428 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8429 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8430 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8432 // Build the animation
8433 float durationSeconds(1.0f);
8434 Animation animation = Animation::New(durationSeconds);
8436 KeyFrames keyFrames = KeyFrames::New();
8437 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8438 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8439 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8441 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8443 // Start the animation
8446 bool signalReceived(false);
8447 AnimationFinishCheck finishCheck(signalReceived);
8448 animation.FinishedSignal().Connect(&application, finishCheck);
8449 application.SendNotification();
8450 application.Render(0);
8451 application.SendNotification();
8452 finishCheck.CheckSignalNotReceived();
8453 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8454 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8455 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8456 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8458 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8459 application.SendNotification();
8460 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8461 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8462 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8463 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8465 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8466 application.SendNotification();
8467 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8468 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8469 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8470 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8472 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8473 application.SendNotification();
8474 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8475 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8476 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8477 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8479 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8480 application.SendNotification();
8481 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8482 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8483 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8484 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8486 // We did expect the animation to finish
8488 finishCheck.CheckSignalReceived();
8492 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
8494 TestApplication application;
8496 float startValue(1.0f);
8497 Actor actor = Actor::New();
8498 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8499 Stage::GetCurrent().Add(actor);
8501 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8502 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8503 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8504 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8505 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8507 // Build the animation
8508 float durationSeconds(1.0f);
8509 Animation animation = Animation::New(durationSeconds);
8511 KeyFrames keyFrames = KeyFrames::New();
8512 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8513 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8514 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8516 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
8518 // Start the animation
8521 bool signalReceived(false);
8522 AnimationFinishCheck finishCheck(signalReceived);
8523 animation.FinishedSignal().Connect(&application, finishCheck);
8524 application.SendNotification();
8525 application.Render(0);
8526 application.SendNotification();
8527 finishCheck.CheckSignalNotReceived();
8528 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8529 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8530 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8531 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8533 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8534 application.SendNotification();
8535 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8536 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8537 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8538 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8540 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8541 application.SendNotification();
8542 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8543 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8544 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8545 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8547 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8548 application.SendNotification();
8549 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8550 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8551 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8552 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8554 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8555 application.SendNotification();
8556 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8557 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8558 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8559 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8561 // We did expect the animation to finish
8563 finishCheck.CheckSignalReceived();
8567 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
8569 TestApplication application;
8571 Actor actor = Actor::New();
8572 AngleAxis aa(Degree(90), Vector3::XAXIS);
8573 actor.SetOrientation(aa.angle, aa.axis);
8574 Stage::GetCurrent().Add(actor);
8576 application.SendNotification();
8577 application.Render(0);
8579 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8581 // Build the animation
8582 float durationSeconds(1.0f);
8583 Animation animation = Animation::New(durationSeconds);
8585 KeyFrames keyFrames = KeyFrames::New();
8586 keyFrames.Add(0.0f, false);
8587 keyFrames.Add(0.2f, true);
8588 keyFrames.Add(0.4f, true);
8589 keyFrames.Add(0.8f, false);
8590 keyFrames.Add(1.0f, true);
8592 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
8594 // Start the animation
8597 bool signalReceived(false);
8598 AnimationFinishCheck finishCheck(signalReceived);
8599 animation.FinishedSignal().Connect(&application, finishCheck);
8600 application.SendNotification();
8601 application.SendNotification();
8602 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8603 application.SendNotification();
8604 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8605 application.SendNotification();
8607 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8608 finishCheck.CheckSignalReceived();
8612 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8614 TestApplication application;
8616 Actor actor = Actor::New();
8617 AngleAxis aa(Degree(90), Vector3::XAXIS);
8618 actor.SetOrientation(aa.angle, aa.axis);
8619 Stage::GetCurrent().Add(actor);
8621 application.SendNotification();
8622 application.Render(0);
8624 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8626 // Build the animation
8627 float durationSeconds(1.0f);
8628 Animation animation = Animation::New(durationSeconds);
8630 KeyFrames keyFrames = KeyFrames::New();
8631 keyFrames.Add(0.0f, false);
8632 keyFrames.Add(0.2f, true);
8633 keyFrames.Add(0.4f, true);
8634 keyFrames.Add(0.8f, false);
8635 keyFrames.Add(1.0f, true);
8637 //Cubic interpolation for boolean values should be ignored
8638 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8640 // Start the animation
8643 bool signalReceived(false);
8644 AnimationFinishCheck finishCheck(signalReceived);
8645 animation.FinishedSignal().Connect(&application, finishCheck);
8646 application.SendNotification();
8647 application.SendNotification();
8648 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8649 application.SendNotification();
8650 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8651 application.SendNotification();
8653 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8654 finishCheck.CheckSignalReceived();
8658 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8660 TestApplication application;
8662 Actor actor = Actor::New();
8663 AngleAxis aa(Degree(90), Vector3::XAXIS);
8664 actor.SetOrientation(aa.angle, aa.axis);
8665 Stage::GetCurrent().Add(actor);
8667 application.SendNotification();
8668 application.Render(0);
8669 Quaternion start(Radian(aa.angle), aa.axis);
8670 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8672 // Build the animation
8673 float durationSeconds(1.0f);
8674 Animation animation = Animation::New(durationSeconds);
8676 KeyFrames keyFrames = KeyFrames::New();
8677 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8679 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8681 // Start the animation
8684 bool signalReceived(false);
8685 AnimationFinishCheck finishCheck(signalReceived);
8686 animation.FinishedSignal().Connect(&application, finishCheck);
8687 application.SendNotification();
8688 application.SendNotification();
8689 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8690 application.SendNotification();
8691 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8692 application.SendNotification();
8694 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8696 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8697 finishCheck.CheckSignalReceived();
8701 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8703 TestApplication application;
8705 Actor actor = Actor::New();
8706 AngleAxis aa(Degree(90), Vector3::XAXIS);
8707 actor.SetOrientation(aa.angle, aa.axis);
8708 application.SendNotification();
8709 application.Render(0);
8710 Stage::GetCurrent().Add(actor);
8712 Quaternion start(Radian(aa.angle), aa.axis);
8713 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8715 // Build the animation
8716 float durationSeconds(1.0f);
8717 Animation animation = Animation::New(durationSeconds);
8719 KeyFrames keyFrames = KeyFrames::New();
8720 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8721 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8722 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8724 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8726 // Start the animation
8729 bool signalReceived(false);
8730 AnimationFinishCheck finishCheck(signalReceived);
8731 animation.FinishedSignal().Connect(&application, finishCheck);
8732 application.SendNotification();
8733 application.Render(0);
8734 application.SendNotification();
8735 finishCheck.CheckSignalNotReceived();
8737 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8738 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8740 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8741 application.SendNotification();
8742 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8743 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8745 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8746 application.SendNotification();
8747 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8748 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8750 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8751 application.SendNotification();
8752 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8753 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8755 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8756 application.SendNotification();
8757 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8758 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8760 // We did expect the animation to finish
8762 finishCheck.CheckSignalReceived();
8766 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
8768 TestApplication application;
8770 Actor actor = Actor::New();
8771 AngleAxis aa(Degree(90), Vector3::XAXIS);
8772 actor.SetOrientation(aa.angle, aa.axis);
8773 Stage::GetCurrent().Add(actor);
8775 application.SendNotification();
8776 application.Render(0);
8777 Quaternion start(Radian(aa.angle), aa.axis);
8778 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8780 // Build the animation
8781 float durationSeconds(1.0f);
8782 Animation animation = Animation::New(durationSeconds);
8784 KeyFrames keyFrames = KeyFrames::New();
8785 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8787 //Cubic interpolation should be ignored for quaternions
8788 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8790 // Start the animation
8793 bool signalReceived(false);
8794 AnimationFinishCheck finishCheck(signalReceived);
8795 animation.FinishedSignal().Connect(&application, finishCheck);
8796 application.SendNotification();
8797 application.SendNotification();
8798 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8799 application.SendNotification();
8800 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8801 application.SendNotification();
8803 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8805 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8806 finishCheck.CheckSignalReceived();
8810 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
8812 TestApplication application;
8814 Actor actor = Actor::New();
8815 AngleAxis aa(Degree(90), Vector3::XAXIS);
8816 actor.SetOrientation(aa.angle, aa.axis);
8817 application.SendNotification();
8818 application.Render(0);
8819 Stage::GetCurrent().Add(actor);
8821 Quaternion start(Radian(aa.angle), aa.axis);
8822 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8824 // Build the animation
8825 float durationSeconds(1.0f);
8826 Animation animation = Animation::New(durationSeconds);
8828 KeyFrames keyFrames = KeyFrames::New();
8829 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8830 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8831 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8833 //Cubic interpolation should be ignored for quaternions
8834 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8836 // Start the animation
8839 bool signalReceived(false);
8840 AnimationFinishCheck finishCheck(signalReceived);
8841 animation.FinishedSignal().Connect(&application, finishCheck);
8842 application.SendNotification();
8843 application.Render(0);
8844 application.SendNotification();
8845 finishCheck.CheckSignalNotReceived();
8847 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8848 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8850 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8851 application.SendNotification();
8852 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8853 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8855 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8856 application.SendNotification();
8857 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8858 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8860 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8861 application.SendNotification();
8862 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
8863 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8865 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8866 application.SendNotification();
8867 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8868 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8870 // We did expect the animation to finish
8872 finishCheck.CheckSignalReceived();
8876 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
8878 TestApplication application;
8880 float startValue(1.0f);
8881 Actor actor = Actor::New();
8882 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8883 Stage::GetCurrent().Add(actor);
8885 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8886 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8887 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8888 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8889 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8891 // Build the animation
8892 float durationSeconds(1.0f);
8893 Animation animation = Animation::New(durationSeconds);
8895 KeyFrames keyFrames = KeyFrames::New();
8896 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8897 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8898 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8900 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
8902 // Start the animation
8905 bool signalReceived(false);
8906 AnimationFinishCheck finishCheck(signalReceived);
8907 animation.FinishedSignal().Connect(&application, finishCheck);
8908 application.SendNotification();
8909 application.Render(0);
8910 application.SendNotification();
8911 finishCheck.CheckSignalNotReceived();
8912 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8913 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8914 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8915 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8917 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8918 application.SendNotification();
8919 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8920 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8921 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8922 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8924 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8925 application.SendNotification();
8926 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8927 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8928 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8929 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8931 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8932 application.SendNotification();
8933 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8934 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8935 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8936 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8938 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8939 application.SendNotification();
8940 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8941 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8942 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8943 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8945 // We did expect the animation to finish
8947 finishCheck.CheckSignalReceived();
8951 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
8953 TestApplication application;
8955 float startValue(1.0f);
8956 Actor actor = Actor::New();
8957 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8958 Stage::GetCurrent().Add(actor);
8960 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8961 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8962 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8963 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8964 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8966 // Build the animation
8967 float durationSeconds(1.0f);
8968 Animation animation = Animation::New(durationSeconds);
8970 KeyFrames keyFrames = KeyFrames::New();
8971 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8972 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8973 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8975 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
8977 // Start the animation
8980 bool signalReceived(false);
8981 AnimationFinishCheck finishCheck(signalReceived);
8982 animation.FinishedSignal().Connect(&application, finishCheck);
8983 application.SendNotification();
8984 application.Render(0);
8985 application.SendNotification();
8986 finishCheck.CheckSignalNotReceived();
8987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8988 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8989 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8990 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8992 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8993 application.SendNotification();
8994 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8995 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8996 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8997 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8999 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9000 application.SendNotification();
9001 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9002 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9003 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9004 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9006 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9007 application.SendNotification();
9008 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
9009 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
9010 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
9011 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
9013 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9014 application.SendNotification();
9015 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9017 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9018 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9020 // We did expect the animation to finish
9022 finishCheck.CheckSignalReceived();
9026 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9028 TestApplication application;
9030 float startValue(1.0f);
9031 Actor actor = Actor::New();
9032 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9033 Stage::GetCurrent().Add(actor);
9035 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9036 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9037 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9038 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9039 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9041 // Build the animation
9042 float durationSeconds(1.0f);
9044 Animation animation = Animation::New(durationSeconds);
9046 KeyFrames keyFrames = KeyFrames::New();
9047 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9048 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9049 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9051 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9053 // Start the animation
9056 bool signalReceived(false);
9057 AnimationFinishCheck finishCheck(signalReceived);
9058 animation.FinishedSignal().Connect(&application, finishCheck);
9059 application.SendNotification();
9061 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9062 application.SendNotification();
9063 finishCheck.CheckSignalNotReceived();
9064 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9065 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9066 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9067 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9069 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9070 application.SendNotification();
9071 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
9072 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
9073 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
9074 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
9076 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9077 application.SendNotification();
9078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9079 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9081 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9083 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9084 application.SendNotification();
9085 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
9086 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
9087 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
9088 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
9090 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9091 application.SendNotification();
9092 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9093 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9094 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9095 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9097 // We did expect the animation to finish
9099 finishCheck.CheckSignalReceived();
9103 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9105 TestApplication application;
9107 float startValue(1.0f);
9108 Actor actor = Actor::New();
9109 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9110 Stage::GetCurrent().Add(actor);
9112 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9113 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9114 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9115 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9116 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9118 // Build the animation
9119 float durationSeconds(1.0f);
9121 Animation animation = Animation::New(durationSeconds);
9123 KeyFrames keyFrames = KeyFrames::New();
9124 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9125 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9126 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9128 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9130 // Start the animation
9133 bool signalReceived(false);
9134 AnimationFinishCheck finishCheck(signalReceived);
9135 animation.FinishedSignal().Connect(&application, finishCheck);
9136 application.SendNotification();
9138 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9139 application.SendNotification();
9140 finishCheck.CheckSignalNotReceived();
9141 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9142 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9143 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9144 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9146 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9147 application.SendNotification();
9148 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
9149 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
9150 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
9151 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
9153 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9154 application.SendNotification();
9155 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9156 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9157 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9158 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9160 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9161 application.SendNotification();
9162 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
9163 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
9164 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
9165 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
9167 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9168 application.SendNotification();
9169 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9171 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9172 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9174 // We did expect the animation to finish
9176 finishCheck.CheckSignalReceived();
9180 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9182 TestApplication application;
9184 float startValue(1.0f);
9186 Actor actor = Actor::New();
9187 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9188 Stage::GetCurrent().Add(actor);
9190 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9191 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9192 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9193 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9194 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9196 // Build the animation
9197 float durationSeconds(1.0f);
9198 Animation animation = Animation::New(durationSeconds);
9200 KeyFrames keyFrames = KeyFrames::New();
9201 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9202 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9203 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9205 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9207 // Start the animation
9210 bool signalReceived(false);
9211 AnimationFinishCheck finishCheck(signalReceived);
9212 animation.FinishedSignal().Connect(&application, finishCheck);
9213 application.SendNotification();
9215 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9216 application.SendNotification();
9217 finishCheck.CheckSignalNotReceived();
9218 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9219 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9220 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9221 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9223 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9224 application.SendNotification();
9225 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
9226 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
9227 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
9228 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
9230 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9231 application.SendNotification();
9232 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9233 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9234 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9235 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9237 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9238 application.SendNotification();
9239 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
9240 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
9241 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
9242 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
9244 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9245 application.SendNotification();
9246 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9247 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9248 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9249 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9251 // We did expect the animation to finish
9253 finishCheck.CheckSignalReceived();
9257 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9259 TestApplication application;
9261 float startValue(1.0f);
9262 Actor actor = Actor::New();
9263 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9264 Stage::GetCurrent().Add(actor);
9266 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9267 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9268 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9269 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9270 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9272 // Build the animation
9273 float durationSeconds(1.0f);
9275 Animation animation = Animation::New(durationSeconds);
9277 KeyFrames keyFrames = KeyFrames::New();
9278 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9279 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9280 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9282 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9284 // Start the animation
9287 bool signalReceived(false);
9288 AnimationFinishCheck finishCheck(signalReceived);
9289 animation.FinishedSignal().Connect(&application, finishCheck);
9290 application.SendNotification();
9292 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9293 application.SendNotification();
9294 finishCheck.CheckSignalNotReceived();
9295 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9296 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9297 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9298 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9300 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9301 application.SendNotification();
9302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
9303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
9304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
9305 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
9307 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9308 application.SendNotification();
9309 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9310 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9311 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9312 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9314 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9315 application.SendNotification();
9316 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
9317 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
9318 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
9319 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
9321 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9322 application.SendNotification();
9323 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9324 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9325 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9326 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9328 // We did expect the animation to finish
9330 finishCheck.CheckSignalReceived();
9334 int UtcDaliAnimationAnimateP(void)
9336 TestApplication application;
9338 Actor actor = Actor::New();
9339 Stage::GetCurrent().Add(actor);
9342 Vector3 position0( 30.0, 80.0, 0.0);
9343 Vector3 position1( 70.0, 120.0, 0.0);
9344 Vector3 position2( 100.0, 100.0, 0.0);
9346 Dali::Path path = Dali::Path::New();
9347 path.AddPoint(position0);
9348 path.AddPoint(position1);
9349 path.AddPoint(position2);
9351 //Control points for first segment
9352 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9353 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9355 //Control points for second segment
9356 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9357 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9359 // Build the animation
9360 float durationSeconds( 1.0f );
9361 Animation animation = Animation::New(durationSeconds);
9362 animation.Animate(actor, path, Vector3::XAXIS);
9364 // Start the animation
9367 bool signalReceived(false);
9368 AnimationFinishCheck finishCheck(signalReceived);
9369 animation.FinishedSignal().Connect(&application, finishCheck);
9370 application.SendNotification();
9371 application.Render(0);
9372 application.SendNotification();
9373 finishCheck.CheckSignalNotReceived();
9374 Vector3 position, tangent;
9375 Quaternion rotation;
9376 path.Sample( 0.0f, position, tangent );
9377 rotation = Quaternion( Vector3::XAXIS, tangent );
9378 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9379 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9381 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9382 application.SendNotification();
9383 path.Sample( 0.25f, position, tangent );
9384 rotation = Quaternion( Vector3::XAXIS, tangent );
9385 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9386 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9388 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9389 application.SendNotification();
9390 path.Sample( 0.5f, position, tangent );
9391 rotation = Quaternion( Vector3::XAXIS, tangent );
9392 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9393 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9395 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9396 application.SendNotification();
9397 path.Sample( 0.75f, position, tangent );
9398 rotation = Quaternion( Vector3::XAXIS, tangent );
9399 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9400 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9402 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9403 application.SendNotification();
9404 path.Sample( 1.0f, position, tangent );
9405 rotation = Quaternion( Vector3::XAXIS, tangent );
9406 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9407 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9409 finishCheck.CheckSignalReceived();
9413 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9415 TestApplication application;
9417 Actor actor = Actor::New();
9418 Stage::GetCurrent().Add(actor);
9421 Vector3 position0( 30.0, 80.0, 0.0);
9422 Vector3 position1( 70.0, 120.0, 0.0);
9423 Vector3 position2( 100.0, 100.0, 0.0);
9425 Dali::Path path = Dali::Path::New();
9426 path.AddPoint(position0);
9427 path.AddPoint(position1);
9428 path.AddPoint(position2);
9430 //Control points for first segment
9431 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9432 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9434 //Control points for second segment
9435 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9436 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9438 // Build the animation
9439 float durationSeconds( 1.0f );
9440 Animation animation = Animation::New(durationSeconds);
9441 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
9443 // Start the animation
9446 bool signalReceived(false);
9447 AnimationFinishCheck finishCheck(signalReceived);
9448 animation.FinishedSignal().Connect(&application, finishCheck);
9449 application.SendNotification();
9450 application.Render(0);
9451 application.SendNotification();
9452 finishCheck.CheckSignalNotReceived();
9453 Vector3 position, tangent;
9454 Quaternion rotation;
9455 path.Sample( 0.0f, position, tangent );
9456 rotation = Quaternion( Vector3::XAXIS, tangent );
9457 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9458 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9460 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9461 application.SendNotification();
9462 path.Sample( 0.25f, position, tangent );
9463 rotation = Quaternion( Vector3::XAXIS, tangent );
9464 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9465 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9467 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9468 application.SendNotification();
9469 path.Sample( 0.5f, position, tangent );
9470 rotation = Quaternion( Vector3::XAXIS, tangent );
9471 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9472 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9474 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9475 application.SendNotification();
9476 path.Sample( 0.75f, position, tangent );
9477 rotation = Quaternion( Vector3::XAXIS, tangent );
9478 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9479 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9481 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9482 application.SendNotification();
9483 path.Sample( 1.0f, position, tangent );
9484 rotation = Quaternion( Vector3::XAXIS, tangent );
9485 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9486 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9488 finishCheck.CheckSignalReceived();
9492 int UtcDaliAnimationAnimateTimePeriodP(void)
9494 TestApplication application;
9496 Actor actor = Actor::New();
9497 Stage::GetCurrent().Add(actor);
9500 Vector3 position0( 30.0, 80.0, 0.0);
9501 Vector3 position1( 70.0, 120.0, 0.0);
9502 Vector3 position2( 100.0, 100.0, 0.0);
9504 Dali::Path path = Dali::Path::New();
9505 path.AddPoint(position0);
9506 path.AddPoint(position1);
9507 path.AddPoint(position2);
9509 //Control points for first segment
9510 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9511 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9513 //Control points for second segment
9514 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9515 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9517 // Build the animation
9518 float durationSeconds( 1.0f );
9519 Animation animation = Animation::New(durationSeconds);
9520 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
9522 // Start the animation
9525 bool signalReceived(false);
9526 AnimationFinishCheck finishCheck(signalReceived);
9527 animation.FinishedSignal().Connect(&application, finishCheck);
9528 application.SendNotification();
9529 application.Render(0);
9530 application.SendNotification();
9531 finishCheck.CheckSignalNotReceived();
9532 Vector3 position, tangent;
9533 Quaternion rotation;
9534 path.Sample( 0.0f, position, tangent );
9535 rotation = Quaternion( Vector3::XAXIS, tangent );
9536 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9537 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9539 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9540 application.SendNotification();
9541 path.Sample( 0.25f, position, tangent );
9542 rotation = Quaternion( Vector3::XAXIS, tangent );
9543 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9544 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9546 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9547 application.SendNotification();
9548 path.Sample( 0.5f, position, tangent );
9549 rotation = Quaternion( Vector3::XAXIS, tangent );
9550 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9551 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9553 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9554 application.SendNotification();
9555 path.Sample( 0.75f, position, tangent );
9556 rotation = Quaternion( Vector3::XAXIS, tangent );
9557 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9558 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9560 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9561 application.SendNotification();
9562 path.Sample( 1.0f, position, tangent );
9563 rotation = Quaternion( Vector3::XAXIS, tangent );
9564 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9565 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9567 finishCheck.CheckSignalReceived();
9571 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
9573 TestApplication application;
9575 Actor actor = Actor::New();
9576 Stage::GetCurrent().Add(actor);
9579 Vector3 position0( 30.0, 80.0, 0.0);
9580 Vector3 position1( 70.0, 120.0, 0.0);
9581 Vector3 position2( 100.0, 100.0, 0.0);
9583 Dali::Path path = Dali::Path::New();
9584 path.AddPoint(position0);
9585 path.AddPoint(position1);
9586 path.AddPoint(position2);
9588 //Control points for first segment
9589 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9590 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9592 //Control points for second segment
9593 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9594 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9596 // Build the animation
9597 float durationSeconds( 1.0f );
9598 Animation animation = Animation::New(durationSeconds);
9599 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
9601 // Start the animation
9604 bool signalReceived(false);
9605 AnimationFinishCheck finishCheck(signalReceived);
9606 animation.FinishedSignal().Connect(&application, finishCheck);
9607 application.SendNotification();
9608 application.Render(0);
9609 application.SendNotification();
9610 finishCheck.CheckSignalNotReceived();
9611 Vector3 position, tangent;
9612 Quaternion rotation;
9613 path.Sample( 0.0f, position, tangent );
9614 rotation = Quaternion( Vector3::XAXIS, tangent );
9615 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9616 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9618 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9619 application.SendNotification();
9620 path.Sample( 0.25f, position, tangent );
9621 rotation = Quaternion( Vector3::XAXIS, tangent );
9622 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9623 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9625 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9626 application.SendNotification();
9627 path.Sample( 0.5f, position, tangent );
9628 rotation = Quaternion( Vector3::XAXIS, tangent );
9629 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9630 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9632 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9633 application.SendNotification();
9634 path.Sample( 0.75f, position, tangent );
9635 rotation = Quaternion( Vector3::XAXIS, tangent );
9636 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9637 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9639 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9640 application.SendNotification();
9641 path.Sample( 1.0f, position, tangent );
9642 rotation = Quaternion( Vector3::XAXIS, tangent );
9643 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9644 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9646 finishCheck.CheckSignalReceived();
9650 int UtcDaliAnimationShowP(void)
9652 TestApplication application;
9654 Actor actor = Actor::New();
9655 actor.SetVisible(false);
9656 application.SendNotification();
9657 application.Render(0);
9658 DALI_TEST_CHECK( !actor.IsVisible() );
9659 Stage::GetCurrent().Add(actor);
9661 // Start the animation
9662 float durationSeconds(10.0f);
9663 Animation animation = Animation::New(durationSeconds);
9664 animation.Show(actor, durationSeconds*0.5f);
9667 bool signalReceived(false);
9668 AnimationFinishCheck finishCheck(signalReceived);
9669 animation.FinishedSignal().Connect(&application, finishCheck);
9671 application.SendNotification();
9672 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9674 // We didn't expect the animation to finish yet
9675 application.SendNotification();
9676 finishCheck.CheckSignalNotReceived();
9677 DALI_TEST_CHECK( !actor.IsVisible() );
9679 application.SendNotification();
9680 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9682 // We didn't expect the animation to finish yet
9683 application.SendNotification();
9684 finishCheck.CheckSignalNotReceived();
9685 DALI_TEST_CHECK( actor.IsVisible() );
9687 application.SendNotification();
9688 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9690 // We did expect the animation to finish
9691 application.SendNotification();
9692 finishCheck.CheckSignalReceived();
9693 DALI_TEST_CHECK( actor.IsVisible() );
9697 int UtcDaliAnimationHideP(void)
9699 TestApplication application;
9701 Actor actor = Actor::New();
9702 DALI_TEST_CHECK( actor.IsVisible() );
9703 Stage::GetCurrent().Add(actor);
9705 // Start the animation
9706 float durationSeconds(10.0f);
9707 Animation animation = Animation::New(durationSeconds);
9708 animation.Hide(actor, durationSeconds*0.5f);
9711 bool signalReceived(false);
9712 AnimationFinishCheck finishCheck(signalReceived);
9713 animation.FinishedSignal().Connect(&application, finishCheck);
9715 application.SendNotification();
9716 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9718 // We didn't expect the animation to finish yet
9719 application.SendNotification();
9720 finishCheck.CheckSignalNotReceived();
9721 DALI_TEST_CHECK( actor.IsVisible() );
9723 application.SendNotification();
9724 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9726 // We didn't expect the animation to finish yet
9727 application.SendNotification();
9728 finishCheck.CheckSignalNotReceived();
9729 DALI_TEST_CHECK( !actor.IsVisible() );
9731 application.SendNotification();
9732 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9734 // We did expect the animation to finish
9735 application.SendNotification();
9736 finishCheck.CheckSignalReceived();
9737 DALI_TEST_CHECK( !actor.IsVisible() );
9741 int UtcDaliAnimationShowHideAtEndP(void)
9743 // Test that show/hide delay can be the same as animation duration
9744 // i.e. to show/hide at the end of the animation
9746 TestApplication application;
9748 Actor actor = Actor::New();
9749 DALI_TEST_CHECK( actor.IsVisible() );
9750 Stage::GetCurrent().Add(actor);
9752 // Start Hide animation
9753 float durationSeconds(10.0f);
9754 Animation animation = Animation::New(durationSeconds);
9755 animation.Hide(actor, durationSeconds/*Hide at end*/);
9758 bool signalReceived(false);
9759 AnimationFinishCheck finishCheck(signalReceived);
9760 animation.FinishedSignal().Connect(&application, finishCheck);
9762 application.SendNotification();
9763 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9765 // We did expect the animation to finish
9766 application.SendNotification();
9767 finishCheck.CheckSignalReceived();
9768 DALI_TEST_CHECK( !actor.IsVisible() );
9770 // Start Show animation
9771 animation = Animation::New(durationSeconds);
9772 animation.Show(actor, durationSeconds/*Show at end*/);
9773 animation.FinishedSignal().Connect(&application, finishCheck);
9776 application.SendNotification();
9777 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9779 // We did expect the animation to finish
9780 application.SendNotification();
9781 finishCheck.CheckSignalReceived();
9782 DALI_TEST_CHECK( actor.IsVisible() );
9786 int UtcDaliKeyFramesCreateDestroyP(void)
9788 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
9790 KeyFrames* keyFrames = new KeyFrames;
9792 DALI_TEST_CHECK( true );
9796 int UtcDaliKeyFramesDownCastP(void)
9798 TestApplication application;
9799 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
9801 KeyFrames keyFrames = KeyFrames::New();
9802 BaseHandle object(keyFrames);
9804 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
9805 DALI_TEST_CHECK(keyFrames2);
9807 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
9808 DALI_TEST_CHECK(keyFrames3);
9810 BaseHandle unInitializedObject;
9811 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
9812 DALI_TEST_CHECK(!keyFrames4);
9814 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
9815 DALI_TEST_CHECK(!keyFrames5);
9819 int UtcDaliAnimationCreateDestroyP(void)
9821 TestApplication application;
9822 Animation* animation = new Animation;
9823 DALI_TEST_CHECK( animation );
9828 struct UpdateManagerTestConstraint
9830 UpdateManagerTestConstraint(TestApplication& application)
9831 : mApplication(application)
9835 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
9837 mApplication.SendNotification(); // Process events
9840 TestApplication& mApplication;
9843 int UtcDaliAnimationUpdateManagerP(void)
9845 TestApplication application;
9847 Actor actor = Actor::New();
9848 Stage::GetCurrent().Add( actor );
9850 // Build the animation
9851 Animation animation = Animation::New( 0.0f );
9853 bool signalReceived = false;
9854 AnimationFinishCheck finishCheck( signalReceived );
9855 animation.FinishedSignal().Connect( &application, finishCheck );
9857 Vector3 startValue(1.0f, 1.0f, 1.0f);
9858 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9859 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
9862 // Apply animation to actor
9863 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
9864 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
9868 application.SendNotification();
9869 application.UpdateOnly( 16 );
9871 finishCheck.CheckSignalNotReceived();
9873 application.SendNotification(); // Process events
9875 finishCheck.CheckSignalReceived();
9880 int UtcDaliAnimationSignalOrderP(void)
9882 TestApplication application;
9884 Actor actor = Actor::New();
9885 Stage::GetCurrent().Add( actor );
9887 // Build the animations
9888 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
9889 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
9891 bool signal1Received = false;
9892 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
9894 bool signal2Received = false;
9895 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
9897 // Apply animations to actor
9898 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
9900 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
9903 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9904 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9906 application.SendNotification();
9907 application.UpdateOnly( 10 ); // 10ms progress
9909 // no notifications yet
9910 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9911 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9913 application.SendNotification();
9916 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
9917 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9918 signal1Received = false;
9920 // 1st animation is complete now, do another update with no ProcessEvents in between
9921 application.UpdateOnly( 20 ); // 20ms progress
9924 application.SendNotification();
9926 // 2nd should complete now
9927 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9928 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
9933 int UtcDaliAnimationExtendDurationP(void)
9935 TestApplication application;
9937 Actor actor = Actor::New();
9939 // Register a float property
9940 float startValue(10.0f);
9941 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9942 Stage::GetCurrent().Add(actor);
9943 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9945 // Build the animation
9946 float initialDurationSeconds(1.0f);
9947 float animatorDelay = 5.0f;
9948 float animatorDurationSeconds(5.0f);
9949 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
9950 Animation animation = Animation::New(initialDurationSeconds);
9951 float targetValue(30.0f);
9952 float relativeValue(targetValue - startValue);
9954 animation.AnimateTo(Property(actor, index),
9956 TimePeriod(animatorDelay, animatorDurationSeconds));
9958 // The duration should have been extended
9959 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
9961 // Start the animation
9964 bool signalReceived(false);
9965 AnimationFinishCheck finishCheck(signalReceived);
9966 animation.FinishedSignal().Connect(&application, finishCheck);
9968 application.SendNotification();
9969 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
9971 // We didn't expect the animation to finish yet
9972 application.SendNotification();
9973 finishCheck.CheckSignalNotReceived();
9974 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9976 application.SendNotification();
9977 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
9979 // We didn't expect the animation to finish yet
9980 application.SendNotification();
9981 finishCheck.CheckSignalNotReceived();
9982 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
9984 application.SendNotification();
9985 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
9987 // We did expect the animation to finish
9988 application.SendNotification();
9989 finishCheck.CheckSignalReceived();
9990 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
9994 int UtcDaliAnimationCustomIntProperty(void)
9996 TestApplication application;
9998 Actor actor = Actor::New();
9999 Stage::GetCurrent().Add(actor);
10000 int startValue(0u);
10002 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10003 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10005 // Build the animation
10006 float durationSeconds(1.0f);
10007 Animation animation = Animation::New(durationSeconds);
10008 animation.AnimateTo( Property(actor, index), 20 );
10010 // Start the animation
10013 bool signalReceived(false);
10014 AnimationFinishCheck finishCheck(signalReceived);
10015 animation.FinishedSignal().Connect(&application, finishCheck);
10017 application.SendNotification();
10018 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10020 // We didn't expect the animation to finish yet
10021 application.SendNotification();
10022 finishCheck.CheckSignalNotReceived();
10023 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 10, TEST_LOCATION );
10025 application.SendNotification();
10026 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10028 // We did expect the animation to finish
10029 application.SendNotification();
10030 finishCheck.CheckSignalReceived();
10031 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 20, TEST_LOCATION );
10035 int UtcDaliAnimationDuration(void)
10037 TestApplication application;
10039 Actor actor = Actor::New();
10040 Stage::GetCurrent().Add(actor);
10042 Animation animation = Animation::New( 0.0f );
10043 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10045 // The animation duration should automatically increase depending on the animator time period
10047 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10048 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10050 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10051 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10056 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10058 TestApplication application;
10060 Actor actor = Actor::New();
10062 // Register an integer property
10064 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10065 Stage::GetCurrent().Add(actor);
10066 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10070 // Build the animation
10071 Animation animation = Animation::New( 2.0f );
10072 std::string relativeValue = "relative string";
10073 animation.AnimateBy( Property(actor, index), relativeValue );
10074 tet_result(TET_FAIL);
10076 catch ( Dali::DaliException& e )
10078 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10086 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10088 TestApplication application;
10090 Actor actor = Actor::New();
10092 // Register an integer property
10094 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10095 Stage::GetCurrent().Add(actor);
10096 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10100 // Build the animation
10101 Animation animation = Animation::New( 2.0f );
10102 std::string relativeValue = "relative string";
10103 animation.AnimateTo( Property(actor, index), relativeValue );
10105 tet_result(TET_FAIL);
10107 catch ( Dali::DaliException& e )
10109 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10115 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10117 TestApplication application;
10119 Actor actor = Actor::New();
10121 // Register an integer property
10123 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10124 Stage::GetCurrent().Add(actor);
10125 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10129 // Build the animation
10130 KeyFrames keyFrames = KeyFrames::New();
10131 keyFrames.Add( 0.0f, std::string("relative string1") );
10132 keyFrames.Add( 1.0f, std::string("relative string2") );
10133 // no need to really create the animation as keyframes do the check
10135 tet_result(TET_FAIL);
10137 catch ( Dali::DaliException& e )
10139 DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );