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 // Target value should be retrievable straight away
2809 DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
2811 bool signalReceived(false);
2812 AnimationFinishCheck finishCheck(signalReceived);
2813 animation.FinishedSignal().Connect(&application, finishCheck);
2815 application.SendNotification();
2816 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2818 // We didn't expect the animation to finish yet
2819 application.SendNotification();
2820 finishCheck.CheckSignalNotReceived();
2821 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2823 application.SendNotification();
2824 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2826 // We did expect the animation to finish
2827 application.SendNotification();
2828 finishCheck.CheckSignalReceived();
2829 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2831 // Check that nothing has changed after a couple of buffer swaps
2832 application.Render(0);
2833 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2834 application.Render(0);
2835 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2837 // Repeat with relative value "false" - this should be an NOOP
2838 animation = Animation::New(durationSeconds);
2839 bool noOpValue(false);
2840 animation.AnimateBy(Property(actor, index), noOpValue);
2842 // Start the animation
2845 finishCheck.Reset();
2846 animation.FinishedSignal().Connect(&application, finishCheck);
2848 application.SendNotification();
2849 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2851 // We didn't expect the animation to finish yet
2852 application.SendNotification();
2853 finishCheck.CheckSignalNotReceived();
2854 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2856 application.SendNotification();
2857 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2859 // We did expect the animation to finish
2860 application.SendNotification();
2861 finishCheck.CheckSignalReceived();
2862 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2864 // Check that nothing has changed after a couple of buffer swaps
2865 application.Render(0);
2866 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2867 application.Render(0);
2868 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2872 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2874 TestApplication application;
2876 Actor actor = Actor::New();
2878 // Register a boolean property
2879 bool startValue(false);
2880 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2881 Stage::GetCurrent().Add(actor);
2882 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2883 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2885 // Build the animation
2886 float durationSeconds(2.0f);
2887 Animation animation = Animation::New(durationSeconds);
2888 bool relativeValue(true);
2889 bool finalValue( false || relativeValue );
2890 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2892 // Start the animation
2895 bool signalReceived(false);
2896 AnimationFinishCheck finishCheck(signalReceived);
2897 animation.FinishedSignal().Connect(&application, finishCheck);
2899 application.SendNotification();
2900 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2902 // We didn't expect the animation to finish yet
2903 application.SendNotification();
2904 finishCheck.CheckSignalNotReceived();
2905 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2907 application.SendNotification();
2908 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2910 // We did expect the animation to finish
2911 application.SendNotification();
2912 finishCheck.CheckSignalReceived();
2913 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2915 // Check that nothing has changed after a couple of buffer swaps
2916 application.Render(0);
2917 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2918 application.Render(0);
2919 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2921 // Repeat with relative value "false" - this should be an NOOP
2922 animation = Animation::New(durationSeconds);
2923 bool noOpValue(false);
2924 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2926 // Start the animation
2929 finishCheck.Reset();
2930 animation.FinishedSignal().Connect(&application, finishCheck);
2932 application.SendNotification();
2933 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2935 // We didn't expect the animation to finish yet
2936 application.SendNotification();
2937 finishCheck.CheckSignalNotReceived();
2938 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2940 application.SendNotification();
2941 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2943 // We did expect the animation to finish
2944 application.SendNotification();
2945 finishCheck.CheckSignalReceived();
2946 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2950 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2952 TestApplication application;
2954 Actor actor = Actor::New();
2956 // Register a boolean property
2957 bool startValue(false);
2958 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2959 Stage::GetCurrent().Add(actor);
2960 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2961 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2963 // Build the animation
2964 float durationSeconds(2.0f);
2965 Animation animation = Animation::New(durationSeconds);
2966 bool relativeValue(true);
2967 bool finalValue( false || relativeValue );
2968 float animatorDurationSeconds(durationSeconds * 0.5f);
2969 animation.AnimateBy( Property(actor, index),
2971 TimePeriod( animatorDurationSeconds ) );
2973 // Start the animation
2976 bool signalReceived(false);
2977 AnimationFinishCheck finishCheck(signalReceived);
2978 animation.FinishedSignal().Connect(&application, finishCheck);
2980 application.SendNotification();
2981 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2983 // We didn't expect the animation to finish yet
2984 application.SendNotification();
2985 finishCheck.CheckSignalNotReceived();
2986 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
2988 application.SendNotification();
2989 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2991 // We didn't expect the animation to finish yet...
2992 application.SendNotification();
2993 finishCheck.CheckSignalNotReceived();
2995 // ...however we should have reached the final value
2996 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
2998 application.SendNotification();
2999 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3001 // We did expect the animation to finish
3002 application.SendNotification();
3003 finishCheck.CheckSignalReceived();
3004 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3006 // Check that nothing has changed after a couple of buffer swaps
3007 application.Render(0);
3008 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3009 application.Render(0);
3010 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3014 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3016 TestApplication application;
3018 Actor actor = Actor::New();
3020 // Register a boolean property
3021 bool startValue(false);
3022 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3023 Stage::GetCurrent().Add(actor);
3024 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3025 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3027 // Build the animation
3028 float durationSeconds(2.0f);
3029 Animation animation = Animation::New(durationSeconds);
3030 bool relativeValue(true);
3031 bool finalValue( false || relativeValue );
3032 float animatorDurationSeconds(durationSeconds * 0.5f);
3033 animation.AnimateBy( Property(actor, index),
3035 AlphaFunction::EASE_IN_OUT,
3036 TimePeriod( animatorDurationSeconds ) );
3038 // Start the animation
3041 bool signalReceived(false);
3042 AnimationFinishCheck finishCheck(signalReceived);
3043 animation.FinishedSignal().Connect(&application, finishCheck);
3045 application.SendNotification();
3046 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3048 // We didn't expect the animation to finish yet
3049 application.SendNotification();
3050 finishCheck.CheckSignalNotReceived();
3051 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
3053 application.SendNotification();
3054 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3056 // We didn't expect the animation to finish yet...
3057 application.SendNotification();
3058 finishCheck.CheckSignalNotReceived();
3060 // ...however we should have reached the final value
3061 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3063 application.SendNotification();
3064 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3066 // We did expect the animation to finish
3067 application.SendNotification();
3068 finishCheck.CheckSignalReceived();
3069 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3071 // Check that nothing has changed after a couple of buffer swaps
3072 application.Render(0);
3073 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3074 application.Render(0);
3075 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
3079 int UtcDaliAnimationAnimateByFloatP(void)
3081 TestApplication application;
3083 Actor actor = Actor::New();
3085 // Register a float property
3086 float startValue(10.0f);
3087 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3088 Stage::GetCurrent().Add(actor);
3089 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3090 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3092 // Build the animation
3093 float durationSeconds(2.0f);
3094 Animation animation = Animation::New(durationSeconds);
3095 float targetValue(50.0f);
3096 float relativeValue(targetValue - startValue);
3097 animation.AnimateBy(Property(actor, index), relativeValue);
3099 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3101 // Start the animation
3104 // Target value should be retrievable straight away
3105 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
3107 bool signalReceived(false);
3108 AnimationFinishCheck finishCheck(signalReceived);
3109 animation.FinishedSignal().Connect(&application, finishCheck);
3111 application.SendNotification();
3112 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3114 // We didn't expect the animation to finish yet
3115 application.SendNotification();
3116 finishCheck.CheckSignalNotReceived();
3117 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3119 application.SendNotification();
3120 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3122 // We did expect the animation to finish
3123 application.SendNotification();
3124 finishCheck.CheckSignalReceived();
3125 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3127 // Check that nothing has changed after a couple of buffer swaps
3128 application.Render(0);
3129 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3130 application.Render(0);
3131 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3135 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3137 TestApplication application;
3139 Actor actor = Actor::New();
3141 // Register a float property
3142 float startValue(10.0f);
3143 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3144 Stage::GetCurrent().Add(actor);
3145 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3146 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3148 // Build the animation
3149 float durationSeconds(1.0f);
3150 Animation animation = Animation::New(durationSeconds);
3151 float targetValue(90.0f);
3152 float relativeValue(targetValue - startValue);
3153 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3155 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3157 // Start the animation
3160 bool signalReceived(false);
3161 AnimationFinishCheck finishCheck(signalReceived);
3162 animation.FinishedSignal().Connect(&application, finishCheck);
3164 application.SendNotification();
3165 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3167 // We didn't expect the animation to finish yet
3168 application.SendNotification();
3169 finishCheck.CheckSignalNotReceived();
3171 // The position should have moved more, than with a linear alpha function
3172 float current( actor.GetCurrentProperty< float >( index ) );
3173 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3175 application.SendNotification();
3176 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3178 // We did expect the animation to finish
3179 application.SendNotification();
3180 finishCheck.CheckSignalReceived();
3181 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3183 // Check that nothing has changed after a couple of buffer swaps
3184 application.Render(0);
3185 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3186 application.Render(0);
3187 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3191 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3193 TestApplication application;
3195 Actor actor = Actor::New();
3197 // Register a float property
3198 float startValue(10.0f);
3199 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3200 Stage::GetCurrent().Add(actor);
3201 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3202 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3204 // Build the animation
3205 float durationSeconds(1.0f);
3206 Animation animation = Animation::New(durationSeconds);
3207 float targetValue(30.0f);
3208 float relativeValue(targetValue - startValue);
3210 animation.AnimateBy(Property(actor, index),
3212 TimePeriod(delay, durationSeconds - delay));
3214 // Start the animation
3217 bool signalReceived(false);
3218 AnimationFinishCheck finishCheck(signalReceived);
3219 animation.FinishedSignal().Connect(&application, finishCheck);
3221 application.SendNotification();
3222 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3224 // We didn't expect the animation to finish yet
3225 application.SendNotification();
3226 finishCheck.CheckSignalNotReceived();
3227 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3229 application.SendNotification();
3230 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3232 // We didn't expect the animation to finish yet
3233 application.SendNotification();
3234 finishCheck.CheckSignalNotReceived();
3235 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3237 application.SendNotification();
3238 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3240 // We did expect the animation to finish
3241 application.SendNotification();
3242 finishCheck.CheckSignalReceived();
3243 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3245 // Check that nothing has changed after a couple of buffer swaps
3246 application.Render(0);
3247 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3248 application.Render(0);
3249 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3253 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3255 TestApplication application;
3257 Actor actor = Actor::New();
3259 // Register a float property
3260 float startValue(10.0f);
3261 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3262 Stage::GetCurrent().Add(actor);
3263 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3264 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3266 // Build the animation
3267 float durationSeconds(1.0f);
3268 Animation animation = Animation::New(durationSeconds);
3269 float targetValue(30.0f);
3270 float relativeValue(targetValue - startValue);
3272 animation.AnimateBy(Property(actor, index),
3274 AlphaFunction::LINEAR,
3275 TimePeriod(delay, durationSeconds - delay));
3277 // Start the animation
3280 bool signalReceived(false);
3281 AnimationFinishCheck finishCheck(signalReceived);
3282 animation.FinishedSignal().Connect(&application, finishCheck);
3284 application.SendNotification();
3285 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3287 // We didn't expect the animation to finish yet
3288 application.SendNotification();
3289 finishCheck.CheckSignalNotReceived();
3290 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
3292 application.SendNotification();
3293 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3295 // We didn't expect the animation to finish yet
3296 application.SendNotification();
3297 finishCheck.CheckSignalNotReceived();
3298 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3300 application.SendNotification();
3301 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3303 // We did expect the animation to finish
3304 application.SendNotification();
3305 finishCheck.CheckSignalReceived();
3306 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3308 // Check that nothing has changed after a couple of buffer swaps
3309 application.Render(0);
3310 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3311 application.Render(0);
3312 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
3316 int UtcDaliAnimationAnimateByIntegerP(void)
3318 TestApplication application;
3320 Actor actor = Actor::New();
3322 // Register an integer property
3324 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3325 Stage::GetCurrent().Add(actor);
3326 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3327 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3329 // Build the animation
3330 float durationSeconds(2.0f);
3331 Animation animation = Animation::New(durationSeconds);
3332 int targetValue(50);
3333 int relativeValue(targetValue - startValue);
3334 animation.AnimateBy(Property(actor, index), relativeValue);
3336 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3338 // Start the animation
3341 // Target value should be retrievable straight away
3342 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
3344 bool signalReceived(false);
3345 AnimationFinishCheck finishCheck(signalReceived);
3346 animation.FinishedSignal().Connect(&application, finishCheck);
3348 application.SendNotification();
3349 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3351 // We didn't expect the animation to finish yet
3352 application.SendNotification();
3353 finishCheck.CheckSignalNotReceived();
3354 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3356 application.SendNotification();
3357 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3359 // We did expect the animation to finish
3360 application.SendNotification();
3361 finishCheck.CheckSignalReceived();
3362 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3364 // Check that nothing has changed after a couple of buffer swaps
3365 application.Render(0);
3366 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3367 application.Render(0);
3368 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3372 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3374 TestApplication application;
3376 Actor actor = Actor::New();
3378 // Register an integer property
3380 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3381 Stage::GetCurrent().Add(actor);
3382 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3383 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3385 // Build the animation
3386 float durationSeconds(1.0f);
3387 Animation animation = Animation::New(durationSeconds);
3388 int targetValue(90);
3389 int relativeValue(targetValue - startValue);
3390 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3392 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3394 // Start the animation
3397 bool signalReceived(false);
3398 AnimationFinishCheck finishCheck(signalReceived);
3399 animation.FinishedSignal().Connect(&application, finishCheck);
3401 application.SendNotification();
3402 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3404 // We didn't expect the animation to finish yet
3405 application.SendNotification();
3406 finishCheck.CheckSignalNotReceived();
3408 // The position should have moved more, than with a linear alpha function
3409 int current( actor.GetCurrentProperty< int >( index ) );
3410 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3412 application.SendNotification();
3413 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3415 // We did expect the animation to finish
3416 application.SendNotification();
3417 finishCheck.CheckSignalReceived();
3418 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3420 // Check that nothing has changed after a couple of buffer swaps
3421 application.Render(0);
3422 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3423 application.Render(0);
3424 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3428 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3430 TestApplication application;
3432 Actor actor = Actor::New();
3434 // Register an integer property
3436 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3437 Stage::GetCurrent().Add(actor);
3438 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3439 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3441 // Build the animation
3442 float durationSeconds(1.0f);
3443 Animation animation = Animation::New(durationSeconds);
3444 int targetValue(30);
3445 int relativeValue(targetValue - startValue);
3447 animation.AnimateBy(Property(actor, index),
3449 TimePeriod(delay, durationSeconds - delay));
3451 // Start the animation
3454 bool signalReceived(false);
3455 AnimationFinishCheck finishCheck(signalReceived);
3456 animation.FinishedSignal().Connect(&application, finishCheck);
3458 application.SendNotification();
3459 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3461 // We didn't expect the animation to finish yet
3462 application.SendNotification();
3463 finishCheck.CheckSignalNotReceived();
3464 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3466 application.SendNotification();
3467 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3469 // We didn't expect the animation to finish yet
3470 application.SendNotification();
3471 finishCheck.CheckSignalNotReceived();
3472 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3474 application.SendNotification();
3475 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3477 // We did expect the animation to finish
3478 application.SendNotification();
3479 finishCheck.CheckSignalReceived();
3480 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3482 // Check that nothing has changed after a couple of buffer swaps
3483 application.Render(0);
3484 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3485 application.Render(0);
3486 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3490 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3492 TestApplication application;
3494 Actor actor = Actor::New();
3496 // Register an integer property
3498 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3499 Stage::GetCurrent().Add(actor);
3500 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3501 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3503 // Build the animation
3504 float durationSeconds(1.0f);
3505 Animation animation = Animation::New(durationSeconds);
3506 int targetValue(30);
3507 int relativeValue(targetValue - startValue);
3509 animation.AnimateBy(Property(actor, index),
3511 AlphaFunction::LINEAR,
3512 TimePeriod(delay, durationSeconds - delay));
3514 // Start the animation
3517 bool signalReceived(false);
3518 AnimationFinishCheck finishCheck(signalReceived);
3519 animation.FinishedSignal().Connect(&application, finishCheck);
3521 application.SendNotification();
3522 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3524 // We didn't expect the animation to finish yet
3525 application.SendNotification();
3526 finishCheck.CheckSignalNotReceived();
3527 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
3529 application.SendNotification();
3530 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3532 // We didn't expect the animation to finish yet
3533 application.SendNotification();
3534 finishCheck.CheckSignalNotReceived();
3535 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3537 application.SendNotification();
3538 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3540 // We did expect the animation to finish
3541 application.SendNotification();
3542 finishCheck.CheckSignalReceived();
3543 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3545 // Check that nothing has changed after a couple of buffer swaps
3546 application.Render(0);
3547 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3548 application.Render(0);
3549 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
3553 int UtcDaliAnimationAnimateByVector2P(void)
3555 TestApplication application;
3557 Actor actor = Actor::New();
3559 // Register a Vector2 property
3560 Vector2 startValue(10.0f, 10.0f);
3561 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3562 Stage::GetCurrent().Add(actor);
3563 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3564 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3566 // Build the animation
3567 float durationSeconds(2.0f);
3568 Animation animation = Animation::New(durationSeconds);
3569 Vector2 targetValue(60.0f, 60.0f);
3570 Vector2 relativeValue(targetValue - startValue);
3571 animation.AnimateBy(Property(actor, index), relativeValue);
3573 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3575 // Start the animation
3578 // Target value should be retrievable straight away
3579 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3581 bool signalReceived(false);
3582 AnimationFinishCheck finishCheck(signalReceived);
3583 animation.FinishedSignal().Connect(&application, finishCheck);
3585 application.SendNotification();
3586 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3588 // We didn't expect the animation to finish yet
3589 application.SendNotification();
3590 finishCheck.CheckSignalNotReceived();
3591 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3593 application.SendNotification();
3594 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3596 // We did expect the animation to finish
3597 application.SendNotification();
3598 finishCheck.CheckSignalReceived();
3599 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3601 // Check that nothing has changed after a couple of buffer swaps
3602 application.Render(0);
3603 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3604 application.Render(0);
3605 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3609 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3611 TestApplication application;
3613 Actor actor = Actor::New();
3615 // Register a Vector2 property
3616 Vector2 startValue(100.0f, 100.0f);
3617 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3618 Stage::GetCurrent().Add(actor);
3619 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3620 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3622 // Build the animation
3623 float durationSeconds(1.0f);
3624 Animation animation = Animation::New(durationSeconds);
3625 Vector2 targetValue(20.0f, 20.0f);
3626 Vector2 relativeValue(targetValue - startValue);
3627 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3629 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3631 // Start the animation
3634 bool signalReceived(false);
3635 AnimationFinishCheck finishCheck(signalReceived);
3636 animation.FinishedSignal().Connect(&application, finishCheck);
3638 application.SendNotification();
3639 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3641 // We didn't expect the animation to finish yet
3642 application.SendNotification();
3643 finishCheck.CheckSignalNotReceived();
3645 // The position should have moved more, than with a linear alpha function
3646 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
3647 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3648 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3650 application.SendNotification();
3651 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3653 // We did expect the animation to finish
3654 application.SendNotification();
3655 finishCheck.CheckSignalReceived();
3656 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3658 // Check that nothing has changed after a couple of buffer swaps
3659 application.Render(0);
3660 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3661 application.Render(0);
3662 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3666 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3668 TestApplication application;
3670 Actor actor = Actor::New();
3672 // Register a Vector2 property
3673 Vector2 startValue(10.0f, 10.0f);
3674 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3675 Stage::GetCurrent().Add(actor);
3676 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3677 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3679 // Build the animation
3680 float durationSeconds(1.0f);
3681 Animation animation = Animation::New(durationSeconds);
3682 Vector2 targetValue(30.0f, 30.0f);
3683 Vector2 relativeValue(targetValue - startValue);
3685 animation.AnimateBy(Property(actor, index),
3687 TimePeriod(delay, durationSeconds - delay));
3689 // Start the animation
3692 bool signalReceived(false);
3693 AnimationFinishCheck finishCheck(signalReceived);
3694 animation.FinishedSignal().Connect(&application, finishCheck);
3696 application.SendNotification();
3697 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3699 // We didn't expect the animation to finish yet
3700 application.SendNotification();
3701 finishCheck.CheckSignalNotReceived();
3702 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3704 application.SendNotification();
3705 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3707 // We didn't expect the animation to finish yet
3708 application.SendNotification();
3709 finishCheck.CheckSignalNotReceived();
3710 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3712 application.SendNotification();
3713 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3715 // We did expect the animation to finish
3716 application.SendNotification();
3717 finishCheck.CheckSignalReceived();
3718 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3720 // Check that nothing has changed after a couple of buffer swaps
3721 application.Render(0);
3722 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3723 application.Render(0);
3724 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3728 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3730 TestApplication application;
3732 Actor actor = Actor::New();
3734 // Register a Vector2 property
3735 Vector2 startValue(5.0f, 5.0f);
3736 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3737 Stage::GetCurrent().Add(actor);
3738 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3739 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3741 // Build the animation
3742 float durationSeconds(1.0f);
3743 Animation animation = Animation::New(durationSeconds);
3744 Vector2 targetValue(10.0f, 10.0f);
3745 Vector2 relativeValue(targetValue - startValue);
3747 animation.AnimateBy(Property(actor, index),
3749 AlphaFunction::LINEAR,
3750 TimePeriod(delay, durationSeconds - delay));
3752 // Start the animation
3755 bool signalReceived(false);
3756 AnimationFinishCheck finishCheck(signalReceived);
3757 animation.FinishedSignal().Connect(&application, finishCheck);
3759 application.SendNotification();
3760 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3762 // We didn't expect the animation to finish yet
3763 application.SendNotification();
3764 finishCheck.CheckSignalNotReceived();
3765 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3767 application.SendNotification();
3768 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3770 // We didn't expect the animation to finish yet
3771 application.SendNotification();
3772 finishCheck.CheckSignalNotReceived();
3773 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3775 application.SendNotification();
3776 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3778 // We did expect the animation to finish
3779 application.SendNotification();
3780 finishCheck.CheckSignalReceived();
3781 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3783 // Check that nothing has changed after a couple of buffer swaps
3784 application.Render(0);
3785 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3786 application.Render(0);
3787 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3791 int UtcDaliAnimationAnimateByVector3P(void)
3793 TestApplication application;
3795 Actor actor = Actor::New();
3797 // Register a Vector3 property
3798 Vector3 startValue(10.0f, 10.0f, 10.0f);
3799 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3800 Stage::GetCurrent().Add(actor);
3801 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3802 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3804 // Build the animation
3805 float durationSeconds(2.0f);
3806 Animation animation = Animation::New(durationSeconds);
3807 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3808 Vector3 relativeValue(targetValue - startValue);
3809 animation.AnimateBy(Property(actor, index), relativeValue);
3811 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3813 // Start the animation
3816 // Target value should be retrievable straight away
3817 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3819 bool signalReceived(false);
3820 AnimationFinishCheck finishCheck(signalReceived);
3821 animation.FinishedSignal().Connect(&application, finishCheck);
3823 application.SendNotification();
3824 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3826 // We didn't expect the animation to finish yet
3827 application.SendNotification();
3828 finishCheck.CheckSignalNotReceived();
3829 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3831 application.SendNotification();
3832 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3834 // We did expect the animation to finish
3835 application.SendNotification();
3836 finishCheck.CheckSignalReceived();
3837 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3839 // Check that nothing has changed after a couple of buffer swaps
3840 application.Render(0);
3841 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3842 application.Render(0);
3843 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3847 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3849 TestApplication application;
3851 Actor actor = Actor::New();
3853 // Register a Vector3 property
3854 Vector3 startValue(100.0f, 100.0f, 100.0f);
3855 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3856 Stage::GetCurrent().Add(actor);
3857 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3858 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3860 // Build the animation
3861 float durationSeconds(1.0f);
3862 Animation animation = Animation::New(durationSeconds);
3863 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3864 Vector3 relativeValue(targetValue - startValue);
3865 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3867 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3869 // Start the animation
3872 bool signalReceived(false);
3873 AnimationFinishCheck finishCheck(signalReceived);
3874 animation.FinishedSignal().Connect(&application, finishCheck);
3876 application.SendNotification();
3877 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3879 // We didn't expect the animation to finish yet
3880 application.SendNotification();
3881 finishCheck.CheckSignalNotReceived();
3883 // The position should have moved more, than with a linear alpha function
3884 Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
3885 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3886 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3887 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3889 application.SendNotification();
3890 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3892 // We did expect the animation to finish
3893 application.SendNotification();
3894 finishCheck.CheckSignalReceived();
3895 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3897 // Check that nothing has changed after a couple of buffer swaps
3898 application.Render(0);
3899 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3900 application.Render(0);
3901 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3905 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3907 TestApplication application;
3909 Actor actor = Actor::New();
3911 // Register a Vector3 property
3912 Vector3 startValue(10.0f, 10.0f, 10.0f);
3913 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3914 Stage::GetCurrent().Add(actor);
3915 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3916 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3918 // Build the animation
3919 float durationSeconds(1.0f);
3920 Animation animation = Animation::New(durationSeconds);
3921 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3922 Vector3 relativeValue(targetValue - startValue);
3924 animation.AnimateBy(Property(actor, index),
3926 TimePeriod(delay, durationSeconds - delay));
3928 // Start the animation
3931 bool signalReceived(false);
3932 AnimationFinishCheck finishCheck(signalReceived);
3933 animation.FinishedSignal().Connect(&application, finishCheck);
3935 application.SendNotification();
3936 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3938 // We didn't expect the animation to finish yet
3939 application.SendNotification();
3940 finishCheck.CheckSignalNotReceived();
3941 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3943 application.SendNotification();
3944 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3946 // We didn't expect the animation to finish yet
3947 application.SendNotification();
3948 finishCheck.CheckSignalNotReceived();
3949 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3951 application.SendNotification();
3952 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3954 // We did expect the animation to finish
3955 application.SendNotification();
3956 finishCheck.CheckSignalReceived();
3957 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3959 // Check that nothing has changed after a couple of buffer swaps
3960 application.Render(0);
3961 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3962 application.Render(0);
3963 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3967 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3969 TestApplication application;
3971 Actor actor = Actor::New();
3973 // Register a Vector3 property
3974 Vector3 startValue(5.0f, 5.0f, 5.0f);
3975 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3976 Stage::GetCurrent().Add(actor);
3977 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3978 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3980 // Build the animation
3981 float durationSeconds(1.0f);
3982 Animation animation = Animation::New(durationSeconds);
3983 Vector3 targetValue(10.0f, 10.0f, 10.0f);
3984 Vector3 relativeValue(targetValue - startValue);
3986 animation.AnimateBy(Property(actor, index),
3988 AlphaFunction::LINEAR,
3989 TimePeriod(delay, durationSeconds - delay));
3991 // Start the animation
3994 bool signalReceived(false);
3995 AnimationFinishCheck finishCheck(signalReceived);
3996 animation.FinishedSignal().Connect(&application, finishCheck);
3998 application.SendNotification();
3999 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4001 // We didn't expect the animation to finish yet
4002 application.SendNotification();
4003 finishCheck.CheckSignalNotReceived();
4004 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4006 application.SendNotification();
4007 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4009 // We didn't expect the animation to finish yet
4010 application.SendNotification();
4011 finishCheck.CheckSignalNotReceived();
4012 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4014 application.SendNotification();
4015 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4017 // We did expect the animation to finish
4018 application.SendNotification();
4019 finishCheck.CheckSignalReceived();
4020 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4022 // Check that nothing has changed after a couple of buffer swaps
4023 application.Render(0);
4024 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4025 application.Render(0);
4026 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4030 int UtcDaliAnimationAnimateByVector4P(void)
4032 TestApplication application;
4034 Actor actor = Actor::New();
4036 // Register a Vector4 property
4037 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4038 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4039 Stage::GetCurrent().Add(actor);
4040 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4041 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4043 // Build the animation
4044 float durationSeconds(2.0f);
4045 Animation animation = Animation::New(durationSeconds);
4046 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4047 Vector4 relativeValue(targetValue - startValue);
4048 animation.AnimateBy(Property(actor, index), relativeValue);
4050 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4052 // Start the animation
4055 // Target value should be retrievable straight away
4056 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4058 bool signalReceived(false);
4059 AnimationFinishCheck finishCheck(signalReceived);
4060 animation.FinishedSignal().Connect(&application, finishCheck);
4062 application.SendNotification();
4063 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4065 // We didn't expect the animation to finish yet
4066 application.SendNotification();
4067 finishCheck.CheckSignalNotReceived();
4068 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4070 application.SendNotification();
4071 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4073 // We did expect the animation to finish
4074 application.SendNotification();
4075 finishCheck.CheckSignalReceived();
4076 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4078 // Check that nothing has changed after a couple of buffer swaps
4079 application.Render(0);
4080 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4081 application.Render(0);
4082 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4086 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4088 TestApplication application;
4090 Actor actor = Actor::New();
4092 // Register a Vector4 property
4093 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4094 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4095 Stage::GetCurrent().Add(actor);
4096 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4097 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4099 // Build the animation
4100 float durationSeconds(1.0f);
4101 Animation animation = Animation::New(durationSeconds);
4102 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4103 Vector4 relativeValue(targetValue - startValue);
4104 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4106 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4108 // Start the animation
4111 bool signalReceived(false);
4112 AnimationFinishCheck finishCheck(signalReceived);
4113 animation.FinishedSignal().Connect(&application, finishCheck);
4115 application.SendNotification();
4116 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4118 // We didn't expect the animation to finish yet
4119 application.SendNotification();
4120 finishCheck.CheckSignalNotReceived();
4122 // The position should have moved more, than with a linear alpha function
4123 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4124 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4125 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4126 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4127 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4129 application.SendNotification();
4130 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4132 // We did expect the animation to finish
4133 application.SendNotification();
4134 finishCheck.CheckSignalReceived();
4135 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4137 // Check that nothing has changed after a couple of buffer swaps
4138 application.Render(0);
4139 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4140 application.Render(0);
4141 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4145 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4147 TestApplication application;
4149 Actor actor = Actor::New();
4151 // Register a Vector4 property
4152 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4153 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4154 Stage::GetCurrent().Add(actor);
4155 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4156 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4158 // Build the animation
4159 float durationSeconds(1.0f);
4160 Animation animation = Animation::New(durationSeconds);
4161 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4162 Vector4 relativeValue(targetValue - startValue);
4164 animation.AnimateBy(Property(actor, index),
4166 TimePeriod(delay, durationSeconds - delay));
4168 // Start the animation
4171 bool signalReceived(false);
4172 AnimationFinishCheck finishCheck(signalReceived);
4173 animation.FinishedSignal().Connect(&application, finishCheck);
4175 application.SendNotification();
4176 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4178 // We didn't expect the animation to finish yet
4179 application.SendNotification();
4180 finishCheck.CheckSignalNotReceived();
4181 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4183 application.SendNotification();
4184 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4186 // We didn't expect the animation to finish yet
4187 application.SendNotification();
4188 finishCheck.CheckSignalNotReceived();
4189 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4191 application.SendNotification();
4192 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4194 // We did expect the animation to finish
4195 application.SendNotification();
4196 finishCheck.CheckSignalReceived();
4197 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4199 // Check that nothing has changed after a couple of buffer swaps
4200 application.Render(0);
4201 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4202 application.Render(0);
4203 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4207 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4209 TestApplication application;
4211 Actor actor = Actor::New();
4213 // Register a Vector4 property
4214 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4215 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4216 Stage::GetCurrent().Add(actor);
4217 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4218 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4220 // Build the animation
4221 float durationSeconds(1.0f);
4222 Animation animation = Animation::New(durationSeconds);
4223 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4224 Vector4 relativeValue(targetValue - startValue);
4226 animation.AnimateBy(Property(actor, index),
4228 AlphaFunction::LINEAR,
4229 TimePeriod(delay, durationSeconds - delay));
4231 // Start the animation
4234 bool signalReceived(false);
4235 AnimationFinishCheck finishCheck(signalReceived);
4236 animation.FinishedSignal().Connect(&application, finishCheck);
4238 application.SendNotification();
4239 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4241 // We didn't expect the animation to finish yet
4242 application.SendNotification();
4243 finishCheck.CheckSignalNotReceived();
4244 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4246 application.SendNotification();
4247 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4249 // We didn't expect the animation to finish yet
4250 application.SendNotification();
4251 finishCheck.CheckSignalNotReceived();
4252 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4254 application.SendNotification();
4255 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4257 // We did expect the animation to finish
4258 application.SendNotification();
4259 finishCheck.CheckSignalReceived();
4260 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4262 // Check that nothing has changed after a couple of buffer swaps
4263 application.Render(0);
4264 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4265 application.Render(0);
4266 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4270 int UtcDaliAnimationAnimateByActorPositionP(void)
4272 TestApplication application;
4274 Actor actor = Actor::New();
4275 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4276 actor.SetPosition(startPosition);
4277 Stage::GetCurrent().Add(actor);
4278 application.SendNotification();
4279 application.Render(0);
4280 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4282 // Build the animation
4283 float durationSeconds(1.0f);
4284 Animation animation = Animation::New(durationSeconds);
4285 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4286 Vector3 relativePosition(targetPosition - startPosition);
4287 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4289 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4291 // Start the animation
4294 // Target value should be retrievable straight away
4295 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4297 bool signalReceived(false);
4298 AnimationFinishCheck finishCheck(signalReceived);
4299 animation.FinishedSignal().Connect(&application, finishCheck);
4301 application.SendNotification();
4302 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4304 // We didn't expect the animation to finish yet
4305 application.SendNotification();
4306 finishCheck.CheckSignalNotReceived();
4307 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4309 application.SendNotification();
4310 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4312 // We did expect the animation to finish
4313 application.SendNotification();
4314 finishCheck.CheckSignalReceived();
4315 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4317 // Check that nothing has changed after a couple of buffer swaps
4318 application.Render(0);
4319 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4320 application.Render(0);
4321 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4325 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4327 TestApplication application;
4329 Actor actor = Actor::New();
4330 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4331 actor.SetPosition(startPosition);
4332 Stage::GetCurrent().Add(actor);
4333 application.SendNotification();
4334 application.Render(0);
4335 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4337 // Build the animation
4338 float durationSeconds(1.0f);
4339 Animation animation = Animation::New(durationSeconds);
4340 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4341 Vector3 relativePosition(targetPosition - startPosition);
4342 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4344 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4346 // Start the animation
4349 bool signalReceived(false);
4350 AnimationFinishCheck finishCheck(signalReceived);
4351 animation.FinishedSignal().Connect(&application, finishCheck);
4353 application.SendNotification();
4354 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4356 // We didn't expect the animation to finish yet
4357 application.SendNotification();
4358 finishCheck.CheckSignalNotReceived();
4360 // The position should have moved more, than with a linear alpha function
4361 Vector3 current(actor.GetCurrentPosition());
4362 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4363 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4364 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4366 application.SendNotification();
4367 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4369 // We did expect the animation to finish
4370 application.SendNotification();
4371 finishCheck.CheckSignalReceived();
4372 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4374 // Check that nothing has changed after a couple of buffer swaps
4375 application.Render(0);
4376 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4377 application.Render(0);
4378 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4382 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4384 TestApplication application;
4386 Actor actor = Actor::New();
4387 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4388 actor.SetPosition(startPosition);
4389 Stage::GetCurrent().Add(actor);
4390 application.SendNotification();
4391 application.Render(0);
4392 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4394 // Build the animation
4395 float durationSeconds(1.0f);
4396 Animation animation = Animation::New(durationSeconds);
4397 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4398 Vector3 relativePosition(targetPosition - startPosition);
4400 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4402 TimePeriod(delay, durationSeconds - delay));
4404 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4406 // Start the animation
4409 bool signalReceived(false);
4410 AnimationFinishCheck finishCheck(signalReceived);
4411 animation.FinishedSignal().Connect(&application, finishCheck);
4413 application.SendNotification();
4414 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4416 // We didn't expect the animation to finish yet
4417 application.SendNotification();
4418 finishCheck.CheckSignalNotReceived();
4419 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4421 application.SendNotification();
4422 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4424 // We did expect the animation to finish
4425 application.SendNotification();
4426 finishCheck.CheckSignalReceived();
4427 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4429 // Check that nothing has changed after a couple of buffer swaps
4430 application.Render(0);
4431 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4432 application.Render(0);
4433 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4437 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4439 TestApplication application;
4441 Actor actor = Actor::New();
4442 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4443 actor.SetPosition(startPosition);
4444 Stage::GetCurrent().Add(actor);
4445 application.SendNotification();
4446 application.Render(0);
4447 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4449 // Build the animation
4450 float durationSeconds(1.0f);
4451 Animation animation = Animation::New(durationSeconds);
4452 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4453 Vector3 relativePosition(targetPosition - startPosition);
4455 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4457 AlphaFunction::LINEAR,
4458 TimePeriod(delay, durationSeconds - delay));
4460 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4462 // Start the animation
4465 bool signalReceived(false);
4466 AnimationFinishCheck finishCheck(signalReceived);
4467 animation.FinishedSignal().Connect(&application, finishCheck);
4469 application.SendNotification();
4470 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4472 // We didn't expect the animation to finish yet
4473 application.SendNotification();
4474 finishCheck.CheckSignalNotReceived();
4475 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4477 application.SendNotification();
4478 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4480 // We did expect the animation to finish
4481 application.SendNotification();
4482 finishCheck.CheckSignalReceived();
4483 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4485 // Check that nothing has changed after a couple of buffer swaps
4486 application.Render(0);
4487 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4488 application.Render(0);
4489 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4493 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4495 TestApplication application;
4497 Actor actor = Actor::New();
4498 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4499 Stage::GetCurrent().Add(actor);
4500 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4502 // Build the animation
4503 float durationSeconds(1.0f);
4504 Animation animation = Animation::New(durationSeconds);
4505 Degree relativeRotationDegrees(360.0f);
4506 Radian relativeRotationRadians(relativeRotationDegrees);
4507 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4509 // Start the animation
4512 // Target value should be retrievable straight away
4513 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4515 bool signalReceived(false);
4516 AnimationFinishCheck finishCheck(signalReceived);
4517 animation.FinishedSignal().Connect(&application, finishCheck);
4519 application.SendNotification();
4520 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4522 // We didn't expect the animation to finish yet
4523 application.SendNotification();
4524 finishCheck.CheckSignalNotReceived();
4525 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4527 application.SendNotification();
4528 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4530 // We didn't expect the animation to finish yet
4531 application.SendNotification();
4532 finishCheck.CheckSignalNotReceived();
4533 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4535 application.SendNotification();
4536 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4538 // We didn't expect the animation to finish yet
4539 application.SendNotification();
4540 finishCheck.CheckSignalNotReceived();
4541 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4543 application.SendNotification();
4544 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4546 // We did expect the animation to finish
4547 application.SendNotification();
4548 finishCheck.CheckSignalReceived();
4549 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4553 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4555 TestApplication application;
4557 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4559 Actor actor = Actor::New();
4560 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4561 Stage::GetCurrent().Add(actor);
4562 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4564 // Build the animation
4565 float durationSeconds(1.0f);
4566 Animation animation = Animation::New(durationSeconds);
4567 Degree relativeRotationDegrees(710.0f);
4568 Radian relativeRotationRadians(relativeRotationDegrees);
4570 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4572 // Start the animation
4575 bool signalReceived(false);
4576 AnimationFinishCheck finishCheck(signalReceived);
4577 animation.FinishedSignal().Connect(&application, finishCheck);
4579 application.SendNotification();
4580 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4582 // We didn't expect the animation to finish yet
4583 application.SendNotification();
4584 finishCheck.CheckSignalNotReceived();
4585 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4587 application.SendNotification();
4588 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4590 // We didn't expect the animation to finish yet
4591 application.SendNotification();
4592 finishCheck.CheckSignalNotReceived();
4593 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4595 application.SendNotification();
4596 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4598 // We didn't expect the animation to finish yet
4599 application.SendNotification();
4600 finishCheck.CheckSignalNotReceived();
4601 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4603 application.SendNotification();
4604 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4606 // We did expect the animation to finish
4607 application.SendNotification();
4608 finishCheck.CheckSignalReceived();
4609 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4614 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4616 TestApplication application;
4618 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4620 Actor actor = Actor::New();
4621 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4622 Stage::GetCurrent().Add(actor);
4623 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4625 // Build the animation
4626 float durationSeconds(1.0f);
4627 Animation animation = Animation::New(durationSeconds);
4628 Degree relativeRotationDegrees(730.0f);
4629 Radian relativeRotationRadians(relativeRotationDegrees);
4631 Radian actualRotationRadians( Degree(10.0f) );
4633 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4635 // Start the animation
4638 bool signalReceived(false);
4639 AnimationFinishCheck finishCheck(signalReceived);
4640 animation.FinishedSignal().Connect(&application, finishCheck);
4642 application.SendNotification();
4643 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4645 // We didn't expect the animation to finish yet
4646 application.SendNotification();
4647 finishCheck.CheckSignalNotReceived();
4648 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4650 application.SendNotification();
4651 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4653 // We didn't expect the animation to finish yet
4654 application.SendNotification();
4655 finishCheck.CheckSignalNotReceived();
4656 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4658 application.SendNotification();
4659 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4661 // We didn't expect the animation to finish yet
4662 application.SendNotification();
4663 finishCheck.CheckSignalNotReceived();
4664 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4666 application.SendNotification();
4667 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4669 // We did expect the animation to finish
4670 application.SendNotification();
4671 finishCheck.CheckSignalReceived();
4672 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4673 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4678 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4680 TestApplication application;
4682 Actor actor = Actor::New();
4683 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4684 Stage::GetCurrent().Add(actor);
4685 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4687 // Build the animation
4688 float durationSeconds(1.0f);
4689 Animation animation = Animation::New(durationSeconds);
4690 Degree relativeRotationDegrees(360.0f);
4691 Radian relativeRotationRadians(relativeRotationDegrees);
4692 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4694 // Start the animation
4697 bool signalReceived(false);
4698 AnimationFinishCheck finishCheck(signalReceived);
4699 animation.FinishedSignal().Connect(&application, finishCheck);
4701 application.SendNotification();
4702 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4704 // We didn't expect the animation to finish yet
4705 application.SendNotification();
4706 finishCheck.CheckSignalNotReceived();
4707 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4709 application.SendNotification();
4710 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4712 // We didn't expect the animation to finish yet
4713 application.SendNotification();
4714 finishCheck.CheckSignalNotReceived();
4715 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4717 application.SendNotification();
4718 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4720 // We didn't expect the animation to finish yet
4721 application.SendNotification();
4722 finishCheck.CheckSignalNotReceived();
4723 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4725 application.SendNotification();
4726 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4728 // We did expect the animation to finish
4729 application.SendNotification();
4730 finishCheck.CheckSignalReceived();
4731 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4735 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4737 TestApplication application;
4739 Actor actor = Actor::New();
4740 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4741 Stage::GetCurrent().Add(actor);
4742 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4744 // Build the animation
4745 float durationSeconds(1.0f);
4746 Animation animation = Animation::New(durationSeconds);
4747 Degree relativeRotationDegrees(360.0f);
4748 Radian relativeRotationRadians(relativeRotationDegrees);
4750 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4751 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4753 // Start the animation
4756 bool signalReceived(false);
4757 AnimationFinishCheck finishCheck(signalReceived);
4758 animation.FinishedSignal().Connect(&application, finishCheck);
4760 application.SendNotification();
4761 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4763 // We didn't expect the animation to finish yet
4764 application.SendNotification();
4765 finishCheck.CheckSignalNotReceived();
4766 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4767 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4769 application.SendNotification();
4770 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4772 // We didn't expect the animation to finish yet
4773 application.SendNotification();
4774 finishCheck.CheckSignalNotReceived();
4775 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4776 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4778 application.SendNotification();
4779 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4781 // We didn't expect the animation to finish yet
4782 application.SendNotification();
4783 finishCheck.CheckSignalNotReceived();
4784 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4785 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4787 application.SendNotification();
4788 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4790 // We did expect the animation to finish
4791 application.SendNotification();
4792 finishCheck.CheckSignalReceived();
4793 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4797 int UtcDaliAnimationAnimateByActorScaleP(void)
4799 TestApplication application;
4801 Actor actor = Actor::New();
4802 Stage::GetCurrent().Add(actor);
4803 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4805 // Build the animation
4806 float durationSeconds(1.0f);
4807 Animation animation = Animation::New(durationSeconds);
4808 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4809 Vector3 relativeScale(targetScale - Vector3::ONE);
4810 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4812 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4814 // Start the animation
4817 // Target value should be retrievable straight away
4818 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
4820 bool signalReceived(false);
4821 AnimationFinishCheck finishCheck(signalReceived);
4822 animation.FinishedSignal().Connect(&application, finishCheck);
4824 application.SendNotification();
4825 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4827 // We didn't expect the animation to finish yet
4828 application.SendNotification();
4829 finishCheck.CheckSignalNotReceived();
4830 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4832 application.SendNotification();
4833 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4835 // We did expect the animation to finish
4836 application.SendNotification();
4837 finishCheck.CheckSignalReceived();
4838 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4841 finishCheck.Reset();
4842 actor.SetScale(Vector3::ONE);
4843 application.SendNotification();
4844 application.Render(0);
4845 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4847 // Repeat with a different (ease-in) alpha function
4848 animation = Animation::New(durationSeconds);
4849 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4850 animation.FinishedSignal().Connect(&application, finishCheck);
4853 application.SendNotification();
4854 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4856 // We didn't expect the animation to finish yet
4857 application.SendNotification();
4858 finishCheck.CheckSignalNotReceived();
4860 // The scale should have grown less, than with a linear alpha function
4861 Vector3 current(actor.GetCurrentScale());
4862 DALI_TEST_CHECK( current.x > 1.0f );
4863 DALI_TEST_CHECK( current.y > 1.0f );
4864 DALI_TEST_CHECK( current.z > 1.0f );
4865 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4866 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4867 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4869 application.SendNotification();
4870 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4872 // We did expect the animation to finish
4873 application.SendNotification();
4874 finishCheck.CheckSignalReceived();
4875 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4878 finishCheck.Reset();
4879 actor.SetScale(Vector3::ONE);
4880 application.SendNotification();
4881 application.Render(0);
4882 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4884 // Repeat with a delay
4886 animation = Animation::New(durationSeconds);
4887 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4888 animation.FinishedSignal().Connect(&application, finishCheck);
4891 application.SendNotification();
4892 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4894 // We didn't expect the animation to finish yet
4895 application.SendNotification();
4896 finishCheck.CheckSignalNotReceived();
4897 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4899 application.SendNotification();
4900 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4902 // We did expect the animation to finish
4903 application.SendNotification();
4904 finishCheck.CheckSignalReceived();
4905 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4909 int UtcDaliAnimationAnimateToBooleanP(void)
4911 TestApplication application;
4913 Actor actor = Actor::New();
4915 // Register a boolean property
4916 const bool startValue(false);
4917 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4918 Stage::GetCurrent().Add(actor);
4919 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4920 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
4922 // Build the animation
4923 float durationSeconds(2.0f);
4924 Animation animation = Animation::New(durationSeconds);
4925 const bool targetValue( !startValue );
4926 animation.AnimateTo(Property(actor, index), targetValue);
4928 // Start the animation
4931 bool signalReceived(false);
4932 AnimationFinishCheck finishCheck(signalReceived);
4933 animation.FinishedSignal().Connect(&application, finishCheck);
4935 application.SendNotification();
4936 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4938 // We didn't expect the animation to finish yet
4939 application.SendNotification();
4940 finishCheck.CheckSignalNotReceived();
4941 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
4943 application.SendNotification();
4944 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4946 // We did expect the animation to finish
4947 application.SendNotification();
4948 finishCheck.CheckSignalReceived();
4949 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
4951 // Check that nothing has changed after a couple of buffer swaps
4952 application.Render(0);
4953 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
4954 application.Render(0);
4955 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
4957 // Repeat with target value "false"
4958 animation = Animation::New(durationSeconds);
4959 const bool finalValue( !targetValue );
4960 animation.AnimateTo(Property(actor, index), finalValue);
4962 // Start the animation
4965 finishCheck.Reset();
4966 animation.FinishedSignal().Connect(&application, finishCheck);
4968 application.SendNotification();
4969 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4971 // We didn't expect the animation to finish yet
4972 application.SendNotification();
4973 finishCheck.CheckSignalNotReceived();
4974 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
4976 application.SendNotification();
4977 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4979 // We did expect the animation to finish
4980 application.SendNotification();
4981 finishCheck.CheckSignalReceived();
4982 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
4984 // Check that nothing has changed after a couple of buffer swaps
4985 application.Render(0);
4986 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
4987 application.Render(0);
4988 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
4992 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4994 TestApplication application;
4996 Actor actor = Actor::New();
4998 // Register a boolean property
4999 const bool startValue(false);
5000 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5001 Stage::GetCurrent().Add(actor);
5002 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5003 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5005 // Build the animation
5006 float durationSeconds(2.0f);
5007 Animation animation = Animation::New(durationSeconds);
5008 const bool targetValue( !startValue );
5009 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5011 // Start the animation
5014 bool signalReceived(false);
5015 AnimationFinishCheck finishCheck(signalReceived);
5016 animation.FinishedSignal().Connect(&application, finishCheck);
5018 application.SendNotification();
5019 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5021 // We didn't expect the animation to finish yet
5022 application.SendNotification();
5023 finishCheck.CheckSignalNotReceived();
5024 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5026 application.SendNotification();
5027 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5029 // We did expect the animation to finish
5030 application.SendNotification();
5031 finishCheck.CheckSignalReceived();
5032 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5034 // Check that nothing has changed after a couple of buffer swaps
5035 application.Render(0);
5036 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5037 application.Render(0);
5038 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5040 // Repeat with target value "false"
5041 animation = Animation::New(durationSeconds);
5042 const bool finalValue( !targetValue );
5043 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5045 // Start the animation
5048 finishCheck.Reset();
5049 animation.FinishedSignal().Connect(&application, finishCheck);
5051 application.SendNotification();
5052 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5054 // We didn't expect the animation to finish yet
5055 application.SendNotification();
5056 finishCheck.CheckSignalNotReceived();
5057 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5059 application.SendNotification();
5060 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5062 // We did expect the animation to finish
5063 application.SendNotification();
5064 finishCheck.CheckSignalReceived();
5065 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5067 // Check that nothing has changed after a couple of buffer swaps
5068 application.Render(0);
5069 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5070 application.Render(0);
5071 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5075 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5077 TestApplication application;
5079 Actor actor = Actor::New();
5081 // Register a boolean property
5082 bool startValue(false);
5083 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5084 Stage::GetCurrent().Add(actor);
5085 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5086 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5088 // Build the animation
5089 float durationSeconds(2.0f);
5090 Animation animation = Animation::New(durationSeconds);
5091 bool finalValue( !startValue );
5092 float animatorDurationSeconds(durationSeconds * 0.5f);
5093 animation.AnimateTo( Property(actor, index),
5095 TimePeriod( animatorDurationSeconds ) );
5097 // Start the animation
5100 bool signalReceived(false);
5101 AnimationFinishCheck finishCheck(signalReceived);
5102 animation.FinishedSignal().Connect(&application, finishCheck);
5104 application.SendNotification();
5105 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5107 // We didn't expect the animation to finish yet
5108 application.SendNotification();
5109 finishCheck.CheckSignalNotReceived();
5110 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5112 application.SendNotification();
5113 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5115 // We didn't expect the animation to finish yet...
5116 application.SendNotification();
5117 finishCheck.CheckSignalNotReceived();
5119 // ...however we should have reached the final value
5120 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5122 application.SendNotification();
5123 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5125 // We did expect the animation to finish
5126 application.SendNotification();
5127 finishCheck.CheckSignalReceived();
5128 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5130 // Check that nothing has changed after a couple of buffer swaps
5131 application.Render(0);
5132 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5133 application.Render(0);
5134 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5138 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5140 TestApplication application;
5142 Actor actor = Actor::New();
5144 // Register a boolean property
5145 bool startValue(false);
5146 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5147 Stage::GetCurrent().Add(actor);
5148 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5149 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5151 // Build the animation
5152 float durationSeconds(2.0f);
5153 Animation animation = Animation::New(durationSeconds);
5154 bool finalValue( !startValue );
5155 float animatorDurationSeconds(durationSeconds * 0.5f);
5156 animation.AnimateTo( Property(actor, index),
5158 AlphaFunction::LINEAR,
5159 TimePeriod( animatorDurationSeconds ) );
5161 // Start the animation
5164 bool signalReceived(false);
5165 AnimationFinishCheck finishCheck(signalReceived);
5166 animation.FinishedSignal().Connect(&application, finishCheck);
5168 application.SendNotification();
5169 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5171 // We didn't expect the animation to finish yet
5172 application.SendNotification();
5173 finishCheck.CheckSignalNotReceived();
5174 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5176 application.SendNotification();
5177 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5179 // We didn't expect the animation to finish yet...
5180 application.SendNotification();
5181 finishCheck.CheckSignalNotReceived();
5183 // ...however we should have reached the final value
5184 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5186 application.SendNotification();
5187 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5189 // We did expect the animation to finish
5190 application.SendNotification();
5191 finishCheck.CheckSignalReceived();
5192 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5194 // Check that nothing has changed after a couple of buffer swaps
5195 application.Render(0);
5196 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5197 application.Render(0);
5198 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5202 int UtcDaliAnimationAnimateToFloatP(void)
5204 TestApplication application;
5206 Actor actor = Actor::New();
5208 // Register a float property
5209 float startValue(10.0f);
5210 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5211 Stage::GetCurrent().Add(actor);
5212 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5213 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5215 // Build the animation
5216 float durationSeconds(2.0f);
5217 Animation animation = Animation::New(durationSeconds);
5218 float targetValue(50.0f);
5219 float relativeValue(targetValue - startValue);
5220 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5222 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5224 // Start the animation
5227 bool signalReceived(false);
5228 AnimationFinishCheck finishCheck(signalReceived);
5229 animation.FinishedSignal().Connect(&application, finishCheck);
5231 application.SendNotification();
5232 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5234 // We didn't expect the animation to finish yet
5235 application.SendNotification();
5236 finishCheck.CheckSignalNotReceived();
5237 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5239 application.SendNotification();
5240 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5242 // We did expect the animation to finish
5243 application.SendNotification();
5244 finishCheck.CheckSignalReceived();
5245 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5249 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5251 TestApplication application;
5253 Actor actor = Actor::New();
5255 // Register a float property
5256 float startValue(10.0f);
5257 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5258 Stage::GetCurrent().Add(actor);
5259 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5260 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5262 // Build the animation
5263 float durationSeconds(1.0f);
5264 Animation animation = Animation::New(durationSeconds);
5265 float targetValue(90.0f);
5266 float relativeValue(targetValue - startValue);
5267 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5269 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5271 // Start the animation
5274 bool signalReceived(false);
5275 AnimationFinishCheck finishCheck(signalReceived);
5276 animation.FinishedSignal().Connect(&application, finishCheck);
5278 application.SendNotification();
5279 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5281 // We didn't expect the animation to finish yet
5282 application.SendNotification();
5283 finishCheck.CheckSignalNotReceived();
5285 // The position should have moved more, than with a linear alpha function
5286 float current( actor.GetCurrentProperty< float >( index ) );
5287 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5289 application.SendNotification();
5290 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5292 // We did expect the animation to finish
5293 application.SendNotification();
5294 finishCheck.CheckSignalReceived();
5295 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5299 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5301 TestApplication application;
5303 Actor actor = Actor::New();
5305 // Register a float property
5306 float startValue(10.0f);
5307 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5308 Stage::GetCurrent().Add(actor);
5309 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5310 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5312 // Build the animation
5313 float durationSeconds(1.0f);
5314 Animation animation = Animation::New(durationSeconds);
5315 float targetValue(30.0f);
5316 float relativeValue(targetValue - startValue);
5318 animation.AnimateTo(Property(actor, index),
5320 TimePeriod(delay, durationSeconds - delay));
5322 // Start the animation
5325 bool signalReceived(false);
5326 AnimationFinishCheck finishCheck(signalReceived);
5327 animation.FinishedSignal().Connect(&application, finishCheck);
5329 application.SendNotification();
5330 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5332 // We didn't expect the animation to finish yet
5333 application.SendNotification();
5334 finishCheck.CheckSignalNotReceived();
5335 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5337 application.SendNotification();
5338 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5340 // We didn't expect the animation to finish yet
5341 application.SendNotification();
5342 finishCheck.CheckSignalNotReceived();
5343 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5345 application.SendNotification();
5346 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5348 // We did expect the animation to finish
5349 application.SendNotification();
5350 finishCheck.CheckSignalReceived();
5351 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5355 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5357 TestApplication application;
5359 Actor actor = Actor::New();
5361 // Register a float property
5362 float startValue(10.0f);
5363 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5364 Stage::GetCurrent().Add(actor);
5365 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5366 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5368 // Build the animation
5369 float durationSeconds(1.0f);
5370 Animation animation = Animation::New(durationSeconds);
5371 float targetValue(30.0f);
5372 float relativeValue(targetValue - startValue);
5374 animation.AnimateTo(Property(actor, index),
5376 AlphaFunction::LINEAR,
5377 TimePeriod(delay, durationSeconds - delay));
5379 // Start the animation
5382 bool signalReceived(false);
5383 AnimationFinishCheck finishCheck(signalReceived);
5384 animation.FinishedSignal().Connect(&application, finishCheck);
5386 application.SendNotification();
5387 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5389 // We didn't expect the animation to finish yet
5390 application.SendNotification();
5391 finishCheck.CheckSignalNotReceived();
5392 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5394 application.SendNotification();
5395 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5397 // We didn't expect the animation to finish yet
5398 application.SendNotification();
5399 finishCheck.CheckSignalNotReceived();
5400 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5402 application.SendNotification();
5403 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5405 // We did expect the animation to finish
5406 application.SendNotification();
5407 finishCheck.CheckSignalReceived();
5408 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5412 int UtcDaliAnimationAnimateToIntegerP(void)
5414 TestApplication application;
5416 Actor actor = Actor::New();
5418 // Register an integer property
5420 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5421 Stage::GetCurrent().Add(actor);
5422 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5423 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5425 // Build the animation
5426 float durationSeconds(2.0f);
5427 Animation animation = Animation::New(durationSeconds);
5428 int targetValue(50);
5429 int relativeValue(targetValue - startValue);
5430 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5432 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5434 // Start the animation
5437 bool signalReceived(false);
5438 AnimationFinishCheck finishCheck(signalReceived);
5439 animation.FinishedSignal().Connect(&application, finishCheck);
5441 application.SendNotification();
5442 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5444 // We didn't expect the animation to finish yet
5445 application.SendNotification();
5446 finishCheck.CheckSignalNotReceived();
5447 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5449 application.SendNotification();
5450 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5452 // We did expect the animation to finish
5453 application.SendNotification();
5454 finishCheck.CheckSignalReceived();
5455 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5459 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5461 TestApplication application;
5463 Actor actor = Actor::New();
5465 // Register an integer property
5467 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5468 Stage::GetCurrent().Add(actor);
5469 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5470 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5472 // Build the animation
5473 float durationSeconds(1.0f);
5474 Animation animation = Animation::New(durationSeconds);
5475 int targetValue(90);
5476 int relativeValue(targetValue - startValue);
5477 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5479 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5481 // Start the animation
5484 bool signalReceived(false);
5485 AnimationFinishCheck finishCheck(signalReceived);
5486 animation.FinishedSignal().Connect(&application, finishCheck);
5488 application.SendNotification();
5489 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5491 // We didn't expect the animation to finish yet
5492 application.SendNotification();
5493 finishCheck.CheckSignalNotReceived();
5495 // The position should have moved more, than with a linear alpha function
5496 int current( actor.GetCurrentProperty< int >( index ) );
5497 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5499 application.SendNotification();
5500 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5502 // We did expect the animation to finish
5503 application.SendNotification();
5504 finishCheck.CheckSignalReceived();
5505 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5509 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5511 TestApplication application;
5513 Actor actor = Actor::New();
5515 // Register an integer property
5517 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5518 Stage::GetCurrent().Add(actor);
5519 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5520 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5522 // Build the animation
5523 float durationSeconds(1.0f);
5524 Animation animation = Animation::New(durationSeconds);
5525 int targetValue(30);
5526 int relativeValue(targetValue - startValue);
5528 animation.AnimateTo(Property(actor, index),
5530 TimePeriod(delay, durationSeconds - delay));
5532 // Start the animation
5535 bool signalReceived(false);
5536 AnimationFinishCheck finishCheck(signalReceived);
5537 animation.FinishedSignal().Connect(&application, finishCheck);
5539 application.SendNotification();
5540 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5542 // We didn't expect the animation to finish yet
5543 application.SendNotification();
5544 finishCheck.CheckSignalNotReceived();
5545 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5547 application.SendNotification();
5548 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5550 // We didn't expect the animation to finish yet
5551 application.SendNotification();
5552 finishCheck.CheckSignalNotReceived();
5553 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5555 application.SendNotification();
5556 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5558 // We did expect the animation to finish
5559 application.SendNotification();
5560 finishCheck.CheckSignalReceived();
5561 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5565 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5567 TestApplication application;
5569 Actor actor = Actor::New();
5571 // Register an integer property
5573 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5574 Stage::GetCurrent().Add(actor);
5575 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5576 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5578 // Build the animation
5579 float durationSeconds(1.0f);
5580 Animation animation = Animation::New(durationSeconds);
5581 int targetValue(30);
5582 int relativeValue(targetValue - startValue);
5584 animation.AnimateTo(Property(actor, index),
5586 AlphaFunction::LINEAR,
5587 TimePeriod(delay, durationSeconds - delay));
5589 // Start the animation
5592 bool signalReceived(false);
5593 AnimationFinishCheck finishCheck(signalReceived);
5594 animation.FinishedSignal().Connect(&application, finishCheck);
5596 application.SendNotification();
5597 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5599 // We didn't expect the animation to finish yet
5600 application.SendNotification();
5601 finishCheck.CheckSignalNotReceived();
5602 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5604 application.SendNotification();
5605 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5607 // We didn't expect the animation to finish yet
5608 application.SendNotification();
5609 finishCheck.CheckSignalNotReceived();
5610 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5612 application.SendNotification();
5613 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5615 // We did expect the animation to finish
5616 application.SendNotification();
5617 finishCheck.CheckSignalReceived();
5618 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5622 int UtcDaliAnimationAnimateToVector2P(void)
5624 TestApplication application;
5626 Actor actor = Actor::New();
5628 // Register a Vector2 property
5629 Vector2 startValue(-50.0f, -50.0f);
5630 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5631 Stage::GetCurrent().Add(actor);
5632 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5633 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5635 // Build the animation
5636 float durationSeconds(2.0f);
5637 Animation animation = Animation::New(durationSeconds);
5638 Vector2 targetValue(50.0f, 50.0f);
5639 Vector2 relativeValue(targetValue - startValue);
5640 animation.AnimateTo(Property(actor, index), targetValue);
5642 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5644 // Start the animation
5647 bool signalReceived(false);
5648 AnimationFinishCheck finishCheck(signalReceived);
5649 animation.FinishedSignal().Connect(&application, finishCheck);
5651 application.SendNotification();
5652 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5654 // We didn't expect the animation to finish yet
5655 application.SendNotification();
5656 finishCheck.CheckSignalNotReceived();
5657 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5659 application.SendNotification();
5660 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5662 // We did expect the animation to finish
5663 application.SendNotification();
5664 finishCheck.CheckSignalReceived();
5665 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5669 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5671 TestApplication application;
5673 Actor actor = Actor::New();
5675 // Register a Vector2 property
5676 Vector2 startValue(1000.0f, 1000.0f);
5677 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5678 Stage::GetCurrent().Add(actor);
5679 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5680 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5682 // Build the animation
5683 float durationSeconds(1.0f);
5684 Animation animation = Animation::New(durationSeconds);
5685 Vector2 targetValue(9000.0f, 9000.0f);
5686 Vector2 relativeValue(targetValue - startValue);
5687 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5689 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5691 // Start the animation
5694 bool signalReceived(false);
5695 AnimationFinishCheck finishCheck(signalReceived);
5696 animation.FinishedSignal().Connect(&application, finishCheck);
5698 application.SendNotification();
5699 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5701 // We didn't expect the animation to finish yet
5702 application.SendNotification();
5703 finishCheck.CheckSignalNotReceived();
5705 // The position should have moved more, than with a linear alpha function
5706 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
5707 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5708 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5710 application.SendNotification();
5711 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5713 // We did expect the animation to finish
5714 application.SendNotification();
5715 finishCheck.CheckSignalReceived();
5716 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5720 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5722 TestApplication application;
5724 Actor actor = Actor::New();
5726 // Register a Vector2 property
5727 Vector2 startValue(10.0f, 10.0f);
5728 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5729 Stage::GetCurrent().Add(actor);
5730 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5731 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5733 // Build the animation
5734 float durationSeconds(1.0f);
5735 Animation animation = Animation::New(durationSeconds);
5736 Vector2 targetValue(-10.0f, 20.0f);
5737 Vector2 relativeValue(targetValue - startValue);
5739 animation.AnimateTo(Property(actor, index),
5741 TimePeriod(delay, durationSeconds - delay));
5743 // Start the animation
5746 bool signalReceived(false);
5747 AnimationFinishCheck finishCheck(signalReceived);
5748 animation.FinishedSignal().Connect(&application, finishCheck);
5750 application.SendNotification();
5751 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5753 // We didn't expect the animation to finish yet
5754 application.SendNotification();
5755 finishCheck.CheckSignalNotReceived();
5756 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5758 application.SendNotification();
5759 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5761 // We didn't expect the animation to finish yet
5762 application.SendNotification();
5763 finishCheck.CheckSignalNotReceived();
5764 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5766 application.SendNotification();
5767 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5769 // We did expect the animation to finish
5770 application.SendNotification();
5771 finishCheck.CheckSignalReceived();
5772 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5776 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5778 TestApplication application;
5780 Actor actor = Actor::New();
5782 // Register a Vector2 property
5783 Vector2 startValue(10.0f, 10.0f);
5784 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5785 Stage::GetCurrent().Add(actor);
5786 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5787 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5789 // Build the animation
5790 float durationSeconds(1.0f);
5791 Animation animation = Animation::New(durationSeconds);
5792 Vector2 targetValue(30.0f, 30.0f);
5793 Vector2 relativeValue(targetValue - startValue);
5795 animation.AnimateTo(Property(actor, index),
5797 AlphaFunction::LINEAR,
5798 TimePeriod(delay, durationSeconds - delay));
5800 // Start the animation
5803 bool signalReceived(false);
5804 AnimationFinishCheck finishCheck(signalReceived);
5805 animation.FinishedSignal().Connect(&application, finishCheck);
5807 application.SendNotification();
5808 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5810 // We didn't expect the animation to finish yet, but cached value should be the final one
5811 application.SendNotification();
5812 finishCheck.CheckSignalNotReceived();
5813 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5814 DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
5816 application.SendNotification();
5817 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5819 // We didn't expect the animation to finish yet
5820 application.SendNotification();
5821 finishCheck.CheckSignalNotReceived();
5822 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5824 application.SendNotification();
5825 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5827 // We did expect the animation to finish
5828 application.SendNotification();
5829 finishCheck.CheckSignalReceived();
5830 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5831 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5835 int UtcDaliAnimationAnimateToVector3P(void)
5837 TestApplication application;
5839 Actor actor = Actor::New();
5841 // Register a Vector3 property
5842 Vector3 startValue(-50.0f, -50.0f, -50.0f);
5843 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5844 Stage::GetCurrent().Add(actor);
5845 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
5846 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
5848 // Build the animation
5849 float durationSeconds(2.0f);
5850 Animation animation = Animation::New(durationSeconds);
5851 Vector3 targetValue(50.0f, 50.0f, 50.0f);
5852 Vector3 relativeValue(targetValue - startValue);
5853 animation.AnimateTo(Property(actor, index), targetValue);
5855 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5857 // Start the animation
5860 bool signalReceived(false);
5861 AnimationFinishCheck finishCheck(signalReceived);
5862 animation.FinishedSignal().Connect(&application, finishCheck);
5864 application.SendNotification();
5865 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5867 // We didn't expect the animation to finish yet
5868 application.SendNotification();
5869 finishCheck.CheckSignalNotReceived();
5870 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5872 application.SendNotification();
5873 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5875 // We did expect the animation to finish
5876 application.SendNotification();
5877 finishCheck.CheckSignalReceived();
5878 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
5882 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5884 TestApplication application;
5886 Actor actor = Actor::New();
5888 // Register a Vector3 property
5889 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5890 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5891 Stage::GetCurrent().Add(actor);
5892 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5893 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
5895 // Build the animation
5896 float durationSeconds(1.0f);
5897 Animation animation = Animation::New(durationSeconds);
5898 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5899 Vector3 relativeValue(targetValue - startValue);
5900 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5902 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5904 // Start the animation
5907 bool signalReceived(false);
5908 AnimationFinishCheck finishCheck(signalReceived);
5909 animation.FinishedSignal().Connect(&application, finishCheck);
5911 application.SendNotification();
5912 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5914 // We didn't expect the animation to finish yet
5915 application.SendNotification();
5916 finishCheck.CheckSignalNotReceived();
5918 // The position should have moved more, than with a linear alpha function
5919 Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
5920 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5921 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5922 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5924 application.SendNotification();
5925 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5927 // We did expect the animation to finish
5928 application.SendNotification();
5929 finishCheck.CheckSignalReceived();
5930 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
5934 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5936 TestApplication application;
5938 Actor actor = Actor::New();
5940 // Register a Vector3 property
5941 Vector3 startValue(10.0f, 10.0f, 10.0f);
5942 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5943 Stage::GetCurrent().Add(actor);
5944 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5945 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
5947 // Build the animation
5948 float durationSeconds(1.0f);
5949 Animation animation = Animation::New(durationSeconds);
5950 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5951 Vector3 relativeValue(targetValue - startValue);
5953 animation.AnimateTo(Property(actor, index),
5955 TimePeriod(delay, durationSeconds - delay));
5957 // Start the animation
5960 bool signalReceived(false);
5961 AnimationFinishCheck finishCheck(signalReceived);
5962 animation.FinishedSignal().Connect(&application, finishCheck);
5964 application.SendNotification();
5965 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5967 // We didn't expect the animation to finish yet
5968 application.SendNotification();
5969 finishCheck.CheckSignalNotReceived();
5970 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
5972 application.SendNotification();
5973 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5975 // We didn't expect the animation to finish yet
5976 application.SendNotification();
5977 finishCheck.CheckSignalNotReceived();
5978 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5980 application.SendNotification();
5981 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5983 // We did expect the animation to finish
5984 application.SendNotification();
5985 finishCheck.CheckSignalReceived();
5986 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
5990 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5992 TestApplication application;
5994 Actor actor = Actor::New();
5996 // Register a Vector3 property
5997 Vector3 startValue(10.0f, 10.0f, 10.0f);
5998 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5999 Stage::GetCurrent().Add(actor);
6000 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6001 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6003 // Build the animation
6004 float durationSeconds(1.0f);
6005 Animation animation = Animation::New(durationSeconds);
6006 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6007 Vector3 relativeValue(targetValue - startValue);
6009 animation.AnimateTo(Property(actor, "testProperty"),
6011 AlphaFunction::LINEAR,
6012 TimePeriod(delay, durationSeconds - delay));
6014 // Start the animation
6017 bool signalReceived(false);
6018 AnimationFinishCheck finishCheck(signalReceived);
6019 animation.FinishedSignal().Connect(&application, finishCheck);
6021 application.SendNotification();
6022 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6024 // We didn't expect the animation to finish yet
6025 application.SendNotification();
6026 finishCheck.CheckSignalNotReceived();
6027 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6029 application.SendNotification();
6030 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6032 // We didn't expect the animation to finish yet
6033 application.SendNotification();
6034 finishCheck.CheckSignalNotReceived();
6035 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6037 application.SendNotification();
6038 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6040 // We did expect the animation to finish
6041 application.SendNotification();
6042 finishCheck.CheckSignalReceived();
6043 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6047 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6049 TestApplication application;
6051 Actor actor = Actor::New();
6053 // Register a Vector3 property
6054 Vector3 startValue(10.0f, 10.0f, 10.0f);
6055 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6056 Stage::GetCurrent().Add(actor);
6057 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6058 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6060 // Build the animation
6061 float durationSeconds(1.0f);
6062 Animation animation = Animation::New(durationSeconds);
6063 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6064 Vector3 relativeValue(targetValue - startValue);
6066 animation.AnimateTo(Property(actor, "testProperty", 0),
6068 AlphaFunction::LINEAR,
6069 TimePeriod(delay, durationSeconds - delay));
6070 animation.AnimateTo(Property(actor, index, 1),
6072 AlphaFunction::LINEAR,
6073 TimePeriod(delay, durationSeconds - delay));
6075 // Start the animation
6078 bool signalReceived(false);
6079 AnimationFinishCheck finishCheck(signalReceived);
6080 animation.FinishedSignal().Connect(&application, finishCheck);
6082 application.SendNotification();
6083 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6085 // We didn't expect the animation to finish yet
6086 application.SendNotification();
6087 finishCheck.CheckSignalNotReceived();
6088 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6090 application.SendNotification();
6091 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6093 // We didn't expect the animation to finish yet
6094 application.SendNotification();
6095 finishCheck.CheckSignalNotReceived();
6096 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6098 application.SendNotification();
6099 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6101 // We did expect the animation to finish
6102 application.SendNotification();
6103 finishCheck.CheckSignalReceived();
6104 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6108 int UtcDaliAnimationAnimateToVector4P(void)
6110 TestApplication application;
6112 Actor actor = Actor::New();
6114 // Register a Vector4 property
6115 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6116 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6117 Stage::GetCurrent().Add(actor);
6118 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6119 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6121 // Build the animation
6122 float durationSeconds(2.0f);
6123 Animation animation = Animation::New(durationSeconds);
6124 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6125 Vector4 relativeValue(targetValue - startValue);
6126 animation.AnimateTo(Property(actor, index), targetValue);
6128 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6130 // Start the animation
6133 bool signalReceived(false);
6134 AnimationFinishCheck finishCheck(signalReceived);
6135 animation.FinishedSignal().Connect(&application, finishCheck);
6137 application.SendNotification();
6138 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6140 // We didn't expect the animation to finish yet
6141 application.SendNotification();
6142 finishCheck.CheckSignalNotReceived();
6143 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6145 application.SendNotification();
6146 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6148 // We did expect the animation to finish
6149 application.SendNotification();
6150 finishCheck.CheckSignalReceived();
6151 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6155 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6157 TestApplication application;
6159 Actor actor = Actor::New();
6161 // Register a Vector4 property
6162 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6163 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6164 Stage::GetCurrent().Add(actor);
6165 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6166 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6168 // Build the animation
6169 float durationSeconds(1.0f);
6170 Animation animation = Animation::New(durationSeconds);
6171 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6172 Vector4 relativeValue(targetValue - startValue);
6173 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6175 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6177 // Start the animation
6180 bool signalReceived(false);
6181 AnimationFinishCheck finishCheck(signalReceived);
6182 animation.FinishedSignal().Connect(&application, finishCheck);
6184 application.SendNotification();
6185 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6187 // We didn't expect the animation to finish yet
6188 application.SendNotification();
6189 finishCheck.CheckSignalNotReceived();
6191 // The position should have moved more, than with a linear alpha function
6192 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6193 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6194 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6195 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6196 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6198 application.SendNotification();
6199 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6201 // We did expect the animation to finish
6202 application.SendNotification();
6203 finishCheck.CheckSignalReceived();
6204 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6208 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6210 TestApplication application;
6212 Actor actor = Actor::New();
6214 // Register a Vector4 property
6215 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6216 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6217 Stage::GetCurrent().Add(actor);
6218 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6219 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6221 // Build the animation
6222 float durationSeconds(1.0f);
6223 Animation animation = Animation::New(durationSeconds);
6224 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6225 Vector4 relativeValue(targetValue - startValue);
6227 animation.AnimateTo(Property(actor, index),
6229 TimePeriod(delay, durationSeconds - delay));
6231 // Start the animation
6234 bool signalReceived(false);
6235 AnimationFinishCheck finishCheck(signalReceived);
6236 animation.FinishedSignal().Connect(&application, finishCheck);
6238 application.SendNotification();
6239 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6241 // We didn't expect the animation to finish yet
6242 application.SendNotification();
6243 finishCheck.CheckSignalNotReceived();
6244 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6246 application.SendNotification();
6247 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6249 // We didn't expect the animation to finish yet
6250 application.SendNotification();
6251 finishCheck.CheckSignalNotReceived();
6252 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6254 application.SendNotification();
6255 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6257 // We did expect the animation to finish
6258 application.SendNotification();
6259 finishCheck.CheckSignalReceived();
6260 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6264 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6266 TestApplication application;
6268 Actor actor = Actor::New();
6270 // Register a Vector4 property
6271 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6272 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6273 Stage::GetCurrent().Add(actor);
6274 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6275 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6277 // Build the animation
6278 float durationSeconds(1.0f);
6279 Animation animation = Animation::New(durationSeconds);
6280 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6281 Vector4 relativeValue(targetValue - startValue);
6283 animation.AnimateTo(Property(actor, index),
6285 AlphaFunction::LINEAR,
6286 TimePeriod(delay, durationSeconds - delay));
6288 // Start the animation
6291 bool signalReceived(false);
6292 AnimationFinishCheck finishCheck(signalReceived);
6293 animation.FinishedSignal().Connect(&application, finishCheck);
6295 application.SendNotification();
6296 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6298 // We didn't expect the animation to finish yet
6299 application.SendNotification();
6300 finishCheck.CheckSignalNotReceived();
6301 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6303 application.SendNotification();
6304 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6306 // We didn't expect the animation to finish yet
6307 application.SendNotification();
6308 finishCheck.CheckSignalNotReceived();
6309 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6311 application.SendNotification();
6312 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6314 // We did expect the animation to finish
6315 application.SendNotification();
6316 finishCheck.CheckSignalReceived();
6317 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6321 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6323 TestApplication application;
6325 Actor actor = Actor::New();
6326 Stage::GetCurrent().Add(actor);
6327 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6329 // Build the animation
6330 float durationSeconds(1.0f);
6331 Animation animation = Animation::New(durationSeconds);
6332 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6336 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6338 catch (Dali::DaliException& e)
6340 DALI_TEST_PRINT_ASSERT( e );
6341 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6346 int UtcDaliAnimationAnimateToActorParentOriginXP(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().x, startValue, TEST_LOCATION );
6354 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6356 // Build the animation
6357 float durationSeconds(1.0f);
6358 Animation animation = Animation::New(durationSeconds);
6359 float targetX(1.0f);
6363 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6365 catch (Dali::DaliException& e)
6367 DALI_TEST_PRINT_ASSERT( e );
6368 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6373 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6375 TestApplication application;
6377 Actor actor = Actor::New();
6378 Stage::GetCurrent().Add(actor);
6379 float startValue(0.0f);
6380 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6381 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6383 // Build the animation
6384 float durationSeconds(1.0f);
6385 Animation animation = Animation::New(durationSeconds);
6386 float targetY(1.0f);
6390 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6392 catch (Dali::DaliException& e)
6394 DALI_TEST_PRINT_ASSERT( e );
6395 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6400 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6402 TestApplication application;
6404 Actor actor = Actor::New();
6405 Stage::GetCurrent().Add(actor);
6406 float startValue(0.5f);
6407 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6408 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6410 // Build the animation
6411 float durationSeconds(1.0f);
6412 Animation animation = Animation::New(durationSeconds);
6413 float targetZ(1.0f);
6417 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6419 catch (Dali::DaliException& e)
6421 DALI_TEST_PRINT_ASSERT( e );
6422 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6427 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6429 TestApplication application;
6431 Actor actor = Actor::New();
6432 Stage::GetCurrent().Add(actor);
6433 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6435 // Build the animation
6436 float durationSeconds(1.0f);
6437 Animation animation = Animation::New(durationSeconds);
6438 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6442 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6444 catch (Dali::DaliException& e)
6446 DALI_TEST_PRINT_ASSERT( e );
6447 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6452 int UtcDaliAnimationAnimateToActorAnchorPointXP(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().x, startValue, TEST_LOCATION );
6460 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6462 // Build the animation
6463 float durationSeconds(1.0f);
6464 Animation animation = Animation::New(durationSeconds);
6465 float targetX(1.0f);
6469 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6471 catch (Dali::DaliException& e)
6473 DALI_TEST_PRINT_ASSERT( e );
6474 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6479 int UtcDaliAnimationAnimateToActorAnchorPointYP(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().y, startValue, TEST_LOCATION );
6487 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6489 // Build the animation
6490 float durationSeconds(1.0f);
6491 Animation animation = Animation::New(durationSeconds);
6492 float targetY(0.0f);
6496 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6498 catch (Dali::DaliException& e)
6500 DALI_TEST_PRINT_ASSERT( e );
6501 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6506 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6508 TestApplication application;
6510 Actor actor = Actor::New();
6511 Stage::GetCurrent().Add(actor);
6512 float startValue(0.5f);
6513 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6514 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6516 // Build the animation
6517 float durationSeconds(1.0f);
6518 Animation animation = Animation::New(durationSeconds);
6519 float targetZ(100.0f);
6523 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6525 catch (Dali::DaliException& e)
6527 DALI_TEST_PRINT_ASSERT( e );
6528 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6533 int UtcDaliAnimationAnimateToActorSizeP(void)
6535 TestApplication application;
6537 Actor actor = Actor::New();
6538 Stage::GetCurrent().Add(actor);
6539 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6541 // Build the animation
6542 float durationSeconds(1.0f);
6543 Animation animation = Animation::New(durationSeconds);
6544 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6545 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6547 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6549 // Should return the initial properties before play
6550 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6551 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
6552 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
6553 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
6555 // Start the animation
6558 // Should return the target property after play
6559 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
6560 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
6561 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
6562 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
6564 bool signalReceived(false);
6565 AnimationFinishCheck finishCheck(signalReceived);
6566 animation.FinishedSignal().Connect(&application, finishCheck);
6568 application.SendNotification();
6569 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6571 // We didn't expect the animation to finish yet
6572 application.SendNotification();
6573 finishCheck.CheckSignalNotReceived();
6574 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6576 application.SendNotification();
6577 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6579 // We did expect the animation to finish
6580 application.SendNotification();
6581 finishCheck.CheckSignalReceived();
6582 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6585 finishCheck.Reset();
6586 actor.SetSize(Vector3::ZERO);
6587 application.SendNotification();
6588 application.Render(0);
6589 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6591 // Repeat with a different (ease-in) alpha function
6592 animation = Animation::New(durationSeconds);
6593 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6594 animation.FinishedSignal().Connect(&application, finishCheck);
6597 application.SendNotification();
6598 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6600 // We didn't expect the animation to finish yet
6601 application.SendNotification();
6602 finishCheck.CheckSignalNotReceived();
6604 // The size should have travelled less, than with a linear alpha function
6605 Vector3 current(actor.GetCurrentSize());
6606 DALI_TEST_CHECK( current.x > 0.0f );
6607 DALI_TEST_CHECK( current.y > 0.0f );
6608 DALI_TEST_CHECK( current.z > 0.0f );
6609 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6610 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6611 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6613 application.SendNotification();
6614 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6616 // We did expect the animation to finish
6617 application.SendNotification();
6618 finishCheck.CheckSignalReceived();
6619 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6622 finishCheck.Reset();
6623 actor.SetSize(Vector3::ZERO);
6624 application.SendNotification();
6625 application.Render(0);
6626 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6628 // Repeat with a delay
6630 animation = Animation::New(durationSeconds);
6631 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6632 animation.FinishedSignal().Connect(&application, finishCheck);
6635 application.SendNotification();
6636 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6638 // We didn't expect the animation to finish yet
6639 application.SendNotification();
6640 finishCheck.CheckSignalNotReceived();
6641 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6643 application.SendNotification();
6644 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6646 // We did expect the animation to finish
6647 application.SendNotification();
6648 finishCheck.CheckSignalReceived();
6649 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6653 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6655 TestApplication application;
6657 Actor actor = Actor::New();
6658 Stage::GetCurrent().Add(actor);
6659 float startValue(0.0f);
6660 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6661 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6663 // Build the animation
6664 float durationSeconds(1.0f);
6665 Animation animation = Animation::New(durationSeconds);
6666 float targetWidth(10.0f);
6667 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6669 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6671 // Should return the initial properties before play
6672 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6673 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
6675 // Start the animation
6678 // Should return the target property after play
6679 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
6680 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
6682 bool signalReceived(false);
6683 AnimationFinishCheck finishCheck(signalReceived);
6684 animation.FinishedSignal().Connect(&application, finishCheck);
6686 application.SendNotification();
6687 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6689 // We didn't expect the animation to finish yet
6690 application.SendNotification();
6691 finishCheck.CheckSignalNotReceived();
6692 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
6694 application.SendNotification();
6695 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6697 // We did expect the animation to finish
6698 application.SendNotification();
6699 finishCheck.CheckSignalReceived();
6700 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
6701 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
6705 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
6707 TestApplication application;
6709 Actor actor = Actor::New();
6710 Stage::GetCurrent().Add(actor);
6711 float startValue(0.0f);
6712 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6713 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6715 // Build the animation
6716 float durationSeconds(1.0f);
6717 Animation animation = Animation::New(durationSeconds);
6718 float targetHeight(-10.0f);
6719 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6721 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6723 // Should return the initial properties before play
6724 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6725 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
6727 // Start the animation
6730 // Should return the target property after play
6731 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
6732 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
6734 bool signalReceived(false);
6735 AnimationFinishCheck finishCheck(signalReceived);
6736 animation.FinishedSignal().Connect(&application, finishCheck);
6738 application.SendNotification();
6739 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6741 // We didn't expect the animation to finish yet
6742 application.SendNotification();
6743 finishCheck.CheckSignalNotReceived();
6744 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6746 application.SendNotification();
6747 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6749 // We did expect the animation to finish
6750 application.SendNotification();
6751 finishCheck.CheckSignalReceived();
6752 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6753 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6757 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6759 TestApplication application;
6761 Actor actor = Actor::New();
6762 Stage::GetCurrent().Add(actor);
6763 float startValue(0.0f);
6764 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6765 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6767 // Build the animation
6768 float durationSeconds(1.0f);
6769 Animation animation = Animation::New(durationSeconds);
6770 float targetDepth(-10.0f);
6771 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6773 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6775 // Should return the initial properties before play
6776 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6777 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
6779 // Start the animation
6782 // Should return the target property after play
6783 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
6784 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
6786 bool signalReceived(false);
6787 AnimationFinishCheck finishCheck(signalReceived);
6788 animation.FinishedSignal().Connect(&application, finishCheck);
6790 application.SendNotification();
6791 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6793 // We didn't expect the animation to finish yet
6794 application.SendNotification();
6795 finishCheck.CheckSignalNotReceived();
6796 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6798 application.SendNotification();
6799 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6801 // We did expect the animation to finish
6802 application.SendNotification();
6803 finishCheck.CheckSignalReceived();
6804 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6805 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6809 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6811 TestApplication application;
6813 Actor actor = Actor::New();
6814 Stage::GetCurrent().Add(actor);
6815 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6817 // Build the animation
6818 float durationSeconds(1.0f);
6819 Animation animation = Animation::New(durationSeconds);
6820 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6821 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6823 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6825 // Start the animation
6828 bool signalReceived(false);
6829 AnimationFinishCheck finishCheck(signalReceived);
6830 animation.FinishedSignal().Connect(&application, finishCheck);
6832 application.SendNotification();
6833 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6835 // We didn't expect the animation to finish yet
6836 application.SendNotification();
6837 finishCheck.CheckSignalNotReceived();
6838 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6840 application.SendNotification();
6841 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6843 // We did expect the animation to finish
6844 application.SendNotification();
6845 finishCheck.CheckSignalReceived();
6846 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6849 finishCheck.Reset();
6850 actor.SetSize(Vector3::ZERO);
6851 application.SendNotification();
6852 application.Render(0);
6853 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6855 // Repeat with a different (ease-in) alpha function
6856 animation = Animation::New(durationSeconds);
6857 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6858 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6859 animation.FinishedSignal().Connect(&application, finishCheck);
6862 application.SendNotification();
6863 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6865 // We didn't expect the animation to finish yet
6866 application.SendNotification();
6867 finishCheck.CheckSignalNotReceived();
6869 // The size should have travelled less, than with a linear alpha function
6870 Vector3 current(actor.GetCurrentSize());
6871 DALI_TEST_CHECK( current.x > 0.0f );
6872 DALI_TEST_CHECK( current.y > 0.0f );
6873 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6874 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6876 application.SendNotification();
6877 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6879 // We did expect the animation to finish
6880 application.SendNotification();
6881 finishCheck.CheckSignalReceived();
6882 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6883 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6886 finishCheck.Reset();
6887 actor.SetSize(Vector3::ZERO);
6888 application.SendNotification();
6889 application.Render(0);
6890 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6892 // Repeat with a delay
6894 animation = Animation::New(durationSeconds);
6895 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6896 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6897 animation.FinishedSignal().Connect(&application, finishCheck);
6900 application.SendNotification();
6901 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6903 // We didn't expect the animation to finish yet
6904 application.SendNotification();
6905 finishCheck.CheckSignalNotReceived();
6906 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6908 application.SendNotification();
6909 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6911 // We did expect the animation to finish
6912 application.SendNotification();
6913 finishCheck.CheckSignalReceived();
6914 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6915 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6919 int UtcDaliAnimationAnimateToActorPositionP(void)
6921 TestApplication application;
6923 Actor actor = Actor::New();
6924 Stage::GetCurrent().Add(actor);
6925 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6927 // Build the animation
6928 float durationSeconds(1.0f);
6929 Animation animation = Animation::New(durationSeconds);
6930 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6931 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6933 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6935 // Should return the initial properties before play
6936 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6937 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
6938 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
6939 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
6941 // Start the animation
6944 // Should return the target property after play
6945 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
6946 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
6947 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
6948 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
6950 bool signalReceived(false);
6951 AnimationFinishCheck finishCheck(signalReceived);
6952 animation.FinishedSignal().Connect(&application, finishCheck);
6954 application.SendNotification();
6955 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6957 // We didn't expect the animation to finish yet
6958 application.SendNotification();
6959 finishCheck.CheckSignalNotReceived();
6960 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6962 application.SendNotification();
6963 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6965 // We did expect the animation to finish
6966 application.SendNotification();
6967 finishCheck.CheckSignalReceived();
6968 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6972 int UtcDaliAnimationAnimateToActorPositionXP(void)
6974 TestApplication application;
6976 Actor actor = Actor::New();
6977 Stage::GetCurrent().Add(actor);
6978 float startValue(0.0f);
6979 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6980 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6981 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6982 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6984 // Build the animation
6985 float durationSeconds(1.0f);
6986 Animation animation = Animation::New(durationSeconds);
6987 float targetX(1.0f);
6988 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6990 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6992 // Should return the initial properties before play
6993 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
6994 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
6996 // Start the animation
6999 // Should return the target property after play
7000 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7001 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7003 bool signalReceived(false);
7004 AnimationFinishCheck finishCheck(signalReceived);
7005 animation.FinishedSignal().Connect(&application, finishCheck);
7007 application.SendNotification();
7008 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7010 // We didn't expect the animation to finish yet
7011 application.SendNotification();
7012 finishCheck.CheckSignalNotReceived();
7013 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
7015 application.SendNotification();
7016 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7018 // We did expect the animation to finish
7019 application.SendNotification();
7020 finishCheck.CheckSignalReceived();
7021 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
7022 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7024 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7028 int UtcDaliAnimationAnimateToActorPositionYP(void)
7030 TestApplication application;
7032 Actor actor = Actor::New();
7033 Stage::GetCurrent().Add(actor);
7034 float startValue(0.0f);
7035 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7036 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7037 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7038 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7040 // Build the animation
7041 float durationSeconds(1.0f);
7042 Animation animation = Animation::New(durationSeconds);
7043 float targetY(10.0f);
7044 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7046 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7048 // Should return the initial properties before play
7049 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7050 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7052 // Start the animation
7055 // Should return the target property after play
7056 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7057 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7059 bool signalReceived(false);
7060 AnimationFinishCheck finishCheck(signalReceived);
7061 animation.FinishedSignal().Connect(&application, finishCheck);
7063 application.SendNotification();
7064 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7066 // We didn't expect the animation to finish yet
7067 application.SendNotification();
7068 finishCheck.CheckSignalNotReceived();
7069 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7071 application.SendNotification();
7072 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7074 // We did expect the animation to finish
7075 application.SendNotification();
7076 finishCheck.CheckSignalReceived();
7077 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7078 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7079 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7080 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7084 int UtcDaliAnimationAnimateToActorPositionZP(void)
7086 TestApplication application;
7088 Actor actor = Actor::New();
7089 Stage::GetCurrent().Add(actor);
7090 float startValue(0.0f);
7091 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7092 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7093 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7094 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7096 // Build the animation
7097 float durationSeconds(1.0f);
7098 Animation animation = Animation::New(durationSeconds);
7099 float targetZ(-5.0f);
7100 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7102 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7104 // Should return the initial properties before play
7105 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7106 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7108 // Start the animation
7111 // Should return the target property after play
7112 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7113 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7115 bool signalReceived(false);
7116 AnimationFinishCheck finishCheck(signalReceived);
7117 animation.FinishedSignal().Connect(&application, finishCheck);
7119 application.SendNotification();
7120 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7122 // We didn't expect the animation to finish yet
7123 application.SendNotification();
7124 finishCheck.CheckSignalNotReceived();
7125 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7127 application.SendNotification();
7128 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7130 // We did expect the animation to finish
7131 application.SendNotification();
7132 finishCheck.CheckSignalReceived();
7133 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7134 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7135 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7136 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7140 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7142 TestApplication application;
7144 Actor actor = Actor::New();
7145 Stage::GetCurrent().Add(actor);
7146 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7148 // Build the animation
7149 float durationSeconds(1.0f);
7150 Animation animation = Animation::New(durationSeconds);
7151 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7152 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7154 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7156 // Start the animation
7159 bool signalReceived(false);
7160 AnimationFinishCheck finishCheck(signalReceived);
7161 animation.FinishedSignal().Connect(&application, finishCheck);
7163 application.SendNotification();
7164 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7166 // We didn't expect the animation to finish yet
7167 application.SendNotification();
7168 finishCheck.CheckSignalNotReceived();
7170 // The position should have moved less, than with a linear alpha function
7171 Vector3 current(actor.GetCurrentPosition());
7172 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7173 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7174 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7175 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7176 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7177 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7179 application.SendNotification();
7180 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7182 // We did expect the animation to finish
7183 application.SendNotification();
7184 finishCheck.CheckSignalReceived();
7185 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7189 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7191 TestApplication application;
7193 Actor actor = Actor::New();
7194 Stage::GetCurrent().Add(actor);
7195 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7197 // Build the animation
7198 float durationSeconds(1.0f);
7199 Animation animation = Animation::New(durationSeconds);
7200 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7202 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7204 TimePeriod( delay, durationSeconds - delay ) );
7206 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7208 // Start the animation
7211 bool signalReceived(false);
7212 AnimationFinishCheck finishCheck(signalReceived);
7213 animation.FinishedSignal().Connect(&application, finishCheck);
7215 application.SendNotification();
7216 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7218 // We didn't expect the animation to finish yet
7219 application.SendNotification();
7220 finishCheck.CheckSignalNotReceived();
7221 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7223 application.SendNotification();
7224 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7226 // We didn't expect the animation to finish yet
7227 application.SendNotification();
7228 finishCheck.CheckSignalNotReceived();
7229 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7231 application.SendNotification();
7232 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7234 // We did expect the animation to finish
7235 application.SendNotification();
7236 finishCheck.CheckSignalReceived();
7237 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7241 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7243 TestApplication application;
7245 Actor actor = Actor::New();
7246 Stage::GetCurrent().Add(actor);
7247 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7249 // Build the animation
7250 float durationSeconds(1.0f);
7251 Animation animation = Animation::New(durationSeconds);
7252 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7254 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7256 AlphaFunction::LINEAR,
7257 TimePeriod( delay, durationSeconds - delay ) );
7259 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7261 // Start the animation
7264 bool signalReceived(false);
7265 AnimationFinishCheck finishCheck(signalReceived);
7266 animation.FinishedSignal().Connect(&application, finishCheck);
7268 application.SendNotification();
7269 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7271 // We didn't expect the animation to finish yet
7272 application.SendNotification();
7273 finishCheck.CheckSignalNotReceived();
7274 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7276 application.SendNotification();
7277 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7279 // We didn't expect the animation to finish yet
7280 application.SendNotification();
7281 finishCheck.CheckSignalNotReceived();
7282 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7284 application.SendNotification();
7285 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7287 // We did expect the animation to finish
7288 application.SendNotification();
7289 finishCheck.CheckSignalReceived();
7290 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7294 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7296 TestApplication application;
7298 Actor actor = Actor::New();
7299 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7300 Stage::GetCurrent().Add(actor);
7301 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7303 // Build the animation
7304 float durationSeconds(1.0f);
7305 Animation animation = Animation::New(durationSeconds);
7306 Degree targetRotationDegrees(90.0f);
7307 Radian targetRotationRadians(targetRotationDegrees);
7308 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7310 // Start the animation
7313 // Target value should be retrievable straight away
7314 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7316 bool signalReceived(false);
7317 AnimationFinishCheck finishCheck(signalReceived);
7318 animation.FinishedSignal().Connect(&application, finishCheck);
7320 application.SendNotification();
7321 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7323 // We didn't expect the animation to finish yet
7324 application.SendNotification();
7325 finishCheck.CheckSignalNotReceived();
7326 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7328 application.SendNotification();
7329 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7331 // We didn't expect the animation to finish yet
7332 application.SendNotification();
7333 finishCheck.CheckSignalNotReceived();
7334 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7336 application.SendNotification();
7337 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7339 // We didn't expect the animation to finish yet
7340 application.SendNotification();
7341 finishCheck.CheckSignalNotReceived();
7342 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7344 application.SendNotification();
7345 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7347 // We did expect the animation to finish
7348 application.SendNotification();
7349 finishCheck.CheckSignalReceived();
7350 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7354 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7356 TestApplication application;
7358 Actor actor = Actor::New();
7359 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7360 Stage::GetCurrent().Add(actor);
7361 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7363 // Build the animation
7364 float durationSeconds(1.0f);
7365 Animation animation = Animation::New(durationSeconds);
7366 Degree targetRotationDegrees(90.0f);
7367 Radian targetRotationRadians(targetRotationDegrees);
7368 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7369 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7371 // Start the animation
7374 bool signalReceived(false);
7375 AnimationFinishCheck finishCheck(signalReceived);
7376 animation.FinishedSignal().Connect(&application, finishCheck);
7378 application.SendNotification();
7379 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7381 // We didn't expect the animation to finish yet
7382 application.SendNotification();
7383 finishCheck.CheckSignalNotReceived();
7384 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7386 application.SendNotification();
7387 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7389 // We didn't expect the animation to finish yet
7390 application.SendNotification();
7391 finishCheck.CheckSignalNotReceived();
7392 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7394 application.SendNotification();
7395 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7397 // We didn't expect the animation to finish yet
7398 application.SendNotification();
7399 finishCheck.CheckSignalNotReceived();
7400 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7402 application.SendNotification();
7403 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7405 // We did expect the animation to finish
7406 application.SendNotification();
7407 finishCheck.CheckSignalReceived();
7408 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7412 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7414 TestApplication application;
7416 Actor actor = Actor::New();
7417 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7418 Stage::GetCurrent().Add(actor);
7419 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7421 // Build the animation
7422 float durationSeconds(1.0f);
7423 Animation animation = Animation::New(durationSeconds);
7424 Degree targetRotationDegrees(90.0f);
7425 Radian targetRotationRadians(targetRotationDegrees);
7426 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7428 // Start the animation
7431 bool signalReceived(false);
7432 AnimationFinishCheck finishCheck(signalReceived);
7433 animation.FinishedSignal().Connect(&application, finishCheck);
7435 application.SendNotification();
7436 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7438 // We didn't expect the animation to finish yet
7439 application.SendNotification();
7440 finishCheck.CheckSignalNotReceived();
7441 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7443 application.SendNotification();
7444 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7446 // We didn't expect the animation to finish yet
7447 application.SendNotification();
7448 finishCheck.CheckSignalNotReceived();
7449 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7451 application.SendNotification();
7452 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7454 // We didn't expect the animation to finish yet
7455 application.SendNotification();
7456 finishCheck.CheckSignalNotReceived();
7457 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7459 application.SendNotification();
7460 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7462 // We did expect the animation to finish
7463 application.SendNotification();
7464 finishCheck.CheckSignalReceived();
7465 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7469 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7471 TestApplication application;
7473 Actor actor = Actor::New();
7474 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7475 Stage::GetCurrent().Add(actor);
7476 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7478 // Build the animation
7479 float durationSeconds(1.0f);
7480 Animation animation = Animation::New(durationSeconds);
7481 Degree targetRotationDegrees(90.0f);
7482 Radian targetRotationRadians(targetRotationDegrees);
7484 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7486 // Start the animation
7489 bool signalReceived(false);
7490 AnimationFinishCheck finishCheck(signalReceived);
7491 animation.FinishedSignal().Connect(&application, finishCheck);
7493 application.SendNotification();
7494 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7496 // We didn't expect the animation to finish yet
7497 application.SendNotification();
7498 finishCheck.CheckSignalNotReceived();
7499 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7500 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7502 application.SendNotification();
7503 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7505 // We didn't expect the animation to finish yet
7506 application.SendNotification();
7507 finishCheck.CheckSignalNotReceived();
7508 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7509 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7511 application.SendNotification();
7512 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7514 // We didn't expect the animation to finish yet
7515 application.SendNotification();
7516 finishCheck.CheckSignalNotReceived();
7517 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7518 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7520 application.SendNotification();
7521 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7523 // We did expect the animation to finish
7524 application.SendNotification();
7525 finishCheck.CheckSignalReceived();
7526 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7530 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7532 TestApplication application;
7534 Actor actor = Actor::New();
7535 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7536 Stage::GetCurrent().Add(actor);
7537 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7539 // Build the animation
7540 float durationSeconds(1.0f);
7541 Animation animation = Animation::New(durationSeconds);
7542 Degree targetRotationDegrees(90.0f);
7543 Radian targetRotationRadians(targetRotationDegrees);
7545 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7547 // Start the animation
7550 bool signalReceived(false);
7551 AnimationFinishCheck finishCheck(signalReceived);
7552 animation.FinishedSignal().Connect(&application, finishCheck);
7554 application.SendNotification();
7555 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7557 // We didn't expect the animation to finish yet
7558 application.SendNotification();
7559 finishCheck.CheckSignalNotReceived();
7560 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7561 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7563 application.SendNotification();
7564 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7566 // We didn't expect the animation to finish yet
7567 application.SendNotification();
7568 finishCheck.CheckSignalNotReceived();
7569 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7570 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7572 application.SendNotification();
7573 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7575 // We didn't expect the animation to finish yet
7576 application.SendNotification();
7577 finishCheck.CheckSignalNotReceived();
7578 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7579 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7581 application.SendNotification();
7582 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7584 // We did expect the animation to finish
7585 application.SendNotification();
7586 finishCheck.CheckSignalReceived();
7587 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7591 int UtcDaliAnimationAnimateToActorScaleP(void)
7593 TestApplication application;
7595 Actor actor = Actor::New();
7596 Stage::GetCurrent().Add(actor);
7597 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7599 // Build the animation
7600 float durationSeconds(1.0f);
7601 Animation animation = Animation::New(durationSeconds);
7602 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7603 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7605 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7607 // Start the animation
7610 // Target value should be retrievable straight away
7611 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
7612 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
7613 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
7614 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
7616 bool signalReceived(false);
7617 AnimationFinishCheck finishCheck(signalReceived);
7618 animation.FinishedSignal().Connect(&application, finishCheck);
7620 application.SendNotification();
7621 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7623 // We didn't expect the animation to finish yet
7624 application.SendNotification();
7625 finishCheck.CheckSignalNotReceived();
7626 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7628 application.SendNotification();
7629 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7631 // We did expect the animation to finish
7632 application.SendNotification();
7633 finishCheck.CheckSignalReceived();
7634 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7637 finishCheck.Reset();
7638 actor.SetScale(Vector3::ONE);
7639 application.SendNotification();
7640 application.Render(0);
7641 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7643 // Repeat with a different (ease-in) alpha function
7644 animation = Animation::New(durationSeconds);
7645 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7646 animation.FinishedSignal().Connect(&application, finishCheck);
7649 application.SendNotification();
7650 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7652 // We didn't expect the animation to finish yet
7653 application.SendNotification();
7654 finishCheck.CheckSignalNotReceived();
7656 // The scale should have grown less, than with a linear alpha function
7657 Vector3 current(actor.GetCurrentScale());
7658 DALI_TEST_CHECK( current.x > 1.0f );
7659 DALI_TEST_CHECK( current.y > 1.0f );
7660 DALI_TEST_CHECK( current.z > 1.0f );
7661 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7662 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7663 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7665 application.SendNotification();
7666 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7668 // We did expect the animation to finish
7669 application.SendNotification();
7670 finishCheck.CheckSignalReceived();
7671 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7674 finishCheck.Reset();
7675 actor.SetScale(Vector3::ONE);
7676 application.SendNotification();
7677 application.Render(0);
7678 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7680 // Repeat with a delay
7682 animation = Animation::New(durationSeconds);
7683 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7684 animation.FinishedSignal().Connect(&application, finishCheck);
7687 application.SendNotification();
7688 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7690 // We didn't expect the animation to finish yet
7691 application.SendNotification();
7692 finishCheck.CheckSignalNotReceived();
7693 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7695 application.SendNotification();
7696 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7698 // We did expect the animation to finish
7699 application.SendNotification();
7700 finishCheck.CheckSignalReceived();
7701 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7705 int UtcDaliAnimationAnimateToActorScaleXP(void)
7707 TestApplication application;
7709 Actor actor = Actor::New();
7710 Stage::GetCurrent().Add(actor);
7711 float startValue(1.0f);
7712 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
7713 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7714 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7715 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7716 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7717 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7718 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7720 // Build the animation
7721 float durationSeconds(1.0f);
7722 Animation animation = Animation::New(durationSeconds);
7723 float targetX(10.0f);
7724 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
7726 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7728 // Start the animation
7731 // Target value should be retrievable straight away
7732 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
7733 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7735 bool signalReceived(false);
7736 AnimationFinishCheck finishCheck(signalReceived);
7737 animation.FinishedSignal().Connect(&application, finishCheck);
7739 application.SendNotification();
7740 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7742 // We didn't expect the animation to finish yet
7743 application.SendNotification();
7744 finishCheck.CheckSignalNotReceived();
7745 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
7746 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
7747 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7748 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7750 application.SendNotification();
7751 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7753 // We did expect the animation to finish
7754 application.SendNotification();
7755 finishCheck.CheckSignalReceived();
7756 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
7757 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
7758 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7759 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7763 int UtcDaliAnimationAnimateToActorScaleYP(void)
7765 TestApplication application;
7767 Actor actor = Actor::New();
7768 Stage::GetCurrent().Add(actor);
7769 float startValue(1.0f);
7770 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
7771 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7772 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7773 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7774 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7776 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7778 // Build the animation
7779 float durationSeconds(1.0f);
7780 Animation animation = Animation::New(durationSeconds);
7781 float targetY(1000.0f);
7782 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7784 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7786 // Start the animation
7789 // Target value should be retrievable straight away
7790 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
7791 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7793 bool signalReceived(false);
7794 AnimationFinishCheck finishCheck(signalReceived);
7795 animation.FinishedSignal().Connect(&application, finishCheck);
7797 application.SendNotification();
7798 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7800 // We didn't expect the animation to finish yet
7801 application.SendNotification();
7802 finishCheck.CheckSignalNotReceived();
7803 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7804 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7805 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
7806 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7808 application.SendNotification();
7809 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7811 // We did expect the animation to finish
7812 application.SendNotification();
7813 finishCheck.CheckSignalReceived();
7814 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7815 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7816 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
7817 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7821 int UtcDaliAnimationAnimateToActorScaleZP(void)
7823 TestApplication application;
7825 Actor actor = Actor::New();
7826 Stage::GetCurrent().Add(actor);
7827 float startValue(1.0f);
7828 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7829 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7830 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7831 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7832 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7833 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7834 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
7836 // Build the animation
7837 float durationSeconds(1.0f);
7838 Animation animation = Animation::New(durationSeconds);
7839 float targetZ(-1000.0f);
7840 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7842 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7844 // Start the animation
7847 // Target value should be retrievable straight away
7848 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
7849 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7851 bool signalReceived(false);
7852 AnimationFinishCheck finishCheck(signalReceived);
7853 animation.FinishedSignal().Connect(&application, finishCheck);
7855 application.SendNotification();
7856 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7858 // We didn't expect the animation to finish yet
7859 application.SendNotification();
7860 finishCheck.CheckSignalNotReceived();
7861 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7862 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7863 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7864 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
7866 application.SendNotification();
7867 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7869 // We did expect the animation to finish
7870 application.SendNotification();
7871 finishCheck.CheckSignalReceived();
7872 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7873 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
7874 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
7875 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
7879 int UtcDaliAnimationAnimateToActorColorP(void)
7881 TestApplication application;
7883 Actor actor = Actor::New();
7884 Stage::GetCurrent().Add(actor);
7885 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7887 // Build the animation
7888 float durationSeconds(1.0f);
7889 Animation animation = Animation::New(durationSeconds);
7890 Vector4 targetColor(Color::RED);
7891 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7893 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7894 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7896 // Start the animation
7899 // Target value should be retrievable straight away
7900 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
7901 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
7902 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
7903 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
7904 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
7905 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
7907 bool signalReceived(false);
7908 AnimationFinishCheck finishCheck(signalReceived);
7909 animation.FinishedSignal().Connect(&application, finishCheck);
7911 application.SendNotification();
7912 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7914 // We didn't expect the animation to finish yet
7915 application.SendNotification();
7916 finishCheck.CheckSignalNotReceived();
7917 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7919 application.SendNotification();
7920 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7922 // We did expect the animation to finish
7923 application.SendNotification();
7924 finishCheck.CheckSignalReceived();
7925 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7928 finishCheck.Reset();
7929 actor.SetColor(Color::WHITE);
7930 application.SendNotification();
7931 application.Render(0);
7932 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7934 // Repeat with a different (ease-in) alpha function
7935 animation = Animation::New(durationSeconds);
7936 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7937 animation.FinishedSignal().Connect(&application, finishCheck);
7940 application.SendNotification();
7941 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7943 // We didn't expect the animation to finish yet
7944 application.SendNotification();
7945 finishCheck.CheckSignalNotReceived();
7947 // The color should have changed less, than with a linear alpha function
7948 Vector4 current(actor.GetCurrentColor());
7949 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7950 DALI_TEST_CHECK( current.y < 1.0f );
7951 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7952 DALI_TEST_CHECK( current.z < 1.0f );
7953 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7954 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7956 application.SendNotification();
7957 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7959 // We did expect the animation to finish
7960 application.SendNotification();
7961 finishCheck.CheckSignalReceived();
7962 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7965 finishCheck.Reset();
7966 actor.SetColor(Color::WHITE);
7967 application.SendNotification();
7968 application.Render(0);
7969 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7971 // Repeat with a shorter animator duration
7972 float animatorDuration = 0.5f;
7973 animation = Animation::New(durationSeconds);
7974 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7975 animation.FinishedSignal().Connect(&application, finishCheck);
7978 application.SendNotification();
7979 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7981 // We didn't expect the animation to finish yet
7982 application.SendNotification();
7983 finishCheck.CheckSignalNotReceived();
7984 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7986 application.SendNotification();
7987 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7989 // We didn't expect the animation to finish yet
7990 application.SendNotification();
7991 finishCheck.CheckSignalNotReceived();
7992 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7994 application.SendNotification();
7995 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7997 // We did expect the animation to finish
7998 application.SendNotification();
7999 finishCheck.CheckSignalReceived();
8000 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8004 int UtcDaliAnimationAnimateToActorColorRedP(void)
8006 TestApplication application;
8008 Actor actor = Actor::New();
8009 Stage::GetCurrent().Add(actor);
8010 float startValue(1.0f);
8011 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
8012 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8013 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8014 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8015 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8016 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8017 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8018 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8019 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8021 // Build the animation
8022 float durationSeconds(1.0f);
8023 Animation animation = Animation::New(durationSeconds);
8024 float targetRed(0.5f);
8025 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8027 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8029 // Start the animation
8032 // Target value should be retrievable straight away
8033 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8034 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8036 bool signalReceived(false);
8037 AnimationFinishCheck finishCheck(signalReceived);
8038 animation.FinishedSignal().Connect(&application, finishCheck);
8040 application.SendNotification();
8041 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8043 // We didn't expect the animation to finish yet
8044 application.SendNotification();
8045 finishCheck.CheckSignalNotReceived();
8046 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8047 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
8048 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8049 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8050 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8052 application.SendNotification();
8053 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8055 // We did expect the animation to finish
8056 application.SendNotification();
8057 finishCheck.CheckSignalReceived();
8058 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8059 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
8060 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8061 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8062 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8066 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8068 TestApplication application;
8070 Actor actor = Actor::New();
8071 Stage::GetCurrent().Add(actor);
8072 float startValue(1.0f);
8073 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8074 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8075 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8076 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8077 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8078 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8079 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8080 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8081 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8083 // Build the animation
8084 float durationSeconds(1.0f);
8085 Animation animation = Animation::New(durationSeconds);
8086 float targetGreen(0.5f);
8087 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8089 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8091 // Start the animation
8094 // Target value should be retrievable straight away
8095 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8096 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8098 bool signalReceived(false);
8099 AnimationFinishCheck finishCheck(signalReceived);
8100 animation.FinishedSignal().Connect(&application, finishCheck);
8102 application.SendNotification();
8103 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8105 // We didn't expect the animation to finish yet
8106 application.SendNotification();
8107 finishCheck.CheckSignalNotReceived();
8108 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8109 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8110 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8111 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8112 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8114 application.SendNotification();
8115 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8117 // We did expect the animation to finish
8118 application.SendNotification();
8119 finishCheck.CheckSignalReceived();
8120 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8121 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8122 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8123 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8124 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8128 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8130 TestApplication application;
8132 Actor actor = Actor::New();
8133 Stage::GetCurrent().Add(actor);
8134 float startValue(1.0f);
8135 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8136 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8137 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8138 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8139 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8140 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8141 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8142 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8143 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8145 // Build the animation
8146 float durationSeconds(1.0f);
8147 Animation animation = Animation::New(durationSeconds);
8148 float targetBlue(0.5f);
8149 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8151 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8153 // Start the animation
8156 // Target value should be retrievable straight away
8157 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8158 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8160 bool signalReceived(false);
8161 AnimationFinishCheck finishCheck(signalReceived);
8162 animation.FinishedSignal().Connect(&application, finishCheck);
8164 application.SendNotification();
8165 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8167 // We didn't expect the animation to finish yet
8168 application.SendNotification();
8169 finishCheck.CheckSignalNotReceived();
8170 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8171 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8172 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8173 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8174 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8176 application.SendNotification();
8177 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8179 // We did expect the animation to finish
8180 application.SendNotification();
8181 finishCheck.CheckSignalReceived();
8182 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8183 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8184 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8185 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8186 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8190 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8192 TestApplication application;
8194 Actor actor = Actor::New();
8195 Stage::GetCurrent().Add(actor);
8196 float startValue(1.0f);
8197 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8198 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8199 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8200 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8201 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8202 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8203 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8204 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8205 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8207 // Build the animation
8208 float durationSeconds(1.0f);
8209 Animation animation = Animation::New(durationSeconds);
8210 float targetAlpha(0.5f);
8211 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8213 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8215 // Start the animation
8218 // Target value should be retrievable straight away
8219 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8220 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8221 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8223 bool signalReceived(false);
8224 AnimationFinishCheck finishCheck(signalReceived);
8225 animation.FinishedSignal().Connect(&application, finishCheck);
8227 application.SendNotification();
8228 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8230 // We didn't expect the animation to finish yet
8231 application.SendNotification();
8232 finishCheck.CheckSignalNotReceived();
8233 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8234 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8235 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8236 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8237 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8239 application.SendNotification();
8240 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8242 // We did expect the animation to finish
8243 application.SendNotification();
8244 finishCheck.CheckSignalReceived();
8245 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8246 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8247 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8248 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8249 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8253 int UtcDaliAnimationKeyFrames01P(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);
8262 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8264 KeyFrames keyFrames2( keyFrames);
8265 DALI_TEST_CHECK( keyFrames2 );
8266 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8268 KeyFrames keyFrames3 = KeyFrames::New();
8269 keyFrames3.Add(0.6f, true);
8270 DALI_TEST_CHECK( keyFrames3 );
8271 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8273 keyFrames3 = keyFrames;
8274 DALI_TEST_CHECK( keyFrames3 );
8275 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8280 int UtcDaliAnimationKeyFrames02P(void)
8282 TestApplication application;
8284 KeyFrames keyFrames = KeyFrames::New();
8285 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8287 keyFrames.Add(0.0f, 0.1f);
8288 keyFrames.Add(0.2f, 0.5f);
8289 keyFrames.Add(0.4f, 0.0f);
8290 keyFrames.Add(0.6f, 1.0f);
8291 keyFrames.Add(0.8f, 0.7f);
8292 keyFrames.Add(1.0f, 0.9f);
8294 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8298 keyFrames.Add(1.9f, false);
8300 catch (Dali::DaliException& e)
8302 DALI_TEST_PRINT_ASSERT( e );
8303 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8308 int UtcDaliAnimationKeyFrames03P(void)
8310 TestApplication application;
8312 KeyFrames keyFrames = KeyFrames::New();
8313 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8315 keyFrames.Add(0.0f, true);
8316 keyFrames.Add(0.2f, false);
8317 keyFrames.Add(0.4f, false);
8318 keyFrames.Add(0.6f, true);
8319 keyFrames.Add(0.8f, true);
8320 keyFrames.Add(1.0f, false);
8322 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8326 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8328 catch (Dali::DaliException& e)
8330 DALI_TEST_PRINT_ASSERT( e );
8331 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8336 int UtcDaliAnimationKeyFrames04P(void)
8338 TestApplication application;
8340 KeyFrames keyFrames = KeyFrames::New();
8341 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8343 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8344 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8345 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8346 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8347 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8348 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8350 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8354 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8356 catch (Dali::DaliException& e)
8358 DALI_TEST_PRINT_ASSERT( e );
8359 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8364 int UtcDaliAnimationKeyFrames05P(void)
8366 TestApplication application;
8368 KeyFrames keyFrames = KeyFrames::New();
8369 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8371 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8372 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8373 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8374 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8375 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8376 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8378 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8382 keyFrames.Add(0.7f, 1.0f);
8384 catch (Dali::DaliException& e)
8386 DALI_TEST_PRINT_ASSERT( e );
8387 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8392 int UtcDaliAnimationKeyFrames06P(void)
8394 TestApplication application;
8396 KeyFrames keyFrames = KeyFrames::New();
8397 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8399 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8400 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8401 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8402 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8403 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8404 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8406 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8410 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8412 catch (Dali::DaliException& e)
8414 DALI_TEST_PRINT_ASSERT( e );
8415 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8420 int UtcDaliAnimationKeyFrames07P(void)
8422 TestApplication application;
8424 KeyFrames keyFrames = KeyFrames::New();
8425 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8427 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8428 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8429 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8430 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8431 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8432 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8434 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8438 keyFrames.Add(0.7f, 1.1f);
8440 catch (Dali::DaliException& e)
8442 DALI_TEST_PRINT_ASSERT( e );
8443 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8448 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8450 TestApplication application;
8452 float startValue(1.0f);
8453 Actor actor = Actor::New();
8454 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8455 Stage::GetCurrent().Add(actor);
8457 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8458 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8459 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8460 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8461 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8462 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8463 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8464 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8465 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8467 // Build the animation
8468 float durationSeconds(1.0f);
8469 Animation animation = Animation::New(durationSeconds);
8471 KeyFrames keyFrames = KeyFrames::New();
8472 keyFrames.Add(0.0f, 0.1f);
8473 keyFrames.Add(0.2f, 0.5f);
8474 keyFrames.Add(0.4f, 0.0f);
8475 keyFrames.Add(0.6f, 1.0f);
8476 keyFrames.Add(0.8f, 0.7f);
8477 keyFrames.Add(1.0f, 0.9f);
8479 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8481 // Start the animation
8484 // Final key frame value should be retrievable straight away
8485 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
8487 bool signalReceived(false);
8488 AnimationFinishCheck finishCheck(signalReceived);
8489 animation.FinishedSignal().Connect(&application, finishCheck);
8490 application.SendNotification();
8491 application.Render(0);
8492 application.SendNotification();
8493 finishCheck.CheckSignalNotReceived();
8494 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8496 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8497 application.SendNotification();
8498 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8499 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8500 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8501 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8502 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8504 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8505 application.SendNotification();
8506 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8507 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8508 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8509 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8510 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8512 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8513 application.SendNotification();
8514 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8515 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8516 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8517 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8518 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8520 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8521 application.SendNotification();
8522 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8523 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8524 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8525 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8526 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8528 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8529 application.SendNotification();
8530 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8531 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8532 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8533 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8534 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8536 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8537 application.SendNotification();
8538 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8539 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8540 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8541 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8542 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8544 // We did expect the animation to finish
8546 finishCheck.CheckSignalReceived();
8550 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8552 TestApplication application;
8554 float startValue(1.0f);
8555 Actor actor = Actor::New();
8556 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8557 Stage::GetCurrent().Add(actor);
8559 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8560 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8561 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8562 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8563 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8564 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8565 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8566 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8567 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8569 // Build the animation
8570 float durationSeconds(1.0f);
8571 Animation animation = Animation::New(durationSeconds);
8573 KeyFrames keyFrames = KeyFrames::New();
8574 keyFrames.Add(0.0f, 0.1f);
8575 keyFrames.Add(0.2f, 0.5f);
8576 keyFrames.Add(0.4f, 0.0f);
8577 keyFrames.Add(0.6f, 1.0f);
8578 keyFrames.Add(0.8f, 0.7f);
8579 keyFrames.Add(1.0f, 0.9f);
8581 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8583 // Start the animation
8586 bool signalReceived(false);
8587 AnimationFinishCheck finishCheck(signalReceived);
8588 animation.FinishedSignal().Connect(&application, finishCheck);
8589 application.SendNotification();
8590 application.Render(0);
8591 application.SendNotification();
8592 finishCheck.CheckSignalNotReceived();
8593 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8595 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8596 application.SendNotification();
8597 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8598 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8599 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8600 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
8601 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8603 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8604 application.SendNotification();
8605 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8606 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8607 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8608 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
8609 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8611 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8612 application.SendNotification();
8613 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8614 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8615 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8616 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
8617 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8619 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8620 application.SendNotification();
8621 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8622 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8623 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8624 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
8625 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8627 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8628 application.SendNotification();
8629 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8630 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8631 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8632 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
8633 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8635 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8636 application.SendNotification();
8637 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8638 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8639 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8640 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
8641 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8643 // We did expect the animation to finish
8645 finishCheck.CheckSignalReceived();
8649 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8651 TestApplication application;
8653 float startValue(1.0f);
8654 Actor actor = Actor::New();
8655 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8656 Stage::GetCurrent().Add(actor);
8658 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8659 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8660 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8661 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8662 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8663 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8664 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8665 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8666 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8668 // Build the animation
8669 float durationSeconds(1.0f);
8670 Animation animation = Animation::New(durationSeconds);
8672 KeyFrames keyFrames = KeyFrames::New();
8673 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8674 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8675 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8677 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8679 // Start the animation
8682 bool signalReceived(false);
8683 AnimationFinishCheck finishCheck(signalReceived);
8684 animation.FinishedSignal().Connect(&application, finishCheck);
8685 application.SendNotification();
8686 application.Render(0);
8687 application.SendNotification();
8688 finishCheck.CheckSignalNotReceived();
8689 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
8690 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8691 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
8692 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8694 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8695 application.SendNotification();
8696 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
8697 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
8698 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
8699 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
8701 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8702 application.SendNotification();
8703 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
8704 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8705 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
8706 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8708 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8709 application.SendNotification();
8710 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
8711 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
8712 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
8713 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
8715 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8716 application.SendNotification();
8717 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
8718 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8719 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
8720 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8722 // We did expect the animation to finish
8724 finishCheck.CheckSignalReceived();
8728 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
8730 TestApplication application;
8732 float startValue(1.0f);
8733 Actor actor = Actor::New();
8734 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8735 Stage::GetCurrent().Add(actor);
8737 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8738 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8739 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8740 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8741 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8742 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8743 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8744 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8745 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8747 // Build the animation
8748 float durationSeconds(1.0f);
8749 Animation animation = Animation::New(durationSeconds);
8751 KeyFrames keyFrames = KeyFrames::New();
8752 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8753 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8754 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8756 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
8758 // Start the animation
8761 bool signalReceived(false);
8762 AnimationFinishCheck finishCheck(signalReceived);
8763 animation.FinishedSignal().Connect(&application, finishCheck);
8764 application.SendNotification();
8765 application.Render(0);
8766 application.SendNotification();
8767 finishCheck.CheckSignalNotReceived();
8768 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
8769 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8770 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
8771 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
8773 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8774 application.SendNotification();
8775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
8776 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
8777 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
8778 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
8780 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8781 application.SendNotification();
8782 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
8783 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
8784 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
8785 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
8787 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8788 application.SendNotification();
8789 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
8790 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
8791 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
8792 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
8794 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8795 application.SendNotification();
8796 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
8797 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
8798 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
8799 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
8801 // We did expect the animation to finish
8803 finishCheck.CheckSignalReceived();
8807 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
8809 TestApplication application;
8811 Actor actor = Actor::New();
8812 AngleAxis aa(Degree(90), Vector3::XAXIS);
8813 actor.SetOrientation(aa.angle, aa.axis);
8814 Stage::GetCurrent().Add(actor);
8816 application.SendNotification();
8817 application.Render(0);
8819 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8821 // Build the animation
8822 float durationSeconds(1.0f);
8823 Animation animation = Animation::New(durationSeconds);
8825 KeyFrames keyFrames = KeyFrames::New();
8826 keyFrames.Add(0.0f, false);
8827 keyFrames.Add(0.2f, true);
8828 keyFrames.Add(0.4f, true);
8829 keyFrames.Add(0.8f, false);
8830 keyFrames.Add(1.0f, true);
8832 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
8834 // Start the animation
8837 bool signalReceived(false);
8838 AnimationFinishCheck finishCheck(signalReceived);
8839 animation.FinishedSignal().Connect(&application, finishCheck);
8840 application.SendNotification();
8841 application.SendNotification();
8842 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8843 application.SendNotification();
8844 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8845 application.SendNotification();
8847 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8848 finishCheck.CheckSignalReceived();
8852 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8854 TestApplication application;
8856 Actor actor = Actor::New();
8857 AngleAxis aa(Degree(90), Vector3::XAXIS);
8858 actor.SetOrientation(aa.angle, aa.axis);
8859 Stage::GetCurrent().Add(actor);
8861 application.SendNotification();
8862 application.Render(0);
8864 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8866 // Build the animation
8867 float durationSeconds(1.0f);
8868 Animation animation = Animation::New(durationSeconds);
8870 KeyFrames keyFrames = KeyFrames::New();
8871 keyFrames.Add(0.0f, false);
8872 keyFrames.Add(0.2f, true);
8873 keyFrames.Add(0.4f, true);
8874 keyFrames.Add(0.8f, false);
8875 keyFrames.Add(1.0f, true);
8877 //Cubic interpolation for boolean values should be ignored
8878 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8880 // Start the animation
8883 bool signalReceived(false);
8884 AnimationFinishCheck finishCheck(signalReceived);
8885 animation.FinishedSignal().Connect(&application, finishCheck);
8886 application.SendNotification();
8887 application.SendNotification();
8888 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8889 application.SendNotification();
8890 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8891 application.SendNotification();
8893 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8894 finishCheck.CheckSignalReceived();
8898 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8900 TestApplication application;
8902 Actor actor = Actor::New();
8903 AngleAxis aa(Degree(90), Vector3::XAXIS);
8904 actor.SetOrientation(aa.angle, aa.axis);
8905 Stage::GetCurrent().Add(actor);
8907 application.SendNotification();
8908 application.Render(0);
8909 Quaternion start(Radian(aa.angle), aa.axis);
8910 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8912 // Build the animation
8913 float durationSeconds(1.0f);
8914 Animation animation = Animation::New(durationSeconds);
8916 KeyFrames keyFrames = KeyFrames::New();
8917 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8919 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8921 // Start the animation
8924 bool signalReceived(false);
8925 AnimationFinishCheck finishCheck(signalReceived);
8926 animation.FinishedSignal().Connect(&application, finishCheck);
8927 application.SendNotification();
8928 application.SendNotification();
8929 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8930 application.SendNotification();
8931 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8932 application.SendNotification();
8934 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8936 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8937 finishCheck.CheckSignalReceived();
8941 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8943 TestApplication application;
8945 Actor actor = Actor::New();
8946 AngleAxis aa(Degree(90), Vector3::XAXIS);
8947 actor.SetOrientation(aa.angle, aa.axis);
8948 application.SendNotification();
8949 application.Render(0);
8950 Stage::GetCurrent().Add(actor);
8952 Quaternion start(Radian(aa.angle), aa.axis);
8953 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8955 // Build the animation
8956 float durationSeconds(1.0f);
8957 Animation animation = Animation::New(durationSeconds);
8959 KeyFrames keyFrames = KeyFrames::New();
8960 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8961 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8962 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8964 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8966 // Start the animation
8969 bool signalReceived(false);
8970 AnimationFinishCheck finishCheck(signalReceived);
8971 animation.FinishedSignal().Connect(&application, finishCheck);
8972 application.SendNotification();
8973 application.Render(0);
8974 application.SendNotification();
8975 finishCheck.CheckSignalNotReceived();
8977 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8978 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8980 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8981 application.SendNotification();
8982 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8983 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8985 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8986 application.SendNotification();
8987 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8988 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8990 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8991 application.SendNotification();
8992 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8993 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8995 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8996 application.SendNotification();
8997 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8998 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9000 // We did expect the animation to finish
9002 finishCheck.CheckSignalReceived();
9006 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9008 TestApplication application;
9010 Actor actor = Actor::New();
9011 AngleAxis aa(Degree(90), Vector3::XAXIS);
9012 actor.SetOrientation(aa.angle, aa.axis);
9013 Stage::GetCurrent().Add(actor);
9015 application.SendNotification();
9016 application.Render(0);
9017 Quaternion start(Radian(aa.angle), aa.axis);
9018 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9020 // Build the animation
9021 float durationSeconds(1.0f);
9022 Animation animation = Animation::New(durationSeconds);
9024 KeyFrames keyFrames = KeyFrames::New();
9025 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9027 //Cubic interpolation should be ignored for quaternions
9028 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9030 // Start the animation
9033 bool signalReceived(false);
9034 AnimationFinishCheck finishCheck(signalReceived);
9035 animation.FinishedSignal().Connect(&application, finishCheck);
9036 application.SendNotification();
9037 application.SendNotification();
9038 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9039 application.SendNotification();
9040 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9041 application.SendNotification();
9043 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9045 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9046 finishCheck.CheckSignalReceived();
9050 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9052 TestApplication application;
9054 Actor actor = Actor::New();
9055 AngleAxis aa(Degree(90), Vector3::XAXIS);
9056 actor.SetOrientation(aa.angle, aa.axis);
9057 application.SendNotification();
9058 application.Render(0);
9059 Stage::GetCurrent().Add(actor);
9061 Quaternion start(Radian(aa.angle), aa.axis);
9062 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9064 // Build the animation
9065 float durationSeconds(1.0f);
9066 Animation animation = Animation::New(durationSeconds);
9068 KeyFrames keyFrames = KeyFrames::New();
9069 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9070 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9071 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9073 //Cubic interpolation should be ignored for quaternions
9074 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9076 // Start the animation
9079 bool signalReceived(false);
9080 AnimationFinishCheck finishCheck(signalReceived);
9081 animation.FinishedSignal().Connect(&application, finishCheck);
9082 application.SendNotification();
9083 application.Render(0);
9084 application.SendNotification();
9085 finishCheck.CheckSignalNotReceived();
9087 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9088 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9090 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9091 application.SendNotification();
9092 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9093 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9095 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9096 application.SendNotification();
9097 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9098 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9100 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9101 application.SendNotification();
9102 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9103 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9105 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9106 application.SendNotification();
9107 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9108 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9110 // We did expect the animation to finish
9112 finishCheck.CheckSignalReceived();
9116 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9118 TestApplication application;
9120 float startValue(1.0f);
9121 Actor actor = Actor::New();
9122 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9123 Stage::GetCurrent().Add(actor);
9125 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9126 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9127 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9128 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9129 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9130 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9131 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9132 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9133 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9135 // Build the animation
9136 float durationSeconds(1.0f);
9137 Animation animation = Animation::New(durationSeconds);
9139 KeyFrames keyFrames = KeyFrames::New();
9140 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9141 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9142 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9144 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9146 // Start the animation
9149 bool signalReceived(false);
9150 AnimationFinishCheck finishCheck(signalReceived);
9151 animation.FinishedSignal().Connect(&application, finishCheck);
9152 application.SendNotification();
9153 application.Render(0);
9154 application.SendNotification();
9155 finishCheck.CheckSignalNotReceived();
9156 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9157 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9158 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9159 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9161 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9162 application.SendNotification();
9163 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9164 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9165 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9166 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9168 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9169 application.SendNotification();
9170 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9171 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9172 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9173 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9175 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9176 application.SendNotification();
9177 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9178 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9179 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9180 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9182 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9183 application.SendNotification();
9184 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9185 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9186 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9187 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9189 // We did expect the animation to finish
9191 finishCheck.CheckSignalReceived();
9195 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9197 TestApplication application;
9199 float startValue(1.0f);
9200 Actor actor = Actor::New();
9201 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9202 Stage::GetCurrent().Add(actor);
9204 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9205 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9206 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9207 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9208 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9209 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9210 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9211 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9212 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9214 // Build the animation
9215 float durationSeconds(1.0f);
9216 Animation animation = Animation::New(durationSeconds);
9218 KeyFrames keyFrames = KeyFrames::New();
9219 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9220 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9221 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9223 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9225 // Start the animation
9228 bool signalReceived(false);
9229 AnimationFinishCheck finishCheck(signalReceived);
9230 animation.FinishedSignal().Connect(&application, finishCheck);
9231 application.SendNotification();
9232 application.Render(0);
9233 application.SendNotification();
9234 finishCheck.CheckSignalNotReceived();
9235 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9236 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9237 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9238 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9240 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9241 application.SendNotification();
9242 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9243 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9244 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9245 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9247 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9248 application.SendNotification();
9249 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9250 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9251 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9252 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9254 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9255 application.SendNotification();
9256 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9257 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9258 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9259 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9261 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9262 application.SendNotification();
9263 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9264 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9265 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9266 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9268 // We did expect the animation to finish
9270 finishCheck.CheckSignalReceived();
9274 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9276 TestApplication application;
9278 float startValue(1.0f);
9279 Actor actor = Actor::New();
9280 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9281 Stage::GetCurrent().Add(actor);
9283 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9284 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9285 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9286 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9287 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9288 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9289 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9290 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9291 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9293 // Build the animation
9294 float durationSeconds(1.0f);
9296 Animation animation = Animation::New(durationSeconds);
9298 KeyFrames keyFrames = KeyFrames::New();
9299 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9300 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9301 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9303 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9305 // Start the animation
9308 bool signalReceived(false);
9309 AnimationFinishCheck finishCheck(signalReceived);
9310 animation.FinishedSignal().Connect(&application, finishCheck);
9311 application.SendNotification();
9313 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9314 application.SendNotification();
9315 finishCheck.CheckSignalNotReceived();
9316 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9317 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9318 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9319 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9321 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9322 application.SendNotification();
9323 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9324 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9325 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9326 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9328 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9329 application.SendNotification();
9330 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9331 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9332 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9333 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9335 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9336 application.SendNotification();
9337 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9338 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9339 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9340 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9342 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9343 application.SendNotification();
9344 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9345 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9346 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9347 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9349 // We did expect the animation to finish
9351 finishCheck.CheckSignalReceived();
9355 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9357 TestApplication application;
9359 float startValue(1.0f);
9360 Actor actor = Actor::New();
9361 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9362 Stage::GetCurrent().Add(actor);
9364 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9365 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9366 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9367 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9368 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9369 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9370 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9371 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9372 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9374 // Build the animation
9375 float durationSeconds(1.0f);
9377 Animation animation = Animation::New(durationSeconds);
9379 KeyFrames keyFrames = KeyFrames::New();
9380 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9381 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9382 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9384 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9386 // Start the animation
9389 bool signalReceived(false);
9390 AnimationFinishCheck finishCheck(signalReceived);
9391 animation.FinishedSignal().Connect(&application, finishCheck);
9392 application.SendNotification();
9394 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9395 application.SendNotification();
9396 finishCheck.CheckSignalNotReceived();
9397 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9398 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9399 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9400 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9402 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9403 application.SendNotification();
9404 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9405 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9406 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9407 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9409 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9410 application.SendNotification();
9411 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9412 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9413 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9414 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9416 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9417 application.SendNotification();
9418 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9419 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9420 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9421 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9423 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9424 application.SendNotification();
9425 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9426 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9427 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9428 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9430 // We did expect the animation to finish
9432 finishCheck.CheckSignalReceived();
9436 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9438 TestApplication application;
9440 float startValue(1.0f);
9442 Actor actor = Actor::New();
9443 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9444 Stage::GetCurrent().Add(actor);
9446 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9447 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9448 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9449 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9450 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9451 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9452 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9453 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9454 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9456 // Build the animation
9457 float durationSeconds(1.0f);
9458 Animation animation = Animation::New(durationSeconds);
9460 KeyFrames keyFrames = KeyFrames::New();
9461 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9462 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9463 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9465 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9467 // Start the animation
9470 bool signalReceived(false);
9471 AnimationFinishCheck finishCheck(signalReceived);
9472 animation.FinishedSignal().Connect(&application, finishCheck);
9473 application.SendNotification();
9475 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9476 application.SendNotification();
9477 finishCheck.CheckSignalNotReceived();
9478 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9479 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9480 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9481 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9483 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9484 application.SendNotification();
9485 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9486 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9487 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9488 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9490 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9491 application.SendNotification();
9492 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9493 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9494 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9495 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9497 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9498 application.SendNotification();
9499 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9500 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9501 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9502 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9504 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9505 application.SendNotification();
9506 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9507 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9508 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9509 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9511 // We did expect the animation to finish
9513 finishCheck.CheckSignalReceived();
9517 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9519 TestApplication application;
9521 float startValue(1.0f);
9522 Actor actor = Actor::New();
9523 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9524 Stage::GetCurrent().Add(actor);
9526 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9527 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9528 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9529 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9530 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9531 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9532 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9533 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9534 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9537 // Build the animation
9538 float durationSeconds(1.0f);
9540 Animation animation = Animation::New(durationSeconds);
9542 KeyFrames keyFrames = KeyFrames::New();
9543 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9544 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9545 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9547 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9549 // Start the animation
9552 bool signalReceived(false);
9553 AnimationFinishCheck finishCheck(signalReceived);
9554 animation.FinishedSignal().Connect(&application, finishCheck);
9555 application.SendNotification();
9557 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9558 application.SendNotification();
9559 finishCheck.CheckSignalNotReceived();
9560 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9561 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9562 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9563 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9565 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9566 application.SendNotification();
9567 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9568 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9569 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9570 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9572 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9573 application.SendNotification();
9574 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9575 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9576 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9577 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9579 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9580 application.SendNotification();
9581 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9582 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9583 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9584 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9586 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9587 application.SendNotification();
9588 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9589 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9590 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9591 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9593 // We did expect the animation to finish
9595 finishCheck.CheckSignalReceived();
9599 int UtcDaliAnimationAnimateP(void)
9601 TestApplication application;
9603 Actor actor = Actor::New();
9604 Stage::GetCurrent().Add(actor);
9607 Vector3 position0( 30.0, 80.0, 0.0);
9608 Vector3 position1( 70.0, 120.0, 0.0);
9609 Vector3 position2( 100.0, 100.0, 0.0);
9611 Dali::Path path = Dali::Path::New();
9612 path.AddPoint(position0);
9613 path.AddPoint(position1);
9614 path.AddPoint(position2);
9616 //Control points for first segment
9617 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9618 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9620 //Control points for second segment
9621 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9622 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9624 // Build the animation
9625 float durationSeconds( 1.0f );
9626 Animation animation = Animation::New(durationSeconds);
9627 animation.Animate(actor, path, Vector3::XAXIS);
9629 // Start the animation
9632 bool signalReceived(false);
9633 AnimationFinishCheck finishCheck(signalReceived);
9634 animation.FinishedSignal().Connect(&application, finishCheck);
9635 application.SendNotification();
9636 application.Render(0);
9637 application.SendNotification();
9638 finishCheck.CheckSignalNotReceived();
9639 Vector3 position, tangent;
9640 Quaternion rotation;
9641 path.Sample( 0.0f, position, tangent );
9642 rotation = Quaternion( Vector3::XAXIS, tangent );
9643 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9644 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9646 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9647 application.SendNotification();
9648 path.Sample( 0.25f, position, tangent );
9649 rotation = Quaternion( Vector3::XAXIS, tangent );
9650 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9651 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9653 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9654 application.SendNotification();
9655 path.Sample( 0.5f, position, tangent );
9656 rotation = Quaternion( Vector3::XAXIS, tangent );
9657 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9658 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9660 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9661 application.SendNotification();
9662 path.Sample( 0.75f, position, tangent );
9663 rotation = Quaternion( Vector3::XAXIS, tangent );
9664 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9665 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9667 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9668 application.SendNotification();
9669 path.Sample( 1.0f, position, tangent );
9670 rotation = Quaternion( Vector3::XAXIS, tangent );
9671 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9672 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9674 finishCheck.CheckSignalReceived();
9678 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9680 TestApplication application;
9682 Actor actor = Actor::New();
9683 Stage::GetCurrent().Add(actor);
9686 Vector3 position0( 30.0, 80.0, 0.0);
9687 Vector3 position1( 70.0, 120.0, 0.0);
9688 Vector3 position2( 100.0, 100.0, 0.0);
9690 Dali::Path path = Dali::Path::New();
9691 path.AddPoint(position0);
9692 path.AddPoint(position1);
9693 path.AddPoint(position2);
9695 //Control points for first segment
9696 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9697 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9699 //Control points for second segment
9700 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9701 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9703 // Build the animation
9704 float durationSeconds( 1.0f );
9705 Animation animation = Animation::New(durationSeconds);
9706 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
9708 // Start the animation
9711 bool signalReceived(false);
9712 AnimationFinishCheck finishCheck(signalReceived);
9713 animation.FinishedSignal().Connect(&application, finishCheck);
9714 application.SendNotification();
9715 application.Render(0);
9716 application.SendNotification();
9717 finishCheck.CheckSignalNotReceived();
9718 Vector3 position, tangent;
9719 Quaternion rotation;
9720 path.Sample( 0.0f, position, tangent );
9721 rotation = Quaternion( Vector3::XAXIS, tangent );
9722 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9723 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9725 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9726 application.SendNotification();
9727 path.Sample( 0.25f, position, tangent );
9728 rotation = Quaternion( Vector3::XAXIS, tangent );
9729 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9730 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9732 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9733 application.SendNotification();
9734 path.Sample( 0.5f, position, tangent );
9735 rotation = Quaternion( Vector3::XAXIS, tangent );
9736 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9737 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9739 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9740 application.SendNotification();
9741 path.Sample( 0.75f, position, tangent );
9742 rotation = Quaternion( Vector3::XAXIS, tangent );
9743 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9744 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9746 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9747 application.SendNotification();
9748 path.Sample( 1.0f, position, tangent );
9749 rotation = Quaternion( Vector3::XAXIS, tangent );
9750 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9751 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9753 finishCheck.CheckSignalReceived();
9757 int UtcDaliAnimationAnimateTimePeriodP(void)
9759 TestApplication application;
9761 Actor actor = Actor::New();
9762 Stage::GetCurrent().Add(actor);
9765 Vector3 position0( 30.0, 80.0, 0.0);
9766 Vector3 position1( 70.0, 120.0, 0.0);
9767 Vector3 position2( 100.0, 100.0, 0.0);
9769 Dali::Path path = Dali::Path::New();
9770 path.AddPoint(position0);
9771 path.AddPoint(position1);
9772 path.AddPoint(position2);
9774 //Control points for first segment
9775 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9776 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9778 //Control points for second segment
9779 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9780 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9782 // Build the animation
9783 float durationSeconds( 1.0f );
9784 Animation animation = Animation::New(durationSeconds);
9785 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
9787 // Start the animation
9790 bool signalReceived(false);
9791 AnimationFinishCheck finishCheck(signalReceived);
9792 animation.FinishedSignal().Connect(&application, finishCheck);
9793 application.SendNotification();
9794 application.Render(0);
9795 application.SendNotification();
9796 finishCheck.CheckSignalNotReceived();
9797 Vector3 position, tangent;
9798 Quaternion rotation;
9799 path.Sample( 0.0f, position, tangent );
9800 rotation = Quaternion( Vector3::XAXIS, tangent );
9801 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9802 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9804 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9805 application.SendNotification();
9806 path.Sample( 0.25f, position, tangent );
9807 rotation = Quaternion( Vector3::XAXIS, tangent );
9808 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9809 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9811 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9812 application.SendNotification();
9813 path.Sample( 0.5f, position, tangent );
9814 rotation = Quaternion( Vector3::XAXIS, tangent );
9815 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9816 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9818 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9819 application.SendNotification();
9820 path.Sample( 0.75f, position, tangent );
9821 rotation = Quaternion( Vector3::XAXIS, tangent );
9822 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9823 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9825 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9826 application.SendNotification();
9827 path.Sample( 1.0f, position, tangent );
9828 rotation = Quaternion( Vector3::XAXIS, tangent );
9829 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9830 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9832 finishCheck.CheckSignalReceived();
9836 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
9838 TestApplication application;
9840 Actor actor = Actor::New();
9841 Stage::GetCurrent().Add(actor);
9844 Vector3 position0( 30.0, 80.0, 0.0);
9845 Vector3 position1( 70.0, 120.0, 0.0);
9846 Vector3 position2( 100.0, 100.0, 0.0);
9848 Dali::Path path = Dali::Path::New();
9849 path.AddPoint(position0);
9850 path.AddPoint(position1);
9851 path.AddPoint(position2);
9853 //Control points for first segment
9854 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9855 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9857 //Control points for second segment
9858 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9859 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9861 // Build the animation
9862 float durationSeconds( 1.0f );
9863 Animation animation = Animation::New(durationSeconds);
9864 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
9866 // Start the animation
9869 bool signalReceived(false);
9870 AnimationFinishCheck finishCheck(signalReceived);
9871 animation.FinishedSignal().Connect(&application, finishCheck);
9872 application.SendNotification();
9873 application.Render(0);
9874 application.SendNotification();
9875 finishCheck.CheckSignalNotReceived();
9876 Vector3 position, tangent;
9877 Quaternion rotation;
9878 path.Sample( 0.0f, position, tangent );
9879 rotation = Quaternion( Vector3::XAXIS, tangent );
9880 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9881 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9883 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9884 application.SendNotification();
9885 path.Sample( 0.25f, position, tangent );
9886 rotation = Quaternion( Vector3::XAXIS, tangent );
9887 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9888 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9890 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9891 application.SendNotification();
9892 path.Sample( 0.5f, position, tangent );
9893 rotation = Quaternion( Vector3::XAXIS, tangent );
9894 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9895 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9897 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9898 application.SendNotification();
9899 path.Sample( 0.75f, position, tangent );
9900 rotation = Quaternion( Vector3::XAXIS, tangent );
9901 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9902 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9904 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9905 application.SendNotification();
9906 path.Sample( 1.0f, position, tangent );
9907 rotation = Quaternion( Vector3::XAXIS, tangent );
9908 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9909 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9911 finishCheck.CheckSignalReceived();
9915 int UtcDaliAnimationShowP(void)
9917 TestApplication application;
9919 Actor actor = Actor::New();
9920 actor.SetVisible(false);
9921 application.SendNotification();
9922 application.Render(0);
9923 DALI_TEST_CHECK( !actor.IsVisible() );
9924 Stage::GetCurrent().Add(actor);
9926 // Start the animation
9927 float durationSeconds(10.0f);
9928 Animation animation = Animation::New(durationSeconds);
9929 animation.Show(actor, durationSeconds*0.5f);
9932 bool signalReceived(false);
9933 AnimationFinishCheck finishCheck(signalReceived);
9934 animation.FinishedSignal().Connect(&application, finishCheck);
9936 application.SendNotification();
9937 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9939 // We didn't expect the animation to finish yet
9940 application.SendNotification();
9941 finishCheck.CheckSignalNotReceived();
9942 DALI_TEST_CHECK( !actor.IsVisible() );
9944 application.SendNotification();
9945 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9947 // We didn't expect the animation to finish yet
9948 application.SendNotification();
9949 finishCheck.CheckSignalNotReceived();
9950 DALI_TEST_CHECK( actor.IsVisible() );
9952 application.SendNotification();
9953 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9955 // We did expect the animation to finish
9956 application.SendNotification();
9957 finishCheck.CheckSignalReceived();
9958 DALI_TEST_CHECK( actor.IsVisible() );
9962 int UtcDaliAnimationHideP(void)
9964 TestApplication application;
9966 Actor actor = Actor::New();
9967 DALI_TEST_CHECK( actor.IsVisible() );
9968 Stage::GetCurrent().Add(actor);
9970 // Start the animation
9971 float durationSeconds(10.0f);
9972 Animation animation = Animation::New(durationSeconds);
9973 animation.Hide(actor, durationSeconds*0.5f);
9976 bool signalReceived(false);
9977 AnimationFinishCheck finishCheck(signalReceived);
9978 animation.FinishedSignal().Connect(&application, finishCheck);
9980 application.SendNotification();
9981 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9983 // We didn't expect the animation to finish yet
9984 application.SendNotification();
9985 finishCheck.CheckSignalNotReceived();
9986 DALI_TEST_CHECK( actor.IsVisible() );
9988 application.SendNotification();
9989 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9991 // We didn't expect the animation to finish yet
9992 application.SendNotification();
9993 finishCheck.CheckSignalNotReceived();
9994 DALI_TEST_CHECK( !actor.IsVisible() );
9996 application.SendNotification();
9997 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9999 // We did expect the animation to finish
10000 application.SendNotification();
10001 finishCheck.CheckSignalReceived();
10002 DALI_TEST_CHECK( !actor.IsVisible() );
10006 int UtcDaliAnimationShowHideAtEndP(void)
10008 // Test that show/hide delay can be the same as animation duration
10009 // i.e. to show/hide at the end of the animation
10011 TestApplication application;
10013 Actor actor = Actor::New();
10014 DALI_TEST_CHECK( actor.IsVisible() );
10015 Stage::GetCurrent().Add(actor);
10017 // Start Hide animation
10018 float durationSeconds(10.0f);
10019 Animation animation = Animation::New(durationSeconds);
10020 animation.Hide(actor, durationSeconds/*Hide at end*/);
10023 bool signalReceived(false);
10024 AnimationFinishCheck finishCheck(signalReceived);
10025 animation.FinishedSignal().Connect(&application, finishCheck);
10027 application.SendNotification();
10028 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10030 // We did expect the animation to finish
10031 application.SendNotification();
10032 finishCheck.CheckSignalReceived();
10033 DALI_TEST_CHECK( !actor.IsVisible() );
10035 // Start Show animation
10036 animation = Animation::New(durationSeconds);
10037 animation.Show(actor, durationSeconds/*Show at end*/);
10038 animation.FinishedSignal().Connect(&application, finishCheck);
10041 application.SendNotification();
10042 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10044 // We did expect the animation to finish
10045 application.SendNotification();
10046 finishCheck.CheckSignalReceived();
10047 DALI_TEST_CHECK( actor.IsVisible() );
10051 int UtcDaliKeyFramesCreateDestroyP(void)
10053 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10055 KeyFrames* keyFrames = new KeyFrames;
10057 DALI_TEST_CHECK( true );
10061 int UtcDaliKeyFramesDownCastP(void)
10063 TestApplication application;
10064 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10066 KeyFrames keyFrames = KeyFrames::New();
10067 BaseHandle object(keyFrames);
10069 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10070 DALI_TEST_CHECK(keyFrames2);
10072 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10073 DALI_TEST_CHECK(keyFrames3);
10075 BaseHandle unInitializedObject;
10076 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10077 DALI_TEST_CHECK(!keyFrames4);
10079 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10080 DALI_TEST_CHECK(!keyFrames5);
10084 int UtcDaliAnimationCreateDestroyP(void)
10086 TestApplication application;
10087 Animation* animation = new Animation;
10088 DALI_TEST_CHECK( animation );
10093 struct UpdateManagerTestConstraint
10095 UpdateManagerTestConstraint(TestApplication& application)
10096 : mApplication(application)
10100 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10102 mApplication.SendNotification(); // Process events
10105 TestApplication& mApplication;
10108 int UtcDaliAnimationUpdateManagerP(void)
10110 TestApplication application;
10112 Actor actor = Actor::New();
10113 Stage::GetCurrent().Add( actor );
10115 // Build the animation
10116 Animation animation = Animation::New( 0.0f );
10118 bool signalReceived = false;
10119 AnimationFinishCheck finishCheck( signalReceived );
10120 animation.FinishedSignal().Connect( &application, finishCheck );
10122 Vector3 startValue(1.0f, 1.0f, 1.0f);
10123 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10124 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10125 constraint.Apply();
10127 // Apply animation to actor
10128 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10129 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10133 application.SendNotification();
10134 application.UpdateOnly( 16 );
10136 finishCheck.CheckSignalNotReceived();
10138 application.SendNotification(); // Process events
10140 finishCheck.CheckSignalReceived();
10145 int UtcDaliAnimationSignalOrderP(void)
10147 TestApplication application;
10149 Actor actor = Actor::New();
10150 Stage::GetCurrent().Add( actor );
10152 // Build the animations
10153 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10154 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10156 bool signal1Received = false;
10157 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10159 bool signal2Received = false;
10160 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10162 // Apply animations to actor
10163 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10165 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10168 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10169 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10171 application.SendNotification();
10172 application.UpdateOnly( 10 ); // 10ms progress
10174 // no notifications yet
10175 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10176 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10178 application.SendNotification();
10181 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10182 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10183 signal1Received = false;
10185 // 1st animation is complete now, do another update with no ProcessEvents in between
10186 application.UpdateOnly( 20 ); // 20ms progress
10189 application.SendNotification();
10191 // 2nd should complete now
10192 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10193 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10198 int UtcDaliAnimationExtendDurationP(void)
10200 TestApplication application;
10202 Actor actor = Actor::New();
10204 // Register a float property
10205 float startValue(10.0f);
10206 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10207 Stage::GetCurrent().Add(actor);
10208 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10209 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10211 // Build the animation
10212 float initialDurationSeconds(1.0f);
10213 float animatorDelay = 5.0f;
10214 float animatorDurationSeconds(5.0f);
10215 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10216 Animation animation = Animation::New(initialDurationSeconds);
10217 float targetValue(30.0f);
10218 float relativeValue(targetValue - startValue);
10220 animation.AnimateTo(Property(actor, index),
10222 TimePeriod(animatorDelay, animatorDurationSeconds));
10224 // The duration should have been extended
10225 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10227 // Start the animation
10230 bool signalReceived(false);
10231 AnimationFinishCheck finishCheck(signalReceived);
10232 animation.FinishedSignal().Connect(&application, finishCheck);
10234 application.SendNotification();
10235 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10237 // We didn't expect the animation to finish yet, but cached value should be the final one
10238 application.SendNotification();
10239 finishCheck.CheckSignalNotReceived();
10240 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10241 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10243 application.SendNotification();
10244 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10246 // We didn't expect the animation to finish yet
10247 application.SendNotification();
10248 finishCheck.CheckSignalNotReceived();
10249 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10251 application.SendNotification();
10252 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10254 // We did expect the animation to finish
10255 application.SendNotification();
10256 finishCheck.CheckSignalReceived();
10257 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10258 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10262 int UtcDaliAnimationCustomIntProperty(void)
10264 TestApplication application;
10266 Actor actor = Actor::New();
10267 Stage::GetCurrent().Add(actor);
10268 int startValue(0u);
10270 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10271 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10272 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10274 // Build the animation
10275 float durationSeconds(1.0f);
10276 Animation animation = Animation::New(durationSeconds);
10277 animation.AnimateTo( Property(actor, index), 20 );
10279 // Start the animation
10282 // Target value should be retrievable straight away
10283 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10285 bool signalReceived(false);
10286 AnimationFinishCheck finishCheck(signalReceived);
10287 animation.FinishedSignal().Connect(&application, finishCheck);
10289 application.SendNotification();
10290 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10292 // We didn't expect the animation to finish yet
10293 application.SendNotification();
10294 finishCheck.CheckSignalNotReceived();
10295 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10297 application.SendNotification();
10298 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10300 // We did expect the animation to finish
10301 application.SendNotification();
10302 finishCheck.CheckSignalReceived();
10303 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10304 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10308 int UtcDaliAnimationDuration(void)
10310 TestApplication application;
10312 Actor actor = Actor::New();
10313 Stage::GetCurrent().Add(actor);
10315 Animation animation = Animation::New( 0.0f );
10316 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10318 // The animation duration should automatically increase depending on the animator time period
10320 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10321 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10323 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10324 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10329 int UtcDaliAnimationAnimateByNonAnimateableTypeN(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.AnimateBy( Property(actor, index), relativeValue );
10347 tet_result(TET_FAIL);
10349 catch ( Dali::DaliException& e )
10351 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10359 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10361 TestApplication application;
10363 Actor actor = Actor::New();
10365 // Register an integer property
10367 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10368 Stage::GetCurrent().Add(actor);
10369 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10373 // Build the animation
10374 Animation animation = Animation::New( 2.0f );
10375 std::string relativeValue = "relative string";
10376 animation.AnimateTo( Property(actor, index), relativeValue );
10378 tet_result(TET_FAIL);
10380 catch ( Dali::DaliException& e )
10382 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10388 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10390 TestApplication application;
10392 Actor actor = Actor::New();
10394 // Register an integer property
10396 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10397 Stage::GetCurrent().Add(actor);
10398 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10402 // Build the animation
10403 KeyFrames keyFrames = KeyFrames::New();
10404 keyFrames.Add( 0.0f, std::string("relative string1") );
10405 keyFrames.Add( 1.0f, std::string("relative string2") );
10406 // no need to really create the animation as keyframes do the check
10408 tet_result(TET_FAIL);
10410 catch ( Dali::DaliException& e )
10412 DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );
10418 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10420 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10422 TestApplication application;
10424 tet_infoline("Set initial position and set up animation to re-position actor");
10426 Actor actor = Actor::New();
10427 Stage::GetCurrent().Add(actor);
10428 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10429 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10431 // Build the animation
10432 Animation animation = Animation::New(2.0f);
10434 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10435 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10436 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10438 tet_infoline("Set target position in animation without intiating play");
10440 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10441 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10443 application.SendNotification();
10444 application.Render();
10446 tet_infoline("Ensure position of actor is still at intial value");
10448 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10449 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10450 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10452 tet_infoline("Play animation and ensure actor position is now target");
10455 application.SendNotification();
10456 application.Render(1000u);
10458 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10460 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10461 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10462 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10464 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10466 application.Render(2000u);
10468 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10470 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10471 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10472 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10477 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10479 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10481 TestApplication application;
10483 std::vector<Vector3> targetPositions;
10485 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10486 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10487 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10489 tet_infoline("Set initial position and set up animation to re-position actor");
10491 Actor actor = Actor::New();
10492 Stage::GetCurrent().Add(actor);
10493 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10494 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10496 // Build the animation
10497 Animation animation = Animation::New(2.0f);
10499 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10500 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10501 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10503 tet_infoline("Set target position in animation without intiating play");
10505 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
10507 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
10510 application.SendNotification();
10511 application.Render();
10513 tet_infoline("Ensure position of actor is still at intial value");
10515 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10516 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10517 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10519 tet_infoline("Play animation and ensure actor position is now target");
10522 application.SendNotification();
10523 application.Render(1000u);
10525 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10527 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10528 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10529 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10531 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10533 application.Render(2000u);
10535 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10537 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10538 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10539 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10544 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
10546 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");
10548 TestApplication application;
10550 std::vector<Vector3> targetSizes;
10551 std::vector<Vector3> targetPositions;
10553 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10554 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10556 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10558 tet_infoline("Set initial position and set up animation to re-position actor");
10560 Actor actor = Actor::New();
10561 Stage::GetCurrent().Add(actor);
10562 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
10563 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
10565 actor.SetProperty( Actor::Property::SIZE, initialSize );
10566 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10568 // Build the animation
10569 Animation animation = Animation::New(2.0f);
10571 tet_infoline("Set target size in animation without intiating play");
10572 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10573 tet_infoline("Set target position in animation without intiating play");
10574 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
10575 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10577 application.SendNotification();
10578 application.Render();
10580 tet_infoline("Ensure position of actor is still at intial size and position");
10582 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10583 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10584 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10586 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
10587 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
10588 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
10590 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10593 application.SendNotification();
10594 application.Render(2000u);
10596 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10598 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10599 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10600 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10602 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
10603 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
10604 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
10609 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
10611 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
10613 TestApplication application;
10615 std::vector<Vector3> targetSizes;
10616 std::vector<float> targetColors;
10618 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10619 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
10621 targetColors.push_back( 1.0f );
10623 tet_infoline("Set initial position and set up animation to re-position actor");
10625 Actor actor = Actor::New();
10626 Stage::GetCurrent().Add(actor);
10627 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
10629 actor.SetProperty( Actor::Property::SIZE, initialSize );
10631 // Build the animation
10632 Animation animation = Animation::New(2.0f);
10634 tet_infoline("Set target size in animation without initiating play");
10635 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10636 tet_infoline("Set target position in animation without intiating play");
10637 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
10638 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10640 application.SendNotification();
10641 application.Render();
10643 tet_infoline("Ensure position of actor is still at initial size and position");
10645 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10646 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10647 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10649 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10652 application.SendNotification();
10653 application.Render(2000u);
10655 tet_infoline("Ensure position and size of actor is at target value when animation playing");
10657 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10658 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10659 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10661 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
10666 int UtcDaliAnimationTimePeriodOrder(void)
10668 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
10670 TestApplication application;
10672 Actor actor = Actor::New();
10673 Stage::GetCurrent().Add( actor );
10675 application.SendNotification();
10676 application.Render();
10678 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
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 );
10681 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10682 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10684 //////////////////////////////////////////////////////////////////////////////////
10686 tet_infoline( "With two AnimateTo calls" );
10688 Animation animation = Animation::New( 0.0f );
10689 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10690 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10693 tet_infoline( "The target position should change instantly" );
10694 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10695 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10697 application.SendNotification();
10698 application.Render(5000); // After the animation is complete
10700 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10701 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10702 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10704 //////////////////////////////////////////////////////////////////////////////////
10706 tet_infoline( "Same animation again but in a different order - should yield the same result" );
10708 actor.SetX( 0.0f );
10709 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10710 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10712 application.SendNotification();
10713 application.Render();
10715 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10716 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10717 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10719 animation = Animation::New( 0.0f );
10720 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
10721 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10724 tet_infoline( "The target position should change instantly" );
10725 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10726 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10728 application.SendNotification();
10729 application.Render(5000); // After the animation is complete
10731 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10732 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
10733 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
10738 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
10740 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" );
10742 TestApplication application;
10744 Actor actor = Actor::New();
10745 Stage::GetCurrent().Add( actor );
10747 application.SendNotification();
10748 application.Render();
10750 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10751 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10752 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10753 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10754 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10756 //////////////////////////////////////////////////////////////////////////////////
10758 tet_infoline( "" );
10760 Animation animation = Animation::New( 0.0f );
10761 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10762 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10763 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10764 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10765 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10766 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10769 tet_infoline( "The target position should change instantly" );
10770 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10771 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10773 application.SendNotification();
10774 application.Render(14000); // After the animation is complete
10776 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10777 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10778 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10780 //////////////////////////////////////////////////////////////////////////////////
10782 tet_infoline( "Same animation again but in a different order - should end up at the same point" );
10784 actor.SetX( 0.0f );
10786 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10787 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10789 application.SendNotification();
10790 application.Render();
10792 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10793 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10794 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10796 animation = Animation::New( 0.0f );
10797 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
10798 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
10799 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
10800 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
10801 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
10802 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
10805 tet_infoline( "The target position should change instantly" );
10806 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10807 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
10809 application.SendNotification();
10810 application.Render(14000); // After the animation is complete
10812 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10813 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
10814 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );