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 // Build the animation
2366 float durationSeconds(1.0f);
2367 Animation animation = Animation::New(durationSeconds);
2368 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2369 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2371 // Start the animation from 40% progress
2372 animation.PlayFrom( 0.4f );
2374 bool signalReceived(false);
2375 AnimationFinishCheck finishCheck(signalReceived);
2376 animation.FinishedSignal().Connect(&application, finishCheck);
2378 application.SendNotification();
2379 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2381 // We didn't expect the animation to finish yet
2382 application.SendNotification();
2383 finishCheck.CheckSignalNotReceived();
2384 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2386 animation.Play(); // Test that calling play has no effect, when animation is already playing
2387 application.SendNotification();
2388 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2390 // We didn't expect the animation to finish yet
2391 application.SendNotification();
2392 finishCheck.CheckSignalNotReceived();
2393 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2395 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2396 // We did expect the animation to finish
2397 application.SendNotification();
2398 finishCheck.CheckSignalReceived();
2399 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2401 // Check that nothing has changed after a couple of buffer swaps
2402 application.Render(0);
2403 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2404 application.Render(0);
2405 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2409 int UtcDaliAnimationPlayFromN(void)
2411 TestApplication application;
2413 Actor actor = Actor::New();
2414 Stage::GetCurrent().Add(actor);
2416 // Build the animation
2417 float durationSeconds(1.0f);
2418 Animation animation = Animation::New(durationSeconds);
2419 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2420 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2422 //PlayFrom with an argument outside the range [0..1] will be ignored
2423 animation.PlayFrom(-1.0f);
2424 application.SendNotification();
2425 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2427 animation.PlayFrom(100.0f);
2428 application.SendNotification();
2429 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2433 int UtcDaliAnimationPauseP(void)
2435 TestApplication application;
2437 Actor actor = Actor::New();
2438 Stage::GetCurrent().Add(actor);
2440 // Build the animation
2441 float durationSeconds(1.0f);
2442 Animation animation = Animation::New(durationSeconds);
2443 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2444 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2446 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2448 // Start the animation
2451 bool signalReceived(false);
2452 AnimationFinishCheck finishCheck(signalReceived);
2453 animation.FinishedSignal().Connect(&application, finishCheck);
2455 application.SendNotification();
2456 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2458 // We didn't expect the animation to finish yet
2459 application.SendNotification();
2460 finishCheck.CheckSignalNotReceived();
2461 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2463 // Pause the animation
2465 application.SendNotification();
2468 for (int i=0; i<5; ++i)
2470 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2472 // We didn't expect the animation to finish yet
2473 application.SendNotification();
2474 finishCheck.CheckSignalNotReceived();
2475 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2480 application.SendNotification();
2481 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2483 // We didn't expect the animation to finish yet
2484 application.SendNotification();
2485 finishCheck.CheckSignalNotReceived();
2487 application.SendNotification();
2488 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2490 // We did expect the animation to finish
2491 application.SendNotification();
2492 finishCheck.CheckSignalReceived();
2493 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2495 // Check that nothing has changed after a couple of buffer swaps
2496 application.Render(0);
2497 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2498 application.Render(0);
2499 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2504 int UtcDaliAnimationGetStateP(void)
2506 TestApplication application;
2508 Actor actor = Actor::New();
2509 Stage::GetCurrent().Add(actor);
2511 // Build the animation
2512 float durationSeconds(1.0f);
2513 Animation animation = Animation::New(durationSeconds);
2514 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2515 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2516 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2518 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2520 // Start the animation
2523 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2525 bool signalReceived(false);
2526 AnimationFinishCheck finishCheck(signalReceived);
2527 animation.FinishedSignal().Connect(&application, finishCheck);
2529 application.SendNotification();
2530 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2532 // We didn't expect the animation to finish yet
2533 application.SendNotification();
2534 finishCheck.CheckSignalNotReceived();
2535 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2536 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2538 // Pause the animation
2540 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2541 application.SendNotification();
2542 application.Render(0.f);
2545 for (int i=0; i<5; ++i)
2547 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2549 // We didn't expect the animation to finish yet
2550 application.SendNotification();
2551 finishCheck.CheckSignalNotReceived();
2552 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2553 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2557 finishCheck.Reset();
2559 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2560 application.SendNotification();
2561 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2562 // We didn't expect the animation to finish yet
2563 application.SendNotification();
2564 finishCheck.CheckSignalNotReceived();
2565 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2567 application.SendNotification();
2568 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2570 // We did expect the animation to finish
2571 application.SendNotification();
2572 finishCheck.CheckSignalReceived();
2573 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2574 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2576 // Check that nothing has changed after a couple of buffer swaps
2577 application.Render(0);
2578 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2579 application.Render(0);
2580 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2581 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2584 finishCheck.Reset();
2586 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2587 application.SendNotification();
2588 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2589 application.SendNotification();
2590 finishCheck.CheckSignalNotReceived();
2591 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2597 int UtcDaliAnimationStopP(void)
2599 TestApplication application;
2601 Actor actor = Actor::New();
2602 Stage::GetCurrent().Add(actor);
2604 // Build the animation
2605 float durationSeconds(1.0f);
2606 Animation animation = Animation::New(durationSeconds);
2607 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2608 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2610 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2612 // Start the animation
2615 bool signalReceived(false);
2616 AnimationFinishCheck finishCheck(signalReceived);
2617 animation.FinishedSignal().Connect(&application, finishCheck);
2619 application.SendNotification();
2620 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2622 // We didn't expect the animation to finish yet
2623 application.SendNotification();
2624 finishCheck.CheckSignalNotReceived();
2625 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2627 // Stop the animation
2629 application.SendNotification();
2632 for (int i=0; i<5; ++i)
2634 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2636 // We did expect the animation to finish
2637 application.SendNotification();
2638 finishCheck.CheckSignalReceived();
2639 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2644 int UtcDaliAnimationStopSetPositionP(void)
2646 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2647 // i.e. to check that the animation does not interfere with the position set.
2649 TestApplication application;
2651 Actor actor = Actor::New();
2652 Stage::GetCurrent().Add(actor);
2654 // Build the animation
2655 float durationSeconds(1.0f);
2656 Animation animation = Animation::New(durationSeconds);
2657 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2658 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2660 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2662 // Start the animation
2665 bool signalReceived(false);
2666 AnimationFinishCheck finishCheck(signalReceived);
2667 animation.FinishedSignal().Connect(&application, finishCheck);
2669 application.SendNotification();
2670 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2672 // We didn't expect the animation to finish yet
2673 application.SendNotification();
2674 finishCheck.CheckSignalNotReceived();
2675 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2677 // Stop the animation
2679 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2680 actor.SetPosition(positionSet);
2681 application.SendNotification();
2684 for (int i=0; i<5; ++i)
2686 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2688 // We did expect the animation to finish
2689 application.SendNotification();
2690 finishCheck.CheckSignalReceived();
2691 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2696 int UtcDaliAnimationClearP(void)
2698 TestApplication application;
2700 Actor actor = Actor::New();
2701 Stage::GetCurrent().Add(actor);
2703 // Build the animation
2704 float durationSeconds(1.0f);
2705 Animation animation = Animation::New(durationSeconds);
2706 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2707 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2709 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2711 // Start the animation
2714 bool signalReceived(false);
2715 AnimationFinishCheck finishCheck(signalReceived);
2716 animation.FinishedSignal().Connect(&application, finishCheck);
2718 application.SendNotification();
2719 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2721 // We didn't expect the animation to finish yet
2722 application.SendNotification();
2723 finishCheck.CheckSignalNotReceived();
2724 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2726 // Clear the animation
2728 application.SendNotification();
2730 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2732 // We don't expect the animation to finish now
2733 application.SendNotification();
2734 finishCheck.CheckSignalNotReceived();
2735 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2737 // Restart as a scale animation; this should not move the actor's position
2738 finishCheck.Reset();
2739 actor.SetPosition(Vector3::ZERO);
2740 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2741 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2744 application.SendNotification();
2745 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2747 // We didn't expect the animation to finish yet
2748 application.SendNotification();
2749 finishCheck.CheckSignalNotReceived();
2750 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2751 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2753 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2755 // We did expect the animation to finish
2756 application.SendNotification();
2757 finishCheck.CheckSignalReceived();
2758 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2759 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2763 int UtcDaliAnimationFinishedSignalP(void)
2765 TestApplication application;
2767 // Start the empty animation
2768 float durationSeconds(1.0f);
2769 Animation animation = Animation::New(durationSeconds);
2772 bool signalReceived(false);
2773 AnimationFinishCheck finishCheck(signalReceived);
2774 animation.FinishedSignal().Connect(&application, finishCheck);
2776 application.SendNotification();
2777 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2779 // We did expect the animation to finish
2780 application.SendNotification();
2781 finishCheck.CheckSignalReceived();
2785 int UtcDaliAnimationAnimateByBooleanP(void)
2787 TestApplication application;
2789 Actor actor = Actor::New();
2791 // Register a boolean property
2792 bool startValue(false);
2793 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2794 Stage::GetCurrent().Add(actor);
2795 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2796 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2798 // Build the animation
2799 float durationSeconds(2.0f);
2800 Animation animation = Animation::New(durationSeconds);
2801 const bool relativeValue(true);
2802 const bool finalValue( false || relativeValue );
2803 animation.AnimateBy(Property(actor, index), relativeValue);
2805 // Start the animation
2808 bool signalReceived(false);
2809 AnimationFinishCheck finishCheck(signalReceived);
2810 animation.FinishedSignal().Connect(&application, finishCheck);
2812 application.SendNotification();
2813 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2815 // We didn't expect the animation to finish yet
2816 application.SendNotification();
2817 finishCheck.CheckSignalNotReceived();
2818 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2820 application.SendNotification();
2821 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2823 // We did expect the animation to finish
2824 application.SendNotification();
2825 finishCheck.CheckSignalReceived();
2826 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2828 // Check that nothing has changed after a couple of buffer swaps
2829 application.Render(0);
2830 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2831 application.Render(0);
2832 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2834 // Repeat with relative value "false" - this should be an NOOP
2835 animation = Animation::New(durationSeconds);
2836 bool noOpValue(false);
2837 animation.AnimateBy(Property(actor, index), noOpValue);
2839 // Start the animation
2842 finishCheck.Reset();
2843 animation.FinishedSignal().Connect(&application, finishCheck);
2845 application.SendNotification();
2846 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2848 // We didn't expect the animation to finish yet
2849 application.SendNotification();
2850 finishCheck.CheckSignalNotReceived();
2851 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2853 application.SendNotification();
2854 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2856 // We did expect the animation to finish
2857 application.SendNotification();
2858 finishCheck.CheckSignalReceived();
2859 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2861 // Check that nothing has changed after a couple of buffer swaps
2862 application.Render(0);
2863 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2864 application.Render(0);
2865 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2869 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2871 TestApplication application;
2873 Actor actor = Actor::New();
2875 // Register a boolean property
2876 bool startValue(false);
2877 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2878 Stage::GetCurrent().Add(actor);
2879 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2880 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2882 // Build the animation
2883 float durationSeconds(2.0f);
2884 Animation animation = Animation::New(durationSeconds);
2885 bool relativeValue(true);
2886 bool finalValue( false || relativeValue );
2887 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2889 // Start the animation
2892 bool signalReceived(false);
2893 AnimationFinishCheck finishCheck(signalReceived);
2894 animation.FinishedSignal().Connect(&application, finishCheck);
2896 application.SendNotification();
2897 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2899 // We didn't expect the animation to finish yet
2900 application.SendNotification();
2901 finishCheck.CheckSignalNotReceived();
2902 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2904 application.SendNotification();
2905 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2907 // We did expect the animation to finish
2908 application.SendNotification();
2909 finishCheck.CheckSignalReceived();
2910 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2912 // Check that nothing has changed after a couple of buffer swaps
2913 application.Render(0);
2914 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2915 application.Render(0);
2916 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2918 // Repeat with relative value "false" - this should be an NOOP
2919 animation = Animation::New(durationSeconds);
2920 bool noOpValue(false);
2921 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2923 // Start the animation
2926 finishCheck.Reset();
2927 animation.FinishedSignal().Connect(&application, finishCheck);
2929 application.SendNotification();
2930 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2932 // We didn't expect the animation to finish yet
2933 application.SendNotification();
2934 finishCheck.CheckSignalNotReceived();
2935 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2937 application.SendNotification();
2938 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2940 // We did expect the animation to finish
2941 application.SendNotification();
2942 finishCheck.CheckSignalReceived();
2943 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2947 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2949 TestApplication application;
2951 Actor actor = Actor::New();
2953 // Register a boolean property
2954 bool startValue(false);
2955 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2956 Stage::GetCurrent().Add(actor);
2957 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2958 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2960 // Build the animation
2961 float durationSeconds(2.0f);
2962 Animation animation = Animation::New(durationSeconds);
2963 bool relativeValue(true);
2964 bool finalValue( false || relativeValue );
2965 float animatorDurationSeconds(durationSeconds * 0.5f);
2966 animation.AnimateBy( Property(actor, index),
2968 TimePeriod( animatorDurationSeconds ) );
2970 // Start the animation
2973 bool signalReceived(false);
2974 AnimationFinishCheck finishCheck(signalReceived);
2975 animation.FinishedSignal().Connect(&application, finishCheck);
2977 application.SendNotification();
2978 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2980 // We didn't expect the animation to finish yet
2981 application.SendNotification();
2982 finishCheck.CheckSignalNotReceived();
2983 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2985 application.SendNotification();
2986 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2988 // We didn't expect the animation to finish yet...
2989 application.SendNotification();
2990 finishCheck.CheckSignalNotReceived();
2992 // ...however we should have reached the final value
2993 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2995 application.SendNotification();
2996 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2998 // We did expect the animation to finish
2999 application.SendNotification();
3000 finishCheck.CheckSignalReceived();
3001 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3003 // Check that nothing has changed after a couple of buffer swaps
3004 application.Render(0);
3005 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3006 application.Render(0);
3007 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3011 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3013 TestApplication application;
3015 Actor actor = Actor::New();
3017 // Register a boolean property
3018 bool startValue(false);
3019 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3020 Stage::GetCurrent().Add(actor);
3021 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3022 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3024 // Build the animation
3025 float durationSeconds(2.0f);
3026 Animation animation = Animation::New(durationSeconds);
3027 bool relativeValue(true);
3028 bool finalValue( false || relativeValue );
3029 float animatorDurationSeconds(durationSeconds * 0.5f);
3030 animation.AnimateBy( Property(actor, index),
3032 AlphaFunction::EASE_IN_OUT,
3033 TimePeriod( animatorDurationSeconds ) );
3035 // Start the animation
3038 bool signalReceived(false);
3039 AnimationFinishCheck finishCheck(signalReceived);
3040 animation.FinishedSignal().Connect(&application, finishCheck);
3042 application.SendNotification();
3043 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3045 // We didn't expect the animation to finish yet
3046 application.SendNotification();
3047 finishCheck.CheckSignalNotReceived();
3048 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3050 application.SendNotification();
3051 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3053 // We didn't expect the animation to finish yet...
3054 application.SendNotification();
3055 finishCheck.CheckSignalNotReceived();
3057 // ...however we should have reached the final value
3058 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3060 application.SendNotification();
3061 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3063 // We did expect the animation to finish
3064 application.SendNotification();
3065 finishCheck.CheckSignalReceived();
3066 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3068 // Check that nothing has changed after a couple of buffer swaps
3069 application.Render(0);
3070 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3071 application.Render(0);
3072 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3076 int UtcDaliAnimationAnimateByFloatP(void)
3078 TestApplication application;
3080 Actor actor = Actor::New();
3082 // Register a float property
3083 float startValue(10.0f);
3084 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3085 Stage::GetCurrent().Add(actor);
3086 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3087 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3089 // Build the animation
3090 float durationSeconds(2.0f);
3091 Animation animation = Animation::New(durationSeconds);
3092 float targetValue(50.0f);
3093 float relativeValue(targetValue - startValue);
3094 animation.AnimateBy(Property(actor, index), relativeValue);
3096 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3098 // Start the animation
3101 bool signalReceived(false);
3102 AnimationFinishCheck finishCheck(signalReceived);
3103 animation.FinishedSignal().Connect(&application, finishCheck);
3105 application.SendNotification();
3106 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3108 // We didn't expect the animation to finish yet
3109 application.SendNotification();
3110 finishCheck.CheckSignalNotReceived();
3111 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3113 application.SendNotification();
3114 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3116 // We did expect the animation to finish
3117 application.SendNotification();
3118 finishCheck.CheckSignalReceived();
3119 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3121 // Check that nothing has changed after a couple of buffer swaps
3122 application.Render(0);
3123 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3124 application.Render(0);
3125 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3129 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3131 TestApplication application;
3133 Actor actor = Actor::New();
3135 // Register a float property
3136 float startValue(10.0f);
3137 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3138 Stage::GetCurrent().Add(actor);
3139 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3140 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3142 // Build the animation
3143 float durationSeconds(1.0f);
3144 Animation animation = Animation::New(durationSeconds);
3145 float targetValue(90.0f);
3146 float relativeValue(targetValue - startValue);
3147 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3149 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3151 // Start the animation
3154 bool signalReceived(false);
3155 AnimationFinishCheck finishCheck(signalReceived);
3156 animation.FinishedSignal().Connect(&application, finishCheck);
3158 application.SendNotification();
3159 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3161 // We didn't expect the animation to finish yet
3162 application.SendNotification();
3163 finishCheck.CheckSignalNotReceived();
3165 // The position should have moved more, than with a linear alpha function
3166 float current( actor.GetCurrentProperty< float >( index ) );
3167 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3169 application.SendNotification();
3170 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3172 // We did expect the animation to finish
3173 application.SendNotification();
3174 finishCheck.CheckSignalReceived();
3175 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3177 // Check that nothing has changed after a couple of buffer swaps
3178 application.Render(0);
3179 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3180 application.Render(0);
3181 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3185 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3187 TestApplication application;
3189 Actor actor = Actor::New();
3191 // Register a float property
3192 float startValue(10.0f);
3193 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3194 Stage::GetCurrent().Add(actor);
3195 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3196 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3198 // Build the animation
3199 float durationSeconds(1.0f);
3200 Animation animation = Animation::New(durationSeconds);
3201 float targetValue(30.0f);
3202 float relativeValue(targetValue - startValue);
3204 animation.AnimateBy(Property(actor, index),
3206 TimePeriod(delay, durationSeconds - delay));
3208 // Start the animation
3211 bool signalReceived(false);
3212 AnimationFinishCheck finishCheck(signalReceived);
3213 animation.FinishedSignal().Connect(&application, finishCheck);
3215 application.SendNotification();
3216 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3218 // We didn't expect the animation to finish yet
3219 application.SendNotification();
3220 finishCheck.CheckSignalNotReceived();
3221 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3223 application.SendNotification();
3224 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3226 // We didn't expect the animation to finish yet
3227 application.SendNotification();
3228 finishCheck.CheckSignalNotReceived();
3229 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3231 application.SendNotification();
3232 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3234 // We did expect the animation to finish
3235 application.SendNotification();
3236 finishCheck.CheckSignalReceived();
3237 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3239 // Check that nothing has changed after a couple of buffer swaps
3240 application.Render(0);
3241 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3242 application.Render(0);
3243 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3247 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3249 TestApplication application;
3251 Actor actor = Actor::New();
3253 // Register a float property
3254 float startValue(10.0f);
3255 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3256 Stage::GetCurrent().Add(actor);
3257 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3258 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3260 // Build the animation
3261 float durationSeconds(1.0f);
3262 Animation animation = Animation::New(durationSeconds);
3263 float targetValue(30.0f);
3264 float relativeValue(targetValue - startValue);
3266 animation.AnimateBy(Property(actor, index),
3268 AlphaFunction::LINEAR,
3269 TimePeriod(delay, durationSeconds - delay));
3271 // Start the animation
3274 bool signalReceived(false);
3275 AnimationFinishCheck finishCheck(signalReceived);
3276 animation.FinishedSignal().Connect(&application, finishCheck);
3278 application.SendNotification();
3279 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3281 // We didn't expect the animation to finish yet
3282 application.SendNotification();
3283 finishCheck.CheckSignalNotReceived();
3284 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3286 application.SendNotification();
3287 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3289 // We didn't expect the animation to finish yet
3290 application.SendNotification();
3291 finishCheck.CheckSignalNotReceived();
3292 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3294 application.SendNotification();
3295 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3297 // We did expect the animation to finish
3298 application.SendNotification();
3299 finishCheck.CheckSignalReceived();
3300 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3302 // Check that nothing has changed after a couple of buffer swaps
3303 application.Render(0);
3304 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3305 application.Render(0);
3306 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3310 int UtcDaliAnimationAnimateByIntegerP(void)
3312 TestApplication application;
3314 Actor actor = Actor::New();
3316 // Register an integer property
3318 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3319 Stage::GetCurrent().Add(actor);
3320 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3321 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3323 // Build the animation
3324 float durationSeconds(2.0f);
3325 Animation animation = Animation::New(durationSeconds);
3326 int targetValue(50);
3327 int relativeValue(targetValue - startValue);
3328 animation.AnimateBy(Property(actor, index), relativeValue);
3330 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3332 // Start the animation
3335 bool signalReceived(false);
3336 AnimationFinishCheck finishCheck(signalReceived);
3337 animation.FinishedSignal().Connect(&application, finishCheck);
3339 application.SendNotification();
3340 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3342 // We didn't expect the animation to finish yet
3343 application.SendNotification();
3344 finishCheck.CheckSignalNotReceived();
3345 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3347 application.SendNotification();
3348 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3350 // We did expect the animation to finish
3351 application.SendNotification();
3352 finishCheck.CheckSignalReceived();
3353 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3355 // Check that nothing has changed after a couple of buffer swaps
3356 application.Render(0);
3357 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3358 application.Render(0);
3359 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3363 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3365 TestApplication application;
3367 Actor actor = Actor::New();
3369 // Register an integer property
3371 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3372 Stage::GetCurrent().Add(actor);
3373 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3374 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3376 // Build the animation
3377 float durationSeconds(1.0f);
3378 Animation animation = Animation::New(durationSeconds);
3379 int targetValue(90);
3380 int relativeValue(targetValue - startValue);
3381 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3383 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3385 // Start the animation
3388 bool signalReceived(false);
3389 AnimationFinishCheck finishCheck(signalReceived);
3390 animation.FinishedSignal().Connect(&application, finishCheck);
3392 application.SendNotification();
3393 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3395 // We didn't expect the animation to finish yet
3396 application.SendNotification();
3397 finishCheck.CheckSignalNotReceived();
3399 // The position should have moved more, than with a linear alpha function
3400 int current( actor.GetCurrentProperty< int >( index ) );
3401 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3403 application.SendNotification();
3404 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3406 // We did expect the animation to finish
3407 application.SendNotification();
3408 finishCheck.CheckSignalReceived();
3409 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3411 // Check that nothing has changed after a couple of buffer swaps
3412 application.Render(0);
3413 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3414 application.Render(0);
3415 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3419 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3421 TestApplication application;
3423 Actor actor = Actor::New();
3425 // Register an integer property
3427 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3428 Stage::GetCurrent().Add(actor);
3429 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3430 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3432 // Build the animation
3433 float durationSeconds(1.0f);
3434 Animation animation = Animation::New(durationSeconds);
3435 int targetValue(30);
3436 int relativeValue(targetValue - startValue);
3438 animation.AnimateBy(Property(actor, index),
3440 TimePeriod(delay, durationSeconds - delay));
3442 // Start the animation
3445 bool signalReceived(false);
3446 AnimationFinishCheck finishCheck(signalReceived);
3447 animation.FinishedSignal().Connect(&application, finishCheck);
3449 application.SendNotification();
3450 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3452 // We didn't expect the animation to finish yet
3453 application.SendNotification();
3454 finishCheck.CheckSignalNotReceived();
3455 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3457 application.SendNotification();
3458 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3460 // We didn't expect the animation to finish yet
3461 application.SendNotification();
3462 finishCheck.CheckSignalNotReceived();
3463 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3465 application.SendNotification();
3466 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3468 // We did expect the animation to finish
3469 application.SendNotification();
3470 finishCheck.CheckSignalReceived();
3471 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3473 // Check that nothing has changed after a couple of buffer swaps
3474 application.Render(0);
3475 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3476 application.Render(0);
3477 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3481 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3483 TestApplication application;
3485 Actor actor = Actor::New();
3487 // Register an integer property
3489 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3490 Stage::GetCurrent().Add(actor);
3491 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3492 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3494 // Build the animation
3495 float durationSeconds(1.0f);
3496 Animation animation = Animation::New(durationSeconds);
3497 int targetValue(30);
3498 int relativeValue(targetValue - startValue);
3500 animation.AnimateBy(Property(actor, index),
3502 AlphaFunction::LINEAR,
3503 TimePeriod(delay, durationSeconds - delay));
3505 // Start the animation
3508 bool signalReceived(false);
3509 AnimationFinishCheck finishCheck(signalReceived);
3510 animation.FinishedSignal().Connect(&application, finishCheck);
3512 application.SendNotification();
3513 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3515 // We didn't expect the animation to finish yet
3516 application.SendNotification();
3517 finishCheck.CheckSignalNotReceived();
3518 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3520 application.SendNotification();
3521 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3523 // We didn't expect the animation to finish yet
3524 application.SendNotification();
3525 finishCheck.CheckSignalNotReceived();
3526 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3528 application.SendNotification();
3529 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3531 // We did expect the animation to finish
3532 application.SendNotification();
3533 finishCheck.CheckSignalReceived();
3534 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3536 // Check that nothing has changed after a couple of buffer swaps
3537 application.Render(0);
3538 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3539 application.Render(0);
3540 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3544 int UtcDaliAnimationAnimateByVector2P(void)
3546 TestApplication application;
3548 Actor actor = Actor::New();
3550 // Register a Vector2 property
3551 Vector2 startValue(10.0f, 10.0f);
3552 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3553 Stage::GetCurrent().Add(actor);
3554 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3555 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3557 // Build the animation
3558 float durationSeconds(2.0f);
3559 Animation animation = Animation::New(durationSeconds);
3560 Vector2 targetValue(60.0f, 60.0f);
3561 Vector2 relativeValue(targetValue - startValue);
3562 animation.AnimateBy(Property(actor, index), relativeValue);
3564 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3566 // Start the animation
3569 bool signalReceived(false);
3570 AnimationFinishCheck finishCheck(signalReceived);
3571 animation.FinishedSignal().Connect(&application, finishCheck);
3573 application.SendNotification();
3574 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3576 // We didn't expect the animation to finish yet
3577 application.SendNotification();
3578 finishCheck.CheckSignalNotReceived();
3579 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3581 application.SendNotification();
3582 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3584 // We did expect the animation to finish
3585 application.SendNotification();
3586 finishCheck.CheckSignalReceived();
3587 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3589 // Check that nothing has changed after a couple of buffer swaps
3590 application.Render(0);
3591 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3592 application.Render(0);
3593 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3597 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3599 TestApplication application;
3601 Actor actor = Actor::New();
3603 // Register a Vector2 property
3604 Vector2 startValue(100.0f, 100.0f);
3605 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3606 Stage::GetCurrent().Add(actor);
3607 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3608 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3610 // Build the animation
3611 float durationSeconds(1.0f);
3612 Animation animation = Animation::New(durationSeconds);
3613 Vector2 targetValue(20.0f, 20.0f);
3614 Vector2 relativeValue(targetValue - startValue);
3615 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3617 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3619 // Start the animation
3622 bool signalReceived(false);
3623 AnimationFinishCheck finishCheck(signalReceived);
3624 animation.FinishedSignal().Connect(&application, finishCheck);
3626 application.SendNotification();
3627 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3629 // We didn't expect the animation to finish yet
3630 application.SendNotification();
3631 finishCheck.CheckSignalNotReceived();
3633 // The position should have moved more, than with a linear alpha function
3634 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
3635 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3636 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3638 application.SendNotification();
3639 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3641 // We did expect the animation to finish
3642 application.SendNotification();
3643 finishCheck.CheckSignalReceived();
3644 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3646 // Check that nothing has changed after a couple of buffer swaps
3647 application.Render(0);
3648 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3649 application.Render(0);
3650 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3654 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3656 TestApplication application;
3658 Actor actor = Actor::New();
3660 // Register a Vector2 property
3661 Vector2 startValue(10.0f, 10.0f);
3662 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3663 Stage::GetCurrent().Add(actor);
3664 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3665 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3667 // Build the animation
3668 float durationSeconds(1.0f);
3669 Animation animation = Animation::New(durationSeconds);
3670 Vector2 targetValue(30.0f, 30.0f);
3671 Vector2 relativeValue(targetValue - startValue);
3673 animation.AnimateBy(Property(actor, index),
3675 TimePeriod(delay, durationSeconds - delay));
3677 // Start the animation
3680 bool signalReceived(false);
3681 AnimationFinishCheck finishCheck(signalReceived);
3682 animation.FinishedSignal().Connect(&application, finishCheck);
3684 application.SendNotification();
3685 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3687 // We didn't expect the animation to finish yet
3688 application.SendNotification();
3689 finishCheck.CheckSignalNotReceived();
3690 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3692 application.SendNotification();
3693 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3695 // We didn't expect the animation to finish yet
3696 application.SendNotification();
3697 finishCheck.CheckSignalNotReceived();
3698 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3700 application.SendNotification();
3701 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3703 // We did expect the animation to finish
3704 application.SendNotification();
3705 finishCheck.CheckSignalReceived();
3706 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3708 // Check that nothing has changed after a couple of buffer swaps
3709 application.Render(0);
3710 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3711 application.Render(0);
3712 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3716 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3718 TestApplication application;
3720 Actor actor = Actor::New();
3722 // Register a Vector2 property
3723 Vector2 startValue(5.0f, 5.0f);
3724 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3725 Stage::GetCurrent().Add(actor);
3726 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3727 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3729 // Build the animation
3730 float durationSeconds(1.0f);
3731 Animation animation = Animation::New(durationSeconds);
3732 Vector2 targetValue(10.0f, 10.0f);
3733 Vector2 relativeValue(targetValue - startValue);
3735 animation.AnimateBy(Property(actor, index),
3737 AlphaFunction::LINEAR,
3738 TimePeriod(delay, durationSeconds - delay));
3740 // Start the animation
3743 bool signalReceived(false);
3744 AnimationFinishCheck finishCheck(signalReceived);
3745 animation.FinishedSignal().Connect(&application, finishCheck);
3747 application.SendNotification();
3748 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% 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, TEST_LOCATION );
3755 application.SendNotification();
3756 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3758 // We didn't expect the animation to finish yet
3759 application.SendNotification();
3760 finishCheck.CheckSignalNotReceived();
3761 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3763 application.SendNotification();
3764 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3766 // We did expect the animation to finish
3767 application.SendNotification();
3768 finishCheck.CheckSignalReceived();
3769 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3771 // Check that nothing has changed after a couple of buffer swaps
3772 application.Render(0);
3773 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3774 application.Render(0);
3775 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3779 int UtcDaliAnimationAnimateByVector3P(void)
3781 TestApplication application;
3783 Actor actor = Actor::New();
3785 // Register a Vector3 property
3786 Vector3 startValue(10.0f, 10.0f, 10.0f);
3787 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3788 Stage::GetCurrent().Add(actor);
3789 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3790 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3792 // Build the animation
3793 float durationSeconds(2.0f);
3794 Animation animation = Animation::New(durationSeconds);
3795 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3796 Vector3 relativeValue(targetValue - startValue);
3797 animation.AnimateBy(Property(actor, index), relativeValue);
3799 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3801 // Start the animation
3804 bool signalReceived(false);
3805 AnimationFinishCheck finishCheck(signalReceived);
3806 animation.FinishedSignal().Connect(&application, finishCheck);
3808 application.SendNotification();
3809 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3811 // We didn't expect the animation to finish yet
3812 application.SendNotification();
3813 finishCheck.CheckSignalNotReceived();
3814 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3816 application.SendNotification();
3817 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3819 // We did expect the animation to finish
3820 application.SendNotification();
3821 finishCheck.CheckSignalReceived();
3822 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3824 // Check that nothing has changed after a couple of buffer swaps
3825 application.Render(0);
3826 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3827 application.Render(0);
3828 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3832 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3834 TestApplication application;
3836 Actor actor = Actor::New();
3838 // Register a Vector3 property
3839 Vector3 startValue(100.0f, 100.0f, 100.0f);
3840 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3841 Stage::GetCurrent().Add(actor);
3842 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3843 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3845 // Build the animation
3846 float durationSeconds(1.0f);
3847 Animation animation = Animation::New(durationSeconds);
3848 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3849 Vector3 relativeValue(targetValue - startValue);
3850 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3852 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3854 // Start the animation
3857 bool signalReceived(false);
3858 AnimationFinishCheck finishCheck(signalReceived);
3859 animation.FinishedSignal().Connect(&application, finishCheck);
3861 application.SendNotification();
3862 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3864 // We didn't expect the animation to finish yet
3865 application.SendNotification();
3866 finishCheck.CheckSignalNotReceived();
3868 // The position should have moved more, than with a linear alpha function
3869 Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
3870 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3871 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3872 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
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 UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3892 TestApplication application;
3894 Actor actor = Actor::New();
3896 // Register a Vector3 property
3897 Vector3 startValue(10.0f, 10.0f, 10.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(30.0f, 30.0f, 30.0f);
3907 Vector3 relativeValue(targetValue - startValue);
3909 animation.AnimateBy(Property(actor, index),
3911 TimePeriod(delay, durationSeconds - delay));
3913 // Start the animation
3916 bool signalReceived(false);
3917 AnimationFinishCheck finishCheck(signalReceived);
3918 animation.FinishedSignal().Connect(&application, finishCheck);
3920 application.SendNotification();
3921 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3923 // We didn't expect the animation to finish yet
3924 application.SendNotification();
3925 finishCheck.CheckSignalNotReceived();
3926 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3928 application.SendNotification();
3929 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3931 // We didn't expect the animation to finish yet
3932 application.SendNotification();
3933 finishCheck.CheckSignalNotReceived();
3934 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3936 application.SendNotification();
3937 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3939 // We did expect the animation to finish
3940 application.SendNotification();
3941 finishCheck.CheckSignalReceived();
3942 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3944 // Check that nothing has changed after a couple of buffer swaps
3945 application.Render(0);
3946 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3947 application.Render(0);
3948 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3952 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3954 TestApplication application;
3956 Actor actor = Actor::New();
3958 // Register a Vector3 property
3959 Vector3 startValue(5.0f, 5.0f, 5.0f);
3960 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3961 Stage::GetCurrent().Add(actor);
3962 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3963 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3965 // Build the animation
3966 float durationSeconds(1.0f);
3967 Animation animation = Animation::New(durationSeconds);
3968 Vector3 targetValue(10.0f, 10.0f, 10.0f);
3969 Vector3 relativeValue(targetValue - startValue);
3971 animation.AnimateBy(Property(actor, index),
3973 AlphaFunction::LINEAR,
3974 TimePeriod(delay, durationSeconds - delay));
3976 // Start the animation
3979 bool signalReceived(false);
3980 AnimationFinishCheck finishCheck(signalReceived);
3981 animation.FinishedSignal().Connect(&application, finishCheck);
3983 application.SendNotification();
3984 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3986 // We didn't expect the animation to finish yet
3987 application.SendNotification();
3988 finishCheck.CheckSignalNotReceived();
3989 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3991 application.SendNotification();
3992 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3994 // We didn't expect the animation to finish yet
3995 application.SendNotification();
3996 finishCheck.CheckSignalNotReceived();
3997 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3999 application.SendNotification();
4000 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4002 // We did expect the animation to finish
4003 application.SendNotification();
4004 finishCheck.CheckSignalReceived();
4005 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4007 // Check that nothing has changed after a couple of buffer swaps
4008 application.Render(0);
4009 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4010 application.Render(0);
4011 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4015 int UtcDaliAnimationAnimateByVector4P(void)
4017 TestApplication application;
4019 Actor actor = Actor::New();
4021 // Register a Vector4 property
4022 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4023 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4024 Stage::GetCurrent().Add(actor);
4025 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4026 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4028 // Build the animation
4029 float durationSeconds(2.0f);
4030 Animation animation = Animation::New(durationSeconds);
4031 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4032 Vector4 relativeValue(targetValue - startValue);
4033 animation.AnimateBy(Property(actor, index), relativeValue);
4035 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4037 // Start the animation
4040 bool signalReceived(false);
4041 AnimationFinishCheck finishCheck(signalReceived);
4042 animation.FinishedSignal().Connect(&application, finishCheck);
4044 application.SendNotification();
4045 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4047 // We didn't expect the animation to finish yet
4048 application.SendNotification();
4049 finishCheck.CheckSignalNotReceived();
4050 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4052 application.SendNotification();
4053 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4055 // We did expect the animation to finish
4056 application.SendNotification();
4057 finishCheck.CheckSignalReceived();
4058 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4060 // Check that nothing has changed after a couple of buffer swaps
4061 application.Render(0);
4062 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4063 application.Render(0);
4064 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4068 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4070 TestApplication application;
4072 Actor actor = Actor::New();
4074 // Register a Vector4 property
4075 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4076 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4077 Stage::GetCurrent().Add(actor);
4078 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4079 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4081 // Build the animation
4082 float durationSeconds(1.0f);
4083 Animation animation = Animation::New(durationSeconds);
4084 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4085 Vector4 relativeValue(targetValue - startValue);
4086 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4088 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4090 // Start the animation
4093 bool signalReceived(false);
4094 AnimationFinishCheck finishCheck(signalReceived);
4095 animation.FinishedSignal().Connect(&application, finishCheck);
4097 application.SendNotification();
4098 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4100 // We didn't expect the animation to finish yet
4101 application.SendNotification();
4102 finishCheck.CheckSignalNotReceived();
4104 // The position should have moved more, than with a linear alpha function
4105 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4106 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4107 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4108 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4109 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4111 application.SendNotification();
4112 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4114 // We did expect the animation to finish
4115 application.SendNotification();
4116 finishCheck.CheckSignalReceived();
4117 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4119 // Check that nothing has changed after a couple of buffer swaps
4120 application.Render(0);
4121 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4122 application.Render(0);
4123 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4127 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4129 TestApplication application;
4131 Actor actor = Actor::New();
4133 // Register a Vector4 property
4134 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4135 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4136 Stage::GetCurrent().Add(actor);
4137 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4138 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4140 // Build the animation
4141 float durationSeconds(1.0f);
4142 Animation animation = Animation::New(durationSeconds);
4143 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4144 Vector4 relativeValue(targetValue - startValue);
4146 animation.AnimateBy(Property(actor, index),
4148 TimePeriod(delay, durationSeconds - delay));
4150 // Start the animation
4153 bool signalReceived(false);
4154 AnimationFinishCheck finishCheck(signalReceived);
4155 animation.FinishedSignal().Connect(&application, finishCheck);
4157 application.SendNotification();
4158 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4160 // We didn't expect the animation to finish yet
4161 application.SendNotification();
4162 finishCheck.CheckSignalNotReceived();
4163 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4165 application.SendNotification();
4166 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4168 // We didn't expect the animation to finish yet
4169 application.SendNotification();
4170 finishCheck.CheckSignalNotReceived();
4171 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4173 application.SendNotification();
4174 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4176 // We did expect the animation to finish
4177 application.SendNotification();
4178 finishCheck.CheckSignalReceived();
4179 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4181 // Check that nothing has changed after a couple of buffer swaps
4182 application.Render(0);
4183 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4184 application.Render(0);
4185 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4189 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4191 TestApplication application;
4193 Actor actor = Actor::New();
4195 // Register a Vector4 property
4196 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4197 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4198 Stage::GetCurrent().Add(actor);
4199 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4200 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4202 // Build the animation
4203 float durationSeconds(1.0f);
4204 Animation animation = Animation::New(durationSeconds);
4205 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4206 Vector4 relativeValue(targetValue - startValue);
4208 animation.AnimateBy(Property(actor, index),
4210 AlphaFunction::LINEAR,
4211 TimePeriod(delay, durationSeconds - delay));
4213 // Start the animation
4216 bool signalReceived(false);
4217 AnimationFinishCheck finishCheck(signalReceived);
4218 animation.FinishedSignal().Connect(&application, finishCheck);
4220 application.SendNotification();
4221 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4223 // We didn't expect the animation to finish yet
4224 application.SendNotification();
4225 finishCheck.CheckSignalNotReceived();
4226 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4228 application.SendNotification();
4229 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4231 // We didn't expect the animation to finish yet
4232 application.SendNotification();
4233 finishCheck.CheckSignalNotReceived();
4234 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4236 application.SendNotification();
4237 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4239 // We did expect the animation to finish
4240 application.SendNotification();
4241 finishCheck.CheckSignalReceived();
4242 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4244 // Check that nothing has changed after a couple of buffer swaps
4245 application.Render(0);
4246 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4247 application.Render(0);
4248 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4252 int UtcDaliAnimationAnimateByActorPositionP(void)
4254 TestApplication application;
4256 Actor actor = Actor::New();
4257 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4258 actor.SetPosition(startPosition);
4259 Stage::GetCurrent().Add(actor);
4260 application.SendNotification();
4261 application.Render(0);
4262 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4264 // Build the animation
4265 float durationSeconds(1.0f);
4266 Animation animation = Animation::New(durationSeconds);
4267 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4268 Vector3 relativePosition(targetPosition - startPosition);
4269 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4271 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4273 // Start the animation
4276 bool signalReceived(false);
4277 AnimationFinishCheck finishCheck(signalReceived);
4278 animation.FinishedSignal().Connect(&application, finishCheck);
4280 application.SendNotification();
4281 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4283 // We didn't expect the animation to finish yet
4284 application.SendNotification();
4285 finishCheck.CheckSignalNotReceived();
4286 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4288 application.SendNotification();
4289 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4291 // We did expect the animation to finish
4292 application.SendNotification();
4293 finishCheck.CheckSignalReceived();
4294 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4296 // Check that nothing has changed after a couple of buffer swaps
4297 application.Render(0);
4298 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4299 application.Render(0);
4300 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4304 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4306 TestApplication application;
4308 Actor actor = Actor::New();
4309 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4310 actor.SetPosition(startPosition);
4311 Stage::GetCurrent().Add(actor);
4312 application.SendNotification();
4313 application.Render(0);
4314 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4316 // Build the animation
4317 float durationSeconds(1.0f);
4318 Animation animation = Animation::New(durationSeconds);
4319 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4320 Vector3 relativePosition(targetPosition - startPosition);
4321 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4323 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4325 // Start the animation
4328 bool signalReceived(false);
4329 AnimationFinishCheck finishCheck(signalReceived);
4330 animation.FinishedSignal().Connect(&application, finishCheck);
4332 application.SendNotification();
4333 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4335 // We didn't expect the animation to finish yet
4336 application.SendNotification();
4337 finishCheck.CheckSignalNotReceived();
4339 // The position should have moved more, than with a linear alpha function
4340 Vector3 current(actor.GetCurrentPosition());
4341 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4342 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4343 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4345 application.SendNotification();
4346 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4348 // We did expect the animation to finish
4349 application.SendNotification();
4350 finishCheck.CheckSignalReceived();
4351 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4353 // Check that nothing has changed after a couple of buffer swaps
4354 application.Render(0);
4355 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4356 application.Render(0);
4357 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4361 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4363 TestApplication application;
4365 Actor actor = Actor::New();
4366 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4367 actor.SetPosition(startPosition);
4368 Stage::GetCurrent().Add(actor);
4369 application.SendNotification();
4370 application.Render(0);
4371 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4373 // Build the animation
4374 float durationSeconds(1.0f);
4375 Animation animation = Animation::New(durationSeconds);
4376 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4377 Vector3 relativePosition(targetPosition - startPosition);
4379 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4381 TimePeriod(delay, durationSeconds - delay));
4383 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4385 // Start the animation
4388 bool signalReceived(false);
4389 AnimationFinishCheck finishCheck(signalReceived);
4390 animation.FinishedSignal().Connect(&application, finishCheck);
4392 application.SendNotification();
4393 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4395 // We didn't expect the animation to finish yet
4396 application.SendNotification();
4397 finishCheck.CheckSignalNotReceived();
4398 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4400 application.SendNotification();
4401 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4403 // We did expect the animation to finish
4404 application.SendNotification();
4405 finishCheck.CheckSignalReceived();
4406 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4408 // Check that nothing has changed after a couple of buffer swaps
4409 application.Render(0);
4410 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4411 application.Render(0);
4412 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4416 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4418 TestApplication application;
4420 Actor actor = Actor::New();
4421 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4422 actor.SetPosition(startPosition);
4423 Stage::GetCurrent().Add(actor);
4424 application.SendNotification();
4425 application.Render(0);
4426 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4428 // Build the animation
4429 float durationSeconds(1.0f);
4430 Animation animation = Animation::New(durationSeconds);
4431 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4432 Vector3 relativePosition(targetPosition - startPosition);
4434 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4436 AlphaFunction::LINEAR,
4437 TimePeriod(delay, durationSeconds - delay));
4439 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4441 // Start the animation
4444 bool signalReceived(false);
4445 AnimationFinishCheck finishCheck(signalReceived);
4446 animation.FinishedSignal().Connect(&application, finishCheck);
4448 application.SendNotification();
4449 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4451 // We didn't expect the animation to finish yet
4452 application.SendNotification();
4453 finishCheck.CheckSignalNotReceived();
4454 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4456 application.SendNotification();
4457 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4459 // We did expect the animation to finish
4460 application.SendNotification();
4461 finishCheck.CheckSignalReceived();
4462 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4464 // Check that nothing has changed after a couple of buffer swaps
4465 application.Render(0);
4466 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4467 application.Render(0);
4468 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4472 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4474 TestApplication application;
4476 Actor actor = Actor::New();
4477 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4478 Stage::GetCurrent().Add(actor);
4479 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4481 // Build the animation
4482 float durationSeconds(1.0f);
4483 Animation animation = Animation::New(durationSeconds);
4484 Degree relativeRotationDegrees(360.0f);
4485 Radian relativeRotationRadians(relativeRotationDegrees);
4486 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
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*250.0f)/* 25% progress */);
4498 // We didn't expect the animation to finish yet
4499 application.SendNotification();
4500 finishCheck.CheckSignalNotReceived();
4501 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4503 application.SendNotification();
4504 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4506 // We didn't expect the animation to finish yet
4507 application.SendNotification();
4508 finishCheck.CheckSignalNotReceived();
4509 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4511 application.SendNotification();
4512 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4514 // We didn't expect the animation to finish yet
4515 application.SendNotification();
4516 finishCheck.CheckSignalNotReceived();
4517 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4519 application.SendNotification();
4520 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4522 // We did expect the animation to finish
4523 application.SendNotification();
4524 finishCheck.CheckSignalReceived();
4525 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4529 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4531 TestApplication application;
4533 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4535 Actor actor = Actor::New();
4536 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4537 Stage::GetCurrent().Add(actor);
4538 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4540 // Build the animation
4541 float durationSeconds(1.0f);
4542 Animation animation = Animation::New(durationSeconds);
4543 Degree relativeRotationDegrees(710.0f);
4544 Radian relativeRotationRadians(relativeRotationDegrees);
4546 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4548 // Start the animation
4551 bool signalReceived(false);
4552 AnimationFinishCheck finishCheck(signalReceived);
4553 animation.FinishedSignal().Connect(&application, finishCheck);
4555 application.SendNotification();
4556 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4558 // We didn't expect the animation to finish yet
4559 application.SendNotification();
4560 finishCheck.CheckSignalNotReceived();
4561 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4563 application.SendNotification();
4564 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4566 // We didn't expect the animation to finish yet
4567 application.SendNotification();
4568 finishCheck.CheckSignalNotReceived();
4569 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4571 application.SendNotification();
4572 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4574 // We didn't expect the animation to finish yet
4575 application.SendNotification();
4576 finishCheck.CheckSignalNotReceived();
4577 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4579 application.SendNotification();
4580 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4582 // We did expect the animation to finish
4583 application.SendNotification();
4584 finishCheck.CheckSignalReceived();
4585 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4590 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4592 TestApplication application;
4594 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4596 Actor actor = Actor::New();
4597 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4598 Stage::GetCurrent().Add(actor);
4599 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4601 // Build the animation
4602 float durationSeconds(1.0f);
4603 Animation animation = Animation::New(durationSeconds);
4604 Degree relativeRotationDegrees(730.0f);
4605 Radian relativeRotationRadians(relativeRotationDegrees);
4607 Radian actualRotationRadians( Degree(10.0f) );
4609 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4611 // Start the animation
4614 bool signalReceived(false);
4615 AnimationFinishCheck finishCheck(signalReceived);
4616 animation.FinishedSignal().Connect(&application, finishCheck);
4618 application.SendNotification();
4619 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4621 // We didn't expect the animation to finish yet
4622 application.SendNotification();
4623 finishCheck.CheckSignalNotReceived();
4624 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4626 application.SendNotification();
4627 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4629 // We didn't expect the animation to finish yet
4630 application.SendNotification();
4631 finishCheck.CheckSignalNotReceived();
4632 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4634 application.SendNotification();
4635 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4637 // We didn't expect the animation to finish yet
4638 application.SendNotification();
4639 finishCheck.CheckSignalNotReceived();
4640 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4642 application.SendNotification();
4643 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4645 // We did expect the animation to finish
4646 application.SendNotification();
4647 finishCheck.CheckSignalReceived();
4648 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4649 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4654 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4656 TestApplication application;
4658 Actor actor = Actor::New();
4659 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4660 Stage::GetCurrent().Add(actor);
4661 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4663 // Build the animation
4664 float durationSeconds(1.0f);
4665 Animation animation = Animation::New(durationSeconds);
4666 Degree relativeRotationDegrees(360.0f);
4667 Radian relativeRotationRadians(relativeRotationDegrees);
4668 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4670 // Start the animation
4673 bool signalReceived(false);
4674 AnimationFinishCheck finishCheck(signalReceived);
4675 animation.FinishedSignal().Connect(&application, finishCheck);
4677 application.SendNotification();
4678 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% 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.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4685 application.SendNotification();
4686 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4688 // We didn't expect the animation to finish yet
4689 application.SendNotification();
4690 finishCheck.CheckSignalNotReceived();
4691 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4693 application.SendNotification();
4694 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4696 // We didn't expect the animation to finish yet
4697 application.SendNotification();
4698 finishCheck.CheckSignalNotReceived();
4699 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4701 application.SendNotification();
4702 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4704 // We did expect the animation to finish
4705 application.SendNotification();
4706 finishCheck.CheckSignalReceived();
4707 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4711 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4713 TestApplication application;
4715 Actor actor = Actor::New();
4716 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4717 Stage::GetCurrent().Add(actor);
4718 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4720 // Build the animation
4721 float durationSeconds(1.0f);
4722 Animation animation = Animation::New(durationSeconds);
4723 Degree relativeRotationDegrees(360.0f);
4724 Radian relativeRotationRadians(relativeRotationDegrees);
4726 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4727 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4729 // Start the animation
4732 bool signalReceived(false);
4733 AnimationFinishCheck finishCheck(signalReceived);
4734 animation.FinishedSignal().Connect(&application, finishCheck);
4736 application.SendNotification();
4737 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4739 // We didn't expect the animation to finish yet
4740 application.SendNotification();
4741 finishCheck.CheckSignalNotReceived();
4742 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4743 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4745 application.SendNotification();
4746 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4748 // We didn't expect the animation to finish yet
4749 application.SendNotification();
4750 finishCheck.CheckSignalNotReceived();
4751 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4752 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4754 application.SendNotification();
4755 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4757 // We didn't expect the animation to finish yet
4758 application.SendNotification();
4759 finishCheck.CheckSignalNotReceived();
4760 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4761 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4763 application.SendNotification();
4764 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4766 // We did expect the animation to finish
4767 application.SendNotification();
4768 finishCheck.CheckSignalReceived();
4769 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4773 int UtcDaliAnimationAnimateByActorScaleP(void)
4775 TestApplication application;
4777 Actor actor = Actor::New();
4778 Stage::GetCurrent().Add(actor);
4779 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4781 // Build the animation
4782 float durationSeconds(1.0f);
4783 Animation animation = Animation::New(durationSeconds);
4784 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4785 Vector3 relativeScale(targetScale - Vector3::ONE);
4786 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4788 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4790 // Start the animation
4793 bool signalReceived(false);
4794 AnimationFinishCheck finishCheck(signalReceived);
4795 animation.FinishedSignal().Connect(&application, finishCheck);
4797 application.SendNotification();
4798 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4800 // We didn't expect the animation to finish yet
4801 application.SendNotification();
4802 finishCheck.CheckSignalNotReceived();
4803 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4805 application.SendNotification();
4806 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4808 // We did expect the animation to finish
4809 application.SendNotification();
4810 finishCheck.CheckSignalReceived();
4811 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4814 finishCheck.Reset();
4815 actor.SetScale(Vector3::ONE);
4816 application.SendNotification();
4817 application.Render(0);
4818 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4820 // Repeat with a different (ease-in) alpha function
4821 animation = Animation::New(durationSeconds);
4822 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4823 animation.FinishedSignal().Connect(&application, finishCheck);
4826 application.SendNotification();
4827 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4829 // We didn't expect the animation to finish yet
4830 application.SendNotification();
4831 finishCheck.CheckSignalNotReceived();
4833 // The scale should have grown less, than with a linear alpha function
4834 Vector3 current(actor.GetCurrentScale());
4835 DALI_TEST_CHECK( current.x > 1.0f );
4836 DALI_TEST_CHECK( current.y > 1.0f );
4837 DALI_TEST_CHECK( current.z > 1.0f );
4838 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4839 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4840 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4842 application.SendNotification();
4843 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4845 // We did expect the animation to finish
4846 application.SendNotification();
4847 finishCheck.CheckSignalReceived();
4848 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4851 finishCheck.Reset();
4852 actor.SetScale(Vector3::ONE);
4853 application.SendNotification();
4854 application.Render(0);
4855 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4857 // Repeat with a delay
4859 animation = Animation::New(durationSeconds);
4860 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4861 animation.FinishedSignal().Connect(&application, finishCheck);
4864 application.SendNotification();
4865 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4867 // We didn't expect the animation to finish yet
4868 application.SendNotification();
4869 finishCheck.CheckSignalNotReceived();
4870 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4872 application.SendNotification();
4873 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4875 // We did expect the animation to finish
4876 application.SendNotification();
4877 finishCheck.CheckSignalReceived();
4878 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4882 int UtcDaliAnimationAnimateToBooleanP(void)
4884 TestApplication application;
4886 Actor actor = Actor::New();
4888 // Register a boolean property
4889 const bool startValue(false);
4890 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4891 Stage::GetCurrent().Add(actor);
4892 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4893 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
4895 // Build the animation
4896 float durationSeconds(2.0f);
4897 Animation animation = Animation::New(durationSeconds);
4898 const bool targetValue( !startValue );
4899 animation.AnimateTo(Property(actor, index), targetValue);
4901 // Start the animation
4904 bool signalReceived(false);
4905 AnimationFinishCheck finishCheck(signalReceived);
4906 animation.FinishedSignal().Connect(&application, finishCheck);
4908 application.SendNotification();
4909 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4911 // We didn't expect the animation to finish yet
4912 application.SendNotification();
4913 finishCheck.CheckSignalNotReceived();
4914 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
4916 application.SendNotification();
4917 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4919 // We did expect the animation to finish
4920 application.SendNotification();
4921 finishCheck.CheckSignalReceived();
4922 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
4924 // Check that nothing has changed after a couple of buffer swaps
4925 application.Render(0);
4926 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
4927 application.Render(0);
4928 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
4930 // Repeat with target value "false"
4931 animation = Animation::New(durationSeconds);
4932 const bool finalValue( !targetValue );
4933 animation.AnimateTo(Property(actor, index), finalValue);
4935 // Start the animation
4938 finishCheck.Reset();
4939 animation.FinishedSignal().Connect(&application, finishCheck);
4941 application.SendNotification();
4942 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4944 // We didn't expect the animation to finish yet
4945 application.SendNotification();
4946 finishCheck.CheckSignalNotReceived();
4947 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
4949 application.SendNotification();
4950 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4952 // We did expect the animation to finish
4953 application.SendNotification();
4954 finishCheck.CheckSignalReceived();
4955 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
4957 // Check that nothing has changed after a couple of buffer swaps
4958 application.Render(0);
4959 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
4960 application.Render(0);
4961 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
4965 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4967 TestApplication application;
4969 Actor actor = Actor::New();
4971 // Register a boolean property
4972 const bool startValue(false);
4973 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4974 Stage::GetCurrent().Add(actor);
4975 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4976 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
4978 // Build the animation
4979 float durationSeconds(2.0f);
4980 Animation animation = Animation::New(durationSeconds);
4981 const bool targetValue( !startValue );
4982 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4984 // Start the animation
4987 bool signalReceived(false);
4988 AnimationFinishCheck finishCheck(signalReceived);
4989 animation.FinishedSignal().Connect(&application, finishCheck);
4991 application.SendNotification();
4992 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4994 // We didn't expect the animation to finish yet
4995 application.SendNotification();
4996 finishCheck.CheckSignalNotReceived();
4997 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
4999 application.SendNotification();
5000 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5002 // We did expect the animation to finish
5003 application.SendNotification();
5004 finishCheck.CheckSignalReceived();
5005 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5007 // Check that nothing has changed after a couple of buffer swaps
5008 application.Render(0);
5009 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5010 application.Render(0);
5011 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5013 // Repeat with target value "false"
5014 animation = Animation::New(durationSeconds);
5015 const bool finalValue( !targetValue );
5016 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5018 // Start the animation
5021 finishCheck.Reset();
5022 animation.FinishedSignal().Connect(&application, finishCheck);
5024 application.SendNotification();
5025 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5027 // We didn't expect the animation to finish yet
5028 application.SendNotification();
5029 finishCheck.CheckSignalNotReceived();
5030 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5032 application.SendNotification();
5033 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5035 // We did expect the animation to finish
5036 application.SendNotification();
5037 finishCheck.CheckSignalReceived();
5038 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5040 // Check that nothing has changed after a couple of buffer swaps
5041 application.Render(0);
5042 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5043 application.Render(0);
5044 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5048 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5050 TestApplication application;
5052 Actor actor = Actor::New();
5054 // Register a boolean property
5055 bool startValue(false);
5056 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5057 Stage::GetCurrent().Add(actor);
5058 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5059 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5061 // Build the animation
5062 float durationSeconds(2.0f);
5063 Animation animation = Animation::New(durationSeconds);
5064 bool finalValue( !startValue );
5065 float animatorDurationSeconds(durationSeconds * 0.5f);
5066 animation.AnimateTo( Property(actor, index),
5068 TimePeriod( animatorDurationSeconds ) );
5070 // Start the animation
5073 bool signalReceived(false);
5074 AnimationFinishCheck finishCheck(signalReceived);
5075 animation.FinishedSignal().Connect(&application, finishCheck);
5077 application.SendNotification();
5078 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5080 // We didn't expect the animation to finish yet
5081 application.SendNotification();
5082 finishCheck.CheckSignalNotReceived();
5083 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5085 application.SendNotification();
5086 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5088 // We didn't expect the animation to finish yet...
5089 application.SendNotification();
5090 finishCheck.CheckSignalNotReceived();
5092 // ...however we should have reached the final value
5093 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5095 application.SendNotification();
5096 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5098 // We did expect the animation to finish
5099 application.SendNotification();
5100 finishCheck.CheckSignalReceived();
5101 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5103 // Check that nothing has changed after a couple of buffer swaps
5104 application.Render(0);
5105 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5106 application.Render(0);
5107 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5111 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5113 TestApplication application;
5115 Actor actor = Actor::New();
5117 // Register a boolean property
5118 bool startValue(false);
5119 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5120 Stage::GetCurrent().Add(actor);
5121 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5122 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5124 // Build the animation
5125 float durationSeconds(2.0f);
5126 Animation animation = Animation::New(durationSeconds);
5127 bool finalValue( !startValue );
5128 float animatorDurationSeconds(durationSeconds * 0.5f);
5129 animation.AnimateTo( Property(actor, index),
5131 AlphaFunction::LINEAR,
5132 TimePeriod( animatorDurationSeconds ) );
5134 // Start the animation
5137 bool signalReceived(false);
5138 AnimationFinishCheck finishCheck(signalReceived);
5139 animation.FinishedSignal().Connect(&application, finishCheck);
5141 application.SendNotification();
5142 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5144 // We didn't expect the animation to finish yet
5145 application.SendNotification();
5146 finishCheck.CheckSignalNotReceived();
5147 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5149 application.SendNotification();
5150 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5152 // We didn't expect the animation to finish yet...
5153 application.SendNotification();
5154 finishCheck.CheckSignalNotReceived();
5156 // ...however we should have reached the final value
5157 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5159 application.SendNotification();
5160 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5162 // We did expect the animation to finish
5163 application.SendNotification();
5164 finishCheck.CheckSignalReceived();
5165 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5167 // Check that nothing has changed after a couple of buffer swaps
5168 application.Render(0);
5169 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5170 application.Render(0);
5171 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5175 int UtcDaliAnimationAnimateToFloatP(void)
5177 TestApplication application;
5179 Actor actor = Actor::New();
5181 // Register a float property
5182 float startValue(10.0f);
5183 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5184 Stage::GetCurrent().Add(actor);
5185 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5186 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5188 // Build the animation
5189 float durationSeconds(2.0f);
5190 Animation animation = Animation::New(durationSeconds);
5191 float targetValue(50.0f);
5192 float relativeValue(targetValue - startValue);
5193 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5195 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5197 // Start the animation
5200 bool signalReceived(false);
5201 AnimationFinishCheck finishCheck(signalReceived);
5202 animation.FinishedSignal().Connect(&application, finishCheck);
5204 application.SendNotification();
5205 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5207 // We didn't expect the animation to finish yet
5208 application.SendNotification();
5209 finishCheck.CheckSignalNotReceived();
5210 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5212 application.SendNotification();
5213 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5215 // We did expect the animation to finish
5216 application.SendNotification();
5217 finishCheck.CheckSignalReceived();
5218 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5222 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5224 TestApplication application;
5226 Actor actor = Actor::New();
5228 // Register a float property
5229 float startValue(10.0f);
5230 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5231 Stage::GetCurrent().Add(actor);
5232 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5233 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5235 // Build the animation
5236 float durationSeconds(1.0f);
5237 Animation animation = Animation::New(durationSeconds);
5238 float targetValue(90.0f);
5239 float relativeValue(targetValue - startValue);
5240 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5242 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5244 // Start the animation
5247 bool signalReceived(false);
5248 AnimationFinishCheck finishCheck(signalReceived);
5249 animation.FinishedSignal().Connect(&application, finishCheck);
5251 application.SendNotification();
5252 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5254 // We didn't expect the animation to finish yet
5255 application.SendNotification();
5256 finishCheck.CheckSignalNotReceived();
5258 // The position should have moved more, than with a linear alpha function
5259 float current( actor.GetCurrentProperty< float >( index ) );
5260 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5262 application.SendNotification();
5263 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5265 // We did expect the animation to finish
5266 application.SendNotification();
5267 finishCheck.CheckSignalReceived();
5268 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5272 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5274 TestApplication application;
5276 Actor actor = Actor::New();
5278 // Register a float property
5279 float startValue(10.0f);
5280 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5281 Stage::GetCurrent().Add(actor);
5282 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5283 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5285 // Build the animation
5286 float durationSeconds(1.0f);
5287 Animation animation = Animation::New(durationSeconds);
5288 float targetValue(30.0f);
5289 float relativeValue(targetValue - startValue);
5291 animation.AnimateTo(Property(actor, index),
5293 TimePeriod(delay, durationSeconds - delay));
5295 // Start the animation
5298 bool signalReceived(false);
5299 AnimationFinishCheck finishCheck(signalReceived);
5300 animation.FinishedSignal().Connect(&application, finishCheck);
5302 application.SendNotification();
5303 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5305 // We didn't expect the animation to finish yet
5306 application.SendNotification();
5307 finishCheck.CheckSignalNotReceived();
5308 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5310 application.SendNotification();
5311 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5313 // We didn't expect the animation to finish yet
5314 application.SendNotification();
5315 finishCheck.CheckSignalNotReceived();
5316 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5318 application.SendNotification();
5319 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5321 // We did expect the animation to finish
5322 application.SendNotification();
5323 finishCheck.CheckSignalReceived();
5324 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5328 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5330 TestApplication application;
5332 Actor actor = Actor::New();
5334 // Register a float property
5335 float startValue(10.0f);
5336 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5337 Stage::GetCurrent().Add(actor);
5338 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5339 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5341 // Build the animation
5342 float durationSeconds(1.0f);
5343 Animation animation = Animation::New(durationSeconds);
5344 float targetValue(30.0f);
5345 float relativeValue(targetValue - startValue);
5347 animation.AnimateTo(Property(actor, index),
5349 AlphaFunction::LINEAR,
5350 TimePeriod(delay, durationSeconds - delay));
5352 // Start the animation
5355 bool signalReceived(false);
5356 AnimationFinishCheck finishCheck(signalReceived);
5357 animation.FinishedSignal().Connect(&application, finishCheck);
5359 application.SendNotification();
5360 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5362 // We didn't expect the animation to finish yet
5363 application.SendNotification();
5364 finishCheck.CheckSignalNotReceived();
5365 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5367 application.SendNotification();
5368 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5370 // We didn't expect the animation to finish yet
5371 application.SendNotification();
5372 finishCheck.CheckSignalNotReceived();
5373 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5375 application.SendNotification();
5376 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5378 // We did expect the animation to finish
5379 application.SendNotification();
5380 finishCheck.CheckSignalReceived();
5381 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5385 int UtcDaliAnimationAnimateToIntegerP(void)
5387 TestApplication application;
5389 Actor actor = Actor::New();
5391 // Register an integer property
5393 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5394 Stage::GetCurrent().Add(actor);
5395 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5396 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5398 // Build the animation
5399 float durationSeconds(2.0f);
5400 Animation animation = Animation::New(durationSeconds);
5401 int targetValue(50);
5402 int relativeValue(targetValue - startValue);
5403 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5405 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5407 // Start the animation
5410 bool signalReceived(false);
5411 AnimationFinishCheck finishCheck(signalReceived);
5412 animation.FinishedSignal().Connect(&application, finishCheck);
5414 application.SendNotification();
5415 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5417 // We didn't expect the animation to finish yet
5418 application.SendNotification();
5419 finishCheck.CheckSignalNotReceived();
5420 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5422 application.SendNotification();
5423 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5425 // We did expect the animation to finish
5426 application.SendNotification();
5427 finishCheck.CheckSignalReceived();
5428 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5432 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5434 TestApplication application;
5436 Actor actor = Actor::New();
5438 // Register an integer property
5440 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5441 Stage::GetCurrent().Add(actor);
5442 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5443 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5445 // Build the animation
5446 float durationSeconds(1.0f);
5447 Animation animation = Animation::New(durationSeconds);
5448 int targetValue(90);
5449 int relativeValue(targetValue - startValue);
5450 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5452 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5454 // Start the animation
5457 bool signalReceived(false);
5458 AnimationFinishCheck finishCheck(signalReceived);
5459 animation.FinishedSignal().Connect(&application, finishCheck);
5461 application.SendNotification();
5462 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5464 // We didn't expect the animation to finish yet
5465 application.SendNotification();
5466 finishCheck.CheckSignalNotReceived();
5468 // The position should have moved more, than with a linear alpha function
5469 int current( actor.GetCurrentProperty< int >( index ) );
5470 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5472 application.SendNotification();
5473 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5475 // We did expect the animation to finish
5476 application.SendNotification();
5477 finishCheck.CheckSignalReceived();
5478 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5482 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5484 TestApplication application;
5486 Actor actor = Actor::New();
5488 // Register an integer property
5490 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5491 Stage::GetCurrent().Add(actor);
5492 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5493 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5495 // Build the animation
5496 float durationSeconds(1.0f);
5497 Animation animation = Animation::New(durationSeconds);
5498 int targetValue(30);
5499 int relativeValue(targetValue - startValue);
5501 animation.AnimateTo(Property(actor, index),
5503 TimePeriod(delay, durationSeconds - delay));
5505 // Start the animation
5508 bool signalReceived(false);
5509 AnimationFinishCheck finishCheck(signalReceived);
5510 animation.FinishedSignal().Connect(&application, finishCheck);
5512 application.SendNotification();
5513 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5515 // We didn't expect the animation to finish yet
5516 application.SendNotification();
5517 finishCheck.CheckSignalNotReceived();
5518 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5520 application.SendNotification();
5521 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5523 // We didn't expect the animation to finish yet
5524 application.SendNotification();
5525 finishCheck.CheckSignalNotReceived();
5526 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5528 application.SendNotification();
5529 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5531 // We did expect the animation to finish
5532 application.SendNotification();
5533 finishCheck.CheckSignalReceived();
5534 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5538 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5540 TestApplication application;
5542 Actor actor = Actor::New();
5544 // Register an integer property
5546 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5547 Stage::GetCurrent().Add(actor);
5548 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5549 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5551 // Build the animation
5552 float durationSeconds(1.0f);
5553 Animation animation = Animation::New(durationSeconds);
5554 int targetValue(30);
5555 int relativeValue(targetValue - startValue);
5557 animation.AnimateTo(Property(actor, index),
5559 AlphaFunction::LINEAR,
5560 TimePeriod(delay, durationSeconds - delay));
5562 // Start the animation
5565 bool signalReceived(false);
5566 AnimationFinishCheck finishCheck(signalReceived);
5567 animation.FinishedSignal().Connect(&application, finishCheck);
5569 application.SendNotification();
5570 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5572 // We didn't expect the animation to finish yet
5573 application.SendNotification();
5574 finishCheck.CheckSignalNotReceived();
5575 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5577 application.SendNotification();
5578 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5580 // We didn't expect the animation to finish yet
5581 application.SendNotification();
5582 finishCheck.CheckSignalNotReceived();
5583 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5585 application.SendNotification();
5586 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5588 // We did expect the animation to finish
5589 application.SendNotification();
5590 finishCheck.CheckSignalReceived();
5591 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5595 int UtcDaliAnimationAnimateToVector2P(void)
5597 TestApplication application;
5599 Actor actor = Actor::New();
5601 // Register a Vector2 property
5602 Vector2 startValue(-50.0f, -50.0f);
5603 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5604 Stage::GetCurrent().Add(actor);
5605 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5606 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5608 // Build the animation
5609 float durationSeconds(2.0f);
5610 Animation animation = Animation::New(durationSeconds);
5611 Vector2 targetValue(50.0f, 50.0f);
5612 Vector2 relativeValue(targetValue - startValue);
5613 animation.AnimateTo(Property(actor, index), targetValue);
5615 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5617 // Start the animation
5620 bool signalReceived(false);
5621 AnimationFinishCheck finishCheck(signalReceived);
5622 animation.FinishedSignal().Connect(&application, finishCheck);
5624 application.SendNotification();
5625 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5627 // We didn't expect the animation to finish yet
5628 application.SendNotification();
5629 finishCheck.CheckSignalNotReceived();
5630 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5632 application.SendNotification();
5633 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5635 // We did expect the animation to finish
5636 application.SendNotification();
5637 finishCheck.CheckSignalReceived();
5638 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5642 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5644 TestApplication application;
5646 Actor actor = Actor::New();
5648 // Register a Vector2 property
5649 Vector2 startValue(1000.0f, 1000.0f);
5650 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5651 Stage::GetCurrent().Add(actor);
5652 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5653 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5655 // Build the animation
5656 float durationSeconds(1.0f);
5657 Animation animation = Animation::New(durationSeconds);
5658 Vector2 targetValue(9000.0f, 9000.0f);
5659 Vector2 relativeValue(targetValue - startValue);
5660 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5662 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5664 // Start the animation
5667 bool signalReceived(false);
5668 AnimationFinishCheck finishCheck(signalReceived);
5669 animation.FinishedSignal().Connect(&application, finishCheck);
5671 application.SendNotification();
5672 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5674 // We didn't expect the animation to finish yet
5675 application.SendNotification();
5676 finishCheck.CheckSignalNotReceived();
5678 // The position should have moved more, than with a linear alpha function
5679 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
5680 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5681 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5683 application.SendNotification();
5684 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5686 // We did expect the animation to finish
5687 application.SendNotification();
5688 finishCheck.CheckSignalReceived();
5689 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5693 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5695 TestApplication application;
5697 Actor actor = Actor::New();
5699 // Register a Vector2 property
5700 Vector2 startValue(10.0f, 10.0f);
5701 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5702 Stage::GetCurrent().Add(actor);
5703 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5704 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5706 // Build the animation
5707 float durationSeconds(1.0f);
5708 Animation animation = Animation::New(durationSeconds);
5709 Vector2 targetValue(-10.0f, 20.0f);
5710 Vector2 relativeValue(targetValue - startValue);
5712 animation.AnimateTo(Property(actor, index),
5714 TimePeriod(delay, durationSeconds - delay));
5716 // Start the animation
5719 bool signalReceived(false);
5720 AnimationFinishCheck finishCheck(signalReceived);
5721 animation.FinishedSignal().Connect(&application, finishCheck);
5723 application.SendNotification();
5724 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5726 // We didn't expect the animation to finish yet
5727 application.SendNotification();
5728 finishCheck.CheckSignalNotReceived();
5729 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5731 application.SendNotification();
5732 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5734 // We didn't expect the animation to finish yet
5735 application.SendNotification();
5736 finishCheck.CheckSignalNotReceived();
5737 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5739 application.SendNotification();
5740 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5742 // We did expect the animation to finish
5743 application.SendNotification();
5744 finishCheck.CheckSignalReceived();
5745 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5749 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5751 TestApplication application;
5753 Actor actor = Actor::New();
5755 // Register a Vector2 property
5756 Vector2 startValue(10.0f, 10.0f);
5757 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5758 Stage::GetCurrent().Add(actor);
5759 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5760 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5762 // Build the animation
5763 float durationSeconds(1.0f);
5764 Animation animation = Animation::New(durationSeconds);
5765 Vector2 targetValue(30.0f, 30.0f);
5766 Vector2 relativeValue(targetValue - startValue);
5768 animation.AnimateTo(Property(actor, index),
5770 AlphaFunction::LINEAR,
5771 TimePeriod(delay, durationSeconds - delay));
5773 // Start the animation
5776 bool signalReceived(false);
5777 AnimationFinishCheck finishCheck(signalReceived);
5778 animation.FinishedSignal().Connect(&application, finishCheck);
5780 application.SendNotification();
5781 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5783 // We didn't expect the animation to finish yet, but cached value should be the final one
5784 application.SendNotification();
5785 finishCheck.CheckSignalNotReceived();
5786 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5787 DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
5789 application.SendNotification();
5790 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5792 // We didn't expect the animation to finish yet
5793 application.SendNotification();
5794 finishCheck.CheckSignalNotReceived();
5795 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5797 application.SendNotification();
5798 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5800 // We did expect the animation to finish
5801 application.SendNotification();
5802 finishCheck.CheckSignalReceived();
5803 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5804 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5808 int UtcDaliAnimationAnimateToVector3P(void)
5810 TestApplication application;
5812 Actor actor = Actor::New();
5814 // Register a Vector3 property
5815 Vector3 startValue(-50.0f, -50.0f, -50.0f);
5816 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5817 Stage::GetCurrent().Add(actor);
5818 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
5819 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
5821 // Build the animation
5822 float durationSeconds(2.0f);
5823 Animation animation = Animation::New(durationSeconds);
5824 Vector3 targetValue(50.0f, 50.0f, 50.0f);
5825 Vector3 relativeValue(targetValue - startValue);
5826 animation.AnimateTo(Property(actor, index), targetValue);
5828 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5830 // Start the animation
5833 bool signalReceived(false);
5834 AnimationFinishCheck finishCheck(signalReceived);
5835 animation.FinishedSignal().Connect(&application, finishCheck);
5837 application.SendNotification();
5838 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5840 // We didn't expect the animation to finish yet
5841 application.SendNotification();
5842 finishCheck.CheckSignalNotReceived();
5843 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5845 application.SendNotification();
5846 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5848 // We did expect the animation to finish
5849 application.SendNotification();
5850 finishCheck.CheckSignalReceived();
5851 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
5855 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5857 TestApplication application;
5859 Actor actor = Actor::New();
5861 // Register a Vector3 property
5862 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5863 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5864 Stage::GetCurrent().Add(actor);
5865 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5866 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
5868 // Build the animation
5869 float durationSeconds(1.0f);
5870 Animation animation = Animation::New(durationSeconds);
5871 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5872 Vector3 relativeValue(targetValue - startValue);
5873 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5875 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5877 // Start the animation
5880 bool signalReceived(false);
5881 AnimationFinishCheck finishCheck(signalReceived);
5882 animation.FinishedSignal().Connect(&application, finishCheck);
5884 application.SendNotification();
5885 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5887 // We didn't expect the animation to finish yet
5888 application.SendNotification();
5889 finishCheck.CheckSignalNotReceived();
5891 // The position should have moved more, than with a linear alpha function
5892 Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
5893 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5894 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5895 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5897 application.SendNotification();
5898 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5900 // We did expect the animation to finish
5901 application.SendNotification();
5902 finishCheck.CheckSignalReceived();
5903 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
5907 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5909 TestApplication application;
5911 Actor actor = Actor::New();
5913 // Register a Vector3 property
5914 Vector3 startValue(10.0f, 10.0f, 10.0f);
5915 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5916 Stage::GetCurrent().Add(actor);
5917 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5918 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
5920 // Build the animation
5921 float durationSeconds(1.0f);
5922 Animation animation = Animation::New(durationSeconds);
5923 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5924 Vector3 relativeValue(targetValue - startValue);
5926 animation.AnimateTo(Property(actor, index),
5928 TimePeriod(delay, durationSeconds - delay));
5930 // Start the animation
5933 bool signalReceived(false);
5934 AnimationFinishCheck finishCheck(signalReceived);
5935 animation.FinishedSignal().Connect(&application, finishCheck);
5937 application.SendNotification();
5938 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5940 // We didn't expect the animation to finish yet
5941 application.SendNotification();
5942 finishCheck.CheckSignalNotReceived();
5943 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
5945 application.SendNotification();
5946 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5948 // We didn't expect the animation to finish yet
5949 application.SendNotification();
5950 finishCheck.CheckSignalNotReceived();
5951 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5953 application.SendNotification();
5954 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5956 // We did expect the animation to finish
5957 application.SendNotification();
5958 finishCheck.CheckSignalReceived();
5959 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
5963 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5965 TestApplication application;
5967 Actor actor = Actor::New();
5969 // Register a Vector3 property
5970 Vector3 startValue(10.0f, 10.0f, 10.0f);
5971 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5972 Stage::GetCurrent().Add(actor);
5973 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5974 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
5976 // Build the animation
5977 float durationSeconds(1.0f);
5978 Animation animation = Animation::New(durationSeconds);
5979 Vector3 targetValue(30.0f, 30.0f, 30.0f);
5980 Vector3 relativeValue(targetValue - startValue);
5982 animation.AnimateTo(Property(actor, "testProperty"),
5984 AlphaFunction::LINEAR,
5985 TimePeriod(delay, durationSeconds - delay));
5987 // Start the animation
5990 bool signalReceived(false);
5991 AnimationFinishCheck finishCheck(signalReceived);
5992 animation.FinishedSignal().Connect(&application, finishCheck);
5994 application.SendNotification();
5995 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5997 // We didn't expect the animation to finish yet
5998 application.SendNotification();
5999 finishCheck.CheckSignalNotReceived();
6000 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6002 application.SendNotification();
6003 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6005 // We didn't expect the animation to finish yet
6006 application.SendNotification();
6007 finishCheck.CheckSignalNotReceived();
6008 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6010 application.SendNotification();
6011 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6013 // We did expect the animation to finish
6014 application.SendNotification();
6015 finishCheck.CheckSignalReceived();
6016 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6020 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6022 TestApplication application;
6024 Actor actor = Actor::New();
6026 // Register a Vector3 property
6027 Vector3 startValue(10.0f, 10.0f, 10.0f);
6028 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6029 Stage::GetCurrent().Add(actor);
6030 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6031 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6033 // Build the animation
6034 float durationSeconds(1.0f);
6035 Animation animation = Animation::New(durationSeconds);
6036 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6037 Vector3 relativeValue(targetValue - startValue);
6039 animation.AnimateTo(Property(actor, "testProperty", 0),
6041 AlphaFunction::LINEAR,
6042 TimePeriod(delay, durationSeconds - delay));
6043 animation.AnimateTo(Property(actor, index, 1),
6045 AlphaFunction::LINEAR,
6046 TimePeriod(delay, durationSeconds - delay));
6048 // Start the animation
6051 bool signalReceived(false);
6052 AnimationFinishCheck finishCheck(signalReceived);
6053 animation.FinishedSignal().Connect(&application, finishCheck);
6055 application.SendNotification();
6056 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6058 // We didn't expect the animation to finish yet
6059 application.SendNotification();
6060 finishCheck.CheckSignalNotReceived();
6061 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6063 application.SendNotification();
6064 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6066 // We didn't expect the animation to finish yet
6067 application.SendNotification();
6068 finishCheck.CheckSignalNotReceived();
6069 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6071 application.SendNotification();
6072 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6074 // We did expect the animation to finish
6075 application.SendNotification();
6076 finishCheck.CheckSignalReceived();
6077 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6081 int UtcDaliAnimationAnimateToVector4P(void)
6083 TestApplication application;
6085 Actor actor = Actor::New();
6087 // Register a Vector4 property
6088 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6089 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6090 Stage::GetCurrent().Add(actor);
6091 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6092 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6094 // Build the animation
6095 float durationSeconds(2.0f);
6096 Animation animation = Animation::New(durationSeconds);
6097 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6098 Vector4 relativeValue(targetValue - startValue);
6099 animation.AnimateTo(Property(actor, index), targetValue);
6101 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6103 // Start the animation
6106 bool signalReceived(false);
6107 AnimationFinishCheck finishCheck(signalReceived);
6108 animation.FinishedSignal().Connect(&application, finishCheck);
6110 application.SendNotification();
6111 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6113 // We didn't expect the animation to finish yet
6114 application.SendNotification();
6115 finishCheck.CheckSignalNotReceived();
6116 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6118 application.SendNotification();
6119 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6121 // We did expect the animation to finish
6122 application.SendNotification();
6123 finishCheck.CheckSignalReceived();
6124 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6128 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6130 TestApplication application;
6132 Actor actor = Actor::New();
6134 // Register a Vector4 property
6135 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6136 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6137 Stage::GetCurrent().Add(actor);
6138 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6139 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6141 // Build the animation
6142 float durationSeconds(1.0f);
6143 Animation animation = Animation::New(durationSeconds);
6144 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6145 Vector4 relativeValue(targetValue - startValue);
6146 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6148 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6150 // Start the animation
6153 bool signalReceived(false);
6154 AnimationFinishCheck finishCheck(signalReceived);
6155 animation.FinishedSignal().Connect(&application, finishCheck);
6157 application.SendNotification();
6158 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6160 // We didn't expect the animation to finish yet
6161 application.SendNotification();
6162 finishCheck.CheckSignalNotReceived();
6164 // The position should have moved more, than with a linear alpha function
6165 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6166 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6167 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6168 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6169 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6171 application.SendNotification();
6172 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6174 // We did expect the animation to finish
6175 application.SendNotification();
6176 finishCheck.CheckSignalReceived();
6177 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6181 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6183 TestApplication application;
6185 Actor actor = Actor::New();
6187 // Register a Vector4 property
6188 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6189 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6190 Stage::GetCurrent().Add(actor);
6191 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6192 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6194 // Build the animation
6195 float durationSeconds(1.0f);
6196 Animation animation = Animation::New(durationSeconds);
6197 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6198 Vector4 relativeValue(targetValue - startValue);
6200 animation.AnimateTo(Property(actor, index),
6202 TimePeriod(delay, durationSeconds - delay));
6204 // Start the animation
6207 bool signalReceived(false);
6208 AnimationFinishCheck finishCheck(signalReceived);
6209 animation.FinishedSignal().Connect(&application, finishCheck);
6211 application.SendNotification();
6212 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6214 // We didn't expect the animation to finish yet
6215 application.SendNotification();
6216 finishCheck.CheckSignalNotReceived();
6217 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6219 application.SendNotification();
6220 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6222 // We didn't expect the animation to finish yet
6223 application.SendNotification();
6224 finishCheck.CheckSignalNotReceived();
6225 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6227 application.SendNotification();
6228 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6230 // We did expect the animation to finish
6231 application.SendNotification();
6232 finishCheck.CheckSignalReceived();
6233 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6237 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6239 TestApplication application;
6241 Actor actor = Actor::New();
6243 // Register a Vector4 property
6244 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6245 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6246 Stage::GetCurrent().Add(actor);
6247 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6248 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6250 // Build the animation
6251 float durationSeconds(1.0f);
6252 Animation animation = Animation::New(durationSeconds);
6253 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6254 Vector4 relativeValue(targetValue - startValue);
6256 animation.AnimateTo(Property(actor, index),
6258 AlphaFunction::LINEAR,
6259 TimePeriod(delay, durationSeconds - delay));
6261 // Start the animation
6264 bool signalReceived(false);
6265 AnimationFinishCheck finishCheck(signalReceived);
6266 animation.FinishedSignal().Connect(&application, finishCheck);
6268 application.SendNotification();
6269 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6271 // We didn't expect the animation to finish yet
6272 application.SendNotification();
6273 finishCheck.CheckSignalNotReceived();
6274 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6276 application.SendNotification();
6277 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6279 // We didn't expect the animation to finish yet
6280 application.SendNotification();
6281 finishCheck.CheckSignalNotReceived();
6282 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6284 application.SendNotification();
6285 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6287 // We did expect the animation to finish
6288 application.SendNotification();
6289 finishCheck.CheckSignalReceived();
6290 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6294 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6296 TestApplication application;
6298 Actor actor = Actor::New();
6299 Stage::GetCurrent().Add(actor);
6300 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6302 // Build the animation
6303 float durationSeconds(1.0f);
6304 Animation animation = Animation::New(durationSeconds);
6305 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6309 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6311 catch (Dali::DaliException& e)
6313 DALI_TEST_PRINT_ASSERT( e );
6314 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6319 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6321 TestApplication application;
6323 Actor actor = Actor::New();
6324 Stage::GetCurrent().Add(actor);
6325 float startValue(0.0f);
6326 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6327 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6329 // Build the animation
6330 float durationSeconds(1.0f);
6331 Animation animation = Animation::New(durationSeconds);
6332 float targetX(1.0f);
6336 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6338 catch (Dali::DaliException& e)
6340 DALI_TEST_PRINT_ASSERT( e );
6341 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6346 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6348 TestApplication application;
6350 Actor actor = Actor::New();
6351 Stage::GetCurrent().Add(actor);
6352 float startValue(0.0f);
6353 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6354 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6356 // Build the animation
6357 float durationSeconds(1.0f);
6358 Animation animation = Animation::New(durationSeconds);
6359 float targetY(1.0f);
6363 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6365 catch (Dali::DaliException& e)
6367 DALI_TEST_PRINT_ASSERT( e );
6368 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6373 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6375 TestApplication application;
6377 Actor actor = Actor::New();
6378 Stage::GetCurrent().Add(actor);
6379 float startValue(0.5f);
6380 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6381 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6383 // Build the animation
6384 float durationSeconds(1.0f);
6385 Animation animation = Animation::New(durationSeconds);
6386 float targetZ(1.0f);
6390 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6392 catch (Dali::DaliException& e)
6394 DALI_TEST_PRINT_ASSERT( e );
6395 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6400 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6402 TestApplication application;
6404 Actor actor = Actor::New();
6405 Stage::GetCurrent().Add(actor);
6406 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6408 // Build the animation
6409 float durationSeconds(1.0f);
6410 Animation animation = Animation::New(durationSeconds);
6411 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6415 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6417 catch (Dali::DaliException& e)
6419 DALI_TEST_PRINT_ASSERT( e );
6420 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6425 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6427 TestApplication application;
6429 Actor actor = Actor::New();
6430 Stage::GetCurrent().Add(actor);
6431 float startValue(0.5f);
6432 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6433 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6435 // Build the animation
6436 float durationSeconds(1.0f);
6437 Animation animation = Animation::New(durationSeconds);
6438 float targetX(1.0f);
6442 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6444 catch (Dali::DaliException& e)
6446 DALI_TEST_PRINT_ASSERT( e );
6447 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6452 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6454 TestApplication application;
6456 Actor actor = Actor::New();
6457 Stage::GetCurrent().Add(actor);
6458 float startValue(0.5f);
6459 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6460 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6462 // Build the animation
6463 float durationSeconds(1.0f);
6464 Animation animation = Animation::New(durationSeconds);
6465 float targetY(0.0f);
6469 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6471 catch (Dali::DaliException& e)
6473 DALI_TEST_PRINT_ASSERT( e );
6474 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6479 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6481 TestApplication application;
6483 Actor actor = Actor::New();
6484 Stage::GetCurrent().Add(actor);
6485 float startValue(0.5f);
6486 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6487 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6489 // Build the animation
6490 float durationSeconds(1.0f);
6491 Animation animation = Animation::New(durationSeconds);
6492 float targetZ(100.0f);
6496 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6498 catch (Dali::DaliException& e)
6500 DALI_TEST_PRINT_ASSERT( e );
6501 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6506 int UtcDaliAnimationAnimateToActorSizeP(void)
6508 TestApplication application;
6510 Actor actor = Actor::New();
6511 Stage::GetCurrent().Add(actor);
6512 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6514 // Build the animation
6515 float durationSeconds(1.0f);
6516 Animation animation = Animation::New(durationSeconds);
6517 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6518 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6520 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6522 // Should return the initial properties before play
6523 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6524 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
6525 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
6526 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
6528 // Start the animation
6531 // Should return the target property after play
6532 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
6533 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
6534 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
6535 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
6537 bool signalReceived(false);
6538 AnimationFinishCheck finishCheck(signalReceived);
6539 animation.FinishedSignal().Connect(&application, finishCheck);
6541 application.SendNotification();
6542 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6544 // We didn't expect the animation to finish yet
6545 application.SendNotification();
6546 finishCheck.CheckSignalNotReceived();
6547 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6549 application.SendNotification();
6550 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6552 // We did expect the animation to finish
6553 application.SendNotification();
6554 finishCheck.CheckSignalReceived();
6555 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6558 finishCheck.Reset();
6559 actor.SetSize(Vector3::ZERO);
6560 application.SendNotification();
6561 application.Render(0);
6562 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6564 // Repeat with a different (ease-in) alpha function
6565 animation = Animation::New(durationSeconds);
6566 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6567 animation.FinishedSignal().Connect(&application, finishCheck);
6570 application.SendNotification();
6571 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6573 // We didn't expect the animation to finish yet
6574 application.SendNotification();
6575 finishCheck.CheckSignalNotReceived();
6577 // The size should have travelled less, than with a linear alpha function
6578 Vector3 current(actor.GetCurrentSize());
6579 DALI_TEST_CHECK( current.x > 0.0f );
6580 DALI_TEST_CHECK( current.y > 0.0f );
6581 DALI_TEST_CHECK( current.z > 0.0f );
6582 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6583 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6584 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6586 application.SendNotification();
6587 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6589 // We did expect the animation to finish
6590 application.SendNotification();
6591 finishCheck.CheckSignalReceived();
6592 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6595 finishCheck.Reset();
6596 actor.SetSize(Vector3::ZERO);
6597 application.SendNotification();
6598 application.Render(0);
6599 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6601 // Repeat with a delay
6603 animation = Animation::New(durationSeconds);
6604 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6605 animation.FinishedSignal().Connect(&application, finishCheck);
6608 application.SendNotification();
6609 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6611 // We didn't expect the animation to finish yet
6612 application.SendNotification();
6613 finishCheck.CheckSignalNotReceived();
6614 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6616 application.SendNotification();
6617 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6619 // We did expect the animation to finish
6620 application.SendNotification();
6621 finishCheck.CheckSignalReceived();
6622 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6626 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6628 TestApplication application;
6630 Actor actor = Actor::New();
6631 Stage::GetCurrent().Add(actor);
6632 float startValue(0.0f);
6633 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6634 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6636 // Build the animation
6637 float durationSeconds(1.0f);
6638 Animation animation = Animation::New(durationSeconds);
6639 float targetWidth(10.0f);
6640 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6642 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6644 // Should return the initial properties before play
6645 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6646 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
6648 // Start the animation
6651 // Should return the target property after play
6652 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
6653 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
6655 bool signalReceived(false);
6656 AnimationFinishCheck finishCheck(signalReceived);
6657 animation.FinishedSignal().Connect(&application, finishCheck);
6659 application.SendNotification();
6660 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6662 // We didn't expect the animation to finish yet
6663 application.SendNotification();
6664 finishCheck.CheckSignalNotReceived();
6665 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
6667 application.SendNotification();
6668 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6670 // We did expect the animation to finish
6671 application.SendNotification();
6672 finishCheck.CheckSignalReceived();
6673 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
6674 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
6678 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
6680 TestApplication application;
6682 Actor actor = Actor::New();
6683 Stage::GetCurrent().Add(actor);
6684 float startValue(0.0f);
6685 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6686 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6688 // Build the animation
6689 float durationSeconds(1.0f);
6690 Animation animation = Animation::New(durationSeconds);
6691 float targetHeight(-10.0f);
6692 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6694 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6696 // Should return the initial properties before play
6697 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6698 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
6700 // Start the animation
6703 // Should return the target property after play
6704 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
6705 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
6707 bool signalReceived(false);
6708 AnimationFinishCheck finishCheck(signalReceived);
6709 animation.FinishedSignal().Connect(&application, finishCheck);
6711 application.SendNotification();
6712 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6714 // We didn't expect the animation to finish yet
6715 application.SendNotification();
6716 finishCheck.CheckSignalNotReceived();
6717 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6719 application.SendNotification();
6720 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6722 // We did expect the animation to finish
6723 application.SendNotification();
6724 finishCheck.CheckSignalReceived();
6725 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6726 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6730 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6732 TestApplication application;
6734 Actor actor = Actor::New();
6735 Stage::GetCurrent().Add(actor);
6736 float startValue(0.0f);
6737 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6738 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6740 // Build the animation
6741 float durationSeconds(1.0f);
6742 Animation animation = Animation::New(durationSeconds);
6743 float targetDepth(-10.0f);
6744 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6746 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6748 // Should return the initial properties before play
6749 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6750 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
6752 // Start the animation
6755 // Should return the target property after play
6756 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
6757 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
6759 bool signalReceived(false);
6760 AnimationFinishCheck finishCheck(signalReceived);
6761 animation.FinishedSignal().Connect(&application, finishCheck);
6763 application.SendNotification();
6764 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6766 // We didn't expect the animation to finish yet
6767 application.SendNotification();
6768 finishCheck.CheckSignalNotReceived();
6769 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6771 application.SendNotification();
6772 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6774 // We did expect the animation to finish
6775 application.SendNotification();
6776 finishCheck.CheckSignalReceived();
6777 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6778 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6782 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6784 TestApplication application;
6786 Actor actor = Actor::New();
6787 Stage::GetCurrent().Add(actor);
6788 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6790 // Build the animation
6791 float durationSeconds(1.0f);
6792 Animation animation = Animation::New(durationSeconds);
6793 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6794 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6796 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6798 // Start the animation
6801 bool signalReceived(false);
6802 AnimationFinishCheck finishCheck(signalReceived);
6803 animation.FinishedSignal().Connect(&application, finishCheck);
6805 application.SendNotification();
6806 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6808 // We didn't expect the animation to finish yet
6809 application.SendNotification();
6810 finishCheck.CheckSignalNotReceived();
6811 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6813 application.SendNotification();
6814 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6816 // We did expect the animation to finish
6817 application.SendNotification();
6818 finishCheck.CheckSignalReceived();
6819 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6822 finishCheck.Reset();
6823 actor.SetSize(Vector3::ZERO);
6824 application.SendNotification();
6825 application.Render(0);
6826 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6828 // Repeat with a different (ease-in) alpha function
6829 animation = Animation::New(durationSeconds);
6830 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6831 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6832 animation.FinishedSignal().Connect(&application, finishCheck);
6835 application.SendNotification();
6836 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6838 // We didn't expect the animation to finish yet
6839 application.SendNotification();
6840 finishCheck.CheckSignalNotReceived();
6842 // The size should have travelled less, than with a linear alpha function
6843 Vector3 current(actor.GetCurrentSize());
6844 DALI_TEST_CHECK( current.x > 0.0f );
6845 DALI_TEST_CHECK( current.y > 0.0f );
6846 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6847 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6849 application.SendNotification();
6850 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6852 // We did expect the animation to finish
6853 application.SendNotification();
6854 finishCheck.CheckSignalReceived();
6855 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6856 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6859 finishCheck.Reset();
6860 actor.SetSize(Vector3::ZERO);
6861 application.SendNotification();
6862 application.Render(0);
6863 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6865 // Repeat with a delay
6867 animation = Animation::New(durationSeconds);
6868 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6869 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6870 animation.FinishedSignal().Connect(&application, finishCheck);
6873 application.SendNotification();
6874 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6876 // We didn't expect the animation to finish yet
6877 application.SendNotification();
6878 finishCheck.CheckSignalNotReceived();
6879 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6881 application.SendNotification();
6882 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6884 // We did expect the animation to finish
6885 application.SendNotification();
6886 finishCheck.CheckSignalReceived();
6887 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6888 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6892 int UtcDaliAnimationAnimateToActorPositionP(void)
6894 TestApplication application;
6896 Actor actor = Actor::New();
6897 Stage::GetCurrent().Add(actor);
6898 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6900 // Build the animation
6901 float durationSeconds(1.0f);
6902 Animation animation = Animation::New(durationSeconds);
6903 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6904 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6906 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6908 // Should return the initial properties before play
6909 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6910 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
6911 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
6912 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
6914 // Start the animation
6917 // Should return the target property after play
6918 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
6919 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
6920 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
6921 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
6923 bool signalReceived(false);
6924 AnimationFinishCheck finishCheck(signalReceived);
6925 animation.FinishedSignal().Connect(&application, finishCheck);
6927 application.SendNotification();
6928 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6930 // We didn't expect the animation to finish yet
6931 application.SendNotification();
6932 finishCheck.CheckSignalNotReceived();
6933 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6935 application.SendNotification();
6936 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6938 // We did expect the animation to finish
6939 application.SendNotification();
6940 finishCheck.CheckSignalReceived();
6941 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6945 int UtcDaliAnimationAnimateToActorPositionXP(void)
6947 TestApplication application;
6949 Actor actor = Actor::New();
6950 Stage::GetCurrent().Add(actor);
6951 float startValue(0.0f);
6952 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6953 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6954 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6955 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6957 // Build the animation
6958 float durationSeconds(1.0f);
6959 Animation animation = Animation::New(durationSeconds);
6960 float targetX(1.0f);
6961 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6963 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6965 // Should return the initial properties before play
6966 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6967 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
6969 // Start the animation
6972 // Should return the target property after play
6973 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
6974 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
6976 bool signalReceived(false);
6977 AnimationFinishCheck finishCheck(signalReceived);
6978 animation.FinishedSignal().Connect(&application, finishCheck);
6980 application.SendNotification();
6981 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6983 // We didn't expect the animation to finish yet
6984 application.SendNotification();
6985 finishCheck.CheckSignalNotReceived();
6986 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
6988 application.SendNotification();
6989 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6991 // We did expect the animation to finish
6992 application.SendNotification();
6993 finishCheck.CheckSignalReceived();
6994 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
6995 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
6996 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6997 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7001 int UtcDaliAnimationAnimateToActorPositionYP(void)
7003 TestApplication application;
7005 Actor actor = Actor::New();
7006 Stage::GetCurrent().Add(actor);
7007 float startValue(0.0f);
7008 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7009 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7010 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7011 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7013 // Build the animation
7014 float durationSeconds(1.0f);
7015 Animation animation = Animation::New(durationSeconds);
7016 float targetY(10.0f);
7017 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7019 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7021 // Should return the initial properties before play
7022 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7023 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7025 // Start the animation
7028 // Should return the target property after play
7029 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7030 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7032 bool signalReceived(false);
7033 AnimationFinishCheck finishCheck(signalReceived);
7034 animation.FinishedSignal().Connect(&application, finishCheck);
7036 application.SendNotification();
7037 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7039 // We didn't expect the animation to finish yet
7040 application.SendNotification();
7041 finishCheck.CheckSignalNotReceived();
7042 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7044 application.SendNotification();
7045 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7047 // We did expect the animation to finish
7048 application.SendNotification();
7049 finishCheck.CheckSignalReceived();
7050 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7051 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7052 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7053 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7057 int UtcDaliAnimationAnimateToActorPositionZP(void)
7059 TestApplication application;
7061 Actor actor = Actor::New();
7062 Stage::GetCurrent().Add(actor);
7063 float startValue(0.0f);
7064 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7065 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7066 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7067 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7069 // Build the animation
7070 float durationSeconds(1.0f);
7071 Animation animation = Animation::New(durationSeconds);
7072 float targetZ(-5.0f);
7073 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7075 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7077 // Should return the initial properties before play
7078 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7079 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7081 // Start the animation
7084 // Should return the target property after play
7085 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7086 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7088 bool signalReceived(false);
7089 AnimationFinishCheck finishCheck(signalReceived);
7090 animation.FinishedSignal().Connect(&application, finishCheck);
7092 application.SendNotification();
7093 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7095 // We didn't expect the animation to finish yet
7096 application.SendNotification();
7097 finishCheck.CheckSignalNotReceived();
7098 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7100 application.SendNotification();
7101 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7103 // We did expect the animation to finish
7104 application.SendNotification();
7105 finishCheck.CheckSignalReceived();
7106 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7107 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7108 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7109 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7113 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7115 TestApplication application;
7117 Actor actor = Actor::New();
7118 Stage::GetCurrent().Add(actor);
7119 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7121 // Build the animation
7122 float durationSeconds(1.0f);
7123 Animation animation = Animation::New(durationSeconds);
7124 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7125 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7127 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7129 // Start the animation
7132 bool signalReceived(false);
7133 AnimationFinishCheck finishCheck(signalReceived);
7134 animation.FinishedSignal().Connect(&application, finishCheck);
7136 application.SendNotification();
7137 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7139 // We didn't expect the animation to finish yet
7140 application.SendNotification();
7141 finishCheck.CheckSignalNotReceived();
7143 // The position should have moved less, than with a linear alpha function
7144 Vector3 current(actor.GetCurrentPosition());
7145 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7146 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7147 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7148 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7149 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7150 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7152 application.SendNotification();
7153 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7155 // We did expect the animation to finish
7156 application.SendNotification();
7157 finishCheck.CheckSignalReceived();
7158 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7162 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7164 TestApplication application;
7166 Actor actor = Actor::New();
7167 Stage::GetCurrent().Add(actor);
7168 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7170 // Build the animation
7171 float durationSeconds(1.0f);
7172 Animation animation = Animation::New(durationSeconds);
7173 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7175 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7177 TimePeriod( delay, durationSeconds - delay ) );
7179 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7181 // Start the animation
7184 bool signalReceived(false);
7185 AnimationFinishCheck finishCheck(signalReceived);
7186 animation.FinishedSignal().Connect(&application, finishCheck);
7188 application.SendNotification();
7189 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7191 // We didn't expect the animation to finish yet
7192 application.SendNotification();
7193 finishCheck.CheckSignalNotReceived();
7194 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7196 application.SendNotification();
7197 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7199 // We didn't expect the animation to finish yet
7200 application.SendNotification();
7201 finishCheck.CheckSignalNotReceived();
7202 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7204 application.SendNotification();
7205 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7207 // We did expect the animation to finish
7208 application.SendNotification();
7209 finishCheck.CheckSignalReceived();
7210 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7214 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7216 TestApplication application;
7218 Actor actor = Actor::New();
7219 Stage::GetCurrent().Add(actor);
7220 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7222 // Build the animation
7223 float durationSeconds(1.0f);
7224 Animation animation = Animation::New(durationSeconds);
7225 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7227 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7229 AlphaFunction::LINEAR,
7230 TimePeriod( delay, durationSeconds - delay ) );
7232 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7234 // Start the animation
7237 bool signalReceived(false);
7238 AnimationFinishCheck finishCheck(signalReceived);
7239 animation.FinishedSignal().Connect(&application, finishCheck);
7241 application.SendNotification();
7242 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7244 // We didn't expect the animation to finish yet
7245 application.SendNotification();
7246 finishCheck.CheckSignalNotReceived();
7247 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7249 application.SendNotification();
7250 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7252 // We didn't expect the animation to finish yet
7253 application.SendNotification();
7254 finishCheck.CheckSignalNotReceived();
7255 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7257 application.SendNotification();
7258 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7260 // We did expect the animation to finish
7261 application.SendNotification();
7262 finishCheck.CheckSignalReceived();
7263 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7267 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7269 TestApplication application;
7271 Actor actor = Actor::New();
7272 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7273 Stage::GetCurrent().Add(actor);
7274 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7276 // Build the animation
7277 float durationSeconds(1.0f);
7278 Animation animation = Animation::New(durationSeconds);
7279 Degree targetRotationDegrees(90.0f);
7280 Radian targetRotationRadians(targetRotationDegrees);
7281 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7283 // Start the animation
7286 // Target value should be retrievable straight away
7287 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7289 bool signalReceived(false);
7290 AnimationFinishCheck finishCheck(signalReceived);
7291 animation.FinishedSignal().Connect(&application, finishCheck);
7293 application.SendNotification();
7294 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7296 // We didn't expect the animation to finish yet
7297 application.SendNotification();
7298 finishCheck.CheckSignalNotReceived();
7299 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7301 application.SendNotification();
7302 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7304 // We didn't expect the animation to finish yet
7305 application.SendNotification();
7306 finishCheck.CheckSignalNotReceived();
7307 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7309 application.SendNotification();
7310 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7312 // We didn't expect the animation to finish yet
7313 application.SendNotification();
7314 finishCheck.CheckSignalNotReceived();
7315 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7317 application.SendNotification();
7318 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7320 // We did expect the animation to finish
7321 application.SendNotification();
7322 finishCheck.CheckSignalReceived();
7323 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7327 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7329 TestApplication application;
7331 Actor actor = Actor::New();
7332 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7333 Stage::GetCurrent().Add(actor);
7334 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7336 // Build the animation
7337 float durationSeconds(1.0f);
7338 Animation animation = Animation::New(durationSeconds);
7339 Degree targetRotationDegrees(90.0f);
7340 Radian targetRotationRadians(targetRotationDegrees);
7341 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7342 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7344 // Start the animation
7347 bool signalReceived(false);
7348 AnimationFinishCheck finishCheck(signalReceived);
7349 animation.FinishedSignal().Connect(&application, finishCheck);
7351 application.SendNotification();
7352 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7354 // We didn't expect the animation to finish yet
7355 application.SendNotification();
7356 finishCheck.CheckSignalNotReceived();
7357 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7359 application.SendNotification();
7360 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7362 // We didn't expect the animation to finish yet
7363 application.SendNotification();
7364 finishCheck.CheckSignalNotReceived();
7365 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7367 application.SendNotification();
7368 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7370 // We didn't expect the animation to finish yet
7371 application.SendNotification();
7372 finishCheck.CheckSignalNotReceived();
7373 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7375 application.SendNotification();
7376 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7378 // We did expect the animation to finish
7379 application.SendNotification();
7380 finishCheck.CheckSignalReceived();
7381 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7385 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7387 TestApplication application;
7389 Actor actor = Actor::New();
7390 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7391 Stage::GetCurrent().Add(actor);
7392 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7394 // Build the animation
7395 float durationSeconds(1.0f);
7396 Animation animation = Animation::New(durationSeconds);
7397 Degree targetRotationDegrees(90.0f);
7398 Radian targetRotationRadians(targetRotationDegrees);
7399 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7401 // Start the animation
7404 bool signalReceived(false);
7405 AnimationFinishCheck finishCheck(signalReceived);
7406 animation.FinishedSignal().Connect(&application, finishCheck);
7408 application.SendNotification();
7409 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7411 // We didn't expect the animation to finish yet
7412 application.SendNotification();
7413 finishCheck.CheckSignalNotReceived();
7414 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7416 application.SendNotification();
7417 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7419 // We didn't expect the animation to finish yet
7420 application.SendNotification();
7421 finishCheck.CheckSignalNotReceived();
7422 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7424 application.SendNotification();
7425 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7427 // We didn't expect the animation to finish yet
7428 application.SendNotification();
7429 finishCheck.CheckSignalNotReceived();
7430 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7432 application.SendNotification();
7433 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7435 // We did expect the animation to finish
7436 application.SendNotification();
7437 finishCheck.CheckSignalReceived();
7438 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7442 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7444 TestApplication application;
7446 Actor actor = Actor::New();
7447 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7448 Stage::GetCurrent().Add(actor);
7449 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7451 // Build the animation
7452 float durationSeconds(1.0f);
7453 Animation animation = Animation::New(durationSeconds);
7454 Degree targetRotationDegrees(90.0f);
7455 Radian targetRotationRadians(targetRotationDegrees);
7457 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7459 // Start the animation
7462 bool signalReceived(false);
7463 AnimationFinishCheck finishCheck(signalReceived);
7464 animation.FinishedSignal().Connect(&application, finishCheck);
7466 application.SendNotification();
7467 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7469 // We didn't expect the animation to finish yet
7470 application.SendNotification();
7471 finishCheck.CheckSignalNotReceived();
7472 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7473 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7475 application.SendNotification();
7476 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7478 // We didn't expect the animation to finish yet
7479 application.SendNotification();
7480 finishCheck.CheckSignalNotReceived();
7481 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7482 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7484 application.SendNotification();
7485 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7487 // We didn't expect the animation to finish yet
7488 application.SendNotification();
7489 finishCheck.CheckSignalNotReceived();
7490 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7491 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7493 application.SendNotification();
7494 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7496 // We did expect the animation to finish
7497 application.SendNotification();
7498 finishCheck.CheckSignalReceived();
7499 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7503 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7505 TestApplication application;
7507 Actor actor = Actor::New();
7508 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7509 Stage::GetCurrent().Add(actor);
7510 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7512 // Build the animation
7513 float durationSeconds(1.0f);
7514 Animation animation = Animation::New(durationSeconds);
7515 Degree targetRotationDegrees(90.0f);
7516 Radian targetRotationRadians(targetRotationDegrees);
7518 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7520 // Start the animation
7523 bool signalReceived(false);
7524 AnimationFinishCheck finishCheck(signalReceived);
7525 animation.FinishedSignal().Connect(&application, finishCheck);
7527 application.SendNotification();
7528 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7530 // We didn't expect the animation to finish yet
7531 application.SendNotification();
7532 finishCheck.CheckSignalNotReceived();
7533 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7534 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7536 application.SendNotification();
7537 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7539 // We didn't expect the animation to finish yet
7540 application.SendNotification();
7541 finishCheck.CheckSignalNotReceived();
7542 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7543 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7545 application.SendNotification();
7546 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7548 // We didn't expect the animation to finish yet
7549 application.SendNotification();
7550 finishCheck.CheckSignalNotReceived();
7551 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7552 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7554 application.SendNotification();
7555 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7557 // We did expect the animation to finish
7558 application.SendNotification();
7559 finishCheck.CheckSignalReceived();
7560 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7564 int UtcDaliAnimationAnimateToActorScaleP(void)
7566 TestApplication application;
7568 Actor actor = Actor::New();
7569 Stage::GetCurrent().Add(actor);
7570 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7572 // Build the animation
7573 float durationSeconds(1.0f);
7574 Animation animation = Animation::New(durationSeconds);
7575 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7576 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7578 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7580 // Start the animation
7583 // Target value should be retrievable straight away
7584 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
7585 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
7586 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
7587 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
7589 bool signalReceived(false);
7590 AnimationFinishCheck finishCheck(signalReceived);
7591 animation.FinishedSignal().Connect(&application, finishCheck);
7593 application.SendNotification();
7594 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7596 // We didn't expect the animation to finish yet
7597 application.SendNotification();
7598 finishCheck.CheckSignalNotReceived();
7599 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7601 application.SendNotification();
7602 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7604 // We did expect the animation to finish
7605 application.SendNotification();
7606 finishCheck.CheckSignalReceived();
7607 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7610 finishCheck.Reset();
7611 actor.SetScale(Vector3::ONE);
7612 application.SendNotification();
7613 application.Render(0);
7614 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7616 // Repeat with a different (ease-in) alpha function
7617 animation = Animation::New(durationSeconds);
7618 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7619 animation.FinishedSignal().Connect(&application, finishCheck);
7622 application.SendNotification();
7623 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7625 // We didn't expect the animation to finish yet
7626 application.SendNotification();
7627 finishCheck.CheckSignalNotReceived();
7629 // The scale should have grown less, than with a linear alpha function
7630 Vector3 current(actor.GetCurrentScale());
7631 DALI_TEST_CHECK( current.x > 1.0f );
7632 DALI_TEST_CHECK( current.y > 1.0f );
7633 DALI_TEST_CHECK( current.z > 1.0f );
7634 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7635 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7636 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7638 application.SendNotification();
7639 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7641 // We did expect the animation to finish
7642 application.SendNotification();
7643 finishCheck.CheckSignalReceived();
7644 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7647 finishCheck.Reset();
7648 actor.SetScale(Vector3::ONE);
7649 application.SendNotification();
7650 application.Render(0);
7651 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7653 // Repeat with a delay
7655 animation = Animation::New(durationSeconds);
7656 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7657 animation.FinishedSignal().Connect(&application, finishCheck);
7660 application.SendNotification();
7661 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7663 // We didn't expect the animation to finish yet
7664 application.SendNotification();
7665 finishCheck.CheckSignalNotReceived();
7666 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7668 application.SendNotification();
7669 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7671 // We did expect the animation to finish
7672 application.SendNotification();
7673 finishCheck.CheckSignalReceived();
7674 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7678 int UtcDaliAnimationAnimateToActorScaleXP(void)
7680 TestApplication application;
7682 Actor actor = Actor::New();
7683 Stage::GetCurrent().Add(actor);
7684 float startValue(1.0f);
7685 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
7686 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7687 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7688 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7689 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7690 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7691 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7693 // Build the animation
7694 float durationSeconds(1.0f);
7695 Animation animation = Animation::New(durationSeconds);
7696 float targetX(10.0f);
7697 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
7699 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7701 // Start the animation
7704 // Target value should be retrievable straight away
7705 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
7706 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7708 bool signalReceived(false);
7709 AnimationFinishCheck finishCheck(signalReceived);
7710 animation.FinishedSignal().Connect(&application, finishCheck);
7712 application.SendNotification();
7713 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7715 // We didn't expect the animation to finish yet
7716 application.SendNotification();
7717 finishCheck.CheckSignalNotReceived();
7718 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
7719 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
7720 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7721 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7723 application.SendNotification();
7724 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7726 // We did expect the animation to finish
7727 application.SendNotification();
7728 finishCheck.CheckSignalReceived();
7729 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
7730 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7731 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7732 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7736 int UtcDaliAnimationAnimateToActorScaleYP(void)
7738 TestApplication application;
7740 Actor actor = Actor::New();
7741 Stage::GetCurrent().Add(actor);
7742 float startValue(1.0f);
7743 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
7744 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7745 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7746 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7747 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7748 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7749 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7751 // Build the animation
7752 float durationSeconds(1.0f);
7753 Animation animation = Animation::New(durationSeconds);
7754 float targetY(1000.0f);
7755 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7757 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7759 // Start the animation
7762 // Target value should be retrievable straight away
7763 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
7764 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7766 bool signalReceived(false);
7767 AnimationFinishCheck finishCheck(signalReceived);
7768 animation.FinishedSignal().Connect(&application, finishCheck);
7770 application.SendNotification();
7771 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7773 // We didn't expect the animation to finish yet
7774 application.SendNotification();
7775 finishCheck.CheckSignalNotReceived();
7776 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7777 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7778 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
7779 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7781 application.SendNotification();
7782 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7784 // We did expect the animation to finish
7785 application.SendNotification();
7786 finishCheck.CheckSignalReceived();
7787 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7788 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7789 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7790 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7794 int UtcDaliAnimationAnimateToActorScaleZP(void)
7796 TestApplication application;
7798 Actor actor = Actor::New();
7799 Stage::GetCurrent().Add(actor);
7800 float startValue(1.0f);
7801 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7802 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7803 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7804 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7805 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7806 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7807 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7809 // Build the animation
7810 float durationSeconds(1.0f);
7811 Animation animation = Animation::New(durationSeconds);
7812 float targetZ(-1000.0f);
7813 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7815 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7817 // Start the animation
7820 // Target value should be retrievable straight away
7821 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
7822 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7824 bool signalReceived(false);
7825 AnimationFinishCheck finishCheck(signalReceived);
7826 animation.FinishedSignal().Connect(&application, finishCheck);
7828 application.SendNotification();
7829 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7831 // We didn't expect the animation to finish yet
7832 application.SendNotification();
7833 finishCheck.CheckSignalNotReceived();
7834 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7835 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7836 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7837 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
7839 application.SendNotification();
7840 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7842 // We did expect the animation to finish
7843 application.SendNotification();
7844 finishCheck.CheckSignalReceived();
7845 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7846 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7847 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7848 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7852 int UtcDaliAnimationAnimateToActorColorP(void)
7854 TestApplication application;
7856 Actor actor = Actor::New();
7857 Stage::GetCurrent().Add(actor);
7858 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7860 // Build the animation
7861 float durationSeconds(1.0f);
7862 Animation animation = Animation::New(durationSeconds);
7863 Vector4 targetColor(Color::RED);
7864 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7866 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7867 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7869 // Start the animation
7872 // Target value should be retrievable straight away
7873 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
7874 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
7875 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
7876 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
7877 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
7878 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
7880 bool signalReceived(false);
7881 AnimationFinishCheck finishCheck(signalReceived);
7882 animation.FinishedSignal().Connect(&application, finishCheck);
7884 application.SendNotification();
7885 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7887 // We didn't expect the animation to finish yet
7888 application.SendNotification();
7889 finishCheck.CheckSignalNotReceived();
7890 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7892 application.SendNotification();
7893 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7895 // We did expect the animation to finish
7896 application.SendNotification();
7897 finishCheck.CheckSignalReceived();
7898 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7901 finishCheck.Reset();
7902 actor.SetColor(Color::WHITE);
7903 application.SendNotification();
7904 application.Render(0);
7905 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7907 // Repeat with a different (ease-in) alpha function
7908 animation = Animation::New(durationSeconds);
7909 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7910 animation.FinishedSignal().Connect(&application, finishCheck);
7913 application.SendNotification();
7914 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7916 // We didn't expect the animation to finish yet
7917 application.SendNotification();
7918 finishCheck.CheckSignalNotReceived();
7920 // The color should have changed less, than with a linear alpha function
7921 Vector4 current(actor.GetCurrentColor());
7922 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7923 DALI_TEST_CHECK( current.y < 1.0f );
7924 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7925 DALI_TEST_CHECK( current.z < 1.0f );
7926 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7927 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7929 application.SendNotification();
7930 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7932 // We did expect the animation to finish
7933 application.SendNotification();
7934 finishCheck.CheckSignalReceived();
7935 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7938 finishCheck.Reset();
7939 actor.SetColor(Color::WHITE);
7940 application.SendNotification();
7941 application.Render(0);
7942 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7944 // Repeat with a shorter animator duration
7945 float animatorDuration = 0.5f;
7946 animation = Animation::New(durationSeconds);
7947 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7948 animation.FinishedSignal().Connect(&application, finishCheck);
7951 application.SendNotification();
7952 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7954 // We didn't expect the animation to finish yet
7955 application.SendNotification();
7956 finishCheck.CheckSignalNotReceived();
7957 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7959 application.SendNotification();
7960 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7962 // We didn't expect the animation to finish yet
7963 application.SendNotification();
7964 finishCheck.CheckSignalNotReceived();
7965 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7967 application.SendNotification();
7968 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7970 // We did expect the animation to finish
7971 application.SendNotification();
7972 finishCheck.CheckSignalReceived();
7973 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7977 int UtcDaliAnimationAnimateToActorColorRedP(void)
7979 TestApplication application;
7981 Actor actor = Actor::New();
7982 Stage::GetCurrent().Add(actor);
7983 float startValue(1.0f);
7984 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
7985 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7986 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7988 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7989 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
7990 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
7991 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
7992 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
7994 // Build the animation
7995 float durationSeconds(1.0f);
7996 Animation animation = Animation::New(durationSeconds);
7997 float targetRed(0.5f);
7998 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8000 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8002 // Start the animation
8005 // Target value should be retrievable straight away
8006 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8007 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8009 bool signalReceived(false);
8010 AnimationFinishCheck finishCheck(signalReceived);
8011 animation.FinishedSignal().Connect(&application, finishCheck);
8013 application.SendNotification();
8014 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8016 // We didn't expect the animation to finish yet
8017 application.SendNotification();
8018 finishCheck.CheckSignalNotReceived();
8019 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8020 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
8021 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8022 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8023 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8025 application.SendNotification();
8026 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8028 // We did expect the animation to finish
8029 application.SendNotification();
8030 finishCheck.CheckSignalReceived();
8031 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8032 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
8033 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8034 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8035 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8039 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8041 TestApplication application;
8043 Actor actor = Actor::New();
8044 Stage::GetCurrent().Add(actor);
8045 float startValue(1.0f);
8046 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8047 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8048 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8049 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8050 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8051 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8052 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8053 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8054 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8056 // Build the animation
8057 float durationSeconds(1.0f);
8058 Animation animation = Animation::New(durationSeconds);
8059 float targetGreen(0.5f);
8060 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8062 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8064 // Start the animation
8067 // Target value should be retrievable straight away
8068 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8069 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8071 bool signalReceived(false);
8072 AnimationFinishCheck finishCheck(signalReceived);
8073 animation.FinishedSignal().Connect(&application, finishCheck);
8075 application.SendNotification();
8076 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8078 // We didn't expect the animation to finish yet
8079 application.SendNotification();
8080 finishCheck.CheckSignalNotReceived();
8081 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8082 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8083 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8084 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8085 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8087 application.SendNotification();
8088 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8090 // We did expect the animation to finish
8091 application.SendNotification();
8092 finishCheck.CheckSignalReceived();
8093 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8094 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8095 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8096 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8097 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8101 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8103 TestApplication application;
8105 Actor actor = Actor::New();
8106 Stage::GetCurrent().Add(actor);
8107 float startValue(1.0f);
8108 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8109 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8110 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8111 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8112 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8113 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8114 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8115 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8116 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8118 // Build the animation
8119 float durationSeconds(1.0f);
8120 Animation animation = Animation::New(durationSeconds);
8121 float targetBlue(0.5f);
8122 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8124 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8126 // Start the animation
8129 // Target value should be retrievable straight away
8130 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8131 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8133 bool signalReceived(false);
8134 AnimationFinishCheck finishCheck(signalReceived);
8135 animation.FinishedSignal().Connect(&application, finishCheck);
8137 application.SendNotification();
8138 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8140 // We didn't expect the animation to finish yet
8141 application.SendNotification();
8142 finishCheck.CheckSignalNotReceived();
8143 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8144 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8145 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8146 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8147 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8149 application.SendNotification();
8150 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8152 // We did expect the animation to finish
8153 application.SendNotification();
8154 finishCheck.CheckSignalReceived();
8155 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8156 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8157 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8158 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8159 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8163 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8165 TestApplication application;
8167 Actor actor = Actor::New();
8168 Stage::GetCurrent().Add(actor);
8169 float startValue(1.0f);
8170 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8171 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8172 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8173 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8174 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8175 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8176 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8177 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8178 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8180 // Build the animation
8181 float durationSeconds(1.0f);
8182 Animation animation = Animation::New(durationSeconds);
8183 float targetAlpha(0.5f);
8184 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8186 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8188 // Start the animation
8191 // Target value should be retrievable straight away
8192 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8193 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8194 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8196 bool signalReceived(false);
8197 AnimationFinishCheck finishCheck(signalReceived);
8198 animation.FinishedSignal().Connect(&application, finishCheck);
8200 application.SendNotification();
8201 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8203 // We didn't expect the animation to finish yet
8204 application.SendNotification();
8205 finishCheck.CheckSignalNotReceived();
8206 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8207 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8208 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8209 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8210 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8212 application.SendNotification();
8213 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8215 // We did expect the animation to finish
8216 application.SendNotification();
8217 finishCheck.CheckSignalReceived();
8218 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8219 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8220 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8221 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8222 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8226 int UtcDaliAnimationKeyFrames01P(void)
8228 TestApplication application;
8230 KeyFrames keyFrames = KeyFrames::New();
8231 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8233 keyFrames.Add(0.0f, 0.1f);
8235 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8237 KeyFrames keyFrames2( keyFrames);
8238 DALI_TEST_CHECK( keyFrames2 );
8239 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8241 KeyFrames keyFrames3 = KeyFrames::New();
8242 keyFrames3.Add(0.6f, true);
8243 DALI_TEST_CHECK( keyFrames3 );
8244 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8246 keyFrames3 = keyFrames;
8247 DALI_TEST_CHECK( keyFrames3 );
8248 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8253 int UtcDaliAnimationKeyFrames02P(void)
8255 TestApplication application;
8257 KeyFrames keyFrames = KeyFrames::New();
8258 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8260 keyFrames.Add(0.0f, 0.1f);
8261 keyFrames.Add(0.2f, 0.5f);
8262 keyFrames.Add(0.4f, 0.0f);
8263 keyFrames.Add(0.6f, 1.0f);
8264 keyFrames.Add(0.8f, 0.7f);
8265 keyFrames.Add(1.0f, 0.9f);
8267 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8271 keyFrames.Add(1.9f, false);
8273 catch (Dali::DaliException& e)
8275 DALI_TEST_PRINT_ASSERT( e );
8276 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8281 int UtcDaliAnimationKeyFrames03P(void)
8283 TestApplication application;
8285 KeyFrames keyFrames = KeyFrames::New();
8286 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8288 keyFrames.Add(0.0f, true);
8289 keyFrames.Add(0.2f, false);
8290 keyFrames.Add(0.4f, false);
8291 keyFrames.Add(0.6f, true);
8292 keyFrames.Add(0.8f, true);
8293 keyFrames.Add(1.0f, false);
8295 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8299 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8301 catch (Dali::DaliException& e)
8303 DALI_TEST_PRINT_ASSERT( e );
8304 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8309 int UtcDaliAnimationKeyFrames04P(void)
8311 TestApplication application;
8313 KeyFrames keyFrames = KeyFrames::New();
8314 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8316 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8317 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8318 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8319 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8320 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8321 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8323 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8327 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8329 catch (Dali::DaliException& e)
8331 DALI_TEST_PRINT_ASSERT( e );
8332 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8337 int UtcDaliAnimationKeyFrames05P(void)
8339 TestApplication application;
8341 KeyFrames keyFrames = KeyFrames::New();
8342 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8344 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8345 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8346 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8347 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8348 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8349 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8351 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8355 keyFrames.Add(0.7f, 1.0f);
8357 catch (Dali::DaliException& e)
8359 DALI_TEST_PRINT_ASSERT( e );
8360 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8365 int UtcDaliAnimationKeyFrames06P(void)
8367 TestApplication application;
8369 KeyFrames keyFrames = KeyFrames::New();
8370 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8372 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8373 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8374 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8375 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8376 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8377 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8379 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8383 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8385 catch (Dali::DaliException& e)
8387 DALI_TEST_PRINT_ASSERT( e );
8388 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8393 int UtcDaliAnimationKeyFrames07P(void)
8395 TestApplication application;
8397 KeyFrames keyFrames = KeyFrames::New();
8398 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8400 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8401 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8402 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8403 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8404 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8405 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8407 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8411 keyFrames.Add(0.7f, 1.1f);
8413 catch (Dali::DaliException& e)
8415 DALI_TEST_PRINT_ASSERT( e );
8416 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8421 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8423 TestApplication application;
8425 float startValue(1.0f);
8426 Actor actor = Actor::New();
8427 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8428 Stage::GetCurrent().Add(actor);
8430 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8431 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8432 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8433 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8434 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8435 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8436 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8437 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8438 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8440 // Build the animation
8441 float durationSeconds(1.0f);
8442 Animation animation = Animation::New(durationSeconds);
8444 KeyFrames keyFrames = KeyFrames::New();
8445 keyFrames.Add(0.0f, 0.1f);
8446 keyFrames.Add(0.2f, 0.5f);
8447 keyFrames.Add(0.4f, 0.0f);
8448 keyFrames.Add(0.6f, 1.0f);
8449 keyFrames.Add(0.8f, 0.7f);
8450 keyFrames.Add(1.0f, 0.9f);
8452 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8454 // Start the animation
8457 bool signalReceived(false);
8458 AnimationFinishCheck finishCheck(signalReceived);
8459 animation.FinishedSignal().Connect(&application, finishCheck);
8460 application.SendNotification();
8461 application.Render(0);
8462 application.SendNotification();
8463 finishCheck.CheckSignalNotReceived();
8464 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8466 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8467 application.SendNotification();
8468 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8469 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8470 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8471 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8472 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8474 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8475 application.SendNotification();
8476 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8477 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8478 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8479 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8480 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8482 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8483 application.SendNotification();
8484 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8485 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8486 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8487 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8488 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8490 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8491 application.SendNotification();
8492 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8493 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8494 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8495 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8496 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8498 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8499 application.SendNotification();
8500 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8501 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8502 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8503 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8504 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8506 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8507 application.SendNotification();
8508 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8509 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8510 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8511 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8512 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8514 // We did expect the animation to finish
8516 finishCheck.CheckSignalReceived();
8520 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8522 TestApplication application;
8524 float startValue(1.0f);
8525 Actor actor = Actor::New();
8526 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8527 Stage::GetCurrent().Add(actor);
8529 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8530 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8531 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8532 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8533 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8534 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8535 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8536 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8537 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8539 // Build the animation
8540 float durationSeconds(1.0f);
8541 Animation animation = Animation::New(durationSeconds);
8543 KeyFrames keyFrames = KeyFrames::New();
8544 keyFrames.Add(0.0f, 0.1f);
8545 keyFrames.Add(0.2f, 0.5f);
8546 keyFrames.Add(0.4f, 0.0f);
8547 keyFrames.Add(0.6f, 1.0f);
8548 keyFrames.Add(0.8f, 0.7f);
8549 keyFrames.Add(1.0f, 0.9f);
8551 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8553 // Start the animation
8556 bool signalReceived(false);
8557 AnimationFinishCheck finishCheck(signalReceived);
8558 animation.FinishedSignal().Connect(&application, finishCheck);
8559 application.SendNotification();
8560 application.Render(0);
8561 application.SendNotification();
8562 finishCheck.CheckSignalNotReceived();
8563 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8565 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8566 application.SendNotification();
8567 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8568 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8569 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8570 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
8571 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8573 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8574 application.SendNotification();
8575 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8576 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8577 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8578 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
8579 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8581 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8582 application.SendNotification();
8583 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8584 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8585 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8586 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
8587 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8589 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8590 application.SendNotification();
8591 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8592 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8593 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8594 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
8595 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8597 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8598 application.SendNotification();
8599 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8600 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8601 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8602 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
8603 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8605 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8606 application.SendNotification();
8607 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8608 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8609 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8610 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
8611 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8613 // We did expect the animation to finish
8615 finishCheck.CheckSignalReceived();
8619 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8621 TestApplication application;
8623 float startValue(1.0f);
8624 Actor actor = Actor::New();
8625 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8626 Stage::GetCurrent().Add(actor);
8628 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8629 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8630 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8631 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8632 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8633 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8634 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8635 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8636 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8638 // Build the animation
8639 float durationSeconds(1.0f);
8640 Animation animation = Animation::New(durationSeconds);
8642 KeyFrames keyFrames = KeyFrames::New();
8643 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8644 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8645 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8647 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8649 // Start the animation
8652 bool signalReceived(false);
8653 AnimationFinishCheck finishCheck(signalReceived);
8654 animation.FinishedSignal().Connect(&application, finishCheck);
8655 application.SendNotification();
8656 application.Render(0);
8657 application.SendNotification();
8658 finishCheck.CheckSignalNotReceived();
8659 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
8660 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8661 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
8662 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8664 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8665 application.SendNotification();
8666 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
8667 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
8668 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
8669 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
8671 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8672 application.SendNotification();
8673 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
8674 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8675 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
8676 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8678 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8679 application.SendNotification();
8680 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
8681 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
8682 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
8683 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
8685 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8686 application.SendNotification();
8687 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
8688 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8689 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
8690 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8692 // We did expect the animation to finish
8694 finishCheck.CheckSignalReceived();
8698 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
8700 TestApplication application;
8702 float startValue(1.0f);
8703 Actor actor = Actor::New();
8704 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8705 Stage::GetCurrent().Add(actor);
8707 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8708 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8709 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8710 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8711 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8712 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8713 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8714 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8715 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8717 // Build the animation
8718 float durationSeconds(1.0f);
8719 Animation animation = Animation::New(durationSeconds);
8721 KeyFrames keyFrames = KeyFrames::New();
8722 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8723 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8724 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8726 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
8728 // Start the animation
8731 bool signalReceived(false);
8732 AnimationFinishCheck finishCheck(signalReceived);
8733 animation.FinishedSignal().Connect(&application, finishCheck);
8734 application.SendNotification();
8735 application.Render(0);
8736 application.SendNotification();
8737 finishCheck.CheckSignalNotReceived();
8738 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
8739 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8740 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
8741 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8743 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8744 application.SendNotification();
8745 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
8746 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
8747 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
8748 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
8750 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8751 application.SendNotification();
8752 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
8753 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8754 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
8755 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8757 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8758 application.SendNotification();
8759 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
8760 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
8761 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
8762 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
8764 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8765 application.SendNotification();
8766 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
8767 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8768 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
8769 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8771 // We did expect the animation to finish
8773 finishCheck.CheckSignalReceived();
8777 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
8779 TestApplication application;
8781 Actor actor = Actor::New();
8782 AngleAxis aa(Degree(90), Vector3::XAXIS);
8783 actor.SetOrientation(aa.angle, aa.axis);
8784 Stage::GetCurrent().Add(actor);
8786 application.SendNotification();
8787 application.Render(0);
8789 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8791 // Build the animation
8792 float durationSeconds(1.0f);
8793 Animation animation = Animation::New(durationSeconds);
8795 KeyFrames keyFrames = KeyFrames::New();
8796 keyFrames.Add(0.0f, false);
8797 keyFrames.Add(0.2f, true);
8798 keyFrames.Add(0.4f, true);
8799 keyFrames.Add(0.8f, false);
8800 keyFrames.Add(1.0f, true);
8802 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
8804 // Start the animation
8807 bool signalReceived(false);
8808 AnimationFinishCheck finishCheck(signalReceived);
8809 animation.FinishedSignal().Connect(&application, finishCheck);
8810 application.SendNotification();
8811 application.SendNotification();
8812 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8813 application.SendNotification();
8814 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8815 application.SendNotification();
8817 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8818 finishCheck.CheckSignalReceived();
8822 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8824 TestApplication application;
8826 Actor actor = Actor::New();
8827 AngleAxis aa(Degree(90), Vector3::XAXIS);
8828 actor.SetOrientation(aa.angle, aa.axis);
8829 Stage::GetCurrent().Add(actor);
8831 application.SendNotification();
8832 application.Render(0);
8834 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8836 // Build the animation
8837 float durationSeconds(1.0f);
8838 Animation animation = Animation::New(durationSeconds);
8840 KeyFrames keyFrames = KeyFrames::New();
8841 keyFrames.Add(0.0f, false);
8842 keyFrames.Add(0.2f, true);
8843 keyFrames.Add(0.4f, true);
8844 keyFrames.Add(0.8f, false);
8845 keyFrames.Add(1.0f, true);
8847 //Cubic interpolation for boolean values should be ignored
8848 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8850 // Start the animation
8853 bool signalReceived(false);
8854 AnimationFinishCheck finishCheck(signalReceived);
8855 animation.FinishedSignal().Connect(&application, finishCheck);
8856 application.SendNotification();
8857 application.SendNotification();
8858 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8859 application.SendNotification();
8860 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8861 application.SendNotification();
8863 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8864 finishCheck.CheckSignalReceived();
8868 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8870 TestApplication application;
8872 Actor actor = Actor::New();
8873 AngleAxis aa(Degree(90), Vector3::XAXIS);
8874 actor.SetOrientation(aa.angle, aa.axis);
8875 Stage::GetCurrent().Add(actor);
8877 application.SendNotification();
8878 application.Render(0);
8879 Quaternion start(Radian(aa.angle), aa.axis);
8880 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8882 // Build the animation
8883 float durationSeconds(1.0f);
8884 Animation animation = Animation::New(durationSeconds);
8886 KeyFrames keyFrames = KeyFrames::New();
8887 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8889 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8891 // Start the animation
8894 bool signalReceived(false);
8895 AnimationFinishCheck finishCheck(signalReceived);
8896 animation.FinishedSignal().Connect(&application, finishCheck);
8897 application.SendNotification();
8898 application.SendNotification();
8899 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8900 application.SendNotification();
8901 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8902 application.SendNotification();
8904 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8906 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8907 finishCheck.CheckSignalReceived();
8911 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8913 TestApplication application;
8915 Actor actor = Actor::New();
8916 AngleAxis aa(Degree(90), Vector3::XAXIS);
8917 actor.SetOrientation(aa.angle, aa.axis);
8918 application.SendNotification();
8919 application.Render(0);
8920 Stage::GetCurrent().Add(actor);
8922 Quaternion start(Radian(aa.angle), aa.axis);
8923 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8925 // Build the animation
8926 float durationSeconds(1.0f);
8927 Animation animation = Animation::New(durationSeconds);
8929 KeyFrames keyFrames = KeyFrames::New();
8930 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8931 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8932 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8934 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8936 // Start the animation
8939 bool signalReceived(false);
8940 AnimationFinishCheck finishCheck(signalReceived);
8941 animation.FinishedSignal().Connect(&application, finishCheck);
8942 application.SendNotification();
8943 application.Render(0);
8944 application.SendNotification();
8945 finishCheck.CheckSignalNotReceived();
8947 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8948 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8950 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8951 application.SendNotification();
8952 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8953 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8955 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8956 application.SendNotification();
8957 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8958 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8960 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8961 application.SendNotification();
8962 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8963 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8965 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8966 application.SendNotification();
8967 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8968 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8970 // We did expect the animation to finish
8972 finishCheck.CheckSignalReceived();
8976 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
8978 TestApplication application;
8980 Actor actor = Actor::New();
8981 AngleAxis aa(Degree(90), Vector3::XAXIS);
8982 actor.SetOrientation(aa.angle, aa.axis);
8983 Stage::GetCurrent().Add(actor);
8985 application.SendNotification();
8986 application.Render(0);
8987 Quaternion start(Radian(aa.angle), aa.axis);
8988 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8990 // Build the animation
8991 float durationSeconds(1.0f);
8992 Animation animation = Animation::New(durationSeconds);
8994 KeyFrames keyFrames = KeyFrames::New();
8995 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8997 //Cubic interpolation should be ignored for quaternions
8998 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9000 // Start the animation
9003 bool signalReceived(false);
9004 AnimationFinishCheck finishCheck(signalReceived);
9005 animation.FinishedSignal().Connect(&application, finishCheck);
9006 application.SendNotification();
9007 application.SendNotification();
9008 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9009 application.SendNotification();
9010 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9011 application.SendNotification();
9013 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9015 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9016 finishCheck.CheckSignalReceived();
9020 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9022 TestApplication application;
9024 Actor actor = Actor::New();
9025 AngleAxis aa(Degree(90), Vector3::XAXIS);
9026 actor.SetOrientation(aa.angle, aa.axis);
9027 application.SendNotification();
9028 application.Render(0);
9029 Stage::GetCurrent().Add(actor);
9031 Quaternion start(Radian(aa.angle), aa.axis);
9032 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9034 // Build the animation
9035 float durationSeconds(1.0f);
9036 Animation animation = Animation::New(durationSeconds);
9038 KeyFrames keyFrames = KeyFrames::New();
9039 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9040 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9041 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9043 //Cubic interpolation should be ignored for quaternions
9044 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9046 // Start the animation
9049 bool signalReceived(false);
9050 AnimationFinishCheck finishCheck(signalReceived);
9051 animation.FinishedSignal().Connect(&application, finishCheck);
9052 application.SendNotification();
9053 application.Render(0);
9054 application.SendNotification();
9055 finishCheck.CheckSignalNotReceived();
9057 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9058 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9060 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9061 application.SendNotification();
9062 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9063 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9065 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9066 application.SendNotification();
9067 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9068 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9070 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9071 application.SendNotification();
9072 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9073 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9075 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9076 application.SendNotification();
9077 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9078 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9080 // We did expect the animation to finish
9082 finishCheck.CheckSignalReceived();
9086 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9088 TestApplication application;
9090 float startValue(1.0f);
9091 Actor actor = Actor::New();
9092 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9093 Stage::GetCurrent().Add(actor);
9095 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9096 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9097 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9098 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9099 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9100 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9101 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9102 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9103 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9105 // Build the animation
9106 float durationSeconds(1.0f);
9107 Animation animation = Animation::New(durationSeconds);
9109 KeyFrames keyFrames = KeyFrames::New();
9110 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9111 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9112 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9114 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9116 // Start the animation
9119 bool signalReceived(false);
9120 AnimationFinishCheck finishCheck(signalReceived);
9121 animation.FinishedSignal().Connect(&application, finishCheck);
9122 application.SendNotification();
9123 application.Render(0);
9124 application.SendNotification();
9125 finishCheck.CheckSignalNotReceived();
9126 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9127 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9128 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9129 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9131 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9132 application.SendNotification();
9133 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9134 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9135 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9136 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9138 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9139 application.SendNotification();
9140 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9141 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9142 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9143 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9145 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9146 application.SendNotification();
9147 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9148 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9149 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9150 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9152 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9153 application.SendNotification();
9154 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9155 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9156 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9157 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9159 // We did expect the animation to finish
9161 finishCheck.CheckSignalReceived();
9165 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9167 TestApplication application;
9169 float startValue(1.0f);
9170 Actor actor = Actor::New();
9171 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9172 Stage::GetCurrent().Add(actor);
9174 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9175 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9176 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9177 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9178 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9179 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9180 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9181 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9182 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, 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, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9190 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9191 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9193 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9195 // Start the animation
9198 bool signalReceived(false);
9199 AnimationFinishCheck finishCheck(signalReceived);
9200 animation.FinishedSignal().Connect(&application, finishCheck);
9201 application.SendNotification();
9202 application.Render(0);
9203 application.SendNotification();
9204 finishCheck.CheckSignalNotReceived();
9205 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9206 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9207 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9208 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9210 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9211 application.SendNotification();
9212 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9213 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9214 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9215 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9217 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9218 application.SendNotification();
9219 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9220 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9221 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9222 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9224 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9225 application.SendNotification();
9226 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9227 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9228 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9229 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9231 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9232 application.SendNotification();
9233 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9234 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9235 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9236 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9238 // We did expect the animation to finish
9240 finishCheck.CheckSignalReceived();
9244 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9246 TestApplication application;
9248 float startValue(1.0f);
9249 Actor actor = Actor::New();
9250 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9251 Stage::GetCurrent().Add(actor);
9253 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9254 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9255 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9256 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9257 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9258 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9259 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9260 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9261 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9263 // Build the animation
9264 float durationSeconds(1.0f);
9266 Animation animation = Animation::New(durationSeconds);
9268 KeyFrames keyFrames = KeyFrames::New();
9269 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9270 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9271 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9273 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9275 // Start the animation
9278 bool signalReceived(false);
9279 AnimationFinishCheck finishCheck(signalReceived);
9280 animation.FinishedSignal().Connect(&application, finishCheck);
9281 application.SendNotification();
9283 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9284 application.SendNotification();
9285 finishCheck.CheckSignalNotReceived();
9286 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9287 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9288 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9289 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9291 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9292 application.SendNotification();
9293 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9294 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9295 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9296 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9298 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9299 application.SendNotification();
9300 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9301 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9302 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9303 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9305 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9306 application.SendNotification();
9307 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9308 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9309 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9310 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9312 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9313 application.SendNotification();
9314 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9315 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9316 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9317 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9319 // We did expect the animation to finish
9321 finishCheck.CheckSignalReceived();
9325 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9327 TestApplication application;
9329 float startValue(1.0f);
9330 Actor actor = Actor::New();
9331 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9332 Stage::GetCurrent().Add(actor);
9334 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9335 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9336 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9337 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9338 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9339 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9340 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9341 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9342 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9344 // Build the animation
9345 float durationSeconds(1.0f);
9347 Animation animation = Animation::New(durationSeconds);
9349 KeyFrames keyFrames = KeyFrames::New();
9350 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9351 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9352 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9354 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9356 // Start the animation
9359 bool signalReceived(false);
9360 AnimationFinishCheck finishCheck(signalReceived);
9361 animation.FinishedSignal().Connect(&application, finishCheck);
9362 application.SendNotification();
9364 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9365 application.SendNotification();
9366 finishCheck.CheckSignalNotReceived();
9367 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9368 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9369 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9370 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9372 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9373 application.SendNotification();
9374 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9375 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9376 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9377 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9379 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9380 application.SendNotification();
9381 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9382 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9383 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9384 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9386 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9387 application.SendNotification();
9388 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9389 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9390 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9391 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9393 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9394 application.SendNotification();
9395 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9396 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9397 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9398 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9400 // We did expect the animation to finish
9402 finishCheck.CheckSignalReceived();
9406 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9408 TestApplication application;
9410 float startValue(1.0f);
9412 Actor actor = Actor::New();
9413 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9414 Stage::GetCurrent().Add(actor);
9416 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9417 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9418 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9419 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9420 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9421 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9422 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9423 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9424 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9426 // Build the animation
9427 float durationSeconds(1.0f);
9428 Animation animation = Animation::New(durationSeconds);
9430 KeyFrames keyFrames = KeyFrames::New();
9431 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9432 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9433 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9435 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9437 // Start the animation
9440 bool signalReceived(false);
9441 AnimationFinishCheck finishCheck(signalReceived);
9442 animation.FinishedSignal().Connect(&application, finishCheck);
9443 application.SendNotification();
9445 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9446 application.SendNotification();
9447 finishCheck.CheckSignalNotReceived();
9448 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9449 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9450 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9451 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9453 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9454 application.SendNotification();
9455 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9456 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9457 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9458 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9460 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9461 application.SendNotification();
9462 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9463 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9464 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9465 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9467 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9468 application.SendNotification();
9469 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9470 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9471 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9472 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9474 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9475 application.SendNotification();
9476 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9477 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9478 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9479 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9481 // We did expect the animation to finish
9483 finishCheck.CheckSignalReceived();
9487 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9489 TestApplication application;
9491 float startValue(1.0f);
9492 Actor actor = Actor::New();
9493 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9494 Stage::GetCurrent().Add(actor);
9496 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9497 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9498 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9499 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9500 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9501 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9502 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9503 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9504 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9507 // Build the animation
9508 float durationSeconds(1.0f);
9510 Animation animation = Animation::New(durationSeconds);
9512 KeyFrames keyFrames = KeyFrames::New();
9513 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9514 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9515 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9517 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9519 // Start the animation
9522 bool signalReceived(false);
9523 AnimationFinishCheck finishCheck(signalReceived);
9524 animation.FinishedSignal().Connect(&application, finishCheck);
9525 application.SendNotification();
9527 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9528 application.SendNotification();
9529 finishCheck.CheckSignalNotReceived();
9530 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9531 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9532 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9533 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9535 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9536 application.SendNotification();
9537 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9538 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9539 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9540 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9542 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9543 application.SendNotification();
9544 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9545 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9546 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9547 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9549 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9550 application.SendNotification();
9551 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9552 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9553 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9554 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9556 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9557 application.SendNotification();
9558 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9559 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9560 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9561 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9563 // We did expect the animation to finish
9565 finishCheck.CheckSignalReceived();
9569 int UtcDaliAnimationAnimateP(void)
9571 TestApplication application;
9573 Actor actor = Actor::New();
9574 Stage::GetCurrent().Add(actor);
9577 Vector3 position0( 30.0, 80.0, 0.0);
9578 Vector3 position1( 70.0, 120.0, 0.0);
9579 Vector3 position2( 100.0, 100.0, 0.0);
9581 Dali::Path path = Dali::Path::New();
9582 path.AddPoint(position0);
9583 path.AddPoint(position1);
9584 path.AddPoint(position2);
9586 //Control points for first segment
9587 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9588 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9590 //Control points for second segment
9591 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9592 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9594 // Build the animation
9595 float durationSeconds( 1.0f );
9596 Animation animation = Animation::New(durationSeconds);
9597 animation.Animate(actor, path, Vector3::XAXIS);
9599 // Start the animation
9602 bool signalReceived(false);
9603 AnimationFinishCheck finishCheck(signalReceived);
9604 animation.FinishedSignal().Connect(&application, finishCheck);
9605 application.SendNotification();
9606 application.Render(0);
9607 application.SendNotification();
9608 finishCheck.CheckSignalNotReceived();
9609 Vector3 position, tangent;
9610 Quaternion rotation;
9611 path.Sample( 0.0f, position, tangent );
9612 rotation = Quaternion( Vector3::XAXIS, tangent );
9613 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9614 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9616 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9617 application.SendNotification();
9618 path.Sample( 0.25f, position, tangent );
9619 rotation = Quaternion( Vector3::XAXIS, tangent );
9620 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9621 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9623 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9624 application.SendNotification();
9625 path.Sample( 0.5f, position, tangent );
9626 rotation = Quaternion( Vector3::XAXIS, tangent );
9627 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9628 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9630 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9631 application.SendNotification();
9632 path.Sample( 0.75f, position, tangent );
9633 rotation = Quaternion( Vector3::XAXIS, tangent );
9634 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9635 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9637 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9638 application.SendNotification();
9639 path.Sample( 1.0f, position, tangent );
9640 rotation = Quaternion( Vector3::XAXIS, tangent );
9641 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9642 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9644 finishCheck.CheckSignalReceived();
9648 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9650 TestApplication application;
9652 Actor actor = Actor::New();
9653 Stage::GetCurrent().Add(actor);
9656 Vector3 position0( 30.0, 80.0, 0.0);
9657 Vector3 position1( 70.0, 120.0, 0.0);
9658 Vector3 position2( 100.0, 100.0, 0.0);
9660 Dali::Path path = Dali::Path::New();
9661 path.AddPoint(position0);
9662 path.AddPoint(position1);
9663 path.AddPoint(position2);
9665 //Control points for first segment
9666 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9667 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9669 //Control points for second segment
9670 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9671 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9673 // Build the animation
9674 float durationSeconds( 1.0f );
9675 Animation animation = Animation::New(durationSeconds);
9676 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
9678 // Start the animation
9681 bool signalReceived(false);
9682 AnimationFinishCheck finishCheck(signalReceived);
9683 animation.FinishedSignal().Connect(&application, finishCheck);
9684 application.SendNotification();
9685 application.Render(0);
9686 application.SendNotification();
9687 finishCheck.CheckSignalNotReceived();
9688 Vector3 position, tangent;
9689 Quaternion rotation;
9690 path.Sample( 0.0f, position, tangent );
9691 rotation = Quaternion( Vector3::XAXIS, tangent );
9692 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9693 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9695 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9696 application.SendNotification();
9697 path.Sample( 0.25f, position, tangent );
9698 rotation = Quaternion( Vector3::XAXIS, tangent );
9699 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9700 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9702 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9703 application.SendNotification();
9704 path.Sample( 0.5f, position, tangent );
9705 rotation = Quaternion( Vector3::XAXIS, tangent );
9706 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9707 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9709 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9710 application.SendNotification();
9711 path.Sample( 0.75f, position, tangent );
9712 rotation = Quaternion( Vector3::XAXIS, tangent );
9713 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9714 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9716 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9717 application.SendNotification();
9718 path.Sample( 1.0f, position, tangent );
9719 rotation = Quaternion( Vector3::XAXIS, tangent );
9720 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9721 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9723 finishCheck.CheckSignalReceived();
9727 int UtcDaliAnimationAnimateTimePeriodP(void)
9729 TestApplication application;
9731 Actor actor = Actor::New();
9732 Stage::GetCurrent().Add(actor);
9735 Vector3 position0( 30.0, 80.0, 0.0);
9736 Vector3 position1( 70.0, 120.0, 0.0);
9737 Vector3 position2( 100.0, 100.0, 0.0);
9739 Dali::Path path = Dali::Path::New();
9740 path.AddPoint(position0);
9741 path.AddPoint(position1);
9742 path.AddPoint(position2);
9744 //Control points for first segment
9745 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9746 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9748 //Control points for second segment
9749 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9750 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9752 // Build the animation
9753 float durationSeconds( 1.0f );
9754 Animation animation = Animation::New(durationSeconds);
9755 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
9757 // Start the animation
9760 bool signalReceived(false);
9761 AnimationFinishCheck finishCheck(signalReceived);
9762 animation.FinishedSignal().Connect(&application, finishCheck);
9763 application.SendNotification();
9764 application.Render(0);
9765 application.SendNotification();
9766 finishCheck.CheckSignalNotReceived();
9767 Vector3 position, tangent;
9768 Quaternion rotation;
9769 path.Sample( 0.0f, position, tangent );
9770 rotation = Quaternion( Vector3::XAXIS, tangent );
9771 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9772 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9774 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9775 application.SendNotification();
9776 path.Sample( 0.25f, position, tangent );
9777 rotation = Quaternion( Vector3::XAXIS, tangent );
9778 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9779 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9781 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9782 application.SendNotification();
9783 path.Sample( 0.5f, position, tangent );
9784 rotation = Quaternion( Vector3::XAXIS, tangent );
9785 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9786 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9788 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9789 application.SendNotification();
9790 path.Sample( 0.75f, position, tangent );
9791 rotation = Quaternion( Vector3::XAXIS, tangent );
9792 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9793 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9795 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9796 application.SendNotification();
9797 path.Sample( 1.0f, position, tangent );
9798 rotation = Quaternion( Vector3::XAXIS, tangent );
9799 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9800 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9802 finishCheck.CheckSignalReceived();
9806 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
9808 TestApplication application;
9810 Actor actor = Actor::New();
9811 Stage::GetCurrent().Add(actor);
9814 Vector3 position0( 30.0, 80.0, 0.0);
9815 Vector3 position1( 70.0, 120.0, 0.0);
9816 Vector3 position2( 100.0, 100.0, 0.0);
9818 Dali::Path path = Dali::Path::New();
9819 path.AddPoint(position0);
9820 path.AddPoint(position1);
9821 path.AddPoint(position2);
9823 //Control points for first segment
9824 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9825 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9827 //Control points for second segment
9828 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9829 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9831 // Build the animation
9832 float durationSeconds( 1.0f );
9833 Animation animation = Animation::New(durationSeconds);
9834 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
9836 // Start the animation
9839 bool signalReceived(false);
9840 AnimationFinishCheck finishCheck(signalReceived);
9841 animation.FinishedSignal().Connect(&application, finishCheck);
9842 application.SendNotification();
9843 application.Render(0);
9844 application.SendNotification();
9845 finishCheck.CheckSignalNotReceived();
9846 Vector3 position, tangent;
9847 Quaternion rotation;
9848 path.Sample( 0.0f, position, tangent );
9849 rotation = Quaternion( Vector3::XAXIS, tangent );
9850 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9851 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9853 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9854 application.SendNotification();
9855 path.Sample( 0.25f, position, tangent );
9856 rotation = Quaternion( Vector3::XAXIS, tangent );
9857 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9858 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9860 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9861 application.SendNotification();
9862 path.Sample( 0.5f, position, tangent );
9863 rotation = Quaternion( Vector3::XAXIS, tangent );
9864 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9865 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9867 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9868 application.SendNotification();
9869 path.Sample( 0.75f, position, tangent );
9870 rotation = Quaternion( Vector3::XAXIS, tangent );
9871 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9872 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9874 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9875 application.SendNotification();
9876 path.Sample( 1.0f, position, tangent );
9877 rotation = Quaternion( Vector3::XAXIS, tangent );
9878 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9879 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9881 finishCheck.CheckSignalReceived();
9885 int UtcDaliAnimationShowP(void)
9887 TestApplication application;
9889 Actor actor = Actor::New();
9890 actor.SetVisible(false);
9891 application.SendNotification();
9892 application.Render(0);
9893 DALI_TEST_CHECK( !actor.IsVisible() );
9894 Stage::GetCurrent().Add(actor);
9896 // Start the animation
9897 float durationSeconds(10.0f);
9898 Animation animation = Animation::New(durationSeconds);
9899 animation.Show(actor, durationSeconds*0.5f);
9902 bool signalReceived(false);
9903 AnimationFinishCheck finishCheck(signalReceived);
9904 animation.FinishedSignal().Connect(&application, finishCheck);
9906 application.SendNotification();
9907 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9909 // We didn't expect the animation to finish yet
9910 application.SendNotification();
9911 finishCheck.CheckSignalNotReceived();
9912 DALI_TEST_CHECK( !actor.IsVisible() );
9914 application.SendNotification();
9915 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9917 // We didn't expect the animation to finish yet
9918 application.SendNotification();
9919 finishCheck.CheckSignalNotReceived();
9920 DALI_TEST_CHECK( actor.IsVisible() );
9922 application.SendNotification();
9923 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9925 // We did expect the animation to finish
9926 application.SendNotification();
9927 finishCheck.CheckSignalReceived();
9928 DALI_TEST_CHECK( actor.IsVisible() );
9932 int UtcDaliAnimationHideP(void)
9934 TestApplication application;
9936 Actor actor = Actor::New();
9937 DALI_TEST_CHECK( actor.IsVisible() );
9938 Stage::GetCurrent().Add(actor);
9940 // Start the animation
9941 float durationSeconds(10.0f);
9942 Animation animation = Animation::New(durationSeconds);
9943 animation.Hide(actor, durationSeconds*0.5f);
9946 bool signalReceived(false);
9947 AnimationFinishCheck finishCheck(signalReceived);
9948 animation.FinishedSignal().Connect(&application, finishCheck);
9950 application.SendNotification();
9951 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9953 // We didn't expect the animation to finish yet
9954 application.SendNotification();
9955 finishCheck.CheckSignalNotReceived();
9956 DALI_TEST_CHECK( actor.IsVisible() );
9958 application.SendNotification();
9959 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9961 // We didn't expect the animation to finish yet
9962 application.SendNotification();
9963 finishCheck.CheckSignalNotReceived();
9964 DALI_TEST_CHECK( !actor.IsVisible() );
9966 application.SendNotification();
9967 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9969 // We did expect the animation to finish
9970 application.SendNotification();
9971 finishCheck.CheckSignalReceived();
9972 DALI_TEST_CHECK( !actor.IsVisible() );
9976 int UtcDaliAnimationShowHideAtEndP(void)
9978 // Test that show/hide delay can be the same as animation duration
9979 // i.e. to show/hide at the end of the animation
9981 TestApplication application;
9983 Actor actor = Actor::New();
9984 DALI_TEST_CHECK( actor.IsVisible() );
9985 Stage::GetCurrent().Add(actor);
9987 // Start Hide animation
9988 float durationSeconds(10.0f);
9989 Animation animation = Animation::New(durationSeconds);
9990 animation.Hide(actor, durationSeconds/*Hide at end*/);
9993 bool signalReceived(false);
9994 AnimationFinishCheck finishCheck(signalReceived);
9995 animation.FinishedSignal().Connect(&application, finishCheck);
9997 application.SendNotification();
9998 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10000 // We did expect the animation to finish
10001 application.SendNotification();
10002 finishCheck.CheckSignalReceived();
10003 DALI_TEST_CHECK( !actor.IsVisible() );
10005 // Start Show animation
10006 animation = Animation::New(durationSeconds);
10007 animation.Show(actor, durationSeconds/*Show at end*/);
10008 animation.FinishedSignal().Connect(&application, finishCheck);
10011 application.SendNotification();
10012 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10014 // We did expect the animation to finish
10015 application.SendNotification();
10016 finishCheck.CheckSignalReceived();
10017 DALI_TEST_CHECK( actor.IsVisible() );
10021 int UtcDaliKeyFramesCreateDestroyP(void)
10023 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10025 KeyFrames* keyFrames = new KeyFrames;
10027 DALI_TEST_CHECK( true );
10031 int UtcDaliKeyFramesDownCastP(void)
10033 TestApplication application;
10034 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10036 KeyFrames keyFrames = KeyFrames::New();
10037 BaseHandle object(keyFrames);
10039 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10040 DALI_TEST_CHECK(keyFrames2);
10042 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10043 DALI_TEST_CHECK(keyFrames3);
10045 BaseHandle unInitializedObject;
10046 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10047 DALI_TEST_CHECK(!keyFrames4);
10049 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10050 DALI_TEST_CHECK(!keyFrames5);
10054 int UtcDaliAnimationCreateDestroyP(void)
10056 TestApplication application;
10057 Animation* animation = new Animation;
10058 DALI_TEST_CHECK( animation );
10063 struct UpdateManagerTestConstraint
10065 UpdateManagerTestConstraint(TestApplication& application)
10066 : mApplication(application)
10070 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10072 mApplication.SendNotification(); // Process events
10075 TestApplication& mApplication;
10078 int UtcDaliAnimationUpdateManagerP(void)
10080 TestApplication application;
10082 Actor actor = Actor::New();
10083 Stage::GetCurrent().Add( actor );
10085 // Build the animation
10086 Animation animation = Animation::New( 0.0f );
10088 bool signalReceived = false;
10089 AnimationFinishCheck finishCheck( signalReceived );
10090 animation.FinishedSignal().Connect( &application, finishCheck );
10092 Vector3 startValue(1.0f, 1.0f, 1.0f);
10093 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10094 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10095 constraint.Apply();
10097 // Apply animation to actor
10098 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10099 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10103 application.SendNotification();
10104 application.UpdateOnly( 16 );
10106 finishCheck.CheckSignalNotReceived();
10108 application.SendNotification(); // Process events
10110 finishCheck.CheckSignalReceived();
10115 int UtcDaliAnimationSignalOrderP(void)
10117 TestApplication application;
10119 Actor actor = Actor::New();
10120 Stage::GetCurrent().Add( actor );
10122 // Build the animations
10123 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10124 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10126 bool signal1Received = false;
10127 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10129 bool signal2Received = false;
10130 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10132 // Apply animations to actor
10133 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10135 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10138 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10139 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10141 application.SendNotification();
10142 application.UpdateOnly( 10 ); // 10ms progress
10144 // no notifications yet
10145 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10146 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10148 application.SendNotification();
10151 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10152 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10153 signal1Received = false;
10155 // 1st animation is complete now, do another update with no ProcessEvents in between
10156 application.UpdateOnly( 20 ); // 20ms progress
10159 application.SendNotification();
10161 // 2nd should complete now
10162 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10163 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10168 int UtcDaliAnimationExtendDurationP(void)
10170 TestApplication application;
10172 Actor actor = Actor::New();
10174 // Register a float property
10175 float startValue(10.0f);
10176 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10177 Stage::GetCurrent().Add(actor);
10178 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10179 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10181 // Build the animation
10182 float initialDurationSeconds(1.0f);
10183 float animatorDelay = 5.0f;
10184 float animatorDurationSeconds(5.0f);
10185 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10186 Animation animation = Animation::New(initialDurationSeconds);
10187 float targetValue(30.0f);
10188 float relativeValue(targetValue - startValue);
10190 animation.AnimateTo(Property(actor, index),
10192 TimePeriod(animatorDelay, animatorDurationSeconds));
10194 // The duration should have been extended
10195 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10197 // Start the animation
10200 bool signalReceived(false);
10201 AnimationFinishCheck finishCheck(signalReceived);
10202 animation.FinishedSignal().Connect(&application, finishCheck);
10204 application.SendNotification();
10205 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10207 // We didn't expect the animation to finish yet, but cached value should be the final one
10208 application.SendNotification();
10209 finishCheck.CheckSignalNotReceived();
10210 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10211 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10213 application.SendNotification();
10214 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10216 // We didn't expect the animation to finish yet
10217 application.SendNotification();
10218 finishCheck.CheckSignalNotReceived();
10219 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10221 application.SendNotification();
10222 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10224 // We did expect the animation to finish
10225 application.SendNotification();
10226 finishCheck.CheckSignalReceived();
10227 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10228 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10232 int UtcDaliAnimationCustomIntProperty(void)
10234 TestApplication application;
10236 Actor actor = Actor::New();
10237 Stage::GetCurrent().Add(actor);
10238 int startValue(0u);
10240 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10241 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10242 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10244 // Build the animation
10245 float durationSeconds(1.0f);
10246 Animation animation = Animation::New(durationSeconds);
10247 animation.AnimateTo( Property(actor, index), 20 );
10249 // Start the animation
10252 // Target value should be retrievable straight away
10253 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10255 bool signalReceived(false);
10256 AnimationFinishCheck finishCheck(signalReceived);
10257 animation.FinishedSignal().Connect(&application, finishCheck);
10259 application.SendNotification();
10260 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10262 // We didn't expect the animation to finish yet
10263 application.SendNotification();
10264 finishCheck.CheckSignalNotReceived();
10265 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10267 application.SendNotification();
10268 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10270 // We did expect the animation to finish
10271 application.SendNotification();
10272 finishCheck.CheckSignalReceived();
10273 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10274 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10278 int UtcDaliAnimationDuration(void)
10280 TestApplication application;
10282 Actor actor = Actor::New();
10283 Stage::GetCurrent().Add(actor);
10285 Animation animation = Animation::New( 0.0f );
10286 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10288 // The animation duration should automatically increase depending on the animator time period
10290 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10291 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10293 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10294 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10299 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10301 TestApplication application;
10303 Actor actor = Actor::New();
10305 // Register an integer property
10307 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10308 Stage::GetCurrent().Add(actor);
10309 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10313 // Build the animation
10314 Animation animation = Animation::New( 2.0f );
10315 std::string relativeValue = "relative string";
10316 animation.AnimateBy( Property(actor, index), relativeValue );
10317 tet_result(TET_FAIL);
10319 catch ( Dali::DaliException& e )
10321 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10329 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10331 TestApplication application;
10333 Actor actor = Actor::New();
10335 // Register an integer property
10337 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10338 Stage::GetCurrent().Add(actor);
10339 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10343 // Build the animation
10344 Animation animation = Animation::New( 2.0f );
10345 std::string relativeValue = "relative string";
10346 animation.AnimateTo( Property(actor, index), relativeValue );
10348 tet_result(TET_FAIL);
10350 catch ( Dali::DaliException& e )
10352 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10358 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10360 TestApplication application;
10362 Actor actor = Actor::New();
10364 // Register an integer property
10366 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10367 Stage::GetCurrent().Add(actor);
10368 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10372 // Build the animation
10373 KeyFrames keyFrames = KeyFrames::New();
10374 keyFrames.Add( 0.0f, std::string("relative string1") );
10375 keyFrames.Add( 1.0f, std::string("relative string2") );
10376 // no need to really create the animation as keyframes do the check
10378 tet_result(TET_FAIL);
10380 catch ( Dali::DaliException& e )
10382 DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );
10388 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10390 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10392 TestApplication application;
10394 tet_infoline("Set initial position and set up animation to re-position actor");
10396 Actor actor = Actor::New();
10397 Stage::GetCurrent().Add(actor);
10398 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10399 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10401 // Build the animation
10402 Animation animation = Animation::New(2.0f);
10404 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10405 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10406 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10408 tet_infoline("Set target position in animation without intiating play");
10410 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10411 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10413 application.SendNotification();
10414 application.Render();
10416 tet_infoline("Ensure position of actor is still at intial value");
10418 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10419 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10420 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10422 tet_infoline("Play animation and ensure actor position is now target");
10425 application.SendNotification();
10426 application.Render(1000u);
10428 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10430 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10431 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10432 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10434 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10436 application.Render(2000u);
10438 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10440 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10441 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10442 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10447 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10449 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10451 TestApplication application;
10453 std::vector<Vector3> targetPositions;
10455 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10456 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10457 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10459 tet_infoline("Set initial position and set up animation to re-position actor");
10461 Actor actor = Actor::New();
10462 Stage::GetCurrent().Add(actor);
10463 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10464 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10466 // Build the animation
10467 Animation animation = Animation::New(2.0f);
10469 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10470 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10471 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10473 tet_infoline("Set target position in animation without intiating play");
10475 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
10477 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
10480 application.SendNotification();
10481 application.Render();
10483 tet_infoline("Ensure position of actor is still at intial value");
10485 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10486 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10487 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10489 tet_infoline("Play animation and ensure actor position is now target");
10492 application.SendNotification();
10493 application.Render(1000u);
10495 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10497 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10498 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10499 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10501 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10503 application.Render(2000u);
10505 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10507 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10508 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10509 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10514 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
10516 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");
10518 TestApplication application;
10520 std::vector<Vector3> targetSizes;
10521 std::vector<Vector3> targetPositions;
10523 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10524 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10526 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10528 tet_infoline("Set initial position and set up animation to re-position actor");
10530 Actor actor = Actor::New();
10531 Stage::GetCurrent().Add(actor);
10532 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
10533 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
10535 actor.SetProperty( Actor::Property::SIZE, initialSize );
10536 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10538 // Build the animation
10539 Animation animation = Animation::New(2.0f);
10541 tet_infoline("Set target size in animation without intiating play");
10542 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10543 tet_infoline("Set target position in animation without intiating play");
10544 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
10545 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10547 application.SendNotification();
10548 application.Render();
10550 tet_infoline("Ensure position of actor is still at intial size and position");
10552 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10553 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10554 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10556 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
10557 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
10558 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
10560 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10563 application.SendNotification();
10564 application.Render(2000u);
10566 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10568 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10569 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10570 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10572 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
10573 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
10574 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
10579 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
10581 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
10583 TestApplication application;
10585 std::vector<Vector3> targetSizes;
10586 std::vector<float> targetColors;
10588 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10589 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
10591 targetColors.push_back( 1.0f );
10593 tet_infoline("Set initial position and set up animation to re-position actor");
10595 Actor actor = Actor::New();
10596 Stage::GetCurrent().Add(actor);
10597 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
10599 actor.SetProperty( Actor::Property::SIZE, initialSize );
10601 // Build the animation
10602 Animation animation = Animation::New(2.0f);
10604 tet_infoline("Set target size in animation without initiating play");
10605 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10606 tet_infoline("Set target position in animation without intiating play");
10607 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
10608 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10610 application.SendNotification();
10611 application.Render();
10613 tet_infoline("Ensure position of actor is still at initial size and position");
10615 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10616 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10617 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10619 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10622 application.SendNotification();
10623 application.Render(2000u);
10625 tet_infoline("Ensure position and size of actor is at target value when animation playing");
10627 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10628 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10629 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10631 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
10636 int UtcDaliAnimationTimePeriodOrder(void)
10638 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
10640 TestApplication application;
10642 Actor actor = Actor::New();
10643 Stage::GetCurrent().Add( actor );
10645 application.SendNotification();
10646 application.Render();
10648 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10649 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10650 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10651 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10652 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10654 //////////////////////////////////////////////////////////////////////////////////
10656 tet_infoline( "With two AnimateTo calls" );
10658 Animation animation = Animation::New( 0.0f );
10659 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10660 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10663 tet_infoline( "The target position should change instantly" );
10664 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10665 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10667 application.SendNotification();
10668 application.Render(5000); // After the animation is complete
10670 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10671 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10672 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10674 //////////////////////////////////////////////////////////////////////////////////
10676 tet_infoline( "Same animation again but in a different order - should yield the same result" );
10678 actor.SetX( 0.0f );
10679 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10680 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10682 application.SendNotification();
10683 application.Render();
10685 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10686 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10687 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10689 animation = Animation::New( 0.0f );
10690 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10691 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10694 tet_infoline( "The target position should change instantly" );
10695 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10696 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10698 application.SendNotification();
10699 application.Render(5000); // After the animation is complete
10701 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10702 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10703 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10708 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
10710 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" );
10712 TestApplication application;
10714 Actor actor = Actor::New();
10715 Stage::GetCurrent().Add( actor );
10717 application.SendNotification();
10718 application.Render();
10720 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10721 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10722 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10723 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10724 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10726 //////////////////////////////////////////////////////////////////////////////////
10728 tet_infoline( "" );
10730 Animation animation = Animation::New( 0.0f );
10731 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10732 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10733 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10734 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10735 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10736 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10739 tet_infoline( "The target position should change instantly" );
10740 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10741 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10743 application.SendNotification();
10744 application.Render(14000); // After the animation is complete
10746 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10747 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10748 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10750 //////////////////////////////////////////////////////////////////////////////////
10752 tet_infoline( "Same animation again but in a different order - should end up at the same point" );
10754 actor.SetX( 0.0f );
10756 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10757 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10759 application.SendNotification();
10760 application.Render();
10762 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10763 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10764 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10766 animation = Animation::New( 0.0f );
10767 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10768 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10769 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10770 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10771 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10772 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10775 tet_infoline( "The target position should change instantly" );
10776 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10777 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10779 application.SendNotification();
10780 application.Render(14000); // After the animation is complete
10782 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10783 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10784 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );