2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <dali/public-api/dali-core.h>
23 #include <dali/devel-api/actors/actor-devel.h>
24 #include <dali-test-suite-utils.h>
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 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
2367 // Build the animation
2368 float durationSeconds(1.0f);
2369 Animation animation = Animation::New(durationSeconds);
2370 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2371 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2373 // Start the animation from 40% progress
2374 animation.PlayFrom( 0.4f );
2376 // Target value should be updated straight away
2377 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
2379 bool signalReceived(false);
2380 AnimationFinishCheck finishCheck(signalReceived);
2381 animation.FinishedSignal().Connect(&application, finishCheck);
2383 application.SendNotification();
2384 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2386 // We didn't expect the animation to finish yet
2387 application.SendNotification();
2388 finishCheck.CheckSignalNotReceived();
2389 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2391 animation.Play(); // Test that calling play has no effect, when animation is already playing
2392 application.SendNotification();
2393 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2395 // We didn't expect the animation to finish yet
2396 application.SendNotification();
2397 finishCheck.CheckSignalNotReceived();
2398 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2400 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2401 // We did expect the animation to finish
2402 application.SendNotification();
2403 finishCheck.CheckSignalReceived();
2404 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2406 // Check that nothing has changed after a couple of buffer swaps
2407 application.Render(0);
2408 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2409 application.Render(0);
2410 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2414 int UtcDaliAnimationPlayFromN(void)
2416 TestApplication application;
2418 Actor actor = Actor::New();
2419 Stage::GetCurrent().Add(actor);
2421 // Build the animation
2422 float durationSeconds(1.0f);
2423 Animation animation = Animation::New(durationSeconds);
2424 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2425 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2427 //PlayFrom with an argument outside the range [0..1] will be ignored
2428 animation.PlayFrom(-1.0f);
2429 application.SendNotification();
2430 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2432 animation.PlayFrom(100.0f);
2433 application.SendNotification();
2434 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2438 int UtcDaliAnimationPauseP(void)
2440 TestApplication application;
2442 Actor actor = Actor::New();
2443 Stage::GetCurrent().Add(actor);
2445 // Build the animation
2446 float durationSeconds(1.0f);
2447 Animation animation = Animation::New(durationSeconds);
2448 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2449 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2451 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2453 // Start the animation
2456 bool signalReceived(false);
2457 AnimationFinishCheck finishCheck(signalReceived);
2458 animation.FinishedSignal().Connect(&application, finishCheck);
2460 application.SendNotification();
2461 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2463 // We didn't expect the animation to finish yet
2464 application.SendNotification();
2465 finishCheck.CheckSignalNotReceived();
2466 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2468 // Pause the animation
2470 application.SendNotification();
2473 for (int i=0; i<5; ++i)
2475 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2477 // We didn't expect the animation to finish yet
2478 application.SendNotification();
2479 finishCheck.CheckSignalNotReceived();
2480 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2485 application.SendNotification();
2486 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2488 // We didn't expect the animation to finish yet
2489 application.SendNotification();
2490 finishCheck.CheckSignalNotReceived();
2492 application.SendNotification();
2493 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2495 // We did expect the animation to finish
2496 application.SendNotification();
2497 finishCheck.CheckSignalReceived();
2498 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2500 // Check that nothing has changed after a couple of buffer swaps
2501 application.Render(0);
2502 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2503 application.Render(0);
2504 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2509 int UtcDaliAnimationGetStateP(void)
2511 TestApplication application;
2513 Actor actor = Actor::New();
2514 Stage::GetCurrent().Add(actor);
2516 // Build the animation
2517 float durationSeconds(1.0f);
2518 Animation animation = Animation::New(durationSeconds);
2519 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2520 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2521 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2523 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2525 // Start the animation
2528 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2530 bool signalReceived(false);
2531 AnimationFinishCheck finishCheck(signalReceived);
2532 animation.FinishedSignal().Connect(&application, finishCheck);
2534 application.SendNotification();
2535 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2537 // We didn't expect the animation to finish yet
2538 application.SendNotification();
2539 finishCheck.CheckSignalNotReceived();
2540 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2541 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2543 // Pause the animation
2545 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2546 application.SendNotification();
2547 application.Render(0.f);
2550 for (int i=0; i<5; ++i)
2552 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2554 // We didn't expect the animation to finish yet
2555 application.SendNotification();
2556 finishCheck.CheckSignalNotReceived();
2557 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2558 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2562 finishCheck.Reset();
2564 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2565 application.SendNotification();
2566 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2567 // We didn't expect the animation to finish yet
2568 application.SendNotification();
2569 finishCheck.CheckSignalNotReceived();
2570 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2572 application.SendNotification();
2573 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2575 // We did expect the animation to finish
2576 application.SendNotification();
2577 finishCheck.CheckSignalReceived();
2578 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2579 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2581 // Check that nothing has changed after a couple of buffer swaps
2582 application.Render(0);
2583 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2584 application.Render(0);
2585 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2586 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2589 finishCheck.Reset();
2591 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2592 application.SendNotification();
2593 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2594 application.SendNotification();
2595 finishCheck.CheckSignalNotReceived();
2596 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2602 int UtcDaliAnimationStopP(void)
2604 TestApplication application;
2606 Actor actor = Actor::New();
2607 Stage::GetCurrent().Add(actor);
2609 // Build the animation
2610 float durationSeconds(1.0f);
2611 Animation animation = Animation::New(durationSeconds);
2612 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2613 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2615 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2617 // Start the animation
2620 bool signalReceived(false);
2621 AnimationFinishCheck finishCheck(signalReceived);
2622 animation.FinishedSignal().Connect(&application, finishCheck);
2624 application.SendNotification();
2625 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2627 // We didn't expect the animation to finish yet
2628 application.SendNotification();
2629 finishCheck.CheckSignalNotReceived();
2630 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2632 // Stop the animation
2634 application.SendNotification();
2637 for (int i=0; i<5; ++i)
2639 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2641 // We did expect the animation to finish
2642 application.SendNotification();
2643 finishCheck.CheckSignalReceived();
2644 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2649 int UtcDaliAnimationStopSetPositionP(void)
2651 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2652 // i.e. to check that the animation does not interfere with the position set.
2654 TestApplication application;
2656 Actor actor = Actor::New();
2657 Stage::GetCurrent().Add(actor);
2659 // Build the animation
2660 float durationSeconds(1.0f);
2661 Animation animation = Animation::New(durationSeconds);
2662 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2663 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2665 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2667 // Start the animation
2670 bool signalReceived(false);
2671 AnimationFinishCheck finishCheck(signalReceived);
2672 animation.FinishedSignal().Connect(&application, finishCheck);
2674 application.SendNotification();
2675 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2677 // We didn't expect the animation to finish yet
2678 application.SendNotification();
2679 finishCheck.CheckSignalNotReceived();
2680 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2682 // Stop the animation
2684 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2685 actor.SetPosition(positionSet);
2686 application.SendNotification();
2689 for (int i=0; i<5; ++i)
2691 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2693 // We did expect the animation to finish
2694 application.SendNotification();
2695 finishCheck.CheckSignalReceived();
2696 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2701 int UtcDaliAnimationClearP(void)
2703 TestApplication application;
2705 Actor actor = Actor::New();
2706 Stage::GetCurrent().Add(actor);
2708 // Build the animation
2709 float durationSeconds(1.0f);
2710 Animation animation = Animation::New(durationSeconds);
2711 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2712 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2714 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2716 // Start the animation
2719 bool signalReceived(false);
2720 AnimationFinishCheck finishCheck(signalReceived);
2721 animation.FinishedSignal().Connect(&application, finishCheck);
2723 application.SendNotification();
2724 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2726 // We didn't expect the animation to finish yet
2727 application.SendNotification();
2728 finishCheck.CheckSignalNotReceived();
2729 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2731 // Clear the animation
2733 application.SendNotification();
2735 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2737 // We don't expect the animation to finish now
2738 application.SendNotification();
2739 finishCheck.CheckSignalNotReceived();
2740 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2742 // Restart as a scale animation; this should not move the actor's position
2743 finishCheck.Reset();
2744 actor.SetPosition(Vector3::ZERO);
2745 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2746 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2749 application.SendNotification();
2750 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2752 // We didn't expect the animation to finish yet
2753 application.SendNotification();
2754 finishCheck.CheckSignalNotReceived();
2755 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2756 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2758 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2760 // We did expect the animation to finish
2761 application.SendNotification();
2762 finishCheck.CheckSignalReceived();
2763 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2764 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2768 int UtcDaliAnimationFinishedSignalP(void)
2770 TestApplication application;
2772 // Start the empty animation
2773 float durationSeconds(1.0f);
2774 Animation animation = Animation::New(durationSeconds);
2777 bool signalReceived(false);
2778 AnimationFinishCheck finishCheck(signalReceived);
2779 animation.FinishedSignal().Connect(&application, finishCheck);
2781 application.SendNotification();
2782 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2784 // We did expect the animation to finish
2785 application.SendNotification();
2786 finishCheck.CheckSignalReceived();
2790 int UtcDaliAnimationAnimateByBooleanP(void)
2792 TestApplication application;
2794 Actor actor = Actor::New();
2796 // Register a boolean property
2797 bool startValue(false);
2798 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2799 Stage::GetCurrent().Add(actor);
2800 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2801 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2803 // Build the animation
2804 float durationSeconds(2.0f);
2805 Animation animation = Animation::New(durationSeconds);
2806 const bool relativeValue(true);
2807 const bool finalValue( false || relativeValue );
2808 animation.AnimateBy(Property(actor, index), relativeValue);
2810 // Start the animation
2813 // Target value should be retrievable straight away
2814 DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
2816 bool signalReceived(false);
2817 AnimationFinishCheck finishCheck(signalReceived);
2818 animation.FinishedSignal().Connect(&application, finishCheck);
2820 application.SendNotification();
2821 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2823 // We didn't expect the animation to finish yet
2824 application.SendNotification();
2825 finishCheck.CheckSignalNotReceived();
2826 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2828 application.SendNotification();
2829 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2831 // We did expect the animation to finish
2832 application.SendNotification();
2833 finishCheck.CheckSignalReceived();
2834 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2836 // Check that nothing has changed after a couple of buffer swaps
2837 application.Render(0);
2838 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2839 application.Render(0);
2840 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2842 // Repeat with relative value "false" - this should be an NOOP
2843 animation = Animation::New(durationSeconds);
2844 bool noOpValue(false);
2845 animation.AnimateBy(Property(actor, index), noOpValue);
2847 // Start the animation
2850 finishCheck.Reset();
2851 animation.FinishedSignal().Connect(&application, finishCheck);
2853 application.SendNotification();
2854 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2856 // We didn't expect the animation to finish yet
2857 application.SendNotification();
2858 finishCheck.CheckSignalNotReceived();
2859 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2861 application.SendNotification();
2862 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2864 // We did expect the animation to finish
2865 application.SendNotification();
2866 finishCheck.CheckSignalReceived();
2867 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2869 // Check that nothing has changed after a couple of buffer swaps
2870 application.Render(0);
2871 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2872 application.Render(0);
2873 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2877 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2879 TestApplication application;
2881 Actor actor = Actor::New();
2883 // Register a boolean property
2884 bool startValue(false);
2885 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2886 Stage::GetCurrent().Add(actor);
2887 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2888 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2890 // Build the animation
2891 float durationSeconds(2.0f);
2892 Animation animation = Animation::New(durationSeconds);
2893 bool relativeValue(true);
2894 bool finalValue( false || relativeValue );
2895 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2897 // Start the animation
2900 bool signalReceived(false);
2901 AnimationFinishCheck finishCheck(signalReceived);
2902 animation.FinishedSignal().Connect(&application, finishCheck);
2904 application.SendNotification();
2905 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2907 // We didn't expect the animation to finish yet
2908 application.SendNotification();
2909 finishCheck.CheckSignalNotReceived();
2910 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2912 application.SendNotification();
2913 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2915 // We did expect the animation to finish
2916 application.SendNotification();
2917 finishCheck.CheckSignalReceived();
2918 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2920 // Check that nothing has changed after a couple of buffer swaps
2921 application.Render(0);
2922 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2923 application.Render(0);
2924 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2926 // Repeat with relative value "false" - this should be an NOOP
2927 animation = Animation::New(durationSeconds);
2928 bool noOpValue(false);
2929 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2931 // Start the animation
2934 finishCheck.Reset();
2935 animation.FinishedSignal().Connect(&application, finishCheck);
2937 application.SendNotification();
2938 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2940 // We didn't expect the animation to finish yet
2941 application.SendNotification();
2942 finishCheck.CheckSignalNotReceived();
2943 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2945 application.SendNotification();
2946 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2948 // We did expect the animation to finish
2949 application.SendNotification();
2950 finishCheck.CheckSignalReceived();
2951 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2955 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2957 TestApplication application;
2959 Actor actor = Actor::New();
2961 // Register a boolean property
2962 bool startValue(false);
2963 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2964 Stage::GetCurrent().Add(actor);
2965 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2966 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2968 // Build the animation
2969 float durationSeconds(2.0f);
2970 Animation animation = Animation::New(durationSeconds);
2971 bool relativeValue(true);
2972 bool finalValue( false || relativeValue );
2973 float animatorDurationSeconds(durationSeconds * 0.5f);
2974 animation.AnimateBy( Property(actor, index),
2976 TimePeriod( animatorDurationSeconds ) );
2978 // Start the animation
2981 bool signalReceived(false);
2982 AnimationFinishCheck finishCheck(signalReceived);
2983 animation.FinishedSignal().Connect(&application, finishCheck);
2985 application.SendNotification();
2986 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2988 // We didn't expect the animation to finish yet
2989 application.SendNotification();
2990 finishCheck.CheckSignalNotReceived();
2991 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2993 application.SendNotification();
2994 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2996 // We didn't expect the animation to finish yet...
2997 application.SendNotification();
2998 finishCheck.CheckSignalNotReceived();
3000 // ...however we should have reached the final value
3001 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3003 application.SendNotification();
3004 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3006 // We did expect the animation to finish
3007 application.SendNotification();
3008 finishCheck.CheckSignalReceived();
3009 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3011 // Check that nothing has changed after a couple of buffer swaps
3012 application.Render(0);
3013 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3014 application.Render(0);
3015 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3019 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3021 TestApplication application;
3023 Actor actor = Actor::New();
3025 // Register a boolean property
3026 bool startValue(false);
3027 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3028 Stage::GetCurrent().Add(actor);
3029 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3030 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3032 // Build the animation
3033 float durationSeconds(2.0f);
3034 Animation animation = Animation::New(durationSeconds);
3035 bool relativeValue(true);
3036 bool finalValue( false || relativeValue );
3037 float animatorDurationSeconds(durationSeconds * 0.5f);
3038 animation.AnimateBy( Property(actor, index),
3040 AlphaFunction::EASE_IN_OUT,
3041 TimePeriod( animatorDurationSeconds ) );
3043 // Start the animation
3046 bool signalReceived(false);
3047 AnimationFinishCheck finishCheck(signalReceived);
3048 animation.FinishedSignal().Connect(&application, finishCheck);
3050 application.SendNotification();
3051 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3053 // We didn't expect the animation to finish yet
3054 application.SendNotification();
3055 finishCheck.CheckSignalNotReceived();
3056 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3058 application.SendNotification();
3059 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3061 // We didn't expect the animation to finish yet...
3062 application.SendNotification();
3063 finishCheck.CheckSignalNotReceived();
3065 // ...however we should have reached the final value
3066 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3068 application.SendNotification();
3069 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3071 // We did expect the animation to finish
3072 application.SendNotification();
3073 finishCheck.CheckSignalReceived();
3074 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3076 // Check that nothing has changed after a couple of buffer swaps
3077 application.Render(0);
3078 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3079 application.Render(0);
3080 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3084 int UtcDaliAnimationAnimateByFloatP(void)
3086 TestApplication application;
3088 Actor actor = Actor::New();
3090 // Register a float property
3091 float startValue(10.0f);
3092 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3093 Stage::GetCurrent().Add(actor);
3094 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3095 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3097 // Build the animation
3098 float durationSeconds(2.0f);
3099 Animation animation = Animation::New(durationSeconds);
3100 float targetValue(50.0f);
3101 float relativeValue(targetValue - startValue);
3102 animation.AnimateBy(Property(actor, index), relativeValue);
3104 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3106 // Start the animation
3109 // Target value should be retrievable straight away
3110 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3112 bool signalReceived(false);
3113 AnimationFinishCheck finishCheck(signalReceived);
3114 animation.FinishedSignal().Connect(&application, finishCheck);
3116 application.SendNotification();
3117 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3119 // We didn't expect the animation to finish yet
3120 application.SendNotification();
3121 finishCheck.CheckSignalNotReceived();
3122 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3124 application.SendNotification();
3125 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3127 // We did expect the animation to finish
3128 application.SendNotification();
3129 finishCheck.CheckSignalReceived();
3130 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3132 // Check that nothing has changed after a couple of buffer swaps
3133 application.Render(0);
3134 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3135 application.Render(0);
3136 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3140 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3142 TestApplication application;
3144 Actor actor = Actor::New();
3146 // Register a float property
3147 float startValue(10.0f);
3148 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3149 Stage::GetCurrent().Add(actor);
3150 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3151 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3153 // Build the animation
3154 float durationSeconds(1.0f);
3155 Animation animation = Animation::New(durationSeconds);
3156 float targetValue(90.0f);
3157 float relativeValue(targetValue - startValue);
3158 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3160 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3162 // Start the animation
3165 bool signalReceived(false);
3166 AnimationFinishCheck finishCheck(signalReceived);
3167 animation.FinishedSignal().Connect(&application, finishCheck);
3169 application.SendNotification();
3170 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3172 // We didn't expect the animation to finish yet
3173 application.SendNotification();
3174 finishCheck.CheckSignalNotReceived();
3176 // The position should have moved more, than with a linear alpha function
3177 float current( actor.GetCurrentProperty< float >( index ) );
3178 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3180 application.SendNotification();
3181 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3183 // We did expect the animation to finish
3184 application.SendNotification();
3185 finishCheck.CheckSignalReceived();
3186 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3188 // Check that nothing has changed after a couple of buffer swaps
3189 application.Render(0);
3190 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3191 application.Render(0);
3192 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3196 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3198 TestApplication application;
3200 Actor actor = Actor::New();
3202 // Register a float property
3203 float startValue(10.0f);
3204 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3205 Stage::GetCurrent().Add(actor);
3206 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3207 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3209 // Build the animation
3210 float durationSeconds(1.0f);
3211 Animation animation = Animation::New(durationSeconds);
3212 float targetValue(30.0f);
3213 float relativeValue(targetValue - startValue);
3215 animation.AnimateBy(Property(actor, index),
3217 TimePeriod(delay, durationSeconds - delay));
3219 // Start the animation
3222 bool signalReceived(false);
3223 AnimationFinishCheck finishCheck(signalReceived);
3224 animation.FinishedSignal().Connect(&application, finishCheck);
3226 application.SendNotification();
3227 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3229 // We didn't expect the animation to finish yet
3230 application.SendNotification();
3231 finishCheck.CheckSignalNotReceived();
3232 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3234 application.SendNotification();
3235 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3237 // We didn't expect the animation to finish yet
3238 application.SendNotification();
3239 finishCheck.CheckSignalNotReceived();
3240 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3242 application.SendNotification();
3243 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3245 // We did expect the animation to finish
3246 application.SendNotification();
3247 finishCheck.CheckSignalReceived();
3248 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3250 // Check that nothing has changed after a couple of buffer swaps
3251 application.Render(0);
3252 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3253 application.Render(0);
3254 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3258 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3260 TestApplication application;
3262 Actor actor = Actor::New();
3264 // Register a float property
3265 float startValue(10.0f);
3266 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3267 Stage::GetCurrent().Add(actor);
3268 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3269 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3271 // Build the animation
3272 float durationSeconds(1.0f);
3273 Animation animation = Animation::New(durationSeconds);
3274 float targetValue(30.0f);
3275 float relativeValue(targetValue - startValue);
3277 animation.AnimateBy(Property(actor, index),
3279 AlphaFunction::LINEAR,
3280 TimePeriod(delay, durationSeconds - delay));
3282 // Start the animation
3285 bool signalReceived(false);
3286 AnimationFinishCheck finishCheck(signalReceived);
3287 animation.FinishedSignal().Connect(&application, finishCheck);
3289 application.SendNotification();
3290 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3292 // We didn't expect the animation to finish yet
3293 application.SendNotification();
3294 finishCheck.CheckSignalNotReceived();
3295 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3297 application.SendNotification();
3298 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3300 // We didn't expect the animation to finish yet
3301 application.SendNotification();
3302 finishCheck.CheckSignalNotReceived();
3303 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3305 application.SendNotification();
3306 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3308 // We did expect the animation to finish
3309 application.SendNotification();
3310 finishCheck.CheckSignalReceived();
3311 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3313 // Check that nothing has changed after a couple of buffer swaps
3314 application.Render(0);
3315 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3316 application.Render(0);
3317 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3321 int UtcDaliAnimationAnimateByIntegerP(void)
3323 TestApplication application;
3325 Actor actor = Actor::New();
3327 // Register an integer property
3329 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3330 Stage::GetCurrent().Add(actor);
3331 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3332 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3334 // Build the animation
3335 float durationSeconds(2.0f);
3336 Animation animation = Animation::New(durationSeconds);
3337 int targetValue(50);
3338 int relativeValue(targetValue - startValue);
3339 animation.AnimateBy(Property(actor, index), relativeValue);
3341 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3343 // Start the animation
3346 // Target value should be retrievable straight away
3347 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3349 bool signalReceived(false);
3350 AnimationFinishCheck finishCheck(signalReceived);
3351 animation.FinishedSignal().Connect(&application, finishCheck);
3353 application.SendNotification();
3354 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3356 // We didn't expect the animation to finish yet
3357 application.SendNotification();
3358 finishCheck.CheckSignalNotReceived();
3359 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3361 application.SendNotification();
3362 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3364 // We did expect the animation to finish
3365 application.SendNotification();
3366 finishCheck.CheckSignalReceived();
3367 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3369 // Check that nothing has changed after a couple of buffer swaps
3370 application.Render(0);
3371 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3372 application.Render(0);
3373 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3377 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3379 TestApplication application;
3381 Actor actor = Actor::New();
3383 // Register an integer property
3385 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3386 Stage::GetCurrent().Add(actor);
3387 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3388 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3390 // Build the animation
3391 float durationSeconds(1.0f);
3392 Animation animation = Animation::New(durationSeconds);
3393 int targetValue(90);
3394 int relativeValue(targetValue - startValue);
3395 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3397 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3399 // Start the animation
3402 bool signalReceived(false);
3403 AnimationFinishCheck finishCheck(signalReceived);
3404 animation.FinishedSignal().Connect(&application, finishCheck);
3406 application.SendNotification();
3407 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3409 // We didn't expect the animation to finish yet
3410 application.SendNotification();
3411 finishCheck.CheckSignalNotReceived();
3413 // The position should have moved more, than with a linear alpha function
3414 int current( actor.GetCurrentProperty< int >( index ) );
3415 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3417 application.SendNotification();
3418 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3420 // We did expect the animation to finish
3421 application.SendNotification();
3422 finishCheck.CheckSignalReceived();
3423 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3425 // Check that nothing has changed after a couple of buffer swaps
3426 application.Render(0);
3427 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3428 application.Render(0);
3429 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3433 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3435 TestApplication application;
3437 Actor actor = Actor::New();
3439 // Register an integer property
3441 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3442 Stage::GetCurrent().Add(actor);
3443 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3444 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3446 // Build the animation
3447 float durationSeconds(1.0f);
3448 Animation animation = Animation::New(durationSeconds);
3449 int targetValue(30);
3450 int relativeValue(targetValue - startValue);
3452 animation.AnimateBy(Property(actor, index),
3454 TimePeriod(delay, durationSeconds - delay));
3456 // Start the animation
3459 bool signalReceived(false);
3460 AnimationFinishCheck finishCheck(signalReceived);
3461 animation.FinishedSignal().Connect(&application, finishCheck);
3463 application.SendNotification();
3464 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3466 // We didn't expect the animation to finish yet
3467 application.SendNotification();
3468 finishCheck.CheckSignalNotReceived();
3469 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3471 application.SendNotification();
3472 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3474 // We didn't expect the animation to finish yet
3475 application.SendNotification();
3476 finishCheck.CheckSignalNotReceived();
3477 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3479 application.SendNotification();
3480 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3482 // We did expect the animation to finish
3483 application.SendNotification();
3484 finishCheck.CheckSignalReceived();
3485 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3487 // Check that nothing has changed after a couple of buffer swaps
3488 application.Render(0);
3489 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3490 application.Render(0);
3491 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3495 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3497 TestApplication application;
3499 Actor actor = Actor::New();
3501 // Register an integer property
3503 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3504 Stage::GetCurrent().Add(actor);
3505 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3506 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3508 // Build the animation
3509 float durationSeconds(1.0f);
3510 Animation animation = Animation::New(durationSeconds);
3511 int targetValue(30);
3512 int relativeValue(targetValue - startValue);
3514 animation.AnimateBy(Property(actor, index),
3516 AlphaFunction::LINEAR,
3517 TimePeriod(delay, durationSeconds - delay));
3519 // Start the animation
3522 bool signalReceived(false);
3523 AnimationFinishCheck finishCheck(signalReceived);
3524 animation.FinishedSignal().Connect(&application, finishCheck);
3526 application.SendNotification();
3527 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3529 // We didn't expect the animation to finish yet
3530 application.SendNotification();
3531 finishCheck.CheckSignalNotReceived();
3532 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3534 application.SendNotification();
3535 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3537 // We didn't expect the animation to finish yet
3538 application.SendNotification();
3539 finishCheck.CheckSignalNotReceived();
3540 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3542 application.SendNotification();
3543 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3545 // We did expect the animation to finish
3546 application.SendNotification();
3547 finishCheck.CheckSignalReceived();
3548 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3550 // Check that nothing has changed after a couple of buffer swaps
3551 application.Render(0);
3552 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3553 application.Render(0);
3554 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3558 int UtcDaliAnimationAnimateByQuaternionP(void)
3560 TestApplication application;
3562 Actor actor = Actor::New();
3564 // Register a quaternion property
3565 const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
3566 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3567 Stage::GetCurrent().Add(actor);
3568 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3569 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3571 // Build the animation
3572 float durationSeconds(2.0f);
3573 Animation animation = Animation::New(durationSeconds);
3574 const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
3575 const Quaternion finalValue( startValue * relativeValue );
3576 animation.AnimateBy(Property(actor, index), relativeValue);
3578 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3579 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3581 // Start the animation
3584 // Target value should be retrievable straight away
3585 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3587 application.SendNotification();
3588 application.Render( 2000 ); // animation complete
3590 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3591 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
3596 int UtcDaliAnimationAnimateByVector2P(void)
3598 TestApplication application;
3600 Actor actor = Actor::New();
3602 // Register a Vector2 property
3603 Vector2 startValue(10.0f, 10.0f);
3604 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3605 Stage::GetCurrent().Add(actor);
3606 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3607 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3609 // Build the animation
3610 float durationSeconds(2.0f);
3611 Animation animation = Animation::New(durationSeconds);
3612 Vector2 targetValue(60.0f, 60.0f);
3613 Vector2 relativeValue(targetValue - startValue);
3614 animation.AnimateBy(Property(actor, index), relativeValue);
3616 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3618 // Start the animation
3621 // Target value should be retrievable straight away
3622 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3624 bool signalReceived(false);
3625 AnimationFinishCheck finishCheck(signalReceived);
3626 animation.FinishedSignal().Connect(&application, finishCheck);
3628 application.SendNotification();
3629 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3631 // We didn't expect the animation to finish yet
3632 application.SendNotification();
3633 finishCheck.CheckSignalNotReceived();
3634 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3636 application.SendNotification();
3637 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3639 // We did expect the animation to finish
3640 application.SendNotification();
3641 finishCheck.CheckSignalReceived();
3642 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3644 // Check that nothing has changed after a couple of buffer swaps
3645 application.Render(0);
3646 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3647 application.Render(0);
3648 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3652 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3654 TestApplication application;
3656 Actor actor = Actor::New();
3658 // Register a Vector2 property
3659 Vector2 startValue(100.0f, 100.0f);
3660 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3661 Stage::GetCurrent().Add(actor);
3662 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3663 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3665 // Build the animation
3666 float durationSeconds(1.0f);
3667 Animation animation = Animation::New(durationSeconds);
3668 Vector2 targetValue(20.0f, 20.0f);
3669 Vector2 relativeValue(targetValue - startValue);
3670 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3672 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3674 // Start the animation
3677 bool signalReceived(false);
3678 AnimationFinishCheck finishCheck(signalReceived);
3679 animation.FinishedSignal().Connect(&application, finishCheck);
3681 application.SendNotification();
3682 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3684 // We didn't expect the animation to finish yet
3685 application.SendNotification();
3686 finishCheck.CheckSignalNotReceived();
3688 // The position should have moved more, than with a linear alpha function
3689 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
3690 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3691 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3693 application.SendNotification();
3694 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3696 // We did expect the animation to finish
3697 application.SendNotification();
3698 finishCheck.CheckSignalReceived();
3699 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3701 // Check that nothing has changed after a couple of buffer swaps
3702 application.Render(0);
3703 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3704 application.Render(0);
3705 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3709 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3711 TestApplication application;
3713 Actor actor = Actor::New();
3715 // Register a Vector2 property
3716 Vector2 startValue(10.0f, 10.0f);
3717 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3718 Stage::GetCurrent().Add(actor);
3719 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3720 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3722 // Build the animation
3723 float durationSeconds(1.0f);
3724 Animation animation = Animation::New(durationSeconds);
3725 Vector2 targetValue(30.0f, 30.0f);
3726 Vector2 relativeValue(targetValue - startValue);
3728 animation.AnimateBy(Property(actor, index),
3730 TimePeriod(delay, durationSeconds - delay));
3732 // Start the animation
3735 bool signalReceived(false);
3736 AnimationFinishCheck finishCheck(signalReceived);
3737 animation.FinishedSignal().Connect(&application, finishCheck);
3739 application.SendNotification();
3740 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3742 // We didn't expect the animation to finish yet
3743 application.SendNotification();
3744 finishCheck.CheckSignalNotReceived();
3745 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3747 application.SendNotification();
3748 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3750 // We didn't expect the animation to finish yet
3751 application.SendNotification();
3752 finishCheck.CheckSignalNotReceived();
3753 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3755 application.SendNotification();
3756 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3758 // We did expect the animation to finish
3759 application.SendNotification();
3760 finishCheck.CheckSignalReceived();
3761 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3763 // Check that nothing has changed after a couple of buffer swaps
3764 application.Render(0);
3765 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3766 application.Render(0);
3767 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3771 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3773 TestApplication application;
3775 Actor actor = Actor::New();
3777 // Register a Vector2 property
3778 Vector2 startValue(5.0f, 5.0f);
3779 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3780 Stage::GetCurrent().Add(actor);
3781 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3782 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3784 // Build the animation
3785 float durationSeconds(1.0f);
3786 Animation animation = Animation::New(durationSeconds);
3787 Vector2 targetValue(10.0f, 10.0f);
3788 Vector2 relativeValue(targetValue - startValue);
3790 animation.AnimateBy(Property(actor, index),
3792 AlphaFunction::LINEAR,
3793 TimePeriod(delay, durationSeconds - delay));
3795 // Start the animation
3798 bool signalReceived(false);
3799 AnimationFinishCheck finishCheck(signalReceived);
3800 animation.FinishedSignal().Connect(&application, finishCheck);
3802 application.SendNotification();
3803 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3805 // We didn't expect the animation to finish yet
3806 application.SendNotification();
3807 finishCheck.CheckSignalNotReceived();
3808 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3810 application.SendNotification();
3811 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3813 // We didn't expect the animation to finish yet
3814 application.SendNotification();
3815 finishCheck.CheckSignalNotReceived();
3816 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3818 application.SendNotification();
3819 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3821 // We did expect the animation to finish
3822 application.SendNotification();
3823 finishCheck.CheckSignalReceived();
3824 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3826 // Check that nothing has changed after a couple of buffer swaps
3827 application.Render(0);
3828 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3829 application.Render(0);
3830 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3834 int UtcDaliAnimationAnimateByVector3P(void)
3836 TestApplication application;
3838 Actor actor = Actor::New();
3840 // Register a Vector3 property
3841 Vector3 startValue(10.0f, 10.0f, 10.0f);
3842 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3843 Stage::GetCurrent().Add(actor);
3844 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3845 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3847 // Build the animation
3848 float durationSeconds(2.0f);
3849 Animation animation = Animation::New(durationSeconds);
3850 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3851 Vector3 relativeValue(targetValue - startValue);
3852 animation.AnimateBy(Property(actor, index), relativeValue);
3854 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3856 // Start the animation
3859 // Target value should be retrievable straight away
3860 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3862 bool signalReceived(false);
3863 AnimationFinishCheck finishCheck(signalReceived);
3864 animation.FinishedSignal().Connect(&application, finishCheck);
3866 application.SendNotification();
3867 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3869 // We didn't expect the animation to finish yet
3870 application.SendNotification();
3871 finishCheck.CheckSignalNotReceived();
3872 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3874 application.SendNotification();
3875 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3877 // We did expect the animation to finish
3878 application.SendNotification();
3879 finishCheck.CheckSignalReceived();
3880 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3882 // Check that nothing has changed after a couple of buffer swaps
3883 application.Render(0);
3884 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3885 application.Render(0);
3886 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3890 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3892 TestApplication application;
3894 Actor actor = Actor::New();
3896 // Register a Vector3 property
3897 Vector3 startValue(100.0f, 100.0f, 100.0f);
3898 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3899 Stage::GetCurrent().Add(actor);
3900 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3901 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3903 // Build the animation
3904 float durationSeconds(1.0f);
3905 Animation animation = Animation::New(durationSeconds);
3906 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3907 Vector3 relativeValue(targetValue - startValue);
3908 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3910 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3912 // Start the animation
3915 bool signalReceived(false);
3916 AnimationFinishCheck finishCheck(signalReceived);
3917 animation.FinishedSignal().Connect(&application, finishCheck);
3919 application.SendNotification();
3920 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3922 // We didn't expect the animation to finish yet
3923 application.SendNotification();
3924 finishCheck.CheckSignalNotReceived();
3926 // The position should have moved more, than with a linear alpha function
3927 Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
3928 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3929 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3930 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3932 application.SendNotification();
3933 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3935 // We did expect the animation to finish
3936 application.SendNotification();
3937 finishCheck.CheckSignalReceived();
3938 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3940 // Check that nothing has changed after a couple of buffer swaps
3941 application.Render(0);
3942 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3943 application.Render(0);
3944 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3948 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3950 TestApplication application;
3952 Actor actor = Actor::New();
3954 // Register a Vector3 property
3955 Vector3 startValue(10.0f, 10.0f, 10.0f);
3956 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3957 Stage::GetCurrent().Add(actor);
3958 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3959 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3961 // Build the animation
3962 float durationSeconds(1.0f);
3963 Animation animation = Animation::New(durationSeconds);
3964 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3965 Vector3 relativeValue(targetValue - startValue);
3967 animation.AnimateBy(Property(actor, index),
3969 TimePeriod(delay, durationSeconds - delay));
3971 // Start the animation
3974 bool signalReceived(false);
3975 AnimationFinishCheck finishCheck(signalReceived);
3976 animation.FinishedSignal().Connect(&application, finishCheck);
3978 application.SendNotification();
3979 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3981 // We didn't expect the animation to finish yet
3982 application.SendNotification();
3983 finishCheck.CheckSignalNotReceived();
3984 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3986 application.SendNotification();
3987 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3989 // We didn't expect the animation to finish yet
3990 application.SendNotification();
3991 finishCheck.CheckSignalNotReceived();
3992 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3994 application.SendNotification();
3995 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3997 // We did expect the animation to finish
3998 application.SendNotification();
3999 finishCheck.CheckSignalReceived();
4000 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4002 // Check that nothing has changed after a couple of buffer swaps
4003 application.Render(0);
4004 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4005 application.Render(0);
4006 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4010 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4012 TestApplication application;
4014 Actor actor = Actor::New();
4016 // Register a Vector3 property
4017 Vector3 startValue(5.0f, 5.0f, 5.0f);
4018 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4019 Stage::GetCurrent().Add(actor);
4020 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4021 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4023 // Build the animation
4024 float durationSeconds(1.0f);
4025 Animation animation = Animation::New(durationSeconds);
4026 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4027 Vector3 relativeValue(targetValue - startValue);
4029 animation.AnimateBy(Property(actor, index),
4031 AlphaFunction::LINEAR,
4032 TimePeriod(delay, durationSeconds - delay));
4034 // Start the animation
4037 bool signalReceived(false);
4038 AnimationFinishCheck finishCheck(signalReceived);
4039 animation.FinishedSignal().Connect(&application, finishCheck);
4041 application.SendNotification();
4042 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4044 // We didn't expect the animation to finish yet
4045 application.SendNotification();
4046 finishCheck.CheckSignalNotReceived();
4047 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4049 application.SendNotification();
4050 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4052 // We didn't expect the animation to finish yet
4053 application.SendNotification();
4054 finishCheck.CheckSignalNotReceived();
4055 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4057 application.SendNotification();
4058 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4060 // We did expect the animation to finish
4061 application.SendNotification();
4062 finishCheck.CheckSignalReceived();
4063 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4065 // Check that nothing has changed after a couple of buffer swaps
4066 application.Render(0);
4067 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4068 application.Render(0);
4069 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4073 int UtcDaliAnimationAnimateByVector4P(void)
4075 TestApplication application;
4077 Actor actor = Actor::New();
4079 // Register a Vector4 property
4080 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4081 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4082 Stage::GetCurrent().Add(actor);
4083 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4084 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4086 // Build the animation
4087 float durationSeconds(2.0f);
4088 Animation animation = Animation::New(durationSeconds);
4089 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4090 Vector4 relativeValue(targetValue - startValue);
4091 animation.AnimateBy(Property(actor, index), relativeValue);
4093 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4095 // Start the animation
4098 // Target value should be retrievable straight away
4099 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4101 bool signalReceived(false);
4102 AnimationFinishCheck finishCheck(signalReceived);
4103 animation.FinishedSignal().Connect(&application, finishCheck);
4105 application.SendNotification();
4106 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4108 // We didn't expect the animation to finish yet
4109 application.SendNotification();
4110 finishCheck.CheckSignalNotReceived();
4111 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4113 application.SendNotification();
4114 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4116 // We did expect the animation to finish
4117 application.SendNotification();
4118 finishCheck.CheckSignalReceived();
4119 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4121 // Check that nothing has changed after a couple of buffer swaps
4122 application.Render(0);
4123 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4124 application.Render(0);
4125 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4129 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4131 TestApplication application;
4133 Actor actor = Actor::New();
4135 // Register a Vector4 property
4136 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4137 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4138 Stage::GetCurrent().Add(actor);
4139 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4140 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4142 // Build the animation
4143 float durationSeconds(1.0f);
4144 Animation animation = Animation::New(durationSeconds);
4145 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4146 Vector4 relativeValue(targetValue - startValue);
4147 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4149 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4151 // Start the animation
4154 bool signalReceived(false);
4155 AnimationFinishCheck finishCheck(signalReceived);
4156 animation.FinishedSignal().Connect(&application, finishCheck);
4158 application.SendNotification();
4159 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4161 // We didn't expect the animation to finish yet
4162 application.SendNotification();
4163 finishCheck.CheckSignalNotReceived();
4165 // The position should have moved more, than with a linear alpha function
4166 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4167 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4168 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4169 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4170 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4172 application.SendNotification();
4173 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4175 // We did expect the animation to finish
4176 application.SendNotification();
4177 finishCheck.CheckSignalReceived();
4178 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4180 // Check that nothing has changed after a couple of buffer swaps
4181 application.Render(0);
4182 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4183 application.Render(0);
4184 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4188 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4190 TestApplication application;
4192 Actor actor = Actor::New();
4194 // Register a Vector4 property
4195 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4196 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4197 Stage::GetCurrent().Add(actor);
4198 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4199 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4201 // Build the animation
4202 float durationSeconds(1.0f);
4203 Animation animation = Animation::New(durationSeconds);
4204 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4205 Vector4 relativeValue(targetValue - startValue);
4207 animation.AnimateBy(Property(actor, index),
4209 TimePeriod(delay, durationSeconds - delay));
4211 // Start the animation
4214 bool signalReceived(false);
4215 AnimationFinishCheck finishCheck(signalReceived);
4216 animation.FinishedSignal().Connect(&application, finishCheck);
4218 application.SendNotification();
4219 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4221 // We didn't expect the animation to finish yet
4222 application.SendNotification();
4223 finishCheck.CheckSignalNotReceived();
4224 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4226 application.SendNotification();
4227 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4229 // We didn't expect the animation to finish yet
4230 application.SendNotification();
4231 finishCheck.CheckSignalNotReceived();
4232 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4234 application.SendNotification();
4235 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4237 // We did expect the animation to finish
4238 application.SendNotification();
4239 finishCheck.CheckSignalReceived();
4240 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4242 // Check that nothing has changed after a couple of buffer swaps
4243 application.Render(0);
4244 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4245 application.Render(0);
4246 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4250 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4252 TestApplication application;
4254 Actor actor = Actor::New();
4256 // Register a Vector4 property
4257 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4258 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4259 Stage::GetCurrent().Add(actor);
4260 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4261 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4263 // Build the animation
4264 float durationSeconds(1.0f);
4265 Animation animation = Animation::New(durationSeconds);
4266 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4267 Vector4 relativeValue(targetValue - startValue);
4269 animation.AnimateBy(Property(actor, index),
4271 AlphaFunction::LINEAR,
4272 TimePeriod(delay, durationSeconds - delay));
4274 // Start the animation
4277 bool signalReceived(false);
4278 AnimationFinishCheck finishCheck(signalReceived);
4279 animation.FinishedSignal().Connect(&application, finishCheck);
4281 application.SendNotification();
4282 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4284 // We didn't expect the animation to finish yet
4285 application.SendNotification();
4286 finishCheck.CheckSignalNotReceived();
4287 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4289 application.SendNotification();
4290 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4292 // We didn't expect the animation to finish yet
4293 application.SendNotification();
4294 finishCheck.CheckSignalNotReceived();
4295 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4297 application.SendNotification();
4298 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4300 // We did expect the animation to finish
4301 application.SendNotification();
4302 finishCheck.CheckSignalReceived();
4303 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4305 // Check that nothing has changed after a couple of buffer swaps
4306 application.Render(0);
4307 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4308 application.Render(0);
4309 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4313 int UtcDaliAnimationAnimateByActorPositionP(void)
4315 TestApplication application;
4317 Actor actor = Actor::New();
4318 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4319 actor.SetPosition(startPosition);
4320 Stage::GetCurrent().Add(actor);
4321 application.SendNotification();
4322 application.Render(0);
4323 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4325 // Build the animation
4326 float durationSeconds(1.0f);
4327 Animation animation = Animation::New(durationSeconds);
4328 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4329 Vector3 relativePosition(targetPosition - startPosition);
4330 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4332 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4334 // Start the animation
4337 // Target value should be retrievable straight away
4338 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4340 bool signalReceived(false);
4341 AnimationFinishCheck finishCheck(signalReceived);
4342 animation.FinishedSignal().Connect(&application, finishCheck);
4344 application.SendNotification();
4345 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4347 // We didn't expect the animation to finish yet
4348 application.SendNotification();
4349 finishCheck.CheckSignalNotReceived();
4350 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4352 application.SendNotification();
4353 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4355 // We did expect the animation to finish
4356 application.SendNotification();
4357 finishCheck.CheckSignalReceived();
4358 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4360 // Check that nothing has changed after a couple of buffer swaps
4361 application.Render(0);
4362 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4363 application.Render(0);
4364 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4368 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4370 TestApplication application;
4372 Actor actor = Actor::New();
4373 Stage::GetCurrent().Add(actor);
4374 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4376 // Build the animation
4377 float durationSeconds(1.0f);
4378 Animation animation = Animation::New(durationSeconds);
4379 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4380 Vector3 relativePosition(targetPosition - Vector3::ZERO);
4381 animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
4382 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
4383 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
4385 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4386 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4388 // Start the animation
4391 // Target value should be retrievable straight away
4392 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4393 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
4394 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
4395 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
4397 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
4399 application.SendNotification();
4400 application.Render( 1000 ); // 1 second progress
4402 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4407 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4409 TestApplication application;
4411 Actor actor = Actor::New();
4412 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4413 actor.SetPosition(startPosition);
4414 Stage::GetCurrent().Add(actor);
4415 application.SendNotification();
4416 application.Render(0);
4417 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4419 // Build the animation
4420 float durationSeconds(1.0f);
4421 Animation animation = Animation::New(durationSeconds);
4422 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4423 Vector3 relativePosition(targetPosition - startPosition);
4424 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4426 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4428 // Start the animation
4431 bool signalReceived(false);
4432 AnimationFinishCheck finishCheck(signalReceived);
4433 animation.FinishedSignal().Connect(&application, finishCheck);
4435 application.SendNotification();
4436 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4438 // We didn't expect the animation to finish yet
4439 application.SendNotification();
4440 finishCheck.CheckSignalNotReceived();
4442 // The position should have moved more, than with a linear alpha function
4443 Vector3 current(actor.GetCurrentPosition());
4444 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4445 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4446 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4448 application.SendNotification();
4449 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4451 // We did expect the animation to finish
4452 application.SendNotification();
4453 finishCheck.CheckSignalReceived();
4454 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4456 // Check that nothing has changed after a couple of buffer swaps
4457 application.Render(0);
4458 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4459 application.Render(0);
4460 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4464 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4466 TestApplication application;
4468 Actor actor = Actor::New();
4469 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4470 actor.SetPosition(startPosition);
4471 Stage::GetCurrent().Add(actor);
4472 application.SendNotification();
4473 application.Render(0);
4474 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4476 // Build the animation
4477 float durationSeconds(1.0f);
4478 Animation animation = Animation::New(durationSeconds);
4479 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4480 Vector3 relativePosition(targetPosition - startPosition);
4482 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4484 TimePeriod(delay, durationSeconds - delay));
4486 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4488 // Start the animation
4491 bool signalReceived(false);
4492 AnimationFinishCheck finishCheck(signalReceived);
4493 animation.FinishedSignal().Connect(&application, finishCheck);
4495 application.SendNotification();
4496 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4498 // We didn't expect the animation to finish yet
4499 application.SendNotification();
4500 finishCheck.CheckSignalNotReceived();
4501 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4503 application.SendNotification();
4504 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4506 // We did expect the animation to finish
4507 application.SendNotification();
4508 finishCheck.CheckSignalReceived();
4509 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4511 // Check that nothing has changed after a couple of buffer swaps
4512 application.Render(0);
4513 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4514 application.Render(0);
4515 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4519 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4521 TestApplication application;
4523 Actor actor = Actor::New();
4524 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4525 actor.SetPosition(startPosition);
4526 Stage::GetCurrent().Add(actor);
4527 application.SendNotification();
4528 application.Render(0);
4529 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4531 // Build the animation
4532 float durationSeconds(1.0f);
4533 Animation animation = Animation::New(durationSeconds);
4534 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4535 Vector3 relativePosition(targetPosition - startPosition);
4537 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4539 AlphaFunction::LINEAR,
4540 TimePeriod(delay, durationSeconds - delay));
4542 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4544 // Start the animation
4547 bool signalReceived(false);
4548 AnimationFinishCheck finishCheck(signalReceived);
4549 animation.FinishedSignal().Connect(&application, finishCheck);
4551 application.SendNotification();
4552 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4554 // We didn't expect the animation to finish yet
4555 application.SendNotification();
4556 finishCheck.CheckSignalNotReceived();
4557 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4559 application.SendNotification();
4560 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4562 // We did expect the animation to finish
4563 application.SendNotification();
4564 finishCheck.CheckSignalReceived();
4565 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4567 // Check that nothing has changed after a couple of buffer swaps
4568 application.Render(0);
4569 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4570 application.Render(0);
4571 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4575 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4577 TestApplication application;
4579 Actor actor = Actor::New();
4580 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4581 Stage::GetCurrent().Add(actor);
4582 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4584 // Build the animation
4585 float durationSeconds(1.0f);
4586 Animation animation = Animation::New(durationSeconds);
4587 Degree relativeRotationDegrees(360.0f);
4588 Radian relativeRotationRadians(relativeRotationDegrees);
4589 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4591 // Start the animation
4594 // Target value should be retrievable straight away
4595 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4597 bool signalReceived(false);
4598 AnimationFinishCheck finishCheck(signalReceived);
4599 animation.FinishedSignal().Connect(&application, finishCheck);
4601 application.SendNotification();
4602 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4604 // We didn't expect the animation to finish yet
4605 application.SendNotification();
4606 finishCheck.CheckSignalNotReceived();
4607 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4609 application.SendNotification();
4610 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4612 // We didn't expect the animation to finish yet
4613 application.SendNotification();
4614 finishCheck.CheckSignalNotReceived();
4615 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4617 application.SendNotification();
4618 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4620 // We didn't expect the animation to finish yet
4621 application.SendNotification();
4622 finishCheck.CheckSignalNotReceived();
4623 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4625 application.SendNotification();
4626 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4628 // We did expect the animation to finish
4629 application.SendNotification();
4630 finishCheck.CheckSignalReceived();
4631 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4635 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4637 TestApplication application;
4639 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4641 Actor actor = Actor::New();
4642 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4643 Stage::GetCurrent().Add(actor);
4644 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4646 // Build the animation
4647 float durationSeconds(1.0f);
4648 Animation animation = Animation::New(durationSeconds);
4649 Degree relativeRotationDegrees(710.0f);
4650 Radian relativeRotationRadians(relativeRotationDegrees);
4652 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4654 // Start the animation
4657 bool signalReceived(false);
4658 AnimationFinishCheck finishCheck(signalReceived);
4659 animation.FinishedSignal().Connect(&application, finishCheck);
4661 application.SendNotification();
4662 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% 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.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4669 application.SendNotification();
4670 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% 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.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4677 application.SendNotification();
4678 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4680 // We didn't expect the animation to finish yet
4681 application.SendNotification();
4682 finishCheck.CheckSignalNotReceived();
4683 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4685 application.SendNotification();
4686 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4688 // We did expect the animation to finish
4689 application.SendNotification();
4690 finishCheck.CheckSignalReceived();
4691 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4696 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4698 TestApplication application;
4700 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4702 Actor actor = Actor::New();
4703 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4704 Stage::GetCurrent().Add(actor);
4705 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4707 // Build the animation
4708 float durationSeconds(1.0f);
4709 Animation animation = Animation::New(durationSeconds);
4710 Degree relativeRotationDegrees(730.0f);
4711 Radian relativeRotationRadians(relativeRotationDegrees);
4713 Radian actualRotationRadians( Degree(10.0f) );
4715 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4717 // Start the animation
4720 bool signalReceived(false);
4721 AnimationFinishCheck finishCheck(signalReceived);
4722 animation.FinishedSignal().Connect(&application, finishCheck);
4724 application.SendNotification();
4725 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4727 // We didn't expect the animation to finish yet
4728 application.SendNotification();
4729 finishCheck.CheckSignalNotReceived();
4730 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4732 application.SendNotification();
4733 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4735 // We didn't expect the animation to finish yet
4736 application.SendNotification();
4737 finishCheck.CheckSignalNotReceived();
4738 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4740 application.SendNotification();
4741 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4743 // We didn't expect the animation to finish yet
4744 application.SendNotification();
4745 finishCheck.CheckSignalNotReceived();
4746 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4748 application.SendNotification();
4749 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4751 // We did expect the animation to finish
4752 application.SendNotification();
4753 finishCheck.CheckSignalReceived();
4754 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4755 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4760 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4762 TestApplication application;
4764 Actor actor = Actor::New();
4765 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4766 Stage::GetCurrent().Add(actor);
4767 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4769 // Build the animation
4770 float durationSeconds(1.0f);
4771 Animation animation = Animation::New(durationSeconds);
4772 Degree relativeRotationDegrees(360.0f);
4773 Radian relativeRotationRadians(relativeRotationDegrees);
4774 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4776 // Start the animation
4779 bool signalReceived(false);
4780 AnimationFinishCheck finishCheck(signalReceived);
4781 animation.FinishedSignal().Connect(&application, finishCheck);
4783 application.SendNotification();
4784 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4786 // We didn't expect the animation to finish yet
4787 application.SendNotification();
4788 finishCheck.CheckSignalNotReceived();
4789 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4791 application.SendNotification();
4792 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4794 // We didn't expect the animation to finish yet
4795 application.SendNotification();
4796 finishCheck.CheckSignalNotReceived();
4797 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4799 application.SendNotification();
4800 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4802 // We didn't expect the animation to finish yet
4803 application.SendNotification();
4804 finishCheck.CheckSignalNotReceived();
4805 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4807 application.SendNotification();
4808 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4810 // We did expect the animation to finish
4811 application.SendNotification();
4812 finishCheck.CheckSignalReceived();
4813 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4817 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4819 TestApplication application;
4821 Actor actor = Actor::New();
4822 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4823 Stage::GetCurrent().Add(actor);
4824 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4826 // Build the animation
4827 float durationSeconds(1.0f);
4828 Animation animation = Animation::New(durationSeconds);
4829 Degree relativeRotationDegrees(360.0f);
4830 Radian relativeRotationRadians(relativeRotationDegrees);
4832 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4833 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4835 // Start the animation
4838 bool signalReceived(false);
4839 AnimationFinishCheck finishCheck(signalReceived);
4840 animation.FinishedSignal().Connect(&application, finishCheck);
4842 application.SendNotification();
4843 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4845 // We didn't expect the animation to finish yet
4846 application.SendNotification();
4847 finishCheck.CheckSignalNotReceived();
4848 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4849 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4851 application.SendNotification();
4852 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4854 // We didn't expect the animation to finish yet
4855 application.SendNotification();
4856 finishCheck.CheckSignalNotReceived();
4857 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4858 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4860 application.SendNotification();
4861 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4863 // We didn't expect the animation to finish yet
4864 application.SendNotification();
4865 finishCheck.CheckSignalNotReceived();
4866 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4867 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4869 application.SendNotification();
4870 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4872 // We did expect the animation to finish
4873 application.SendNotification();
4874 finishCheck.CheckSignalReceived();
4875 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4879 int UtcDaliAnimationAnimateByActorScaleP(void)
4881 TestApplication application;
4883 Actor actor = Actor::New();
4884 Stage::GetCurrent().Add(actor);
4885 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4887 // Build the animation
4888 float durationSeconds(1.0f);
4889 Animation animation = Animation::New(durationSeconds);
4890 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4891 Vector3 relativeScale(targetScale - Vector3::ONE);
4892 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4894 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4896 // Start the animation
4899 // Target value should be retrievable straight away
4900 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
4902 bool signalReceived(false);
4903 AnimationFinishCheck finishCheck(signalReceived);
4904 animation.FinishedSignal().Connect(&application, finishCheck);
4906 application.SendNotification();
4907 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4909 // We didn't expect the animation to finish yet
4910 application.SendNotification();
4911 finishCheck.CheckSignalNotReceived();
4912 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4914 application.SendNotification();
4915 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4917 // We did expect the animation to finish
4918 application.SendNotification();
4919 finishCheck.CheckSignalReceived();
4920 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4923 finishCheck.Reset();
4924 actor.SetScale(Vector3::ONE);
4925 application.SendNotification();
4926 application.Render(0);
4927 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4929 // Repeat with a different (ease-in) alpha function
4930 animation = Animation::New(durationSeconds);
4931 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4932 animation.FinishedSignal().Connect(&application, finishCheck);
4935 application.SendNotification();
4936 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4938 // We didn't expect the animation to finish yet
4939 application.SendNotification();
4940 finishCheck.CheckSignalNotReceived();
4942 // The scale should have grown less, than with a linear alpha function
4943 Vector3 current(actor.GetCurrentScale());
4944 DALI_TEST_CHECK( current.x > 1.0f );
4945 DALI_TEST_CHECK( current.y > 1.0f );
4946 DALI_TEST_CHECK( current.z > 1.0f );
4947 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4948 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4949 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4951 application.SendNotification();
4952 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4954 // We did expect the animation to finish
4955 application.SendNotification();
4956 finishCheck.CheckSignalReceived();
4957 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4960 finishCheck.Reset();
4961 actor.SetScale(Vector3::ONE);
4962 application.SendNotification();
4963 application.Render(0);
4964 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4966 // Repeat with a delay
4968 animation = Animation::New(durationSeconds);
4969 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4970 animation.FinishedSignal().Connect(&application, finishCheck);
4973 application.SendNotification();
4974 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4976 // We didn't expect the animation to finish yet
4977 application.SendNotification();
4978 finishCheck.CheckSignalNotReceived();
4979 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4981 application.SendNotification();
4982 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4984 // We did expect the animation to finish
4985 application.SendNotification();
4986 finishCheck.CheckSignalReceived();
4987 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4991 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
4993 TestApplication application;
4995 Actor actor = Actor::New();
4996 Stage::GetCurrent().Add(actor);
4997 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4999 // Build the animation
5000 float durationSeconds(1.0f);
5001 Animation animation = Animation::New(durationSeconds);
5002 Vector3 targetScale(2.0f, 3.0f, 4.0f);
5003 Vector3 relativeScale(targetScale - Vector3::ONE);
5004 animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
5005 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
5006 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
5008 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5009 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5011 // Start the animation
5014 // Target value should be retrievable straight away
5015 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5016 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
5017 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
5018 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
5020 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Not changed yet
5022 application.SendNotification();
5023 application.Render( 1000 ); // 1 second progress
5025 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5030 int UtcDaliAnimationAnimateByActorColorP(void)
5032 TestApplication application;
5034 Actor actor = Actor::New();
5035 Stage::GetCurrent().Add(actor);
5036 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5038 // Build the animation
5039 float durationSeconds(1.0f);
5040 Animation animation = Animation::New(durationSeconds);
5041 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5042 Vector4 relativeColor( targetColor - Color::WHITE );
5043 animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
5045 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5046 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5048 // Start the animation
5051 // Target value should be retrievable straight away
5052 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5053 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5054 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5055 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5056 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5058 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5060 application.SendNotification();
5061 application.Render( 1000 ); // 1 second progress
5063 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5068 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5070 TestApplication application;
5072 Actor actor = Actor::New();
5073 Stage::GetCurrent().Add(actor);
5074 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5076 // Build the animation
5077 float durationSeconds(1.0f);
5078 Animation animation = Animation::New(durationSeconds);
5079 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5080 Vector4 relativeColor( targetColor - Color::WHITE );
5081 animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
5082 animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
5083 animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
5084 animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
5086 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5087 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5089 // Start the animation
5092 // Target value should be retrievable straight away
5093 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5094 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5095 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5096 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5097 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5099 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5101 application.SendNotification();
5102 application.Render( 1000 ); // 1 second progress
5104 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5109 int UtcDaliAnimationAnimateByActorSizeP(void)
5111 TestApplication application;
5113 Actor actor = Actor::New();
5114 Stage::GetCurrent().Add(actor);
5115 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5117 // Build the animation
5118 float durationSeconds(1.0f);
5119 Animation animation = Animation::New(durationSeconds);
5120 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5121 Vector3 relativeSize( targetSize - Vector3::ZERO );
5122 animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
5124 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5125 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5127 // Start the animation
5130 // Target value should be retrievable straight away
5131 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5132 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5133 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5134 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5136 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5138 application.SendNotification();
5139 application.Render( 1000 ); // 1 second progress
5141 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5146 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5148 TestApplication application;
5150 Actor actor = Actor::New();
5151 Stage::GetCurrent().Add(actor);
5152 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5154 // Build the animation
5155 float durationSeconds(1.0f);
5156 Animation animation = Animation::New(durationSeconds);
5157 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5158 Vector3 relativeSize( targetSize - Vector3::ZERO );
5159 animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
5160 animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
5161 animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
5163 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5164 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5166 // Start the animation
5169 // Target value should be retrievable straight away
5170 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5171 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5172 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5173 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5175 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5177 application.SendNotification();
5178 application.Render( 1000 ); // 1 second progress
5180 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5185 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5187 TestApplication application;
5189 Actor actor = Actor::New();
5190 Stage::GetCurrent().Add(actor);
5191 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5193 actor.SetVisible( false );
5195 application.SendNotification();
5196 application.Render();
5198 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
5200 // Build the animation
5201 float durationSeconds(1.0f);
5202 Animation animation = Animation::New(durationSeconds);
5203 bool targetVisibility( true );
5204 bool relativeVisibility( targetVisibility );
5205 animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
5207 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5209 // Start the animation
5212 // Target value should be retrievable straight away
5213 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
5214 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION ); // Not changed yet
5216 application.SendNotification();
5217 application.Render( 1000 ); // 1 second progress
5219 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5224 int UtcDaliAnimationAnimateToBooleanP(void)
5226 TestApplication application;
5228 Actor actor = Actor::New();
5230 // Register a boolean property
5231 const bool startValue(false);
5232 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5233 Stage::GetCurrent().Add(actor);
5234 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5235 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5237 // Build the animation
5238 float durationSeconds(2.0f);
5239 Animation animation = Animation::New(durationSeconds);
5240 const bool targetValue( !startValue );
5241 animation.AnimateTo(Property(actor, index), targetValue);
5243 // Start the animation
5246 bool signalReceived(false);
5247 AnimationFinishCheck finishCheck(signalReceived);
5248 animation.FinishedSignal().Connect(&application, finishCheck);
5250 application.SendNotification();
5251 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5253 // We didn't expect the animation to finish yet
5254 application.SendNotification();
5255 finishCheck.CheckSignalNotReceived();
5256 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5258 application.SendNotification();
5259 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5261 // We did expect the animation to finish
5262 application.SendNotification();
5263 finishCheck.CheckSignalReceived();
5264 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5266 // Check that nothing has changed after a couple of buffer swaps
5267 application.Render(0);
5268 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5269 application.Render(0);
5270 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5272 // Repeat with target value "false"
5273 animation = Animation::New(durationSeconds);
5274 const bool finalValue( !targetValue );
5275 animation.AnimateTo(Property(actor, index), finalValue);
5277 // Start the animation
5280 finishCheck.Reset();
5281 animation.FinishedSignal().Connect(&application, finishCheck);
5283 application.SendNotification();
5284 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5286 // We didn't expect the animation to finish yet
5287 application.SendNotification();
5288 finishCheck.CheckSignalNotReceived();
5289 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5291 application.SendNotification();
5292 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5294 // We did expect the animation to finish
5295 application.SendNotification();
5296 finishCheck.CheckSignalReceived();
5297 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5299 // Check that nothing has changed after a couple of buffer swaps
5300 application.Render(0);
5301 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5302 application.Render(0);
5303 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5307 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5309 TestApplication application;
5311 Actor actor = Actor::New();
5313 // Register a boolean property
5314 const bool startValue(false);
5315 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5316 Stage::GetCurrent().Add(actor);
5317 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5318 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5320 // Build the animation
5321 float durationSeconds(2.0f);
5322 Animation animation = Animation::New(durationSeconds);
5323 const bool targetValue( !startValue );
5324 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5326 // Start the animation
5329 bool signalReceived(false);
5330 AnimationFinishCheck finishCheck(signalReceived);
5331 animation.FinishedSignal().Connect(&application, finishCheck);
5333 application.SendNotification();
5334 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5336 // We didn't expect the animation to finish yet
5337 application.SendNotification();
5338 finishCheck.CheckSignalNotReceived();
5339 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5341 application.SendNotification();
5342 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5344 // We did expect the animation to finish
5345 application.SendNotification();
5346 finishCheck.CheckSignalReceived();
5347 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5349 // Check that nothing has changed after a couple of buffer swaps
5350 application.Render(0);
5351 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5352 application.Render(0);
5353 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5355 // Repeat with target value "false"
5356 animation = Animation::New(durationSeconds);
5357 const bool finalValue( !targetValue );
5358 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5360 // Start the animation
5363 finishCheck.Reset();
5364 animation.FinishedSignal().Connect(&application, finishCheck);
5366 application.SendNotification();
5367 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5369 // We didn't expect the animation to finish yet
5370 application.SendNotification();
5371 finishCheck.CheckSignalNotReceived();
5372 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5374 application.SendNotification();
5375 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5377 // We did expect the animation to finish
5378 application.SendNotification();
5379 finishCheck.CheckSignalReceived();
5380 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5382 // Check that nothing has changed after a couple of buffer swaps
5383 application.Render(0);
5384 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5385 application.Render(0);
5386 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5390 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5392 TestApplication application;
5394 Actor actor = Actor::New();
5396 // Register a boolean property
5397 bool startValue(false);
5398 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5399 Stage::GetCurrent().Add(actor);
5400 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5401 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5403 // Build the animation
5404 float durationSeconds(2.0f);
5405 Animation animation = Animation::New(durationSeconds);
5406 bool finalValue( !startValue );
5407 float animatorDurationSeconds(durationSeconds * 0.5f);
5408 animation.AnimateTo( Property(actor, index),
5410 TimePeriod( animatorDurationSeconds ) );
5412 // Start the animation
5415 bool signalReceived(false);
5416 AnimationFinishCheck finishCheck(signalReceived);
5417 animation.FinishedSignal().Connect(&application, finishCheck);
5419 application.SendNotification();
5420 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5422 // We didn't expect the animation to finish yet
5423 application.SendNotification();
5424 finishCheck.CheckSignalNotReceived();
5425 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5427 application.SendNotification();
5428 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5430 // We didn't expect the animation to finish yet...
5431 application.SendNotification();
5432 finishCheck.CheckSignalNotReceived();
5434 // ...however we should have reached the final value
5435 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5437 application.SendNotification();
5438 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5440 // We did expect the animation to finish
5441 application.SendNotification();
5442 finishCheck.CheckSignalReceived();
5443 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5445 // Check that nothing has changed after a couple of buffer swaps
5446 application.Render(0);
5447 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5448 application.Render(0);
5449 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5453 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5455 TestApplication application;
5457 Actor actor = Actor::New();
5459 // Register a boolean property
5460 bool startValue(false);
5461 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5462 Stage::GetCurrent().Add(actor);
5463 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5464 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5466 // Build the animation
5467 float durationSeconds(2.0f);
5468 Animation animation = Animation::New(durationSeconds);
5469 bool finalValue( !startValue );
5470 float animatorDurationSeconds(durationSeconds * 0.5f);
5471 animation.AnimateTo( Property(actor, index),
5473 AlphaFunction::LINEAR,
5474 TimePeriod( animatorDurationSeconds ) );
5476 // Start the animation
5479 bool signalReceived(false);
5480 AnimationFinishCheck finishCheck(signalReceived);
5481 animation.FinishedSignal().Connect(&application, finishCheck);
5483 application.SendNotification();
5484 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5486 // We didn't expect the animation to finish yet
5487 application.SendNotification();
5488 finishCheck.CheckSignalNotReceived();
5489 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5491 application.SendNotification();
5492 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5494 // We didn't expect the animation to finish yet...
5495 application.SendNotification();
5496 finishCheck.CheckSignalNotReceived();
5498 // ...however we should have reached the final value
5499 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5501 application.SendNotification();
5502 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5504 // We did expect the animation to finish
5505 application.SendNotification();
5506 finishCheck.CheckSignalReceived();
5507 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5509 // Check that nothing has changed after a couple of buffer swaps
5510 application.Render(0);
5511 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5512 application.Render(0);
5513 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5517 int UtcDaliAnimationAnimateToFloatP(void)
5519 TestApplication application;
5521 Actor actor = Actor::New();
5523 // Register a float property
5524 float startValue(10.0f);
5525 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5526 Stage::GetCurrent().Add(actor);
5527 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5528 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5530 // Build the animation
5531 float durationSeconds(2.0f);
5532 Animation animation = Animation::New(durationSeconds);
5533 float targetValue(50.0f);
5534 float relativeValue(targetValue - startValue);
5535 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5537 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5539 // Start the animation
5542 bool signalReceived(false);
5543 AnimationFinishCheck finishCheck(signalReceived);
5544 animation.FinishedSignal().Connect(&application, finishCheck);
5546 application.SendNotification();
5547 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5549 // We didn't expect the animation to finish yet
5550 application.SendNotification();
5551 finishCheck.CheckSignalNotReceived();
5552 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5554 application.SendNotification();
5555 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5557 // We did expect the animation to finish
5558 application.SendNotification();
5559 finishCheck.CheckSignalReceived();
5560 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5564 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5566 TestApplication application;
5568 Actor actor = Actor::New();
5570 // Register a float property
5571 float startValue(10.0f);
5572 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5573 Stage::GetCurrent().Add(actor);
5574 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5575 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5577 // Build the animation
5578 float durationSeconds(1.0f);
5579 Animation animation = Animation::New(durationSeconds);
5580 float targetValue(90.0f);
5581 float relativeValue(targetValue - startValue);
5582 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5584 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5586 // Start the animation
5589 bool signalReceived(false);
5590 AnimationFinishCheck finishCheck(signalReceived);
5591 animation.FinishedSignal().Connect(&application, finishCheck);
5593 application.SendNotification();
5594 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5596 // We didn't expect the animation to finish yet
5597 application.SendNotification();
5598 finishCheck.CheckSignalNotReceived();
5600 // The position should have moved more, than with a linear alpha function
5601 float current( actor.GetCurrentProperty< float >( index ) );
5602 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5604 application.SendNotification();
5605 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5607 // We did expect the animation to finish
5608 application.SendNotification();
5609 finishCheck.CheckSignalReceived();
5610 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5614 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5616 TestApplication application;
5618 Actor actor = Actor::New();
5620 // Register a float property
5621 float startValue(10.0f);
5622 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5623 Stage::GetCurrent().Add(actor);
5624 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5625 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5627 // Build the animation
5628 float durationSeconds(1.0f);
5629 Animation animation = Animation::New(durationSeconds);
5630 float targetValue(30.0f);
5631 float relativeValue(targetValue - startValue);
5633 animation.AnimateTo(Property(actor, index),
5635 TimePeriod(delay, durationSeconds - delay));
5637 // Start the animation
5640 bool signalReceived(false);
5641 AnimationFinishCheck finishCheck(signalReceived);
5642 animation.FinishedSignal().Connect(&application, finishCheck);
5644 application.SendNotification();
5645 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5647 // We didn't expect the animation to finish yet
5648 application.SendNotification();
5649 finishCheck.CheckSignalNotReceived();
5650 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5652 application.SendNotification();
5653 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5655 // We didn't expect the animation to finish yet
5656 application.SendNotification();
5657 finishCheck.CheckSignalNotReceived();
5658 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5660 application.SendNotification();
5661 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5663 // We did expect the animation to finish
5664 application.SendNotification();
5665 finishCheck.CheckSignalReceived();
5666 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5670 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5672 TestApplication application;
5674 Actor actor = Actor::New();
5676 // Register a float property
5677 float startValue(10.0f);
5678 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5679 Stage::GetCurrent().Add(actor);
5680 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5681 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5683 // Build the animation
5684 float durationSeconds(1.0f);
5685 Animation animation = Animation::New(durationSeconds);
5686 float targetValue(30.0f);
5687 float relativeValue(targetValue - startValue);
5689 animation.AnimateTo(Property(actor, index),
5691 AlphaFunction::LINEAR,
5692 TimePeriod(delay, durationSeconds - delay));
5694 // Start the animation
5697 bool signalReceived(false);
5698 AnimationFinishCheck finishCheck(signalReceived);
5699 animation.FinishedSignal().Connect(&application, finishCheck);
5701 application.SendNotification();
5702 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5704 // We didn't expect the animation to finish yet
5705 application.SendNotification();
5706 finishCheck.CheckSignalNotReceived();
5707 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5709 application.SendNotification();
5710 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5712 // We didn't expect the animation to finish yet
5713 application.SendNotification();
5714 finishCheck.CheckSignalNotReceived();
5715 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5717 application.SendNotification();
5718 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5720 // We did expect the animation to finish
5721 application.SendNotification();
5722 finishCheck.CheckSignalReceived();
5723 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5727 int UtcDaliAnimationAnimateToIntegerP(void)
5729 TestApplication application;
5731 Actor actor = Actor::New();
5733 // Register an integer property
5735 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5736 Stage::GetCurrent().Add(actor);
5737 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5738 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5740 // Build the animation
5741 float durationSeconds(2.0f);
5742 Animation animation = Animation::New(durationSeconds);
5743 int targetValue(50);
5744 int relativeValue(targetValue - startValue);
5745 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5747 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5749 // Start the animation
5752 bool signalReceived(false);
5753 AnimationFinishCheck finishCheck(signalReceived);
5754 animation.FinishedSignal().Connect(&application, finishCheck);
5756 application.SendNotification();
5757 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5759 // We didn't expect the animation to finish yet
5760 application.SendNotification();
5761 finishCheck.CheckSignalNotReceived();
5762 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5764 application.SendNotification();
5765 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5767 // We did expect the animation to finish
5768 application.SendNotification();
5769 finishCheck.CheckSignalReceived();
5770 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5774 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5776 TestApplication application;
5778 Actor actor = Actor::New();
5780 // Register an integer property
5782 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5783 Stage::GetCurrent().Add(actor);
5784 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5785 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5787 // Build the animation
5788 float durationSeconds(1.0f);
5789 Animation animation = Animation::New(durationSeconds);
5790 int targetValue(90);
5791 int relativeValue(targetValue - startValue);
5792 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5794 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5796 // Start the animation
5799 bool signalReceived(false);
5800 AnimationFinishCheck finishCheck(signalReceived);
5801 animation.FinishedSignal().Connect(&application, finishCheck);
5803 application.SendNotification();
5804 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5806 // We didn't expect the animation to finish yet
5807 application.SendNotification();
5808 finishCheck.CheckSignalNotReceived();
5810 // The position should have moved more, than with a linear alpha function
5811 int current( actor.GetCurrentProperty< int >( index ) );
5812 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5814 application.SendNotification();
5815 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5817 // We did expect the animation to finish
5818 application.SendNotification();
5819 finishCheck.CheckSignalReceived();
5820 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5824 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5826 TestApplication application;
5828 Actor actor = Actor::New();
5830 // Register an integer property
5832 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5833 Stage::GetCurrent().Add(actor);
5834 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5835 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5837 // Build the animation
5838 float durationSeconds(1.0f);
5839 Animation animation = Animation::New(durationSeconds);
5840 int targetValue(30);
5841 int relativeValue(targetValue - startValue);
5843 animation.AnimateTo(Property(actor, index),
5845 TimePeriod(delay, durationSeconds - delay));
5847 // Start the animation
5850 bool signalReceived(false);
5851 AnimationFinishCheck finishCheck(signalReceived);
5852 animation.FinishedSignal().Connect(&application, finishCheck);
5854 application.SendNotification();
5855 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5857 // We didn't expect the animation to finish yet
5858 application.SendNotification();
5859 finishCheck.CheckSignalNotReceived();
5860 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5862 application.SendNotification();
5863 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5865 // We didn't expect the animation to finish yet
5866 application.SendNotification();
5867 finishCheck.CheckSignalNotReceived();
5868 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5870 application.SendNotification();
5871 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5873 // We did expect the animation to finish
5874 application.SendNotification();
5875 finishCheck.CheckSignalReceived();
5876 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5880 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5882 TestApplication application;
5884 Actor actor = Actor::New();
5886 // Register an integer property
5888 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5889 Stage::GetCurrent().Add(actor);
5890 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5891 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5893 // Build the animation
5894 float durationSeconds(1.0f);
5895 Animation animation = Animation::New(durationSeconds);
5896 int targetValue(30);
5897 int relativeValue(targetValue - startValue);
5899 animation.AnimateTo(Property(actor, index),
5901 AlphaFunction::LINEAR,
5902 TimePeriod(delay, durationSeconds - delay));
5904 // Start the animation
5907 bool signalReceived(false);
5908 AnimationFinishCheck finishCheck(signalReceived);
5909 animation.FinishedSignal().Connect(&application, finishCheck);
5911 application.SendNotification();
5912 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5914 // We didn't expect the animation to finish yet
5915 application.SendNotification();
5916 finishCheck.CheckSignalNotReceived();
5917 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5919 application.SendNotification();
5920 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5922 // We didn't expect the animation to finish yet
5923 application.SendNotification();
5924 finishCheck.CheckSignalNotReceived();
5925 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5927 application.SendNotification();
5928 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5930 // We did expect the animation to finish
5931 application.SendNotification();
5932 finishCheck.CheckSignalReceived();
5933 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5937 int UtcDaliAnimationAnimateToVector2P(void)
5939 TestApplication application;
5941 Actor actor = Actor::New();
5943 // Register a Vector2 property
5944 Vector2 startValue(-50.0f, -50.0f);
5945 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5946 Stage::GetCurrent().Add(actor);
5947 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5948 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5950 // Build the animation
5951 float durationSeconds(2.0f);
5952 Animation animation = Animation::New(durationSeconds);
5953 Vector2 targetValue(50.0f, 50.0f);
5954 Vector2 relativeValue(targetValue - startValue);
5955 animation.AnimateTo(Property(actor, index), targetValue);
5957 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5959 // Start the animation
5962 bool signalReceived(false);
5963 AnimationFinishCheck finishCheck(signalReceived);
5964 animation.FinishedSignal().Connect(&application, finishCheck);
5966 application.SendNotification();
5967 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5969 // We didn't expect the animation to finish yet
5970 application.SendNotification();
5971 finishCheck.CheckSignalNotReceived();
5972 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5974 application.SendNotification();
5975 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5977 // We did expect the animation to finish
5978 application.SendNotification();
5979 finishCheck.CheckSignalReceived();
5980 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5984 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5986 TestApplication application;
5988 Actor actor = Actor::New();
5990 // Register a Vector2 property
5991 Vector2 startValue(1000.0f, 1000.0f);
5992 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5993 Stage::GetCurrent().Add(actor);
5994 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5995 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5997 // Build the animation
5998 float durationSeconds(1.0f);
5999 Animation animation = Animation::New(durationSeconds);
6000 Vector2 targetValue(9000.0f, 9000.0f);
6001 Vector2 relativeValue(targetValue - startValue);
6002 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
6004 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6006 // Start the animation
6009 bool signalReceived(false);
6010 AnimationFinishCheck finishCheck(signalReceived);
6011 animation.FinishedSignal().Connect(&application, finishCheck);
6013 application.SendNotification();
6014 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6016 // We didn't expect the animation to finish yet
6017 application.SendNotification();
6018 finishCheck.CheckSignalNotReceived();
6020 // The position should have moved more, than with a linear alpha function
6021 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
6022 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6023 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6025 application.SendNotification();
6026 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6028 // We did expect the animation to finish
6029 application.SendNotification();
6030 finishCheck.CheckSignalReceived();
6031 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6035 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6037 TestApplication application;
6039 Actor actor = Actor::New();
6041 // Register a Vector2 property
6042 Vector2 startValue(10.0f, 10.0f);
6043 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6044 Stage::GetCurrent().Add(actor);
6045 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6046 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6048 // Build the animation
6049 float durationSeconds(1.0f);
6050 Animation animation = Animation::New(durationSeconds);
6051 Vector2 targetValue(-10.0f, 20.0f);
6052 Vector2 relativeValue(targetValue - startValue);
6054 animation.AnimateTo(Property(actor, index),
6056 TimePeriod(delay, durationSeconds - delay));
6058 // Start the animation
6061 bool signalReceived(false);
6062 AnimationFinishCheck finishCheck(signalReceived);
6063 animation.FinishedSignal().Connect(&application, finishCheck);
6065 application.SendNotification();
6066 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6068 // We didn't expect the animation to finish yet
6069 application.SendNotification();
6070 finishCheck.CheckSignalNotReceived();
6071 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6073 application.SendNotification();
6074 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6076 // We didn't expect the animation to finish yet
6077 application.SendNotification();
6078 finishCheck.CheckSignalNotReceived();
6079 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6081 application.SendNotification();
6082 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6084 // We did expect the animation to finish
6085 application.SendNotification();
6086 finishCheck.CheckSignalReceived();
6087 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6091 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6093 TestApplication application;
6095 Actor actor = Actor::New();
6097 // Register a Vector2 property
6098 Vector2 startValue(10.0f, 10.0f);
6099 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6100 Stage::GetCurrent().Add(actor);
6101 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6102 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6104 // Build the animation
6105 float durationSeconds(1.0f);
6106 Animation animation = Animation::New(durationSeconds);
6107 Vector2 targetValue(30.0f, 30.0f);
6108 Vector2 relativeValue(targetValue - startValue);
6110 animation.AnimateTo(Property(actor, index),
6112 AlphaFunction::LINEAR,
6113 TimePeriod(delay, durationSeconds - delay));
6115 // Start the animation
6118 bool signalReceived(false);
6119 AnimationFinishCheck finishCheck(signalReceived);
6120 animation.FinishedSignal().Connect(&application, finishCheck);
6122 application.SendNotification();
6123 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6125 // We didn't expect the animation to finish yet, but cached value should be the final one
6126 application.SendNotification();
6127 finishCheck.CheckSignalNotReceived();
6128 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6129 DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
6131 application.SendNotification();
6132 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6134 // We didn't expect the animation to finish yet
6135 application.SendNotification();
6136 finishCheck.CheckSignalNotReceived();
6137 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6139 application.SendNotification();
6140 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6142 // We did expect the animation to finish
6143 application.SendNotification();
6144 finishCheck.CheckSignalReceived();
6145 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6146 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6150 int UtcDaliAnimationAnimateToVector3P(void)
6152 TestApplication application;
6154 Actor actor = Actor::New();
6156 // Register a Vector3 property
6157 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6158 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6159 Stage::GetCurrent().Add(actor);
6160 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
6161 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6163 // Build the animation
6164 float durationSeconds(2.0f);
6165 Animation animation = Animation::New(durationSeconds);
6166 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6167 Vector3 relativeValue(targetValue - startValue);
6168 animation.AnimateTo(Property(actor, index), targetValue);
6170 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6172 // Start the animation
6175 bool signalReceived(false);
6176 AnimationFinishCheck finishCheck(signalReceived);
6177 animation.FinishedSignal().Connect(&application, finishCheck);
6179 application.SendNotification();
6180 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6182 // We didn't expect the animation to finish yet
6183 application.SendNotification();
6184 finishCheck.CheckSignalNotReceived();
6185 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6187 application.SendNotification();
6188 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6190 // We did expect the animation to finish
6191 application.SendNotification();
6192 finishCheck.CheckSignalReceived();
6193 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6197 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6199 TestApplication application;
6201 Actor actor = Actor::New();
6203 // Register a Vector3 property
6204 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6205 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6206 Stage::GetCurrent().Add(actor);
6207 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6208 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6210 // Build the animation
6211 float durationSeconds(1.0f);
6212 Animation animation = Animation::New(durationSeconds);
6213 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6214 Vector3 relativeValue(targetValue - startValue);
6215 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6217 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6219 // Start the animation
6222 bool signalReceived(false);
6223 AnimationFinishCheck finishCheck(signalReceived);
6224 animation.FinishedSignal().Connect(&application, finishCheck);
6226 application.SendNotification();
6227 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6229 // We didn't expect the animation to finish yet
6230 application.SendNotification();
6231 finishCheck.CheckSignalNotReceived();
6233 // The position should have moved more, than with a linear alpha function
6234 Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
6235 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6236 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6237 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6239 application.SendNotification();
6240 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6242 // We did expect the animation to finish
6243 application.SendNotification();
6244 finishCheck.CheckSignalReceived();
6245 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6249 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6251 TestApplication application;
6253 Actor actor = Actor::New();
6255 // Register a Vector3 property
6256 Vector3 startValue(10.0f, 10.0f, 10.0f);
6257 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6258 Stage::GetCurrent().Add(actor);
6259 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6260 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6262 // Build the animation
6263 float durationSeconds(1.0f);
6264 Animation animation = Animation::New(durationSeconds);
6265 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6266 Vector3 relativeValue(targetValue - startValue);
6268 animation.AnimateTo(Property(actor, index),
6270 TimePeriod(delay, durationSeconds - delay));
6272 // Start the animation
6275 bool signalReceived(false);
6276 AnimationFinishCheck finishCheck(signalReceived);
6277 animation.FinishedSignal().Connect(&application, finishCheck);
6279 application.SendNotification();
6280 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6282 // We didn't expect the animation to finish yet
6283 application.SendNotification();
6284 finishCheck.CheckSignalNotReceived();
6285 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6287 application.SendNotification();
6288 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6290 // We didn't expect the animation to finish yet
6291 application.SendNotification();
6292 finishCheck.CheckSignalNotReceived();
6293 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6295 application.SendNotification();
6296 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6298 // We did expect the animation to finish
6299 application.SendNotification();
6300 finishCheck.CheckSignalReceived();
6301 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6305 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6307 TestApplication application;
6309 Actor actor = Actor::New();
6311 // Register a Vector3 property
6312 Vector3 startValue(10.0f, 10.0f, 10.0f);
6313 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6314 Stage::GetCurrent().Add(actor);
6315 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6316 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6318 // Build the animation
6319 float durationSeconds(1.0f);
6320 Animation animation = Animation::New(durationSeconds);
6321 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6322 Vector3 relativeValue(targetValue - startValue);
6324 animation.AnimateTo(Property(actor, "testProperty"),
6326 AlphaFunction::LINEAR,
6327 TimePeriod(delay, durationSeconds - delay));
6329 // Start the animation
6332 bool signalReceived(false);
6333 AnimationFinishCheck finishCheck(signalReceived);
6334 animation.FinishedSignal().Connect(&application, finishCheck);
6336 application.SendNotification();
6337 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6339 // We didn't expect the animation to finish yet
6340 application.SendNotification();
6341 finishCheck.CheckSignalNotReceived();
6342 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6344 application.SendNotification();
6345 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6347 // We didn't expect the animation to finish yet
6348 application.SendNotification();
6349 finishCheck.CheckSignalNotReceived();
6350 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6352 application.SendNotification();
6353 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6355 // We did expect the animation to finish
6356 application.SendNotification();
6357 finishCheck.CheckSignalReceived();
6358 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6362 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6364 TestApplication application;
6366 Actor actor = Actor::New();
6368 // Register a Vector3 property
6369 Vector3 startValue(10.0f, 10.0f, 10.0f);
6370 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6371 Stage::GetCurrent().Add(actor);
6372 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6373 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6375 // Build the animation
6376 float durationSeconds(1.0f);
6377 Animation animation = Animation::New(durationSeconds);
6378 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6379 Vector3 relativeValue(targetValue - startValue);
6381 animation.AnimateTo(Property(actor, "testProperty", 0),
6383 AlphaFunction::LINEAR,
6384 TimePeriod(delay, durationSeconds - delay));
6385 animation.AnimateTo(Property(actor, index, 1),
6387 AlphaFunction::LINEAR,
6388 TimePeriod(delay, durationSeconds - delay));
6390 // Start the animation
6393 bool signalReceived(false);
6394 AnimationFinishCheck finishCheck(signalReceived);
6395 animation.FinishedSignal().Connect(&application, finishCheck);
6397 application.SendNotification();
6398 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6400 // We didn't expect the animation to finish yet
6401 application.SendNotification();
6402 finishCheck.CheckSignalNotReceived();
6403 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6405 application.SendNotification();
6406 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6408 // We didn't expect the animation to finish yet
6409 application.SendNotification();
6410 finishCheck.CheckSignalNotReceived();
6411 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6413 application.SendNotification();
6414 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6416 // We did expect the animation to finish
6417 application.SendNotification();
6418 finishCheck.CheckSignalReceived();
6419 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6423 int UtcDaliAnimationAnimateToVector4P(void)
6425 TestApplication application;
6427 Actor actor = Actor::New();
6429 // Register a Vector4 property
6430 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6431 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6432 Stage::GetCurrent().Add(actor);
6433 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6434 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6436 // Build the animation
6437 float durationSeconds(2.0f);
6438 Animation animation = Animation::New(durationSeconds);
6439 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6440 Vector4 relativeValue(targetValue - startValue);
6441 animation.AnimateTo(Property(actor, index), targetValue);
6443 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6445 // Start the animation
6448 bool signalReceived(false);
6449 AnimationFinishCheck finishCheck(signalReceived);
6450 animation.FinishedSignal().Connect(&application, finishCheck);
6452 application.SendNotification();
6453 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6455 // We didn't expect the animation to finish yet
6456 application.SendNotification();
6457 finishCheck.CheckSignalNotReceived();
6458 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6460 application.SendNotification();
6461 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6463 // We did expect the animation to finish
6464 application.SendNotification();
6465 finishCheck.CheckSignalReceived();
6466 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6470 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6472 TestApplication application;
6474 Actor actor = Actor::New();
6476 // Register a Vector4 property
6477 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6478 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6479 Stage::GetCurrent().Add(actor);
6480 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6481 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6483 // Build the animation
6484 float durationSeconds(1.0f);
6485 Animation animation = Animation::New(durationSeconds);
6486 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6487 Vector4 relativeValue(targetValue - startValue);
6488 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6490 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6492 // Start the animation
6495 bool signalReceived(false);
6496 AnimationFinishCheck finishCheck(signalReceived);
6497 animation.FinishedSignal().Connect(&application, finishCheck);
6499 application.SendNotification();
6500 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6502 // We didn't expect the animation to finish yet
6503 application.SendNotification();
6504 finishCheck.CheckSignalNotReceived();
6506 // The position should have moved more, than with a linear alpha function
6507 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6508 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6509 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6510 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6511 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6513 application.SendNotification();
6514 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6516 // We did expect the animation to finish
6517 application.SendNotification();
6518 finishCheck.CheckSignalReceived();
6519 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6523 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6525 TestApplication application;
6527 Actor actor = Actor::New();
6529 // Register a Vector4 property
6530 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6531 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6532 Stage::GetCurrent().Add(actor);
6533 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6534 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6536 // Build the animation
6537 float durationSeconds(1.0f);
6538 Animation animation = Animation::New(durationSeconds);
6539 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6540 Vector4 relativeValue(targetValue - startValue);
6542 animation.AnimateTo(Property(actor, index),
6544 TimePeriod(delay, durationSeconds - delay));
6546 // Start the animation
6549 bool signalReceived(false);
6550 AnimationFinishCheck finishCheck(signalReceived);
6551 animation.FinishedSignal().Connect(&application, finishCheck);
6553 application.SendNotification();
6554 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6556 // We didn't expect the animation to finish yet
6557 application.SendNotification();
6558 finishCheck.CheckSignalNotReceived();
6559 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6561 application.SendNotification();
6562 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6564 // We didn't expect the animation to finish yet
6565 application.SendNotification();
6566 finishCheck.CheckSignalNotReceived();
6567 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6569 application.SendNotification();
6570 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6572 // We did expect the animation to finish
6573 application.SendNotification();
6574 finishCheck.CheckSignalReceived();
6575 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6579 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6581 TestApplication application;
6583 Actor actor = Actor::New();
6585 // Register a Vector4 property
6586 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6587 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6588 Stage::GetCurrent().Add(actor);
6589 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6590 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6592 // Build the animation
6593 float durationSeconds(1.0f);
6594 Animation animation = Animation::New(durationSeconds);
6595 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6596 Vector4 relativeValue(targetValue - startValue);
6598 animation.AnimateTo(Property(actor, index),
6600 AlphaFunction::LINEAR,
6601 TimePeriod(delay, durationSeconds - delay));
6603 // Start the animation
6606 bool signalReceived(false);
6607 AnimationFinishCheck finishCheck(signalReceived);
6608 animation.FinishedSignal().Connect(&application, finishCheck);
6610 application.SendNotification();
6611 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6613 // We didn't expect the animation to finish yet
6614 application.SendNotification();
6615 finishCheck.CheckSignalNotReceived();
6616 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6618 application.SendNotification();
6619 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6621 // We didn't expect the animation to finish yet
6622 application.SendNotification();
6623 finishCheck.CheckSignalNotReceived();
6624 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6626 application.SendNotification();
6627 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6629 // We did expect the animation to finish
6630 application.SendNotification();
6631 finishCheck.CheckSignalReceived();
6632 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6636 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6638 TestApplication application;
6640 Actor actor = Actor::New();
6641 Stage::GetCurrent().Add(actor);
6642 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6644 // Build the animation
6645 float durationSeconds(1.0f);
6646 Animation animation = Animation::New(durationSeconds);
6647 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6651 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6653 catch (Dali::DaliException& e)
6655 DALI_TEST_PRINT_ASSERT( e );
6656 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6661 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6663 TestApplication application;
6665 Actor actor = Actor::New();
6666 Stage::GetCurrent().Add(actor);
6667 float startValue(0.0f);
6668 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6669 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6671 // Build the animation
6672 float durationSeconds(1.0f);
6673 Animation animation = Animation::New(durationSeconds);
6674 float targetX(1.0f);
6678 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6680 catch (Dali::DaliException& e)
6682 DALI_TEST_PRINT_ASSERT( e );
6683 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6688 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6690 TestApplication application;
6692 Actor actor = Actor::New();
6693 Stage::GetCurrent().Add(actor);
6694 float startValue(0.0f);
6695 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6696 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6698 // Build the animation
6699 float durationSeconds(1.0f);
6700 Animation animation = Animation::New(durationSeconds);
6701 float targetY(1.0f);
6705 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6707 catch (Dali::DaliException& e)
6709 DALI_TEST_PRINT_ASSERT( e );
6710 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6715 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6717 TestApplication application;
6719 Actor actor = Actor::New();
6720 Stage::GetCurrent().Add(actor);
6721 float startValue(0.5f);
6722 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6723 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6725 // Build the animation
6726 float durationSeconds(1.0f);
6727 Animation animation = Animation::New(durationSeconds);
6728 float targetZ(1.0f);
6732 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6734 catch (Dali::DaliException& e)
6736 DALI_TEST_PRINT_ASSERT( e );
6737 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6742 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6744 TestApplication application;
6746 Actor actor = Actor::New();
6747 Stage::GetCurrent().Add(actor);
6748 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6750 // Build the animation
6751 float durationSeconds(1.0f);
6752 Animation animation = Animation::New(durationSeconds);
6753 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6757 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6759 catch (Dali::DaliException& e)
6761 DALI_TEST_PRINT_ASSERT( e );
6762 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6767 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6769 TestApplication application;
6771 Actor actor = Actor::New();
6772 Stage::GetCurrent().Add(actor);
6773 float startValue(0.5f);
6774 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6775 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6777 // Build the animation
6778 float durationSeconds(1.0f);
6779 Animation animation = Animation::New(durationSeconds);
6780 float targetX(1.0f);
6784 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6786 catch (Dali::DaliException& e)
6788 DALI_TEST_PRINT_ASSERT( e );
6789 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6794 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6796 TestApplication application;
6798 Actor actor = Actor::New();
6799 Stage::GetCurrent().Add(actor);
6800 float startValue(0.5f);
6801 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6802 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6804 // Build the animation
6805 float durationSeconds(1.0f);
6806 Animation animation = Animation::New(durationSeconds);
6807 float targetY(0.0f);
6811 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6813 catch (Dali::DaliException& e)
6815 DALI_TEST_PRINT_ASSERT( e );
6816 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6821 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6823 TestApplication application;
6825 Actor actor = Actor::New();
6826 Stage::GetCurrent().Add(actor);
6827 float startValue(0.5f);
6828 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6829 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6831 // Build the animation
6832 float durationSeconds(1.0f);
6833 Animation animation = Animation::New(durationSeconds);
6834 float targetZ(100.0f);
6838 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6840 catch (Dali::DaliException& e)
6842 DALI_TEST_PRINT_ASSERT( e );
6843 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6848 int UtcDaliAnimationAnimateToActorSizeP(void)
6850 TestApplication application;
6852 Actor actor = Actor::New();
6853 Stage::GetCurrent().Add(actor);
6854 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6856 // Build the animation
6857 float durationSeconds(1.0f);
6858 Animation animation = Animation::New(durationSeconds);
6859 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6860 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6862 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6864 // Should return the initial properties before play
6865 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6866 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
6867 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
6868 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
6870 // Start the animation
6873 // Should return the target property after play
6874 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
6875 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
6876 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
6877 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
6879 bool signalReceived(false);
6880 AnimationFinishCheck finishCheck(signalReceived);
6881 animation.FinishedSignal().Connect(&application, finishCheck);
6883 application.SendNotification();
6884 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6886 // We didn't expect the animation to finish yet
6887 application.SendNotification();
6888 finishCheck.CheckSignalNotReceived();
6889 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6891 application.SendNotification();
6892 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6894 // We did expect the animation to finish
6895 application.SendNotification();
6896 finishCheck.CheckSignalReceived();
6897 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6900 finishCheck.Reset();
6901 actor.SetSize(Vector3::ZERO);
6902 application.SendNotification();
6903 application.Render(0);
6904 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6906 // Repeat with a different (ease-in) alpha function
6907 animation = Animation::New(durationSeconds);
6908 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6909 animation.FinishedSignal().Connect(&application, finishCheck);
6912 application.SendNotification();
6913 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6915 // We didn't expect the animation to finish yet
6916 application.SendNotification();
6917 finishCheck.CheckSignalNotReceived();
6919 // The size should have travelled less, than with a linear alpha function
6920 Vector3 current(actor.GetCurrentSize());
6921 DALI_TEST_CHECK( current.x > 0.0f );
6922 DALI_TEST_CHECK( current.y > 0.0f );
6923 DALI_TEST_CHECK( current.z > 0.0f );
6924 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6925 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6926 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6928 application.SendNotification();
6929 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6931 // We did expect the animation to finish
6932 application.SendNotification();
6933 finishCheck.CheckSignalReceived();
6934 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6937 finishCheck.Reset();
6938 actor.SetSize(Vector3::ZERO);
6939 application.SendNotification();
6940 application.Render(0);
6941 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6943 // Repeat with a delay
6945 animation = Animation::New(durationSeconds);
6946 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6947 animation.FinishedSignal().Connect(&application, finishCheck);
6950 application.SendNotification();
6951 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6953 // We didn't expect the animation to finish yet
6954 application.SendNotification();
6955 finishCheck.CheckSignalNotReceived();
6956 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6958 application.SendNotification();
6959 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6961 // We did expect the animation to finish
6962 application.SendNotification();
6963 finishCheck.CheckSignalReceived();
6964 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6968 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6970 TestApplication application;
6972 Actor actor = Actor::New();
6973 Stage::GetCurrent().Add(actor);
6974 float startValue(0.0f);
6975 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6976 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6978 // Build the animation
6979 float durationSeconds(1.0f);
6980 Animation animation = Animation::New(durationSeconds);
6981 float targetWidth(10.0f);
6982 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6984 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6986 // Should return the initial properties before play
6987 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6988 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
6990 // Start the animation
6993 // Should return the target property after play
6994 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
6995 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
6997 bool signalReceived(false);
6998 AnimationFinishCheck finishCheck(signalReceived);
6999 animation.FinishedSignal().Connect(&application, finishCheck);
7001 application.SendNotification();
7002 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7004 // We didn't expect the animation to finish yet
7005 application.SendNotification();
7006 finishCheck.CheckSignalNotReceived();
7007 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
7009 application.SendNotification();
7010 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7012 // We did expect the animation to finish
7013 application.SendNotification();
7014 finishCheck.CheckSignalReceived();
7015 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
7016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
7020 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7022 TestApplication application;
7024 Actor actor = Actor::New();
7025 Stage::GetCurrent().Add(actor);
7026 float startValue(0.0f);
7027 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
7028 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
7030 // Build the animation
7031 float durationSeconds(1.0f);
7032 Animation animation = Animation::New(durationSeconds);
7033 float targetHeight(-10.0f);
7034 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
7036 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
7038 // Should return the initial properties before play
7039 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7040 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
7042 // Start the animation
7045 // Should return the target property after play
7046 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
7047 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
7049 bool signalReceived(false);
7050 AnimationFinishCheck finishCheck(signalReceived);
7051 animation.FinishedSignal().Connect(&application, finishCheck);
7053 application.SendNotification();
7054 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7056 // We didn't expect the animation to finish yet
7057 application.SendNotification();
7058 finishCheck.CheckSignalNotReceived();
7059 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
7061 application.SendNotification();
7062 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7064 // We did expect the animation to finish
7065 application.SendNotification();
7066 finishCheck.CheckSignalReceived();
7067 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
7068 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
7072 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7074 TestApplication application;
7076 Actor actor = Actor::New();
7077 Stage::GetCurrent().Add(actor);
7078 float startValue(0.0f);
7079 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
7080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
7082 // Build the animation
7083 float durationSeconds(1.0f);
7084 Animation animation = Animation::New(durationSeconds);
7085 float targetDepth(-10.0f);
7086 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
7088 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
7090 // Should return the initial properties before play
7091 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7092 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
7094 // Start the animation
7097 // Should return the target property after play
7098 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
7099 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
7101 bool signalReceived(false);
7102 AnimationFinishCheck finishCheck(signalReceived);
7103 animation.FinishedSignal().Connect(&application, finishCheck);
7105 application.SendNotification();
7106 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7108 // We didn't expect the animation to finish yet
7109 application.SendNotification();
7110 finishCheck.CheckSignalNotReceived();
7111 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
7113 application.SendNotification();
7114 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7116 // We did expect the animation to finish
7117 application.SendNotification();
7118 finishCheck.CheckSignalReceived();
7119 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
7120 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
7124 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7126 TestApplication application;
7128 Actor actor = Actor::New();
7129 Stage::GetCurrent().Add(actor);
7130 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7132 // Build the animation
7133 float durationSeconds(1.0f);
7134 Animation animation = Animation::New(durationSeconds);
7135 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7136 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
7138 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7140 // Start the animation
7143 bool signalReceived(false);
7144 AnimationFinishCheck finishCheck(signalReceived);
7145 animation.FinishedSignal().Connect(&application, finishCheck);
7147 application.SendNotification();
7148 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7150 // We didn't expect the animation to finish yet
7151 application.SendNotification();
7152 finishCheck.CheckSignalNotReceived();
7153 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
7155 application.SendNotification();
7156 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7158 // We did expect the animation to finish
7159 application.SendNotification();
7160 finishCheck.CheckSignalReceived();
7161 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7164 finishCheck.Reset();
7165 actor.SetSize(Vector3::ZERO);
7166 application.SendNotification();
7167 application.Render(0);
7168 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7170 // Repeat with a different (ease-in) alpha function
7171 animation = Animation::New(durationSeconds);
7172 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
7173 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
7174 animation.FinishedSignal().Connect(&application, finishCheck);
7177 application.SendNotification();
7178 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7180 // We didn't expect the animation to finish yet
7181 application.SendNotification();
7182 finishCheck.CheckSignalNotReceived();
7184 // The size should have travelled less, than with a linear alpha function
7185 Vector3 current(actor.GetCurrentSize());
7186 DALI_TEST_CHECK( current.x > 0.0f );
7187 DALI_TEST_CHECK( current.y > 0.0f );
7188 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7189 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7191 application.SendNotification();
7192 application.Render(static_cast<unsigned int>(durationSeconds*10.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.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7198 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7201 finishCheck.Reset();
7202 actor.SetSize(Vector3::ZERO);
7203 application.SendNotification();
7204 application.Render(0);
7205 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7207 // Repeat with a delay
7209 animation = Animation::New(durationSeconds);
7210 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7211 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7212 animation.FinishedSignal().Connect(&application, finishCheck);
7215 application.SendNotification();
7216 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7218 // We didn't expect the animation to finish yet
7219 application.SendNotification();
7220 finishCheck.CheckSignalNotReceived();
7221 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7223 application.SendNotification();
7224 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7226 // We did expect the animation to finish
7227 application.SendNotification();
7228 finishCheck.CheckSignalReceived();
7229 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7230 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7234 int UtcDaliAnimationAnimateToActorPositionP(void)
7236 TestApplication application;
7238 Actor actor = Actor::New();
7239 Stage::GetCurrent().Add(actor);
7240 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7242 // Build the animation
7243 float durationSeconds(1.0f);
7244 Animation animation = Animation::New(durationSeconds);
7245 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7246 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7248 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7250 // Should return the initial properties before play
7251 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7252 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
7253 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
7254 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
7256 // Start the animation
7259 // Should return the target property after play
7260 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7261 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
7262 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
7263 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
7265 bool signalReceived(false);
7266 AnimationFinishCheck finishCheck(signalReceived);
7267 animation.FinishedSignal().Connect(&application, finishCheck);
7269 application.SendNotification();
7270 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7272 // We didn't expect the animation to finish yet
7273 application.SendNotification();
7274 finishCheck.CheckSignalNotReceived();
7275 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7277 application.SendNotification();
7278 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7280 // We did expect the animation to finish
7281 application.SendNotification();
7282 finishCheck.CheckSignalReceived();
7283 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7287 int UtcDaliAnimationAnimateToActorPositionXP(void)
7289 TestApplication application;
7291 Actor actor = Actor::New();
7292 Stage::GetCurrent().Add(actor);
7293 float startValue(0.0f);
7294 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
7295 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7296 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7297 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7299 // Build the animation
7300 float durationSeconds(1.0f);
7301 Animation animation = Animation::New(durationSeconds);
7302 float targetX(1.0f);
7303 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
7305 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7307 // Should return the initial properties before play
7308 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7309 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
7311 // Start the animation
7314 // Should return the target property after play
7315 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7316 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7318 bool signalReceived(false);
7319 AnimationFinishCheck finishCheck(signalReceived);
7320 animation.FinishedSignal().Connect(&application, finishCheck);
7322 application.SendNotification();
7323 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7325 // We didn't expect the animation to finish yet
7326 application.SendNotification();
7327 finishCheck.CheckSignalNotReceived();
7328 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
7330 application.SendNotification();
7331 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7333 // We did expect the animation to finish
7334 application.SendNotification();
7335 finishCheck.CheckSignalReceived();
7336 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
7337 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7338 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7339 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7343 int UtcDaliAnimationAnimateToActorPositionYP(void)
7345 TestApplication application;
7347 Actor actor = Actor::New();
7348 Stage::GetCurrent().Add(actor);
7349 float startValue(0.0f);
7350 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7351 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7352 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7353 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7355 // Build the animation
7356 float durationSeconds(1.0f);
7357 Animation animation = Animation::New(durationSeconds);
7358 float targetY(10.0f);
7359 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7361 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7363 // Should return the initial properties before play
7364 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7365 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7367 // Start the animation
7370 // Should return the target property after play
7371 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7372 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7374 bool signalReceived(false);
7375 AnimationFinishCheck finishCheck(signalReceived);
7376 animation.FinishedSignal().Connect(&application, finishCheck);
7378 application.SendNotification();
7379 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7381 // We didn't expect the animation to finish yet
7382 application.SendNotification();
7383 finishCheck.CheckSignalNotReceived();
7384 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7386 application.SendNotification();
7387 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7389 // We did expect the animation to finish
7390 application.SendNotification();
7391 finishCheck.CheckSignalReceived();
7392 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7393 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7394 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7395 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7399 int UtcDaliAnimationAnimateToActorPositionZP(void)
7401 TestApplication application;
7403 Actor actor = Actor::New();
7404 Stage::GetCurrent().Add(actor);
7405 float startValue(0.0f);
7406 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7407 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7408 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7409 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7411 // Build the animation
7412 float durationSeconds(1.0f);
7413 Animation animation = Animation::New(durationSeconds);
7414 float targetZ(-5.0f);
7415 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7417 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7419 // Should return the initial properties before play
7420 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7421 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7423 // Start the animation
7426 // Should return the target property after play
7427 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7428 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7430 bool signalReceived(false);
7431 AnimationFinishCheck finishCheck(signalReceived);
7432 animation.FinishedSignal().Connect(&application, finishCheck);
7434 application.SendNotification();
7435 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7437 // We didn't expect the animation to finish yet
7438 application.SendNotification();
7439 finishCheck.CheckSignalNotReceived();
7440 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7442 application.SendNotification();
7443 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7445 // We did expect the animation to finish
7446 application.SendNotification();
7447 finishCheck.CheckSignalReceived();
7448 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7449 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7450 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7451 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7455 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7457 TestApplication application;
7459 Actor actor = Actor::New();
7460 Stage::GetCurrent().Add(actor);
7461 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7463 // Build the animation
7464 float durationSeconds(1.0f);
7465 Animation animation = Animation::New(durationSeconds);
7466 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7467 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7469 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7471 // Start the animation
7474 bool signalReceived(false);
7475 AnimationFinishCheck finishCheck(signalReceived);
7476 animation.FinishedSignal().Connect(&application, finishCheck);
7478 application.SendNotification();
7479 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7481 // We didn't expect the animation to finish yet
7482 application.SendNotification();
7483 finishCheck.CheckSignalNotReceived();
7485 // The position should have moved less, than with a linear alpha function
7486 Vector3 current(actor.GetCurrentPosition());
7487 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7488 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7489 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7490 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7491 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7492 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7494 application.SendNotification();
7495 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7497 // We did expect the animation to finish
7498 application.SendNotification();
7499 finishCheck.CheckSignalReceived();
7500 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7504 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7506 TestApplication application;
7508 Actor actor = Actor::New();
7509 Stage::GetCurrent().Add(actor);
7510 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7512 // Build the animation
7513 float durationSeconds(1.0f);
7514 Animation animation = Animation::New(durationSeconds);
7515 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7517 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7519 TimePeriod( delay, durationSeconds - delay ) );
7521 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7523 // Start the animation
7526 bool signalReceived(false);
7527 AnimationFinishCheck finishCheck(signalReceived);
7528 animation.FinishedSignal().Connect(&application, finishCheck);
7530 application.SendNotification();
7531 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7533 // We didn't expect the animation to finish yet
7534 application.SendNotification();
7535 finishCheck.CheckSignalNotReceived();
7536 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7538 application.SendNotification();
7539 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7541 // We didn't expect the animation to finish yet
7542 application.SendNotification();
7543 finishCheck.CheckSignalNotReceived();
7544 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7546 application.SendNotification();
7547 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7549 // We did expect the animation to finish
7550 application.SendNotification();
7551 finishCheck.CheckSignalReceived();
7552 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7556 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7558 TestApplication application;
7560 Actor actor = Actor::New();
7561 Stage::GetCurrent().Add(actor);
7562 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7564 // Build the animation
7565 float durationSeconds(1.0f);
7566 Animation animation = Animation::New(durationSeconds);
7567 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7569 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7571 AlphaFunction::LINEAR,
7572 TimePeriod( delay, durationSeconds - delay ) );
7574 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7576 // Start the animation
7579 bool signalReceived(false);
7580 AnimationFinishCheck finishCheck(signalReceived);
7581 animation.FinishedSignal().Connect(&application, finishCheck);
7583 application.SendNotification();
7584 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7586 // We didn't expect the animation to finish yet
7587 application.SendNotification();
7588 finishCheck.CheckSignalNotReceived();
7589 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7591 application.SendNotification();
7592 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7594 // We didn't expect the animation to finish yet
7595 application.SendNotification();
7596 finishCheck.CheckSignalNotReceived();
7597 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7599 application.SendNotification();
7600 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7602 // We did expect the animation to finish
7603 application.SendNotification();
7604 finishCheck.CheckSignalReceived();
7605 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7609 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7611 TestApplication application;
7613 Actor actor = Actor::New();
7614 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7615 Stage::GetCurrent().Add(actor);
7616 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7618 // Build the animation
7619 float durationSeconds(1.0f);
7620 Animation animation = Animation::New(durationSeconds);
7621 Degree targetRotationDegrees(90.0f);
7622 Radian targetRotationRadians(targetRotationDegrees);
7623 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7625 // Start the animation
7628 // Target value should be retrievable straight away
7629 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7631 bool signalReceived(false);
7632 AnimationFinishCheck finishCheck(signalReceived);
7633 animation.FinishedSignal().Connect(&application, finishCheck);
7635 application.SendNotification();
7636 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7638 // We didn't expect the animation to finish yet
7639 application.SendNotification();
7640 finishCheck.CheckSignalNotReceived();
7641 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7643 application.SendNotification();
7644 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7646 // We didn't expect the animation to finish yet
7647 application.SendNotification();
7648 finishCheck.CheckSignalNotReceived();
7649 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7651 application.SendNotification();
7652 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7654 // We didn't expect the animation to finish yet
7655 application.SendNotification();
7656 finishCheck.CheckSignalNotReceived();
7657 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7659 application.SendNotification();
7660 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7662 // We did expect the animation to finish
7663 application.SendNotification();
7664 finishCheck.CheckSignalReceived();
7665 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7669 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7671 TestApplication application;
7673 Actor actor = Actor::New();
7674 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7675 Stage::GetCurrent().Add(actor);
7676 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7678 // Build the animation
7679 float durationSeconds(1.0f);
7680 Animation animation = Animation::New(durationSeconds);
7681 Degree targetRotationDegrees(90.0f);
7682 Radian targetRotationRadians(targetRotationDegrees);
7683 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7684 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7686 // Start the animation
7689 bool signalReceived(false);
7690 AnimationFinishCheck finishCheck(signalReceived);
7691 animation.FinishedSignal().Connect(&application, finishCheck);
7693 application.SendNotification();
7694 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7696 // We didn't expect the animation to finish yet
7697 application.SendNotification();
7698 finishCheck.CheckSignalNotReceived();
7699 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7701 application.SendNotification();
7702 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7704 // We didn't expect the animation to finish yet
7705 application.SendNotification();
7706 finishCheck.CheckSignalNotReceived();
7707 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7709 application.SendNotification();
7710 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7712 // We didn't expect the animation to finish yet
7713 application.SendNotification();
7714 finishCheck.CheckSignalNotReceived();
7715 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7717 application.SendNotification();
7718 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7720 // We did expect the animation to finish
7721 application.SendNotification();
7722 finishCheck.CheckSignalReceived();
7723 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7727 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7729 TestApplication application;
7731 Actor actor = Actor::New();
7732 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7733 Stage::GetCurrent().Add(actor);
7734 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7736 // Build the animation
7737 float durationSeconds(1.0f);
7738 Animation animation = Animation::New(durationSeconds);
7739 Degree targetRotationDegrees(90.0f);
7740 Radian targetRotationRadians(targetRotationDegrees);
7741 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7743 // Start the animation
7746 bool signalReceived(false);
7747 AnimationFinishCheck finishCheck(signalReceived);
7748 animation.FinishedSignal().Connect(&application, finishCheck);
7750 application.SendNotification();
7751 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7753 // We didn't expect the animation to finish yet
7754 application.SendNotification();
7755 finishCheck.CheckSignalNotReceived();
7756 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7758 application.SendNotification();
7759 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7761 // We didn't expect the animation to finish yet
7762 application.SendNotification();
7763 finishCheck.CheckSignalNotReceived();
7764 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7766 application.SendNotification();
7767 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7769 // We didn't expect the animation to finish yet
7770 application.SendNotification();
7771 finishCheck.CheckSignalNotReceived();
7772 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7774 application.SendNotification();
7775 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7777 // We did expect the animation to finish
7778 application.SendNotification();
7779 finishCheck.CheckSignalReceived();
7780 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7784 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7786 TestApplication application;
7788 Actor actor = Actor::New();
7789 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7790 Stage::GetCurrent().Add(actor);
7791 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7793 // Build the animation
7794 float durationSeconds(1.0f);
7795 Animation animation = Animation::New(durationSeconds);
7796 Degree targetRotationDegrees(90.0f);
7797 Radian targetRotationRadians(targetRotationDegrees);
7799 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7801 // Start the animation
7804 bool signalReceived(false);
7805 AnimationFinishCheck finishCheck(signalReceived);
7806 animation.FinishedSignal().Connect(&application, finishCheck);
7808 application.SendNotification();
7809 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7811 // We didn't expect the animation to finish yet
7812 application.SendNotification();
7813 finishCheck.CheckSignalNotReceived();
7814 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7815 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7817 application.SendNotification();
7818 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7820 // We didn't expect the animation to finish yet
7821 application.SendNotification();
7822 finishCheck.CheckSignalNotReceived();
7823 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7824 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7826 application.SendNotification();
7827 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7829 // We didn't expect the animation to finish yet
7830 application.SendNotification();
7831 finishCheck.CheckSignalNotReceived();
7832 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7833 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7835 application.SendNotification();
7836 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7838 // We did expect the animation to finish
7839 application.SendNotification();
7840 finishCheck.CheckSignalReceived();
7841 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7845 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7847 TestApplication application;
7849 Actor actor = Actor::New();
7850 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7851 Stage::GetCurrent().Add(actor);
7852 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7854 // Build the animation
7855 float durationSeconds(1.0f);
7856 Animation animation = Animation::New(durationSeconds);
7857 Degree targetRotationDegrees(90.0f);
7858 Radian targetRotationRadians(targetRotationDegrees);
7860 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7862 // Start the animation
7865 bool signalReceived(false);
7866 AnimationFinishCheck finishCheck(signalReceived);
7867 animation.FinishedSignal().Connect(&application, finishCheck);
7869 application.SendNotification();
7870 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7872 // We didn't expect the animation to finish yet
7873 application.SendNotification();
7874 finishCheck.CheckSignalNotReceived();
7875 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7876 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7878 application.SendNotification();
7879 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7881 // We didn't expect the animation to finish yet
7882 application.SendNotification();
7883 finishCheck.CheckSignalNotReceived();
7884 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7885 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7887 application.SendNotification();
7888 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7890 // We didn't expect the animation to finish yet
7891 application.SendNotification();
7892 finishCheck.CheckSignalNotReceived();
7893 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7894 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7896 application.SendNotification();
7897 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7899 // We did expect the animation to finish
7900 application.SendNotification();
7901 finishCheck.CheckSignalReceived();
7902 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7906 int UtcDaliAnimationAnimateToActorScaleP(void)
7908 TestApplication application;
7910 Actor actor = Actor::New();
7911 Stage::GetCurrent().Add(actor);
7912 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7914 // Build the animation
7915 float durationSeconds(1.0f);
7916 Animation animation = Animation::New(durationSeconds);
7917 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7918 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7920 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7922 // Start the animation
7925 // Target value should be retrievable straight away
7926 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
7927 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
7928 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
7929 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
7931 bool signalReceived(false);
7932 AnimationFinishCheck finishCheck(signalReceived);
7933 animation.FinishedSignal().Connect(&application, finishCheck);
7935 application.SendNotification();
7936 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7938 // We didn't expect the animation to finish yet
7939 application.SendNotification();
7940 finishCheck.CheckSignalNotReceived();
7941 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7943 application.SendNotification();
7944 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7946 // We did expect the animation to finish
7947 application.SendNotification();
7948 finishCheck.CheckSignalReceived();
7949 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7952 finishCheck.Reset();
7953 actor.SetScale(Vector3::ONE);
7954 application.SendNotification();
7955 application.Render(0);
7956 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7958 // Repeat with a different (ease-in) alpha function
7959 animation = Animation::New(durationSeconds);
7960 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7961 animation.FinishedSignal().Connect(&application, finishCheck);
7964 application.SendNotification();
7965 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7967 // We didn't expect the animation to finish yet
7968 application.SendNotification();
7969 finishCheck.CheckSignalNotReceived();
7971 // The scale should have grown less, than with a linear alpha function
7972 Vector3 current(actor.GetCurrentScale());
7973 DALI_TEST_CHECK( current.x > 1.0f );
7974 DALI_TEST_CHECK( current.y > 1.0f );
7975 DALI_TEST_CHECK( current.z > 1.0f );
7976 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7977 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7978 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7980 application.SendNotification();
7981 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7983 // We did expect the animation to finish
7984 application.SendNotification();
7985 finishCheck.CheckSignalReceived();
7986 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7989 finishCheck.Reset();
7990 actor.SetScale(Vector3::ONE);
7991 application.SendNotification();
7992 application.Render(0);
7993 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7995 // Repeat with a delay
7997 animation = Animation::New(durationSeconds);
7998 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7999 animation.FinishedSignal().Connect(&application, finishCheck);
8002 application.SendNotification();
8003 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8005 // We didn't expect the animation to finish yet
8006 application.SendNotification();
8007 finishCheck.CheckSignalNotReceived();
8008 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8010 application.SendNotification();
8011 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8013 // We did expect the animation to finish
8014 application.SendNotification();
8015 finishCheck.CheckSignalReceived();
8016 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8020 int UtcDaliAnimationAnimateToActorScaleXP(void)
8022 TestApplication application;
8024 Actor actor = Actor::New();
8025 Stage::GetCurrent().Add(actor);
8026 float startValue(1.0f);
8027 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
8028 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8029 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8030 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8031 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8032 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8033 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8035 // Build the animation
8036 float durationSeconds(1.0f);
8037 Animation animation = Animation::New(durationSeconds);
8038 float targetX(10.0f);
8039 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
8041 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
8043 // Start the animation
8046 // Target value should be retrievable straight away
8047 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
8048 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8050 bool signalReceived(false);
8051 AnimationFinishCheck finishCheck(signalReceived);
8052 animation.FinishedSignal().Connect(&application, finishCheck);
8054 application.SendNotification();
8055 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8057 // We didn't expect the animation to finish yet
8058 application.SendNotification();
8059 finishCheck.CheckSignalNotReceived();
8060 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
8061 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
8062 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8063 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8065 application.SendNotification();
8066 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8068 // We did expect the animation to finish
8069 application.SendNotification();
8070 finishCheck.CheckSignalReceived();
8071 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
8072 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8073 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8074 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8078 int UtcDaliAnimationAnimateToActorScaleYP(void)
8080 TestApplication application;
8082 Actor actor = Actor::New();
8083 Stage::GetCurrent().Add(actor);
8084 float startValue(1.0f);
8085 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
8086 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8087 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8088 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8089 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8090 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8091 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8093 // Build the animation
8094 float durationSeconds(1.0f);
8095 Animation animation = Animation::New(durationSeconds);
8096 float targetY(1000.0f);
8097 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
8099 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
8101 // Start the animation
8104 // Target value should be retrievable straight away
8105 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
8106 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8108 bool signalReceived(false);
8109 AnimationFinishCheck finishCheck(signalReceived);
8110 animation.FinishedSignal().Connect(&application, finishCheck);
8112 application.SendNotification();
8113 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8115 // We didn't expect the animation to finish yet
8116 application.SendNotification();
8117 finishCheck.CheckSignalNotReceived();
8118 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
8119 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8120 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
8121 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8123 application.SendNotification();
8124 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8126 // We did expect the animation to finish
8127 application.SendNotification();
8128 finishCheck.CheckSignalReceived();
8129 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
8130 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8131 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8132 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8136 int UtcDaliAnimationAnimateToActorScaleZP(void)
8138 TestApplication application;
8140 Actor actor = Actor::New();
8141 Stage::GetCurrent().Add(actor);
8142 float startValue(1.0f);
8143 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
8144 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8145 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8146 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8147 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8148 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8149 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8151 // Build the animation
8152 float durationSeconds(1.0f);
8153 Animation animation = Animation::New(durationSeconds);
8154 float targetZ(-1000.0f);
8155 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
8157 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
8159 // Start the animation
8162 // Target value should be retrievable straight away
8163 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
8164 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8166 bool signalReceived(false);
8167 AnimationFinishCheck finishCheck(signalReceived);
8168 animation.FinishedSignal().Connect(&application, finishCheck);
8170 application.SendNotification();
8171 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8173 // We didn't expect the animation to finish yet
8174 application.SendNotification();
8175 finishCheck.CheckSignalNotReceived();
8176 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
8177 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8178 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8179 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
8181 application.SendNotification();
8182 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8184 // We did expect the animation to finish
8185 application.SendNotification();
8186 finishCheck.CheckSignalReceived();
8187 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
8188 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8189 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8190 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8194 int UtcDaliAnimationAnimateToActorColorP(void)
8196 TestApplication application;
8198 Actor actor = Actor::New();
8199 Stage::GetCurrent().Add(actor);
8200 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8202 // Build the animation
8203 float durationSeconds(1.0f);
8204 Animation animation = Animation::New(durationSeconds);
8205 Vector4 targetColor(Color::RED);
8206 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
8208 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8209 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8211 // Start the animation
8214 // Target value should be retrievable straight away
8215 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8216 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
8217 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
8218 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
8219 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
8220 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
8222 bool signalReceived(false);
8223 AnimationFinishCheck finishCheck(signalReceived);
8224 animation.FinishedSignal().Connect(&application, finishCheck);
8226 application.SendNotification();
8227 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8229 // We didn't expect the animation to finish yet
8230 application.SendNotification();
8231 finishCheck.CheckSignalNotReceived();
8232 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
8234 application.SendNotification();
8235 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8237 // We did expect the animation to finish
8238 application.SendNotification();
8239 finishCheck.CheckSignalReceived();
8240 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8243 finishCheck.Reset();
8244 actor.SetColor(Color::WHITE);
8245 application.SendNotification();
8246 application.Render(0);
8247 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8249 // Repeat with a different (ease-in) alpha function
8250 animation = Animation::New(durationSeconds);
8251 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8252 animation.FinishedSignal().Connect(&application, finishCheck);
8255 application.SendNotification();
8256 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8258 // We didn't expect the animation to finish yet
8259 application.SendNotification();
8260 finishCheck.CheckSignalNotReceived();
8262 // The color should have changed less, than with a linear alpha function
8263 Vector4 current(actor.GetCurrentColor());
8264 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
8265 DALI_TEST_CHECK( current.y < 1.0f );
8266 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
8267 DALI_TEST_CHECK( current.z < 1.0f );
8268 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
8269 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8271 application.SendNotification();
8272 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8274 // We did expect the animation to finish
8275 application.SendNotification();
8276 finishCheck.CheckSignalReceived();
8277 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8280 finishCheck.Reset();
8281 actor.SetColor(Color::WHITE);
8282 application.SendNotification();
8283 application.Render(0);
8284 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8286 // Repeat with a shorter animator duration
8287 float animatorDuration = 0.5f;
8288 animation = Animation::New(durationSeconds);
8289 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8290 animation.FinishedSignal().Connect(&application, finishCheck);
8293 application.SendNotification();
8294 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8296 // We didn't expect the animation to finish yet
8297 application.SendNotification();
8298 finishCheck.CheckSignalNotReceived();
8299 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
8301 application.SendNotification();
8302 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8304 // We didn't expect the animation to finish yet
8305 application.SendNotification();
8306 finishCheck.CheckSignalNotReceived();
8307 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8309 application.SendNotification();
8310 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8312 // We did expect the animation to finish
8313 application.SendNotification();
8314 finishCheck.CheckSignalReceived();
8315 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8319 int UtcDaliAnimationAnimateToActorColorRedP(void)
8321 TestApplication application;
8323 Actor actor = Actor::New();
8324 Stage::GetCurrent().Add(actor);
8325 float startValue(1.0f);
8326 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
8327 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8328 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8329 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8330 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8331 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8332 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8333 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8334 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8336 // Build the animation
8337 float durationSeconds(1.0f);
8338 Animation animation = Animation::New(durationSeconds);
8339 float targetRed(0.5f);
8340 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8342 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8344 // Start the animation
8347 // Target value should be retrievable straight away
8348 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8349 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8351 bool signalReceived(false);
8352 AnimationFinishCheck finishCheck(signalReceived);
8353 animation.FinishedSignal().Connect(&application, finishCheck);
8355 application.SendNotification();
8356 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8358 // We didn't expect the animation to finish yet
8359 application.SendNotification();
8360 finishCheck.CheckSignalNotReceived();
8361 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8362 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
8363 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8364 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8365 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8367 application.SendNotification();
8368 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8370 // We did expect the animation to finish
8371 application.SendNotification();
8372 finishCheck.CheckSignalReceived();
8373 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8374 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
8375 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8376 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8377 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8381 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8383 TestApplication application;
8385 Actor actor = Actor::New();
8386 Stage::GetCurrent().Add(actor);
8387 float startValue(1.0f);
8388 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
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), startValue, TEST_LOCATION );
8393 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8394 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8395 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8396 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8398 // Build the animation
8399 float durationSeconds(1.0f);
8400 Animation animation = Animation::New(durationSeconds);
8401 float targetGreen(0.5f);
8402 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8404 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8406 // Start the animation
8409 // Target value should be retrievable straight away
8410 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8411 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8413 bool signalReceived(false);
8414 AnimationFinishCheck finishCheck(signalReceived);
8415 animation.FinishedSignal().Connect(&application, finishCheck);
8417 application.SendNotification();
8418 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8420 // We didn't expect the animation to finish yet
8421 application.SendNotification();
8422 finishCheck.CheckSignalNotReceived();
8423 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8424 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8425 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8426 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8427 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8429 application.SendNotification();
8430 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8432 // We did expect the animation to finish
8433 application.SendNotification();
8434 finishCheck.CheckSignalReceived();
8435 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8436 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8437 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8438 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8439 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8443 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8445 TestApplication application;
8447 Actor actor = Actor::New();
8448 Stage::GetCurrent().Add(actor);
8449 float startValue(1.0f);
8450 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8451 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8452 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8453 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8454 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8455 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8456 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8457 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8458 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8460 // Build the animation
8461 float durationSeconds(1.0f);
8462 Animation animation = Animation::New(durationSeconds);
8463 float targetBlue(0.5f);
8464 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8466 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8468 // Start the animation
8471 // Target value should be retrievable straight away
8472 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8473 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8475 bool signalReceived(false);
8476 AnimationFinishCheck finishCheck(signalReceived);
8477 animation.FinishedSignal().Connect(&application, finishCheck);
8479 application.SendNotification();
8480 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8482 // We didn't expect the animation to finish yet
8483 application.SendNotification();
8484 finishCheck.CheckSignalNotReceived();
8485 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8486 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8487 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8488 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8489 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8491 application.SendNotification();
8492 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8494 // We did expect the animation to finish
8495 application.SendNotification();
8496 finishCheck.CheckSignalReceived();
8497 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8498 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8499 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8500 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8501 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8505 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8507 TestApplication application;
8509 Actor actor = Actor::New();
8510 Stage::GetCurrent().Add(actor);
8511 float startValue(1.0f);
8512 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8513 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8514 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8515 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8516 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8517 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8518 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8519 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8520 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8522 // Build the animation
8523 float durationSeconds(1.0f);
8524 Animation animation = Animation::New(durationSeconds);
8525 float targetAlpha(0.5f);
8526 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8528 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8530 // Start the animation
8533 // Target value should be retrievable straight away
8534 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8535 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8536 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8538 bool signalReceived(false);
8539 AnimationFinishCheck finishCheck(signalReceived);
8540 animation.FinishedSignal().Connect(&application, finishCheck);
8542 application.SendNotification();
8543 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8545 // We didn't expect the animation to finish yet
8546 application.SendNotification();
8547 finishCheck.CheckSignalNotReceived();
8548 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8549 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8550 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8551 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8552 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8554 application.SendNotification();
8555 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8557 // We did expect the animation to finish
8558 application.SendNotification();
8559 finishCheck.CheckSignalReceived();
8560 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8561 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8562 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8563 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8564 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8568 int UtcDaliAnimationKeyFrames01P(void)
8570 TestApplication application;
8572 KeyFrames keyFrames = KeyFrames::New();
8573 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8575 keyFrames.Add(0.0f, 0.1f);
8577 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8579 KeyFrames keyFrames2( keyFrames);
8580 DALI_TEST_CHECK( keyFrames2 );
8581 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8583 KeyFrames keyFrames3 = KeyFrames::New();
8584 keyFrames3.Add(0.6f, true);
8585 DALI_TEST_CHECK( keyFrames3 );
8586 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8588 keyFrames3 = keyFrames;
8589 DALI_TEST_CHECK( keyFrames3 );
8590 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8595 int UtcDaliAnimationKeyFrames02P(void)
8597 TestApplication application;
8599 KeyFrames keyFrames = KeyFrames::New();
8600 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8602 keyFrames.Add(0.0f, 0.1f);
8603 keyFrames.Add(0.2f, 0.5f);
8604 keyFrames.Add(0.4f, 0.0f);
8605 keyFrames.Add(0.6f, 1.0f);
8606 keyFrames.Add(0.8f, 0.7f);
8607 keyFrames.Add(1.0f, 0.9f);
8609 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8613 keyFrames.Add(1.9f, false);
8615 catch (Dali::DaliException& e)
8617 DALI_TEST_PRINT_ASSERT( e );
8618 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8623 int UtcDaliAnimationKeyFrames03P(void)
8625 TestApplication application;
8627 KeyFrames keyFrames = KeyFrames::New();
8628 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8630 keyFrames.Add(0.0f, true);
8631 keyFrames.Add(0.2f, false);
8632 keyFrames.Add(0.4f, false);
8633 keyFrames.Add(0.6f, true);
8634 keyFrames.Add(0.8f, true);
8635 keyFrames.Add(1.0f, false);
8637 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8641 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8643 catch (Dali::DaliException& e)
8645 DALI_TEST_PRINT_ASSERT( e );
8646 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8651 int UtcDaliAnimationKeyFrames04P(void)
8653 TestApplication application;
8655 KeyFrames keyFrames = KeyFrames::New();
8656 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8658 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8659 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8660 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8661 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8662 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8663 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8665 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8669 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8671 catch (Dali::DaliException& e)
8673 DALI_TEST_PRINT_ASSERT( e );
8674 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8679 int UtcDaliAnimationKeyFrames05P(void)
8681 TestApplication application;
8683 KeyFrames keyFrames = KeyFrames::New();
8684 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8686 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8687 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8688 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8689 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8690 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8691 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8693 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8697 keyFrames.Add(0.7f, 1.0f);
8699 catch (Dali::DaliException& e)
8701 DALI_TEST_PRINT_ASSERT( e );
8702 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8707 int UtcDaliAnimationKeyFrames06P(void)
8709 TestApplication application;
8711 KeyFrames keyFrames = KeyFrames::New();
8712 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8714 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8715 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8716 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8717 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8718 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8719 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8721 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8725 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8727 catch (Dali::DaliException& e)
8729 DALI_TEST_PRINT_ASSERT( e );
8730 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8735 int UtcDaliAnimationKeyFrames07P(void)
8737 TestApplication application;
8739 KeyFrames keyFrames = KeyFrames::New();
8740 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8742 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8743 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8744 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8745 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8746 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8747 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8749 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8753 keyFrames.Add(0.7f, 1.1f);
8755 catch (Dali::DaliException& e)
8757 DALI_TEST_PRINT_ASSERT( e );
8758 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8763 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8765 TestApplication application;
8767 float startValue(1.0f);
8768 Actor actor = Actor::New();
8769 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8770 Stage::GetCurrent().Add(actor);
8772 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8773 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8774 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8775 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8776 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8777 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8778 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8779 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8780 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8782 // Build the animation
8783 float durationSeconds(1.0f);
8784 Animation animation = Animation::New(durationSeconds);
8786 KeyFrames keyFrames = KeyFrames::New();
8787 keyFrames.Add(0.0f, 0.1f);
8788 keyFrames.Add(0.2f, 0.5f);
8789 keyFrames.Add(0.4f, 0.0f);
8790 keyFrames.Add(0.6f, 1.0f);
8791 keyFrames.Add(0.8f, 0.7f);
8792 keyFrames.Add(1.0f, 0.9f);
8794 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8796 // Start the animation
8799 // Final key frame value should be retrievable straight away
8800 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
8802 bool signalReceived(false);
8803 AnimationFinishCheck finishCheck(signalReceived);
8804 animation.FinishedSignal().Connect(&application, finishCheck);
8805 application.SendNotification();
8806 application.Render(0);
8807 application.SendNotification();
8808 finishCheck.CheckSignalNotReceived();
8809 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8811 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8812 application.SendNotification();
8813 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8814 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8815 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8816 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8817 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8819 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8820 application.SendNotification();
8821 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8822 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8823 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8824 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8825 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8827 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8828 application.SendNotification();
8829 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8830 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8831 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8832 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8833 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8835 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8836 application.SendNotification();
8837 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8838 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8839 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8840 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8841 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8843 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8844 application.SendNotification();
8845 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8846 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8847 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8848 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8849 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8851 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8852 application.SendNotification();
8853 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8854 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8855 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8856 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8857 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8859 // We did expect the animation to finish
8861 finishCheck.CheckSignalReceived();
8865 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8867 TestApplication application;
8869 float startValue(1.0f);
8870 Actor actor = Actor::New();
8871 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8872 Stage::GetCurrent().Add(actor);
8874 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8875 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8876 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8877 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8878 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8879 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8880 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8881 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8882 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8884 // Build the animation
8885 float durationSeconds(1.0f);
8886 Animation animation = Animation::New(durationSeconds);
8888 KeyFrames keyFrames = KeyFrames::New();
8889 keyFrames.Add(0.0f, 0.1f);
8890 keyFrames.Add(0.2f, 0.5f);
8891 keyFrames.Add(0.4f, 0.0f);
8892 keyFrames.Add(0.6f, 1.0f);
8893 keyFrames.Add(0.8f, 0.7f);
8894 keyFrames.Add(1.0f, 0.9f);
8896 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8898 // Start the animation
8901 bool signalReceived(false);
8902 AnimationFinishCheck finishCheck(signalReceived);
8903 animation.FinishedSignal().Connect(&application, finishCheck);
8904 application.SendNotification();
8905 application.Render(0);
8906 application.SendNotification();
8907 finishCheck.CheckSignalNotReceived();
8908 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8910 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8911 application.SendNotification();
8912 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8913 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8914 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8915 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
8916 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8918 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8919 application.SendNotification();
8920 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8921 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8922 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8923 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
8924 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8926 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8927 application.SendNotification();
8928 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8929 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8930 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8931 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
8932 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8934 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8935 application.SendNotification();
8936 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8937 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8938 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8939 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
8940 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8942 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8943 application.SendNotification();
8944 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8945 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8946 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8947 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
8948 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8950 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8951 application.SendNotification();
8952 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8953 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8954 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8955 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
8956 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8958 // We did expect the animation to finish
8960 finishCheck.CheckSignalReceived();
8964 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8966 TestApplication application;
8968 float startValue(1.0f);
8969 Actor actor = Actor::New();
8970 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8971 Stage::GetCurrent().Add(actor);
8973 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8974 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8975 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8976 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8977 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8978 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8979 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8980 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8981 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8983 // Build the animation
8984 float durationSeconds(1.0f);
8985 Animation animation = Animation::New(durationSeconds);
8987 KeyFrames keyFrames = KeyFrames::New();
8988 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8989 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8990 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8992 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8994 // Start the animation
8997 bool signalReceived(false);
8998 AnimationFinishCheck finishCheck(signalReceived);
8999 animation.FinishedSignal().Connect(&application, finishCheck);
9000 application.SendNotification();
9001 application.Render(0);
9002 application.SendNotification();
9003 finishCheck.CheckSignalNotReceived();
9004 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9005 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9006 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9007 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9009 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9010 application.SendNotification();
9011 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9012 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9013 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9014 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9016 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9017 application.SendNotification();
9018 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9019 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9020 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9021 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9023 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9024 application.SendNotification();
9025 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9026 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9027 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9028 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9030 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9031 application.SendNotification();
9032 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9033 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9034 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9035 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9037 // We did expect the animation to finish
9039 finishCheck.CheckSignalReceived();
9043 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9045 TestApplication application;
9047 float startValue(1.0f);
9048 Actor actor = Actor::New();
9049 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9050 Stage::GetCurrent().Add(actor);
9052 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9053 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9054 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9055 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9056 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9057 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9058 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9059 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9060 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9062 // Build the animation
9063 float durationSeconds(1.0f);
9064 Animation animation = Animation::New(durationSeconds);
9066 KeyFrames keyFrames = KeyFrames::New();
9067 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9068 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9069 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9071 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
9073 // Start the animation
9076 bool signalReceived(false);
9077 AnimationFinishCheck finishCheck(signalReceived);
9078 animation.FinishedSignal().Connect(&application, finishCheck);
9079 application.SendNotification();
9080 application.Render(0);
9081 application.SendNotification();
9082 finishCheck.CheckSignalNotReceived();
9083 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9084 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9085 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9086 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9088 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9089 application.SendNotification();
9090 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9091 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9092 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9093 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9095 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9096 application.SendNotification();
9097 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9098 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9099 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9100 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9102 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9103 application.SendNotification();
9104 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9105 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9106 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9107 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9109 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9110 application.SendNotification();
9111 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9112 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9113 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9114 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9116 // We did expect the animation to finish
9118 finishCheck.CheckSignalReceived();
9122 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9124 TestApplication application;
9126 Actor actor = Actor::New();
9127 AngleAxis aa(Degree(90), Vector3::XAXIS);
9128 actor.SetOrientation(aa.angle, aa.axis);
9129 Stage::GetCurrent().Add(actor);
9131 application.SendNotification();
9132 application.Render(0);
9134 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9136 // Build the animation
9137 float durationSeconds(1.0f);
9138 Animation animation = Animation::New(durationSeconds);
9140 KeyFrames keyFrames = KeyFrames::New();
9141 keyFrames.Add(0.0f, false);
9142 keyFrames.Add(0.2f, true);
9143 keyFrames.Add(0.4f, true);
9144 keyFrames.Add(0.8f, false);
9145 keyFrames.Add(1.0f, true);
9147 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
9149 // Start the animation
9152 // Final key frame value should be retrievable straight away
9153 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
9155 bool signalReceived(false);
9156 AnimationFinishCheck finishCheck(signalReceived);
9157 animation.FinishedSignal().Connect(&application, finishCheck);
9158 application.SendNotification();
9159 application.SendNotification();
9160 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9161 application.SendNotification();
9162 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9163 application.SendNotification();
9165 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9166 finishCheck.CheckSignalReceived();
9170 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9172 TestApplication application;
9174 Actor actor = Actor::New();
9175 AngleAxis aa(Degree(90), Vector3::XAXIS);
9176 actor.SetOrientation(aa.angle, aa.axis);
9177 Stage::GetCurrent().Add(actor);
9179 application.SendNotification();
9180 application.Render(0);
9182 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9184 // Build the animation
9185 float durationSeconds(1.0f);
9186 Animation animation = Animation::New(durationSeconds);
9188 KeyFrames keyFrames = KeyFrames::New();
9189 keyFrames.Add(0.0f, false);
9190 keyFrames.Add(0.2f, true);
9191 keyFrames.Add(0.4f, true);
9192 keyFrames.Add(0.8f, false);
9193 keyFrames.Add(1.0f, true);
9195 //Cubic interpolation for boolean values should be ignored
9196 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
9198 // Start the animation
9201 bool signalReceived(false);
9202 AnimationFinishCheck finishCheck(signalReceived);
9203 animation.FinishedSignal().Connect(&application, finishCheck);
9204 application.SendNotification();
9205 application.SendNotification();
9206 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9207 application.SendNotification();
9208 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9209 application.SendNotification();
9211 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9212 finishCheck.CheckSignalReceived();
9216 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9218 TestApplication application;
9220 Actor actor = Actor::New();
9221 AngleAxis aa(Degree(90), Vector3::XAXIS);
9222 actor.SetOrientation(aa.angle, aa.axis);
9223 Stage::GetCurrent().Add(actor);
9225 application.SendNotification();
9226 application.Render(0);
9227 Quaternion start(Radian(aa.angle), aa.axis);
9228 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9230 // Build the animation
9231 float durationSeconds(1.0f);
9232 Animation animation = Animation::New(durationSeconds);
9234 KeyFrames keyFrames = KeyFrames::New();
9235 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9237 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9239 // Start the animation
9242 // Final key frame value should be retrievable straight away
9243 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
9245 bool signalReceived(false);
9246 AnimationFinishCheck finishCheck(signalReceived);
9247 animation.FinishedSignal().Connect(&application, finishCheck);
9248 application.SendNotification();
9249 application.SendNotification();
9250 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9251 application.SendNotification();
9252 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9253 application.SendNotification();
9255 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9257 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9258 finishCheck.CheckSignalReceived();
9262 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9264 TestApplication application;
9266 Actor actor = Actor::New();
9267 AngleAxis aa(Degree(90), Vector3::XAXIS);
9268 actor.SetOrientation(aa.angle, aa.axis);
9269 application.SendNotification();
9270 application.Render(0);
9271 Stage::GetCurrent().Add(actor);
9273 Quaternion start(Radian(aa.angle), aa.axis);
9274 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9276 // Build the animation
9277 float durationSeconds(1.0f);
9278 Animation animation = Animation::New(durationSeconds);
9280 KeyFrames keyFrames = KeyFrames::New();
9281 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9282 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9283 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9285 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9287 // Start the animation
9290 bool signalReceived(false);
9291 AnimationFinishCheck finishCheck(signalReceived);
9292 animation.FinishedSignal().Connect(&application, finishCheck);
9293 application.SendNotification();
9294 application.Render(0);
9295 application.SendNotification();
9296 finishCheck.CheckSignalNotReceived();
9298 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9299 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9301 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9302 application.SendNotification();
9303 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9304 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9306 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9307 application.SendNotification();
9308 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9309 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9311 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9312 application.SendNotification();
9313 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
9314 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9316 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9317 application.SendNotification();
9318 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9319 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9321 // We did expect the animation to finish
9323 finishCheck.CheckSignalReceived();
9327 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9329 TestApplication application;
9331 Actor actor = Actor::New();
9332 AngleAxis aa(Degree(90), Vector3::XAXIS);
9333 actor.SetOrientation(aa.angle, aa.axis);
9334 Stage::GetCurrent().Add(actor);
9336 application.SendNotification();
9337 application.Render(0);
9338 Quaternion start(Radian(aa.angle), aa.axis);
9339 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9341 // Build the animation
9342 float durationSeconds(1.0f);
9343 Animation animation = Animation::New(durationSeconds);
9345 KeyFrames keyFrames = KeyFrames::New();
9346 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9348 //Cubic interpolation should be ignored for quaternions
9349 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9351 // Start the animation
9354 bool signalReceived(false);
9355 AnimationFinishCheck finishCheck(signalReceived);
9356 animation.FinishedSignal().Connect(&application, finishCheck);
9357 application.SendNotification();
9358 application.SendNotification();
9359 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9360 application.SendNotification();
9361 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9362 application.SendNotification();
9364 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9366 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9367 finishCheck.CheckSignalReceived();
9371 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9373 TestApplication application;
9375 Actor actor = Actor::New();
9376 AngleAxis aa(Degree(90), Vector3::XAXIS);
9377 actor.SetOrientation(aa.angle, aa.axis);
9378 application.SendNotification();
9379 application.Render(0);
9380 Stage::GetCurrent().Add(actor);
9382 Quaternion start(Radian(aa.angle), aa.axis);
9383 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9385 // Build the animation
9386 float durationSeconds(1.0f);
9387 Animation animation = Animation::New(durationSeconds);
9389 KeyFrames keyFrames = KeyFrames::New();
9390 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9391 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9392 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9394 //Cubic interpolation should be ignored for quaternions
9395 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9397 // Start the animation
9400 bool signalReceived(false);
9401 AnimationFinishCheck finishCheck(signalReceived);
9402 animation.FinishedSignal().Connect(&application, finishCheck);
9403 application.SendNotification();
9404 application.Render(0);
9405 application.SendNotification();
9406 finishCheck.CheckSignalNotReceived();
9408 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9409 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9411 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9412 application.SendNotification();
9413 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9414 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9416 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9417 application.SendNotification();
9418 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9419 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9421 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9422 application.SendNotification();
9423 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9424 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9426 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9427 application.SendNotification();
9428 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9429 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9431 // We did expect the animation to finish
9433 finishCheck.CheckSignalReceived();
9437 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9439 TestApplication application;
9441 float startValue(1.0f);
9442 Actor actor = Actor::New();
9443 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9444 Stage::GetCurrent().Add(actor);
9446 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9447 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9448 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9449 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9450 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9451 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9452 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9453 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9454 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9456 // Build the animation
9457 float durationSeconds(1.0f);
9458 Animation animation = Animation::New(durationSeconds);
9460 KeyFrames keyFrames = KeyFrames::New();
9461 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9462 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9463 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9465 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9467 // Start the animation
9470 bool signalReceived(false);
9471 AnimationFinishCheck finishCheck(signalReceived);
9472 animation.FinishedSignal().Connect(&application, finishCheck);
9473 application.SendNotification();
9474 application.Render(0);
9475 application.SendNotification();
9476 finishCheck.CheckSignalNotReceived();
9477 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9478 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9479 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9480 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9482 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9483 application.SendNotification();
9484 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9485 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9486 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9487 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9489 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9490 application.SendNotification();
9491 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9492 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9493 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9494 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9496 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9497 application.SendNotification();
9498 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9499 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9500 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9501 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9503 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9504 application.SendNotification();
9505 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9506 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9507 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9508 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9510 // We did expect the animation to finish
9512 finishCheck.CheckSignalReceived();
9516 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9518 TestApplication application;
9520 float startValue(1.0f);
9521 Actor actor = Actor::New();
9522 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9523 Stage::GetCurrent().Add(actor);
9525 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9526 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9527 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9528 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9529 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9530 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9531 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9532 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9533 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9535 // Build the animation
9536 float durationSeconds(1.0f);
9537 Animation animation = Animation::New(durationSeconds);
9539 KeyFrames keyFrames = KeyFrames::New();
9540 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9541 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9542 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9544 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9546 // Start the animation
9549 bool signalReceived(false);
9550 AnimationFinishCheck finishCheck(signalReceived);
9551 animation.FinishedSignal().Connect(&application, finishCheck);
9552 application.SendNotification();
9553 application.Render(0);
9554 application.SendNotification();
9555 finishCheck.CheckSignalNotReceived();
9556 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9557 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9558 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9559 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9561 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9562 application.SendNotification();
9563 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9564 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9565 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9566 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9568 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9569 application.SendNotification();
9570 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9571 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9572 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9573 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9575 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9576 application.SendNotification();
9577 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9578 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9579 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9580 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9582 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9583 application.SendNotification();
9584 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9585 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9586 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9587 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9589 // We did expect the animation to finish
9591 finishCheck.CheckSignalReceived();
9595 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9597 TestApplication application;
9599 float startValue(1.0f);
9600 Actor actor = Actor::New();
9601 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9602 Stage::GetCurrent().Add(actor);
9604 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9605 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9606 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9607 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9608 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9609 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9610 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9611 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9612 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9614 // Build the animation
9615 float durationSeconds(1.0f);
9617 Animation animation = Animation::New(durationSeconds);
9619 KeyFrames keyFrames = KeyFrames::New();
9620 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9621 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9622 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9624 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9626 // Start the animation
9629 bool signalReceived(false);
9630 AnimationFinishCheck finishCheck(signalReceived);
9631 animation.FinishedSignal().Connect(&application, finishCheck);
9632 application.SendNotification();
9634 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9635 application.SendNotification();
9636 finishCheck.CheckSignalNotReceived();
9637 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9638 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9639 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9640 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9642 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9643 application.SendNotification();
9644 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9645 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9646 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9647 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9649 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9650 application.SendNotification();
9651 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9652 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9653 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9654 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9656 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9657 application.SendNotification();
9658 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9659 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9660 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9661 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9663 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9664 application.SendNotification();
9665 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9666 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9667 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9668 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9670 // We did expect the animation to finish
9672 finishCheck.CheckSignalReceived();
9676 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9678 TestApplication application;
9680 float startValue(1.0f);
9681 Actor actor = Actor::New();
9682 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9683 Stage::GetCurrent().Add(actor);
9685 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9686 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9687 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9688 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9689 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9690 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9691 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9692 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9693 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9695 // Build the animation
9696 float durationSeconds(1.0f);
9698 Animation animation = Animation::New(durationSeconds);
9700 KeyFrames keyFrames = KeyFrames::New();
9701 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9702 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9703 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9705 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9707 // Start the animation
9710 bool signalReceived(false);
9711 AnimationFinishCheck finishCheck(signalReceived);
9712 animation.FinishedSignal().Connect(&application, finishCheck);
9713 application.SendNotification();
9715 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9716 application.SendNotification();
9717 finishCheck.CheckSignalNotReceived();
9718 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9719 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9720 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9721 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9723 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9724 application.SendNotification();
9725 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9726 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9727 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9728 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9730 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9731 application.SendNotification();
9732 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9733 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9734 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9735 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9737 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9738 application.SendNotification();
9739 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9740 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9741 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9742 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9744 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9745 application.SendNotification();
9746 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9747 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9748 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9749 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9751 // We did expect the animation to finish
9753 finishCheck.CheckSignalReceived();
9757 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9759 TestApplication application;
9761 float startValue(1.0f);
9763 Actor actor = Actor::New();
9764 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9765 Stage::GetCurrent().Add(actor);
9767 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9768 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9769 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9770 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9771 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9772 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9773 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9774 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9777 // Build the animation
9778 float durationSeconds(1.0f);
9779 Animation animation = Animation::New(durationSeconds);
9781 KeyFrames keyFrames = KeyFrames::New();
9782 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9783 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9784 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9786 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9788 // Start the animation
9791 bool signalReceived(false);
9792 AnimationFinishCheck finishCheck(signalReceived);
9793 animation.FinishedSignal().Connect(&application, finishCheck);
9794 application.SendNotification();
9796 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9797 application.SendNotification();
9798 finishCheck.CheckSignalNotReceived();
9799 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9800 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9801 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9802 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9804 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9805 application.SendNotification();
9806 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9807 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9808 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9809 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9811 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9812 application.SendNotification();
9813 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9814 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9815 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9816 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9818 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9819 application.SendNotification();
9820 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9821 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9822 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9823 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9825 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9826 application.SendNotification();
9827 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9828 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9829 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9830 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9832 // We did expect the animation to finish
9834 finishCheck.CheckSignalReceived();
9838 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9840 TestApplication application;
9842 float startValue(1.0f);
9843 Actor actor = Actor::New();
9844 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9845 Stage::GetCurrent().Add(actor);
9847 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9848 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9849 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9850 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9851 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9852 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9853 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9854 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9855 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9858 // Build the animation
9859 float durationSeconds(1.0f);
9861 Animation animation = Animation::New(durationSeconds);
9863 KeyFrames keyFrames = KeyFrames::New();
9864 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9865 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9866 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9868 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9870 // Start the animation
9873 bool signalReceived(false);
9874 AnimationFinishCheck finishCheck(signalReceived);
9875 animation.FinishedSignal().Connect(&application, finishCheck);
9876 application.SendNotification();
9878 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9879 application.SendNotification();
9880 finishCheck.CheckSignalNotReceived();
9881 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9882 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9883 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9884 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9886 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9887 application.SendNotification();
9888 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9889 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9890 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9891 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9893 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9894 application.SendNotification();
9895 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9896 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9897 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9898 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9900 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9901 application.SendNotification();
9902 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9903 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9904 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9905 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9907 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9908 application.SendNotification();
9909 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9910 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9911 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9912 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9914 // We did expect the animation to finish
9916 finishCheck.CheckSignalReceived();
9920 int UtcDaliAnimationAnimateP(void)
9922 TestApplication application;
9924 Actor actor = Actor::New();
9925 Stage::GetCurrent().Add(actor);
9928 Vector3 position0( 30.0, 80.0, 0.0);
9929 Vector3 position1( 70.0, 120.0, 0.0);
9930 Vector3 position2( 100.0, 100.0, 0.0);
9932 Dali::Path path = Dali::Path::New();
9933 path.AddPoint(position0);
9934 path.AddPoint(position1);
9935 path.AddPoint(position2);
9937 //Control points for first segment
9938 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9939 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9941 //Control points for second segment
9942 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9943 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9945 // Build the animation
9946 float durationSeconds( 1.0f );
9947 Animation animation = Animation::New(durationSeconds);
9948 animation.Animate(actor, path, Vector3::XAXIS);
9950 // Start the animation
9953 bool signalReceived(false);
9954 AnimationFinishCheck finishCheck(signalReceived);
9955 animation.FinishedSignal().Connect(&application, finishCheck);
9956 application.SendNotification();
9957 application.Render(0);
9958 application.SendNotification();
9959 finishCheck.CheckSignalNotReceived();
9960 Vector3 position, tangent;
9961 Quaternion rotation;
9962 path.Sample( 0.0f, position, tangent );
9963 rotation = Quaternion( Vector3::XAXIS, tangent );
9964 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9965 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9967 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9968 application.SendNotification();
9969 path.Sample( 0.25f, position, tangent );
9970 rotation = Quaternion( Vector3::XAXIS, tangent );
9971 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9972 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9974 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9975 application.SendNotification();
9976 path.Sample( 0.5f, position, tangent );
9977 rotation = Quaternion( Vector3::XAXIS, tangent );
9978 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9979 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9981 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9982 application.SendNotification();
9983 path.Sample( 0.75f, position, tangent );
9984 rotation = Quaternion( Vector3::XAXIS, tangent );
9985 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9986 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9988 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9989 application.SendNotification();
9990 path.Sample( 1.0f, position, tangent );
9991 rotation = Quaternion( Vector3::XAXIS, tangent );
9992 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9993 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9995 finishCheck.CheckSignalReceived();
9999 int UtcDaliAnimationAnimateAlphaFunctionP(void)
10001 TestApplication application;
10003 Actor actor = Actor::New();
10004 Stage::GetCurrent().Add(actor);
10007 Vector3 position0( 30.0, 80.0, 0.0);
10008 Vector3 position1( 70.0, 120.0, 0.0);
10009 Vector3 position2( 100.0, 100.0, 0.0);
10011 Dali::Path path = Dali::Path::New();
10012 path.AddPoint(position0);
10013 path.AddPoint(position1);
10014 path.AddPoint(position2);
10016 //Control points for first segment
10017 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10018 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10020 //Control points for second segment
10021 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10022 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10024 // Build the animation
10025 float durationSeconds( 1.0f );
10026 Animation animation = Animation::New(durationSeconds);
10027 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10029 // Start the animation
10032 bool signalReceived(false);
10033 AnimationFinishCheck finishCheck(signalReceived);
10034 animation.FinishedSignal().Connect(&application, finishCheck);
10035 application.SendNotification();
10036 application.Render(0);
10037 application.SendNotification();
10038 finishCheck.CheckSignalNotReceived();
10039 Vector3 position, tangent;
10040 Quaternion rotation;
10041 path.Sample( 0.0f, position, tangent );
10042 rotation = Quaternion( Vector3::XAXIS, tangent );
10043 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10044 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10046 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10047 application.SendNotification();
10048 path.Sample( 0.25f, position, tangent );
10049 rotation = Quaternion( Vector3::XAXIS, tangent );
10050 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10051 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10053 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10054 application.SendNotification();
10055 path.Sample( 0.5f, position, tangent );
10056 rotation = Quaternion( Vector3::XAXIS, tangent );
10057 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10058 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10060 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10061 application.SendNotification();
10062 path.Sample( 0.75f, position, tangent );
10063 rotation = Quaternion( Vector3::XAXIS, tangent );
10064 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10065 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10067 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10068 application.SendNotification();
10069 path.Sample( 1.0f, position, tangent );
10070 rotation = Quaternion( Vector3::XAXIS, tangent );
10071 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10072 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10074 finishCheck.CheckSignalReceived();
10078 int UtcDaliAnimationAnimateTimePeriodP(void)
10080 TestApplication application;
10082 Actor actor = Actor::New();
10083 Stage::GetCurrent().Add(actor);
10086 Vector3 position0( 30.0, 80.0, 0.0);
10087 Vector3 position1( 70.0, 120.0, 0.0);
10088 Vector3 position2( 100.0, 100.0, 0.0);
10090 Dali::Path path = Dali::Path::New();
10091 path.AddPoint(position0);
10092 path.AddPoint(position1);
10093 path.AddPoint(position2);
10095 //Control points for first segment
10096 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10097 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10099 //Control points for second segment
10100 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10101 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10103 // Build the animation
10104 float durationSeconds( 1.0f );
10105 Animation animation = Animation::New(durationSeconds);
10106 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10108 // Start the animation
10111 bool signalReceived(false);
10112 AnimationFinishCheck finishCheck(signalReceived);
10113 animation.FinishedSignal().Connect(&application, finishCheck);
10114 application.SendNotification();
10115 application.Render(0);
10116 application.SendNotification();
10117 finishCheck.CheckSignalNotReceived();
10118 Vector3 position, tangent;
10119 Quaternion rotation;
10120 path.Sample( 0.0f, position, tangent );
10121 rotation = Quaternion( Vector3::XAXIS, tangent );
10122 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10123 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10125 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10126 application.SendNotification();
10127 path.Sample( 0.25f, position, tangent );
10128 rotation = Quaternion( Vector3::XAXIS, tangent );
10129 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10130 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10132 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10133 application.SendNotification();
10134 path.Sample( 0.5f, position, tangent );
10135 rotation = Quaternion( Vector3::XAXIS, tangent );
10136 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10137 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10139 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10140 application.SendNotification();
10141 path.Sample( 0.75f, position, tangent );
10142 rotation = Quaternion( Vector3::XAXIS, tangent );
10143 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10144 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10146 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10147 application.SendNotification();
10148 path.Sample( 1.0f, position, tangent );
10149 rotation = Quaternion( Vector3::XAXIS, tangent );
10150 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10151 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10153 finishCheck.CheckSignalReceived();
10157 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10159 TestApplication application;
10161 Actor actor = Actor::New();
10162 Stage::GetCurrent().Add(actor);
10165 Vector3 position0( 30.0, 80.0, 0.0);
10166 Vector3 position1( 70.0, 120.0, 0.0);
10167 Vector3 position2( 100.0, 100.0, 0.0);
10169 Dali::Path path = Dali::Path::New();
10170 path.AddPoint(position0);
10171 path.AddPoint(position1);
10172 path.AddPoint(position2);
10174 //Control points for first segment
10175 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10176 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10178 //Control points for second segment
10179 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10180 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10182 // Build the animation
10183 float durationSeconds( 1.0f );
10184 Animation animation = Animation::New(durationSeconds);
10185 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10187 // Start the animation
10190 bool signalReceived(false);
10191 AnimationFinishCheck finishCheck(signalReceived);
10192 animation.FinishedSignal().Connect(&application, finishCheck);
10193 application.SendNotification();
10194 application.Render(0);
10195 application.SendNotification();
10196 finishCheck.CheckSignalNotReceived();
10197 Vector3 position, tangent;
10198 Quaternion rotation;
10199 path.Sample( 0.0f, position, tangent );
10200 rotation = Quaternion( Vector3::XAXIS, tangent );
10201 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10202 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10204 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10205 application.SendNotification();
10206 path.Sample( 0.25f, position, tangent );
10207 rotation = Quaternion( Vector3::XAXIS, tangent );
10208 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10209 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10211 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10212 application.SendNotification();
10213 path.Sample( 0.5f, position, tangent );
10214 rotation = Quaternion( Vector3::XAXIS, tangent );
10215 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10216 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10218 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10219 application.SendNotification();
10220 path.Sample( 0.75f, position, tangent );
10221 rotation = Quaternion( Vector3::XAXIS, tangent );
10222 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10223 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10225 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10226 application.SendNotification();
10227 path.Sample( 1.0f, position, tangent );
10228 rotation = Quaternion( Vector3::XAXIS, tangent );
10229 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10230 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10232 finishCheck.CheckSignalReceived();
10236 int UtcDaliAnimationShowP(void)
10238 TestApplication application;
10240 Actor actor = Actor::New();
10241 actor.SetVisible(false);
10242 application.SendNotification();
10243 application.Render(0);
10244 DALI_TEST_CHECK( !actor.IsVisible() );
10245 Stage::GetCurrent().Add(actor);
10247 // Start the animation
10248 float durationSeconds(10.0f);
10249 Animation animation = Animation::New(durationSeconds);
10250 animation.Show(actor, durationSeconds*0.5f);
10253 bool signalReceived(false);
10254 AnimationFinishCheck finishCheck(signalReceived);
10255 animation.FinishedSignal().Connect(&application, finishCheck);
10257 application.SendNotification();
10258 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10260 // We didn't expect the animation to finish yet
10261 application.SendNotification();
10262 finishCheck.CheckSignalNotReceived();
10263 DALI_TEST_CHECK( !actor.IsVisible() );
10265 application.SendNotification();
10266 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
10268 // We didn't expect the animation to finish yet
10269 application.SendNotification();
10270 finishCheck.CheckSignalNotReceived();
10271 DALI_TEST_CHECK( actor.IsVisible() );
10273 application.SendNotification();
10274 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10276 // We did expect the animation to finish
10277 application.SendNotification();
10278 finishCheck.CheckSignalReceived();
10279 DALI_TEST_CHECK( actor.IsVisible() );
10283 int UtcDaliAnimationHideP(void)
10285 TestApplication application;
10287 Actor actor = Actor::New();
10288 DALI_TEST_CHECK( actor.IsVisible() );
10289 Stage::GetCurrent().Add(actor);
10291 // Start the animation
10292 float durationSeconds(10.0f);
10293 Animation animation = Animation::New(durationSeconds);
10294 animation.Hide(actor, durationSeconds*0.5f);
10297 bool signalReceived(false);
10298 AnimationFinishCheck finishCheck(signalReceived);
10299 animation.FinishedSignal().Connect(&application, finishCheck);
10301 application.SendNotification();
10302 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10304 // We didn't expect the animation to finish yet
10305 application.SendNotification();
10306 finishCheck.CheckSignalNotReceived();
10307 DALI_TEST_CHECK( actor.IsVisible() );
10309 application.SendNotification();
10310 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
10312 // We didn't expect the animation to finish yet
10313 application.SendNotification();
10314 finishCheck.CheckSignalNotReceived();
10315 DALI_TEST_CHECK( !actor.IsVisible() );
10317 application.SendNotification();
10318 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10320 // We did expect the animation to finish
10321 application.SendNotification();
10322 finishCheck.CheckSignalReceived();
10323 DALI_TEST_CHECK( !actor.IsVisible() );
10327 int UtcDaliAnimationShowHideAtEndP(void)
10329 // Test that show/hide delay can be the same as animation duration
10330 // i.e. to show/hide at the end of the animation
10332 TestApplication application;
10334 Actor actor = Actor::New();
10335 DALI_TEST_CHECK( actor.IsVisible() );
10336 Stage::GetCurrent().Add(actor);
10338 // Start Hide animation
10339 float durationSeconds(10.0f);
10340 Animation animation = Animation::New(durationSeconds);
10341 animation.Hide(actor, durationSeconds/*Hide at end*/);
10344 bool signalReceived(false);
10345 AnimationFinishCheck finishCheck(signalReceived);
10346 animation.FinishedSignal().Connect(&application, finishCheck);
10348 application.SendNotification();
10349 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10351 // We did expect the animation to finish
10352 application.SendNotification();
10353 finishCheck.CheckSignalReceived();
10354 DALI_TEST_CHECK( !actor.IsVisible() );
10356 // Start Show animation
10357 animation = Animation::New(durationSeconds);
10358 animation.Show(actor, durationSeconds/*Show at end*/);
10359 animation.FinishedSignal().Connect(&application, finishCheck);
10362 application.SendNotification();
10363 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10365 // We did expect the animation to finish
10366 application.SendNotification();
10367 finishCheck.CheckSignalReceived();
10368 DALI_TEST_CHECK( actor.IsVisible() );
10372 int UtcDaliKeyFramesCreateDestroyP(void)
10374 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10376 KeyFrames* keyFrames = new KeyFrames;
10378 DALI_TEST_CHECK( true );
10382 int UtcDaliKeyFramesDownCastP(void)
10384 TestApplication application;
10385 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10387 KeyFrames keyFrames = KeyFrames::New();
10388 BaseHandle object(keyFrames);
10390 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10391 DALI_TEST_CHECK(keyFrames2);
10393 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10394 DALI_TEST_CHECK(keyFrames3);
10396 BaseHandle unInitializedObject;
10397 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10398 DALI_TEST_CHECK(!keyFrames4);
10400 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10401 DALI_TEST_CHECK(!keyFrames5);
10405 int UtcDaliAnimationCreateDestroyP(void)
10407 TestApplication application;
10408 Animation* animation = new Animation;
10409 DALI_TEST_CHECK( animation );
10414 struct UpdateManagerTestConstraint
10416 UpdateManagerTestConstraint(TestApplication& application)
10417 : mApplication(application)
10421 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10423 mApplication.SendNotification(); // Process events
10426 TestApplication& mApplication;
10429 int UtcDaliAnimationUpdateManagerP(void)
10431 TestApplication application;
10433 Actor actor = Actor::New();
10434 Stage::GetCurrent().Add( actor );
10436 // Build the animation
10437 Animation animation = Animation::New( 0.0f );
10439 bool signalReceived = false;
10440 AnimationFinishCheck finishCheck( signalReceived );
10441 animation.FinishedSignal().Connect( &application, finishCheck );
10443 Vector3 startValue(1.0f, 1.0f, 1.0f);
10444 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10445 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10446 constraint.Apply();
10448 // Apply animation to actor
10449 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10450 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10454 application.SendNotification();
10455 application.UpdateOnly( 16 );
10457 finishCheck.CheckSignalNotReceived();
10459 application.SendNotification(); // Process events
10461 finishCheck.CheckSignalReceived();
10466 int UtcDaliAnimationSignalOrderP(void)
10468 TestApplication application;
10470 Actor actor = Actor::New();
10471 Stage::GetCurrent().Add( actor );
10473 // Build the animations
10474 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10475 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10477 bool signal1Received = false;
10478 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10480 bool signal2Received = false;
10481 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10483 // Apply animations to actor
10484 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10486 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10489 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10490 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10492 application.SendNotification();
10493 application.UpdateOnly( 10 ); // 10ms progress
10495 // no notifications yet
10496 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10497 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10499 application.SendNotification();
10502 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10503 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10504 signal1Received = false;
10506 // 1st animation is complete now, do another update with no ProcessEvents in between
10507 application.UpdateOnly( 20 ); // 20ms progress
10510 application.SendNotification();
10512 // 2nd should complete now
10513 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10514 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10519 int UtcDaliAnimationExtendDurationP(void)
10521 TestApplication application;
10523 Actor actor = Actor::New();
10525 // Register a float property
10526 float startValue(10.0f);
10527 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10528 Stage::GetCurrent().Add(actor);
10529 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10530 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10532 // Build the animation
10533 float initialDurationSeconds(1.0f);
10534 float animatorDelay = 5.0f;
10535 float animatorDurationSeconds(5.0f);
10536 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10537 Animation animation = Animation::New(initialDurationSeconds);
10538 float targetValue(30.0f);
10539 float relativeValue(targetValue - startValue);
10541 animation.AnimateTo(Property(actor, index),
10543 TimePeriod(animatorDelay, animatorDurationSeconds));
10545 // The duration should have been extended
10546 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10548 // Start the animation
10551 bool signalReceived(false);
10552 AnimationFinishCheck finishCheck(signalReceived);
10553 animation.FinishedSignal().Connect(&application, finishCheck);
10555 application.SendNotification();
10556 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10558 // We didn't expect the animation to finish yet, but cached value should be the final one
10559 application.SendNotification();
10560 finishCheck.CheckSignalNotReceived();
10561 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10562 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10564 application.SendNotification();
10565 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10567 // We didn't expect the animation to finish yet
10568 application.SendNotification();
10569 finishCheck.CheckSignalNotReceived();
10570 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10572 application.SendNotification();
10573 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10575 // We did expect the animation to finish
10576 application.SendNotification();
10577 finishCheck.CheckSignalReceived();
10578 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10579 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10583 int UtcDaliAnimationCustomIntProperty(void)
10585 TestApplication application;
10587 Actor actor = Actor::New();
10588 Stage::GetCurrent().Add(actor);
10589 int startValue(0u);
10591 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10592 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10593 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10595 // Build the animation
10596 float durationSeconds(1.0f);
10597 Animation animation = Animation::New(durationSeconds);
10598 animation.AnimateTo( Property(actor, index), 20 );
10600 // Start the animation
10603 // Target value should be retrievable straight away
10604 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10606 bool signalReceived(false);
10607 AnimationFinishCheck finishCheck(signalReceived);
10608 animation.FinishedSignal().Connect(&application, finishCheck);
10610 application.SendNotification();
10611 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10613 // We didn't expect the animation to finish yet
10614 application.SendNotification();
10615 finishCheck.CheckSignalNotReceived();
10616 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10618 application.SendNotification();
10619 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10621 // We did expect the animation to finish
10622 application.SendNotification();
10623 finishCheck.CheckSignalReceived();
10624 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10625 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10629 int UtcDaliAnimationDuration(void)
10631 TestApplication application;
10633 Actor actor = Actor::New();
10634 Stage::GetCurrent().Add(actor);
10636 Animation animation = Animation::New( 0.0f );
10637 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10639 // The animation duration should automatically increase depending on the animator time period
10641 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10642 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10644 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10645 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10650 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10652 TestApplication application;
10654 Actor actor = Actor::New();
10656 // Register an integer property
10658 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10659 Stage::GetCurrent().Add(actor);
10660 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10664 // Build the animation
10665 Animation animation = Animation::New( 2.0f );
10666 std::string relativeValue = "relative string";
10667 animation.AnimateBy( Property(actor, index), relativeValue );
10668 tet_result(TET_FAIL);
10670 catch ( Dali::DaliException& e )
10672 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10680 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10682 TestApplication application;
10684 Actor actor = Actor::New();
10686 // Register an integer property
10688 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10689 Stage::GetCurrent().Add(actor);
10690 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10694 // Build the animation
10695 Animation animation = Animation::New( 2.0f );
10696 std::string relativeValue = "relative string";
10697 animation.AnimateTo( Property(actor, index), relativeValue );
10699 tet_result(TET_FAIL);
10701 catch ( Dali::DaliException& e )
10703 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10709 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10711 TestApplication application;
10713 Actor actor = Actor::New();
10715 // Register an integer property
10717 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10718 Stage::GetCurrent().Add(actor);
10719 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10723 // Build the animation
10724 KeyFrames keyFrames = KeyFrames::New();
10725 keyFrames.Add( 0.0f, std::string("relative string1") );
10726 keyFrames.Add( 1.0f, std::string("relative string2") );
10727 // no need to really create the animation as keyframes do the check
10729 tet_result(TET_FAIL);
10731 catch ( Dali::DaliException& e )
10733 DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );
10739 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10741 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10743 TestApplication application;
10745 tet_infoline("Set initial position and set up animation to re-position actor");
10747 Actor actor = Actor::New();
10748 Stage::GetCurrent().Add(actor);
10749 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10750 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10752 // Build the animation
10753 Animation animation = Animation::New(2.0f);
10755 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10756 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10757 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10759 tet_infoline("Set target position in animation without intiating play");
10761 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10762 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10764 application.SendNotification();
10765 application.Render();
10767 tet_infoline("Ensure position of actor is still at intial value");
10769 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10770 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10771 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10773 tet_infoline("Play animation and ensure actor position is now target");
10776 application.SendNotification();
10777 application.Render(1000u);
10779 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10781 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10782 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10783 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10785 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10787 application.Render(2000u);
10789 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10791 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10792 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10793 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10798 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10800 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10802 TestApplication application;
10804 std::vector<Vector3> targetPositions;
10806 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10807 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10808 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10810 tet_infoline("Set initial position and set up animation to re-position actor");
10812 Actor actor = Actor::New();
10813 Stage::GetCurrent().Add(actor);
10814 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10815 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10817 // Build the animation
10818 Animation animation = Animation::New(2.0f);
10820 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10821 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10822 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10824 tet_infoline("Set target position in animation without intiating play");
10826 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
10828 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
10831 application.SendNotification();
10832 application.Render();
10834 tet_infoline("Ensure position of actor is still at intial value");
10836 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10837 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10838 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10840 tet_infoline("Play animation and ensure actor position is now target");
10843 application.SendNotification();
10844 application.Render(1000u);
10846 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10848 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10849 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10850 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10852 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10854 application.Render(2000u);
10856 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10858 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10859 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10860 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10865 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
10867 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even with mulitple animators of different Property Indexes");
10869 TestApplication application;
10871 std::vector<Vector3> targetSizes;
10872 std::vector<Vector3> targetPositions;
10874 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10875 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10877 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10879 tet_infoline("Set initial position and set up animation to re-position actor");
10881 Actor actor = Actor::New();
10882 Stage::GetCurrent().Add(actor);
10883 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
10884 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
10886 actor.SetProperty( Actor::Property::SIZE, initialSize );
10887 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10889 // Build the animation
10890 Animation animation = Animation::New(2.0f);
10892 tet_infoline("Set target size in animation without intiating play");
10893 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10894 tet_infoline("Set target position in animation without intiating play");
10895 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
10896 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10898 application.SendNotification();
10899 application.Render();
10901 tet_infoline("Ensure position of actor is still at intial size and position");
10903 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10904 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10905 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10907 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
10908 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
10909 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
10911 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10914 application.SendNotification();
10915 application.Render(2000u);
10917 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10919 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10920 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10921 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10923 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
10924 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
10925 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
10930 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
10932 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
10934 TestApplication application;
10936 std::vector<Vector3> targetSizes;
10937 std::vector<float> targetColors;
10939 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10940 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
10942 targetColors.push_back( 1.0f );
10944 tet_infoline("Set initial position and set up animation to re-position actor");
10946 Actor actor = Actor::New();
10947 Stage::GetCurrent().Add(actor);
10948 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
10950 actor.SetProperty( Actor::Property::SIZE, initialSize );
10952 // Build the animation
10953 Animation animation = Animation::New(2.0f);
10955 tet_infoline("Set target size in animation without initiating play");
10956 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10957 tet_infoline("Set target position in animation without intiating play");
10958 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
10959 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10961 application.SendNotification();
10962 application.Render();
10964 tet_infoline("Ensure position of actor is still at initial size and position");
10966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10967 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10968 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10970 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10973 application.SendNotification();
10974 application.Render(2000u);
10976 tet_infoline("Ensure position and size of actor is at target value when animation playing");
10978 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10979 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10980 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10982 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
10987 int UtcDaliAnimationTimePeriodOrder(void)
10989 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
10991 TestApplication application;
10993 Actor actor = Actor::New();
10994 Stage::GetCurrent().Add( actor );
10996 application.SendNotification();
10997 application.Render();
10999 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11000 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11001 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11002 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11003 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11005 //////////////////////////////////////////////////////////////////////////////////
11007 tet_infoline( "With two AnimateTo calls" );
11009 Animation animation = Animation::New( 0.0f );
11010 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11011 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11014 tet_infoline( "The target position should change instantly" );
11015 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11016 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11018 application.SendNotification();
11019 application.Render(5000); // After the animation is complete
11021 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11022 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11023 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11025 //////////////////////////////////////////////////////////////////////////////////
11027 tet_infoline( "Same animation again but in a different order - should yield the same result" );
11029 actor.SetX( 0.0f );
11030 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11031 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11033 application.SendNotification();
11034 application.Render();
11036 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11037 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11038 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11040 animation = Animation::New( 0.0f );
11041 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11042 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11045 tet_infoline( "The target position should change instantly" );
11046 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11047 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11049 application.SendNotification();
11050 application.Render(5000); // After the animation is complete
11052 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11053 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11054 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11059 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11061 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls" );
11063 TestApplication application;
11065 Actor actor = Actor::New();
11066 Stage::GetCurrent().Add( actor );
11068 application.SendNotification();
11069 application.Render();
11071 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11072 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11073 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11074 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11075 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11077 //////////////////////////////////////////////////////////////////////////////////
11079 tet_infoline( "" );
11081 Animation animation = Animation::New( 0.0f );
11082 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11083 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11084 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11085 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11086 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11087 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11090 tet_infoline( "The target position should change instantly" );
11091 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11092 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11094 application.SendNotification();
11095 application.Render(14000); // After the animation is complete
11097 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11098 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11099 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11101 //////////////////////////////////////////////////////////////////////////////////
11103 tet_infoline( "Same animation again but in a different order - should end up at the same point" );
11105 actor.SetX( 0.0f );
11107 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11108 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11110 application.SendNotification();
11111 application.Render();
11113 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11114 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11115 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11117 animation = Animation::New( 0.0f );
11118 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11119 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11120 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11121 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11122 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11123 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11126 tet_infoline( "The target position should change instantly" );
11127 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11128 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11130 application.SendNotification();
11131 application.Render(14000); // After the animation is complete
11133 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11134 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11135 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11140 int UtcDaliAnimationAnimateBetweenIntegerP(void)
11142 TestApplication application;
11145 Actor actor = Actor::New();
11146 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11147 Stage::GetCurrent().Add(actor);
11149 application.Render();
11150 application.SendNotification();
11152 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
11154 // Build the animation
11155 float durationSeconds(1.0f);
11156 Animation animation = Animation::New(durationSeconds);
11158 KeyFrames keyFrames = KeyFrames::New();
11159 keyFrames.Add(0.0f, 10);
11160 keyFrames.Add(0.2f, 20);
11161 keyFrames.Add(0.4f, 30);
11162 keyFrames.Add(0.6f, 40);
11163 keyFrames.Add(0.8f, 50);
11164 keyFrames.Add(1.0f, 60);
11166 animation.AnimateBetween( Property(actor, index ), keyFrames );
11168 // Start the animation
11171 // Target value should change to the last key-frame's value straight away
11172 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
11177 int UtcDaliAnimationAnimateBetweenVector2P(void)
11179 TestApplication application;
11181 Vector2 startValue( 10.0f, 20.0f );
11182 Actor actor = Actor::New();
11183 const Property::Index index = actor.RegisterProperty("customProperty", startValue );
11184 Stage::GetCurrent().Add(actor);
11186 application.Render();
11187 application.SendNotification();
11189 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
11191 // Build the animation
11192 float durationSeconds(1.0f);
11193 Animation animation = Animation::New(durationSeconds);
11195 KeyFrames keyFrames = KeyFrames::New();
11196 keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
11197 keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
11198 keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
11199 keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
11200 keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
11201 keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
11203 animation.AnimateBetween( Property(actor, index ), keyFrames );
11205 // Start the animation
11208 // Target value should change to the last key-frame's value straight away
11209 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );