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 UtcDaliAnimationAnimateByQuaternionP(void)
3555 TestApplication application;
3557 Actor actor = Actor::New();
3559 // Register a quaternion property
3560 const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
3561 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3562 Stage::GetCurrent().Add(actor);
3563 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3564 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3566 // Build the animation
3567 float durationSeconds(2.0f);
3568 Animation animation = Animation::New(durationSeconds);
3569 const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
3570 const Quaternion finalValue( startValue * relativeValue );
3571 animation.AnimateBy(Property(actor, index), relativeValue);
3573 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
3574 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
3576 // Start the animation
3579 // Target value should be retrievable straight away
3580 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3582 application.SendNotification();
3583 application.Render( 2000 ); // animation complete
3585 DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
3586 DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
3591 int UtcDaliAnimationAnimateByVector2P(void)
3593 TestApplication application;
3595 Actor actor = Actor::New();
3597 // Register a Vector2 property
3598 Vector2 startValue(10.0f, 10.0f);
3599 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3600 Stage::GetCurrent().Add(actor);
3601 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3602 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3604 // Build the animation
3605 float durationSeconds(2.0f);
3606 Animation animation = Animation::New(durationSeconds);
3607 Vector2 targetValue(60.0f, 60.0f);
3608 Vector2 relativeValue(targetValue - startValue);
3609 animation.AnimateBy(Property(actor, index), relativeValue);
3611 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3613 // Start the animation
3616 // Target value should be retrievable straight away
3617 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3619 bool signalReceived(false);
3620 AnimationFinishCheck finishCheck(signalReceived);
3621 animation.FinishedSignal().Connect(&application, finishCheck);
3623 application.SendNotification();
3624 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3626 // We didn't expect the animation to finish yet
3627 application.SendNotification();
3628 finishCheck.CheckSignalNotReceived();
3629 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3631 application.SendNotification();
3632 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3634 // We did expect the animation to finish
3635 application.SendNotification();
3636 finishCheck.CheckSignalReceived();
3637 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3639 // Check that nothing has changed after a couple of buffer swaps
3640 application.Render(0);
3641 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3642 application.Render(0);
3643 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3647 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3649 TestApplication application;
3651 Actor actor = Actor::New();
3653 // Register a Vector2 property
3654 Vector2 startValue(100.0f, 100.0f);
3655 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3656 Stage::GetCurrent().Add(actor);
3657 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3658 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3660 // Build the animation
3661 float durationSeconds(1.0f);
3662 Animation animation = Animation::New(durationSeconds);
3663 Vector2 targetValue(20.0f, 20.0f);
3664 Vector2 relativeValue(targetValue - startValue);
3665 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3667 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3669 // Start the animation
3672 bool signalReceived(false);
3673 AnimationFinishCheck finishCheck(signalReceived);
3674 animation.FinishedSignal().Connect(&application, finishCheck);
3676 application.SendNotification();
3677 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3679 // We didn't expect the animation to finish yet
3680 application.SendNotification();
3681 finishCheck.CheckSignalNotReceived();
3683 // The position should have moved more, than with a linear alpha function
3684 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
3685 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3686 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3688 application.SendNotification();
3689 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3691 // We did expect the animation to finish
3692 application.SendNotification();
3693 finishCheck.CheckSignalReceived();
3694 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3696 // Check that nothing has changed after a couple of buffer swaps
3697 application.Render(0);
3698 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3699 application.Render(0);
3700 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3704 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3706 TestApplication application;
3708 Actor actor = Actor::New();
3710 // Register a Vector2 property
3711 Vector2 startValue(10.0f, 10.0f);
3712 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3713 Stage::GetCurrent().Add(actor);
3714 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3715 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3717 // Build the animation
3718 float durationSeconds(1.0f);
3719 Animation animation = Animation::New(durationSeconds);
3720 Vector2 targetValue(30.0f, 30.0f);
3721 Vector2 relativeValue(targetValue - startValue);
3723 animation.AnimateBy(Property(actor, index),
3725 TimePeriod(delay, durationSeconds - delay));
3727 // Start the animation
3730 bool signalReceived(false);
3731 AnimationFinishCheck finishCheck(signalReceived);
3732 animation.FinishedSignal().Connect(&application, finishCheck);
3734 application.SendNotification();
3735 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3737 // We didn't expect the animation to finish yet
3738 application.SendNotification();
3739 finishCheck.CheckSignalNotReceived();
3740 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3742 application.SendNotification();
3743 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3745 // We didn't expect the animation to finish yet
3746 application.SendNotification();
3747 finishCheck.CheckSignalNotReceived();
3748 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3750 application.SendNotification();
3751 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3753 // We did expect the animation to finish
3754 application.SendNotification();
3755 finishCheck.CheckSignalReceived();
3756 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3758 // Check that nothing has changed after a couple of buffer swaps
3759 application.Render(0);
3760 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3761 application.Render(0);
3762 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3766 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3768 TestApplication application;
3770 Actor actor = Actor::New();
3772 // Register a Vector2 property
3773 Vector2 startValue(5.0f, 5.0f);
3774 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3775 Stage::GetCurrent().Add(actor);
3776 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3777 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3779 // Build the animation
3780 float durationSeconds(1.0f);
3781 Animation animation = Animation::New(durationSeconds);
3782 Vector2 targetValue(10.0f, 10.0f);
3783 Vector2 relativeValue(targetValue - startValue);
3785 animation.AnimateBy(Property(actor, index),
3787 AlphaFunction::LINEAR,
3788 TimePeriod(delay, durationSeconds - delay));
3790 // Start the animation
3793 bool signalReceived(false);
3794 AnimationFinishCheck finishCheck(signalReceived);
3795 animation.FinishedSignal().Connect(&application, finishCheck);
3797 application.SendNotification();
3798 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3800 // We didn't expect the animation to finish yet
3801 application.SendNotification();
3802 finishCheck.CheckSignalNotReceived();
3803 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
3805 application.SendNotification();
3806 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3808 // We didn't expect the animation to finish yet
3809 application.SendNotification();
3810 finishCheck.CheckSignalNotReceived();
3811 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3813 application.SendNotification();
3814 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3816 // We did expect the animation to finish
3817 application.SendNotification();
3818 finishCheck.CheckSignalReceived();
3819 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3821 // Check that nothing has changed after a couple of buffer swaps
3822 application.Render(0);
3823 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3824 application.Render(0);
3825 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
3829 int UtcDaliAnimationAnimateByVector3P(void)
3831 TestApplication application;
3833 Actor actor = Actor::New();
3835 // Register a Vector3 property
3836 Vector3 startValue(10.0f, 10.0f, 10.0f);
3837 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3838 Stage::GetCurrent().Add(actor);
3839 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3840 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3842 // Build the animation
3843 float durationSeconds(2.0f);
3844 Animation animation = Animation::New(durationSeconds);
3845 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3846 Vector3 relativeValue(targetValue - startValue);
3847 animation.AnimateBy(Property(actor, index), relativeValue);
3849 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3851 // Start the animation
3854 // Target value should be retrievable straight away
3855 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3857 bool signalReceived(false);
3858 AnimationFinishCheck finishCheck(signalReceived);
3859 animation.FinishedSignal().Connect(&application, finishCheck);
3861 application.SendNotification();
3862 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3864 // We didn't expect the animation to finish yet
3865 application.SendNotification();
3866 finishCheck.CheckSignalNotReceived();
3867 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
3869 application.SendNotification();
3870 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3872 // We did expect the animation to finish
3873 application.SendNotification();
3874 finishCheck.CheckSignalReceived();
3875 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3877 // Check that nothing has changed after a couple of buffer swaps
3878 application.Render(0);
3879 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3880 application.Render(0);
3881 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3885 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3887 TestApplication application;
3889 Actor actor = Actor::New();
3891 // Register a Vector3 property
3892 Vector3 startValue(100.0f, 100.0f, 100.0f);
3893 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3894 Stage::GetCurrent().Add(actor);
3895 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3896 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3898 // Build the animation
3899 float durationSeconds(1.0f);
3900 Animation animation = Animation::New(durationSeconds);
3901 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3902 Vector3 relativeValue(targetValue - startValue);
3903 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3905 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3907 // Start the animation
3910 bool signalReceived(false);
3911 AnimationFinishCheck finishCheck(signalReceived);
3912 animation.FinishedSignal().Connect(&application, finishCheck);
3914 application.SendNotification();
3915 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3917 // We didn't expect the animation to finish yet
3918 application.SendNotification();
3919 finishCheck.CheckSignalNotReceived();
3921 // The position should have moved more, than with a linear alpha function
3922 Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
3923 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3924 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3925 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3927 application.SendNotification();
3928 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3930 // We did expect the animation to finish
3931 application.SendNotification();
3932 finishCheck.CheckSignalReceived();
3933 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3935 // Check that nothing has changed after a couple of buffer swaps
3936 application.Render(0);
3937 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3938 application.Render(0);
3939 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3943 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3945 TestApplication application;
3947 Actor actor = Actor::New();
3949 // Register a Vector3 property
3950 Vector3 startValue(10.0f, 10.0f, 10.0f);
3951 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3952 Stage::GetCurrent().Add(actor);
3953 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3954 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3956 // Build the animation
3957 float durationSeconds(1.0f);
3958 Animation animation = Animation::New(durationSeconds);
3959 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3960 Vector3 relativeValue(targetValue - startValue);
3962 animation.AnimateBy(Property(actor, index),
3964 TimePeriod(delay, durationSeconds - delay));
3966 // Start the animation
3969 bool signalReceived(false);
3970 AnimationFinishCheck finishCheck(signalReceived);
3971 animation.FinishedSignal().Connect(&application, finishCheck);
3973 application.SendNotification();
3974 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3976 // We didn't expect the animation to finish yet
3977 application.SendNotification();
3978 finishCheck.CheckSignalNotReceived();
3979 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
3981 application.SendNotification();
3982 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3984 // We didn't expect the animation to finish yet
3985 application.SendNotification();
3986 finishCheck.CheckSignalNotReceived();
3987 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
3989 application.SendNotification();
3990 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3992 // We did expect the animation to finish
3993 application.SendNotification();
3994 finishCheck.CheckSignalReceived();
3995 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
3997 // Check that nothing has changed after a couple of buffer swaps
3998 application.Render(0);
3999 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4000 application.Render(0);
4001 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4005 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
4007 TestApplication application;
4009 Actor actor = Actor::New();
4011 // Register a Vector3 property
4012 Vector3 startValue(5.0f, 5.0f, 5.0f);
4013 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4014 Stage::GetCurrent().Add(actor);
4015 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
4016 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4018 // Build the animation
4019 float durationSeconds(1.0f);
4020 Animation animation = Animation::New(durationSeconds);
4021 Vector3 targetValue(10.0f, 10.0f, 10.0f);
4022 Vector3 relativeValue(targetValue - startValue);
4024 animation.AnimateBy(Property(actor, index),
4026 AlphaFunction::LINEAR,
4027 TimePeriod(delay, durationSeconds - delay));
4029 // Start the animation
4032 bool signalReceived(false);
4033 AnimationFinishCheck finishCheck(signalReceived);
4034 animation.FinishedSignal().Connect(&application, finishCheck);
4036 application.SendNotification();
4037 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4039 // We didn't expect the animation to finish yet
4040 application.SendNotification();
4041 finishCheck.CheckSignalNotReceived();
4042 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
4044 application.SendNotification();
4045 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4047 // We didn't expect the animation to finish yet
4048 application.SendNotification();
4049 finishCheck.CheckSignalNotReceived();
4050 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4052 application.SendNotification();
4053 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4055 // We did expect the animation to finish
4056 application.SendNotification();
4057 finishCheck.CheckSignalReceived();
4058 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4060 // Check that nothing has changed after a couple of buffer swaps
4061 application.Render(0);
4062 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4063 application.Render(0);
4064 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
4068 int UtcDaliAnimationAnimateByVector4P(void)
4070 TestApplication application;
4072 Actor actor = Actor::New();
4074 // Register a Vector4 property
4075 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4076 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4077 Stage::GetCurrent().Add(actor);
4078 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4079 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4081 // Build the animation
4082 float durationSeconds(2.0f);
4083 Animation animation = Animation::New(durationSeconds);
4084 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4085 Vector4 relativeValue(targetValue - startValue);
4086 animation.AnimateBy(Property(actor, index), relativeValue);
4088 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4090 // Start the animation
4093 // Target value should be retrievable straight away
4094 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4096 bool signalReceived(false);
4097 AnimationFinishCheck finishCheck(signalReceived);
4098 animation.FinishedSignal().Connect(&application, finishCheck);
4100 application.SendNotification();
4101 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4103 // We didn't expect the animation to finish yet
4104 application.SendNotification();
4105 finishCheck.CheckSignalNotReceived();
4106 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
4108 application.SendNotification();
4109 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4111 // We did expect the animation to finish
4112 application.SendNotification();
4113 finishCheck.CheckSignalReceived();
4114 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4116 // Check that nothing has changed after a couple of buffer swaps
4117 application.Render(0);
4118 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4119 application.Render(0);
4120 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4124 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4126 TestApplication application;
4128 Actor actor = Actor::New();
4130 // Register a Vector4 property
4131 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4132 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4133 Stage::GetCurrent().Add(actor);
4134 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4135 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4137 // Build the animation
4138 float durationSeconds(1.0f);
4139 Animation animation = Animation::New(durationSeconds);
4140 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4141 Vector4 relativeValue(targetValue - startValue);
4142 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4144 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4146 // Start the animation
4149 bool signalReceived(false);
4150 AnimationFinishCheck finishCheck(signalReceived);
4151 animation.FinishedSignal().Connect(&application, finishCheck);
4153 application.SendNotification();
4154 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4156 // We didn't expect the animation to finish yet
4157 application.SendNotification();
4158 finishCheck.CheckSignalNotReceived();
4160 // The position should have moved more, than with a linear alpha function
4161 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
4162 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4163 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4164 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4165 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4167 application.SendNotification();
4168 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4170 // We did expect the animation to finish
4171 application.SendNotification();
4172 finishCheck.CheckSignalReceived();
4173 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4175 // Check that nothing has changed after a couple of buffer swaps
4176 application.Render(0);
4177 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4178 application.Render(0);
4179 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4183 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4185 TestApplication application;
4187 Actor actor = Actor::New();
4189 // Register a Vector4 property
4190 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4191 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4192 Stage::GetCurrent().Add(actor);
4193 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4194 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4196 // Build the animation
4197 float durationSeconds(1.0f);
4198 Animation animation = Animation::New(durationSeconds);
4199 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4200 Vector4 relativeValue(targetValue - startValue);
4202 animation.AnimateBy(Property(actor, index),
4204 TimePeriod(delay, durationSeconds - delay));
4206 // Start the animation
4209 bool signalReceived(false);
4210 AnimationFinishCheck finishCheck(signalReceived);
4211 animation.FinishedSignal().Connect(&application, finishCheck);
4213 application.SendNotification();
4214 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4216 // We didn't expect the animation to finish yet
4217 application.SendNotification();
4218 finishCheck.CheckSignalNotReceived();
4219 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4221 application.SendNotification();
4222 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4224 // We didn't expect the animation to finish yet
4225 application.SendNotification();
4226 finishCheck.CheckSignalNotReceived();
4227 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4229 application.SendNotification();
4230 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4232 // We did expect the animation to finish
4233 application.SendNotification();
4234 finishCheck.CheckSignalReceived();
4235 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4237 // Check that nothing has changed after a couple of buffer swaps
4238 application.Render(0);
4239 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4240 application.Render(0);
4241 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4245 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4247 TestApplication application;
4249 Actor actor = Actor::New();
4251 // Register a Vector4 property
4252 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4253 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4254 Stage::GetCurrent().Add(actor);
4255 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4256 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4258 // Build the animation
4259 float durationSeconds(1.0f);
4260 Animation animation = Animation::New(durationSeconds);
4261 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4262 Vector4 relativeValue(targetValue - startValue);
4264 animation.AnimateBy(Property(actor, index),
4266 AlphaFunction::LINEAR,
4267 TimePeriod(delay, durationSeconds - delay));
4269 // Start the animation
4272 bool signalReceived(false);
4273 AnimationFinishCheck finishCheck(signalReceived);
4274 animation.FinishedSignal().Connect(&application, finishCheck);
4276 application.SendNotification();
4277 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4279 // We didn't expect the animation to finish yet
4280 application.SendNotification();
4281 finishCheck.CheckSignalNotReceived();
4282 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
4284 application.SendNotification();
4285 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4287 // We didn't expect the animation to finish yet
4288 application.SendNotification();
4289 finishCheck.CheckSignalNotReceived();
4290 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
4292 application.SendNotification();
4293 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4295 // We did expect the animation to finish
4296 application.SendNotification();
4297 finishCheck.CheckSignalReceived();
4298 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4300 // Check that nothing has changed after a couple of buffer swaps
4301 application.Render(0);
4302 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4303 application.Render(0);
4304 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
4308 int UtcDaliAnimationAnimateByActorPositionP(void)
4310 TestApplication application;
4312 Actor actor = Actor::New();
4313 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4314 actor.SetPosition(startPosition);
4315 Stage::GetCurrent().Add(actor);
4316 application.SendNotification();
4317 application.Render(0);
4318 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4320 // Build the animation
4321 float durationSeconds(1.0f);
4322 Animation animation = Animation::New(durationSeconds);
4323 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4324 Vector3 relativePosition(targetPosition - startPosition);
4325 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4327 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4329 // Start the animation
4332 // Target value should be retrievable straight away
4333 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4335 bool signalReceived(false);
4336 AnimationFinishCheck finishCheck(signalReceived);
4337 animation.FinishedSignal().Connect(&application, finishCheck);
4339 application.SendNotification();
4340 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4342 // We didn't expect the animation to finish yet
4343 application.SendNotification();
4344 finishCheck.CheckSignalNotReceived();
4345 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4347 application.SendNotification();
4348 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4350 // We did expect the animation to finish
4351 application.SendNotification();
4352 finishCheck.CheckSignalReceived();
4353 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4355 // Check that nothing has changed after a couple of buffer swaps
4356 application.Render(0);
4357 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4358 application.Render(0);
4359 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4363 int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
4365 TestApplication application;
4367 Actor actor = Actor::New();
4368 Stage::GetCurrent().Add(actor);
4369 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4371 // Build the animation
4372 float durationSeconds(1.0f);
4373 Animation animation = Animation::New(durationSeconds);
4374 Vector3 targetPosition(200.0f, 300.0f, 400.0f);
4375 Vector3 relativePosition(targetPosition - Vector3::ZERO);
4376 animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
4377 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
4378 animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
4380 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
4381 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
4383 // Start the animation
4386 // Target value should be retrievable straight away
4387 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
4388 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
4389 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
4390 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
4392 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
4394 application.SendNotification();
4395 application.Render( 1000 ); // 1 second progress
4397 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4402 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4404 TestApplication application;
4406 Actor actor = Actor::New();
4407 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4408 actor.SetPosition(startPosition);
4409 Stage::GetCurrent().Add(actor);
4410 application.SendNotification();
4411 application.Render(0);
4412 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4414 // Build the animation
4415 float durationSeconds(1.0f);
4416 Animation animation = Animation::New(durationSeconds);
4417 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4418 Vector3 relativePosition(targetPosition - startPosition);
4419 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4421 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4423 // Start the animation
4426 bool signalReceived(false);
4427 AnimationFinishCheck finishCheck(signalReceived);
4428 animation.FinishedSignal().Connect(&application, finishCheck);
4430 application.SendNotification();
4431 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4433 // We didn't expect the animation to finish yet
4434 application.SendNotification();
4435 finishCheck.CheckSignalNotReceived();
4437 // The position should have moved more, than with a linear alpha function
4438 Vector3 current(actor.GetCurrentPosition());
4439 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4440 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4441 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4443 application.SendNotification();
4444 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4446 // We did expect the animation to finish
4447 application.SendNotification();
4448 finishCheck.CheckSignalReceived();
4449 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4451 // Check that nothing has changed after a couple of buffer swaps
4452 application.Render(0);
4453 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4454 application.Render(0);
4455 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4459 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4461 TestApplication application;
4463 Actor actor = Actor::New();
4464 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4465 actor.SetPosition(startPosition);
4466 Stage::GetCurrent().Add(actor);
4467 application.SendNotification();
4468 application.Render(0);
4469 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4471 // Build the animation
4472 float durationSeconds(1.0f);
4473 Animation animation = Animation::New(durationSeconds);
4474 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4475 Vector3 relativePosition(targetPosition - startPosition);
4477 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4479 TimePeriod(delay, durationSeconds - delay));
4481 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4483 // Start the animation
4486 bool signalReceived(false);
4487 AnimationFinishCheck finishCheck(signalReceived);
4488 animation.FinishedSignal().Connect(&application, finishCheck);
4490 application.SendNotification();
4491 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4493 // We didn't expect the animation to finish yet
4494 application.SendNotification();
4495 finishCheck.CheckSignalNotReceived();
4496 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4498 application.SendNotification();
4499 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4501 // We did expect the animation to finish
4502 application.SendNotification();
4503 finishCheck.CheckSignalReceived();
4504 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4506 // Check that nothing has changed after a couple of buffer swaps
4507 application.Render(0);
4508 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4509 application.Render(0);
4510 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4514 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4516 TestApplication application;
4518 Actor actor = Actor::New();
4519 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4520 actor.SetPosition(startPosition);
4521 Stage::GetCurrent().Add(actor);
4522 application.SendNotification();
4523 application.Render(0);
4524 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4526 // Build the animation
4527 float durationSeconds(1.0f);
4528 Animation animation = Animation::New(durationSeconds);
4529 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4530 Vector3 relativePosition(targetPosition - startPosition);
4532 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4534 AlphaFunction::LINEAR,
4535 TimePeriod(delay, durationSeconds - delay));
4537 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4539 // Start the animation
4542 bool signalReceived(false);
4543 AnimationFinishCheck finishCheck(signalReceived);
4544 animation.FinishedSignal().Connect(&application, finishCheck);
4546 application.SendNotification();
4547 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4549 // We didn't expect the animation to finish yet
4550 application.SendNotification();
4551 finishCheck.CheckSignalNotReceived();
4552 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4554 application.SendNotification();
4555 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4557 // We did expect the animation to finish
4558 application.SendNotification();
4559 finishCheck.CheckSignalReceived();
4560 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4562 // Check that nothing has changed after a couple of buffer swaps
4563 application.Render(0);
4564 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4565 application.Render(0);
4566 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4570 int UtcDaliAnimationAnimateByActorOrientationP1(void)
4572 TestApplication application;
4574 Actor actor = Actor::New();
4575 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4576 Stage::GetCurrent().Add(actor);
4577 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4579 // Build the animation
4580 float durationSeconds(1.0f);
4581 Animation animation = Animation::New(durationSeconds);
4582 Degree relativeRotationDegrees(360.0f);
4583 Radian relativeRotationRadians(relativeRotationDegrees);
4584 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4586 // Start the animation
4589 // Target value should be retrievable straight away
4590 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
4592 bool signalReceived(false);
4593 AnimationFinishCheck finishCheck(signalReceived);
4594 animation.FinishedSignal().Connect(&application, finishCheck);
4596 application.SendNotification();
4597 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4599 // We didn't expect the animation to finish yet
4600 application.SendNotification();
4601 finishCheck.CheckSignalNotReceived();
4602 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4604 application.SendNotification();
4605 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4607 // We didn't expect the animation to finish yet
4608 application.SendNotification();
4609 finishCheck.CheckSignalNotReceived();
4610 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4612 application.SendNotification();
4613 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4615 // We didn't expect the animation to finish yet
4616 application.SendNotification();
4617 finishCheck.CheckSignalNotReceived();
4618 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4620 application.SendNotification();
4621 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4623 // We did expect the animation to finish
4624 application.SendNotification();
4625 finishCheck.CheckSignalReceived();
4626 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4630 int UtcDaliAnimationAnimateByActorOrientationP2(void)
4632 TestApplication application;
4634 tet_printf("Testing that rotation angle > 360 performs full rotations\n");
4636 Actor actor = Actor::New();
4637 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4638 Stage::GetCurrent().Add(actor);
4639 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4641 // Build the animation
4642 float durationSeconds(1.0f);
4643 Animation animation = Animation::New(durationSeconds);
4644 Degree relativeRotationDegrees(710.0f);
4645 Radian relativeRotationRadians(relativeRotationDegrees);
4647 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
4649 // Start the animation
4652 bool signalReceived(false);
4653 AnimationFinishCheck finishCheck(signalReceived);
4654 animation.FinishedSignal().Connect(&application, finishCheck);
4656 application.SendNotification();
4657 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4659 // We didn't expect the animation to finish yet
4660 application.SendNotification();
4661 finishCheck.CheckSignalNotReceived();
4662 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4664 application.SendNotification();
4665 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4667 // We didn't expect the animation to finish yet
4668 application.SendNotification();
4669 finishCheck.CheckSignalNotReceived();
4670 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4672 application.SendNotification();
4673 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4675 // We didn't expect the animation to finish yet
4676 application.SendNotification();
4677 finishCheck.CheckSignalNotReceived();
4678 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4680 application.SendNotification();
4681 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4683 // We did expect the animation to finish
4684 application.SendNotification();
4685 finishCheck.CheckSignalReceived();
4686 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4691 int UtcDaliAnimationAnimateByActorOrientationP3(void)
4693 TestApplication application;
4695 tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
4697 Actor actor = Actor::New();
4698 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
4699 Stage::GetCurrent().Add(actor);
4700 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4702 // Build the animation
4703 float durationSeconds(1.0f);
4704 Animation animation = Animation::New(durationSeconds);
4705 Degree relativeRotationDegrees(730.0f);
4706 Radian relativeRotationRadians(relativeRotationDegrees);
4708 Radian actualRotationRadians( Degree(10.0f) );
4710 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
4712 // Start the animation
4715 bool signalReceived(false);
4716 AnimationFinishCheck finishCheck(signalReceived);
4717 animation.FinishedSignal().Connect(&application, finishCheck);
4719 application.SendNotification();
4720 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4722 // We didn't expect the animation to finish yet
4723 application.SendNotification();
4724 finishCheck.CheckSignalNotReceived();
4725 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4727 application.SendNotification();
4728 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4730 // We didn't expect the animation to finish yet
4731 application.SendNotification();
4732 finishCheck.CheckSignalNotReceived();
4733 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4735 application.SendNotification();
4736 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4738 // We didn't expect the animation to finish yet
4739 application.SendNotification();
4740 finishCheck.CheckSignalNotReceived();
4741 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4743 application.SendNotification();
4744 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4746 // We did expect the animation to finish
4747 application.SendNotification();
4748 finishCheck.CheckSignalReceived();
4749 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4750 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
4755 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4757 TestApplication application;
4759 Actor actor = Actor::New();
4760 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4761 Stage::GetCurrent().Add(actor);
4762 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4764 // Build the animation
4765 float durationSeconds(1.0f);
4766 Animation animation = Animation::New(durationSeconds);
4767 Degree relativeRotationDegrees(360.0f);
4768 Radian relativeRotationRadians(relativeRotationDegrees);
4769 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4771 // Start the animation
4774 bool signalReceived(false);
4775 AnimationFinishCheck finishCheck(signalReceived);
4776 animation.FinishedSignal().Connect(&application, finishCheck);
4778 application.SendNotification();
4779 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4781 // We didn't expect the animation to finish yet
4782 application.SendNotification();
4783 finishCheck.CheckSignalNotReceived();
4784 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4786 application.SendNotification();
4787 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4789 // We didn't expect the animation to finish yet
4790 application.SendNotification();
4791 finishCheck.CheckSignalNotReceived();
4792 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4794 application.SendNotification();
4795 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4797 // We didn't expect the animation to finish yet
4798 application.SendNotification();
4799 finishCheck.CheckSignalNotReceived();
4800 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4802 application.SendNotification();
4803 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4805 // We did expect the animation to finish
4806 application.SendNotification();
4807 finishCheck.CheckSignalReceived();
4808 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4812 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4814 TestApplication application;
4816 Actor actor = Actor::New();
4817 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4818 Stage::GetCurrent().Add(actor);
4819 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4821 // Build the animation
4822 float durationSeconds(1.0f);
4823 Animation animation = Animation::New(durationSeconds);
4824 Degree relativeRotationDegrees(360.0f);
4825 Radian relativeRotationRadians(relativeRotationDegrees);
4827 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4828 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4830 // Start the animation
4833 bool signalReceived(false);
4834 AnimationFinishCheck finishCheck(signalReceived);
4835 animation.FinishedSignal().Connect(&application, finishCheck);
4837 application.SendNotification();
4838 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4840 // We didn't expect the animation to finish yet
4841 application.SendNotification();
4842 finishCheck.CheckSignalNotReceived();
4843 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4844 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4846 application.SendNotification();
4847 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4849 // We didn't expect the animation to finish yet
4850 application.SendNotification();
4851 finishCheck.CheckSignalNotReceived();
4852 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4853 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4855 application.SendNotification();
4856 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4858 // We didn't expect the animation to finish yet
4859 application.SendNotification();
4860 finishCheck.CheckSignalNotReceived();
4861 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4862 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4864 application.SendNotification();
4865 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4867 // We did expect the animation to finish
4868 application.SendNotification();
4869 finishCheck.CheckSignalReceived();
4870 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4874 int UtcDaliAnimationAnimateByActorScaleP(void)
4876 TestApplication application;
4878 Actor actor = Actor::New();
4879 Stage::GetCurrent().Add(actor);
4880 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4882 // Build the animation
4883 float durationSeconds(1.0f);
4884 Animation animation = Animation::New(durationSeconds);
4885 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4886 Vector3 relativeScale(targetScale - Vector3::ONE);
4887 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4889 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4891 // Start the animation
4894 // Target value should be retrievable straight away
4895 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
4897 bool signalReceived(false);
4898 AnimationFinishCheck finishCheck(signalReceived);
4899 animation.FinishedSignal().Connect(&application, finishCheck);
4901 application.SendNotification();
4902 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4904 // We didn't expect the animation to finish yet
4905 application.SendNotification();
4906 finishCheck.CheckSignalNotReceived();
4907 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4909 application.SendNotification();
4910 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4912 // We did expect the animation to finish
4913 application.SendNotification();
4914 finishCheck.CheckSignalReceived();
4915 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4918 finishCheck.Reset();
4919 actor.SetScale(Vector3::ONE);
4920 application.SendNotification();
4921 application.Render(0);
4922 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4924 // Repeat with a different (ease-in) alpha function
4925 animation = Animation::New(durationSeconds);
4926 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4927 animation.FinishedSignal().Connect(&application, finishCheck);
4930 application.SendNotification();
4931 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4933 // We didn't expect the animation to finish yet
4934 application.SendNotification();
4935 finishCheck.CheckSignalNotReceived();
4937 // The scale should have grown less, than with a linear alpha function
4938 Vector3 current(actor.GetCurrentScale());
4939 DALI_TEST_CHECK( current.x > 1.0f );
4940 DALI_TEST_CHECK( current.y > 1.0f );
4941 DALI_TEST_CHECK( current.z > 1.0f );
4942 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4943 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4944 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4946 application.SendNotification();
4947 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4949 // We did expect the animation to finish
4950 application.SendNotification();
4951 finishCheck.CheckSignalReceived();
4952 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4955 finishCheck.Reset();
4956 actor.SetScale(Vector3::ONE);
4957 application.SendNotification();
4958 application.Render(0);
4959 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4961 // Repeat with a delay
4963 animation = Animation::New(durationSeconds);
4964 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4965 animation.FinishedSignal().Connect(&application, finishCheck);
4968 application.SendNotification();
4969 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4971 // We didn't expect the animation to finish yet
4972 application.SendNotification();
4973 finishCheck.CheckSignalNotReceived();
4974 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4976 application.SendNotification();
4977 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4979 // We did expect the animation to finish
4980 application.SendNotification();
4981 finishCheck.CheckSignalReceived();
4982 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4986 int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
4988 TestApplication application;
4990 Actor actor = Actor::New();
4991 Stage::GetCurrent().Add(actor);
4992 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4994 // Build the animation
4995 float durationSeconds(1.0f);
4996 Animation animation = Animation::New(durationSeconds);
4997 Vector3 targetScale(2.0f, 3.0f, 4.0f);
4998 Vector3 relativeScale(targetScale - Vector3::ONE);
4999 animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
5000 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
5001 animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
5003 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
5004 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
5006 // Start the animation
5009 // Target value should be retrievable straight away
5010 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
5011 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
5012 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
5013 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
5015 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Not changed yet
5017 application.SendNotification();
5018 application.Render( 1000 ); // 1 second progress
5020 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
5025 int UtcDaliAnimationAnimateByActorColorP(void)
5027 TestApplication application;
5029 Actor actor = Actor::New();
5030 Stage::GetCurrent().Add(actor);
5031 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5033 // Build the animation
5034 float durationSeconds(1.0f);
5035 Animation animation = Animation::New(durationSeconds);
5036 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5037 Vector4 relativeColor( targetColor - Color::WHITE );
5038 animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
5040 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5041 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5043 // Start the animation
5046 // Target value should be retrievable straight away
5047 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5048 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5049 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5050 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5051 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5053 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5055 application.SendNotification();
5056 application.Render( 1000 ); // 1 second progress
5058 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5063 int UtcDaliAnimationAnimateByActorColorComponentsP(void)
5065 TestApplication application;
5067 Actor actor = Actor::New();
5068 Stage::GetCurrent().Add(actor);
5069 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5071 // Build the animation
5072 float durationSeconds(1.0f);
5073 Animation animation = Animation::New(durationSeconds);
5074 Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
5075 Vector4 relativeColor( targetColor - Color::WHITE );
5076 animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
5077 animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
5078 animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
5079 animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
5081 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
5082 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
5084 // Start the animation
5087 // Target value should be retrievable straight away
5088 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
5089 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
5090 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
5091 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
5092 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
5094 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
5096 application.SendNotification();
5097 application.Render( 1000 ); // 1 second progress
5099 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
5104 int UtcDaliAnimationAnimateByActorSizeP(void)
5106 TestApplication application;
5108 Actor actor = Actor::New();
5109 Stage::GetCurrent().Add(actor);
5110 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5112 // Build the animation
5113 float durationSeconds(1.0f);
5114 Animation animation = Animation::New(durationSeconds);
5115 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5116 Vector3 relativeSize( targetSize - Vector3::ZERO );
5117 animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
5119 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5120 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5122 // Start the animation
5125 // Target value should be retrievable straight away
5126 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5127 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5128 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5129 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5131 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5133 application.SendNotification();
5134 application.Render( 1000 ); // 1 second progress
5136 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5141 int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
5143 TestApplication application;
5145 Actor actor = Actor::New();
5146 Stage::GetCurrent().Add(actor);
5147 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5149 // Build the animation
5150 float durationSeconds(1.0f);
5151 Animation animation = Animation::New(durationSeconds);
5152 Vector3 targetSize( 100.0f, 200.0f, 300.0f );
5153 Vector3 relativeSize( targetSize - Vector3::ZERO );
5154 animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
5155 animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
5156 animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
5158 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
5159 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
5161 // Start the animation
5164 // Target value should be retrievable straight away
5165 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
5166 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
5167 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
5168 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
5170 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
5172 application.SendNotification();
5173 application.Render( 1000 ); // 1 second progress
5175 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
5180 int UtcDaliAnimationAnimateByActorVisibilityP(void)
5182 TestApplication application;
5184 Actor actor = Actor::New();
5185 Stage::GetCurrent().Add(actor);
5186 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5188 actor.SetVisible( false );
5190 application.SendNotification();
5191 application.Render();
5193 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
5195 // Build the animation
5196 float durationSeconds(1.0f);
5197 Animation animation = Animation::New(durationSeconds);
5198 bool targetVisibility( true );
5199 bool relativeVisibility( targetVisibility );
5200 animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
5202 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
5204 // Start the animation
5207 // Target value should be retrievable straight away
5208 DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
5209 DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION ); // Not changed yet
5211 application.SendNotification();
5212 application.Render( 1000 ); // 1 second progress
5214 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
5219 int UtcDaliAnimationAnimateToBooleanP(void)
5221 TestApplication application;
5223 Actor actor = Actor::New();
5225 // Register a boolean property
5226 const bool startValue(false);
5227 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5228 Stage::GetCurrent().Add(actor);
5229 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5230 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5232 // Build the animation
5233 float durationSeconds(2.0f);
5234 Animation animation = Animation::New(durationSeconds);
5235 const bool targetValue( !startValue );
5236 animation.AnimateTo(Property(actor, index), targetValue);
5238 // Start the animation
5241 bool signalReceived(false);
5242 AnimationFinishCheck finishCheck(signalReceived);
5243 animation.FinishedSignal().Connect(&application, finishCheck);
5245 application.SendNotification();
5246 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5248 // We didn't expect the animation to finish yet
5249 application.SendNotification();
5250 finishCheck.CheckSignalNotReceived();
5251 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5253 application.SendNotification();
5254 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5256 // We did expect the animation to finish
5257 application.SendNotification();
5258 finishCheck.CheckSignalReceived();
5259 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5261 // Check that nothing has changed after a couple of buffer swaps
5262 application.Render(0);
5263 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5264 application.Render(0);
5265 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5267 // Repeat with target value "false"
5268 animation = Animation::New(durationSeconds);
5269 const bool finalValue( !targetValue );
5270 animation.AnimateTo(Property(actor, index), finalValue);
5272 // Start the animation
5275 finishCheck.Reset();
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();
5284 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5286 application.SendNotification();
5287 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5289 // We did expect the animation to finish
5290 application.SendNotification();
5291 finishCheck.CheckSignalReceived();
5292 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5294 // Check that nothing has changed after a couple of buffer swaps
5295 application.Render(0);
5296 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5297 application.Render(0);
5298 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5302 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
5304 TestApplication application;
5306 Actor actor = Actor::New();
5308 // Register a boolean property
5309 const bool startValue(false);
5310 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5311 Stage::GetCurrent().Add(actor);
5312 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5313 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5315 // Build the animation
5316 float durationSeconds(2.0f);
5317 Animation animation = Animation::New(durationSeconds);
5318 const bool targetValue( !startValue );
5319 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5321 // Start the animation
5324 bool signalReceived(false);
5325 AnimationFinishCheck finishCheck(signalReceived);
5326 animation.FinishedSignal().Connect(&application, finishCheck);
5328 application.SendNotification();
5329 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5331 // We didn't expect the animation to finish yet
5332 application.SendNotification();
5333 finishCheck.CheckSignalNotReceived();
5334 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5336 application.SendNotification();
5337 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5339 // We did expect the animation to finish
5340 application.SendNotification();
5341 finishCheck.CheckSignalReceived();
5342 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5344 // Check that nothing has changed after a couple of buffer swaps
5345 application.Render(0);
5346 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5347 application.Render(0);
5348 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5350 // Repeat with target value "false"
5351 animation = Animation::New(durationSeconds);
5352 const bool finalValue( !targetValue );
5353 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
5355 // Start the animation
5358 finishCheck.Reset();
5359 animation.FinishedSignal().Connect(&application, finishCheck);
5361 application.SendNotification();
5362 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5364 // We didn't expect the animation to finish yet
5365 application.SendNotification();
5366 finishCheck.CheckSignalNotReceived();
5367 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
5369 application.SendNotification();
5370 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5372 // We did expect the animation to finish
5373 application.SendNotification();
5374 finishCheck.CheckSignalReceived();
5375 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5377 // Check that nothing has changed after a couple of buffer swaps
5378 application.Render(0);
5379 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5380 application.Render(0);
5381 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5385 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
5387 TestApplication application;
5389 Actor actor = Actor::New();
5391 // Register a boolean property
5392 bool startValue(false);
5393 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5394 Stage::GetCurrent().Add(actor);
5395 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5396 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5398 // Build the animation
5399 float durationSeconds(2.0f);
5400 Animation animation = Animation::New(durationSeconds);
5401 bool finalValue( !startValue );
5402 float animatorDurationSeconds(durationSeconds * 0.5f);
5403 animation.AnimateTo( Property(actor, index),
5405 TimePeriod( animatorDurationSeconds ) );
5407 // Start the animation
5410 bool signalReceived(false);
5411 AnimationFinishCheck finishCheck(signalReceived);
5412 animation.FinishedSignal().Connect(&application, finishCheck);
5414 application.SendNotification();
5415 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5417 // We didn't expect the animation to finish yet
5418 application.SendNotification();
5419 finishCheck.CheckSignalNotReceived();
5420 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5422 application.SendNotification();
5423 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5425 // We didn't expect the animation to finish yet...
5426 application.SendNotification();
5427 finishCheck.CheckSignalNotReceived();
5429 // ...however we should have reached the final value
5430 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5432 application.SendNotification();
5433 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5435 // We did expect the animation to finish
5436 application.SendNotification();
5437 finishCheck.CheckSignalReceived();
5438 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5440 // Check that nothing has changed after a couple of buffer swaps
5441 application.Render(0);
5442 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5443 application.Render(0);
5444 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5448 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
5450 TestApplication application;
5452 Actor actor = Actor::New();
5454 // Register a boolean property
5455 bool startValue(false);
5456 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5457 Stage::GetCurrent().Add(actor);
5458 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
5459 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5461 // Build the animation
5462 float durationSeconds(2.0f);
5463 Animation animation = Animation::New(durationSeconds);
5464 bool finalValue( !startValue );
5465 float animatorDurationSeconds(durationSeconds * 0.5f);
5466 animation.AnimateTo( Property(actor, index),
5468 AlphaFunction::LINEAR,
5469 TimePeriod( animatorDurationSeconds ) );
5471 // Start the animation
5474 bool signalReceived(false);
5475 AnimationFinishCheck finishCheck(signalReceived);
5476 animation.FinishedSignal().Connect(&application, finishCheck);
5478 application.SendNotification();
5479 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
5481 // We didn't expect the animation to finish yet
5482 application.SendNotification();
5483 finishCheck.CheckSignalNotReceived();
5484 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
5486 application.SendNotification();
5487 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
5489 // We didn't expect the animation to finish yet...
5490 application.SendNotification();
5491 finishCheck.CheckSignalNotReceived();
5493 // ...however we should have reached the final value
5494 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5496 application.SendNotification();
5497 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5499 // We did expect the animation to finish
5500 application.SendNotification();
5501 finishCheck.CheckSignalReceived();
5502 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5504 // Check that nothing has changed after a couple of buffer swaps
5505 application.Render(0);
5506 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5507 application.Render(0);
5508 DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
5512 int UtcDaliAnimationAnimateToFloatP(void)
5514 TestApplication application;
5516 Actor actor = Actor::New();
5518 // Register a float property
5519 float startValue(10.0f);
5520 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5521 Stage::GetCurrent().Add(actor);
5522 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5523 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5525 // Build the animation
5526 float durationSeconds(2.0f);
5527 Animation animation = Animation::New(durationSeconds);
5528 float targetValue(50.0f);
5529 float relativeValue(targetValue - startValue);
5530 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5532 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5534 // Start the animation
5537 bool signalReceived(false);
5538 AnimationFinishCheck finishCheck(signalReceived);
5539 animation.FinishedSignal().Connect(&application, finishCheck);
5541 application.SendNotification();
5542 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5544 // We didn't expect the animation to finish yet
5545 application.SendNotification();
5546 finishCheck.CheckSignalNotReceived();
5547 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5549 application.SendNotification();
5550 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5552 // We did expect the animation to finish
5553 application.SendNotification();
5554 finishCheck.CheckSignalReceived();
5555 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5559 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5561 TestApplication application;
5563 Actor actor = Actor::New();
5565 // Register a float property
5566 float startValue(10.0f);
5567 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5568 Stage::GetCurrent().Add(actor);
5569 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5570 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5572 // Build the animation
5573 float durationSeconds(1.0f);
5574 Animation animation = Animation::New(durationSeconds);
5575 float targetValue(90.0f);
5576 float relativeValue(targetValue - startValue);
5577 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5579 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5581 // Start the animation
5584 bool signalReceived(false);
5585 AnimationFinishCheck finishCheck(signalReceived);
5586 animation.FinishedSignal().Connect(&application, finishCheck);
5588 application.SendNotification();
5589 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5591 // We didn't expect the animation to finish yet
5592 application.SendNotification();
5593 finishCheck.CheckSignalNotReceived();
5595 // The position should have moved more, than with a linear alpha function
5596 float current( actor.GetCurrentProperty< float >( index ) );
5597 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5599 application.SendNotification();
5600 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5602 // We did expect the animation to finish
5603 application.SendNotification();
5604 finishCheck.CheckSignalReceived();
5605 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5609 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5611 TestApplication application;
5613 Actor actor = Actor::New();
5615 // Register a float property
5616 float startValue(10.0f);
5617 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5618 Stage::GetCurrent().Add(actor);
5619 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5620 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5622 // Build the animation
5623 float durationSeconds(1.0f);
5624 Animation animation = Animation::New(durationSeconds);
5625 float targetValue(30.0f);
5626 float relativeValue(targetValue - startValue);
5628 animation.AnimateTo(Property(actor, index),
5630 TimePeriod(delay, durationSeconds - delay));
5632 // Start the animation
5635 bool signalReceived(false);
5636 AnimationFinishCheck finishCheck(signalReceived);
5637 animation.FinishedSignal().Connect(&application, finishCheck);
5639 application.SendNotification();
5640 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5642 // We didn't expect the animation to finish yet
5643 application.SendNotification();
5644 finishCheck.CheckSignalNotReceived();
5645 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5647 application.SendNotification();
5648 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5650 // We didn't expect the animation to finish yet
5651 application.SendNotification();
5652 finishCheck.CheckSignalNotReceived();
5653 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5655 application.SendNotification();
5656 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5658 // We did expect the animation to finish
5659 application.SendNotification();
5660 finishCheck.CheckSignalReceived();
5661 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5665 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5667 TestApplication application;
5669 Actor actor = Actor::New();
5671 // Register a float property
5672 float startValue(10.0f);
5673 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5674 Stage::GetCurrent().Add(actor);
5675 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5676 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5678 // Build the animation
5679 float durationSeconds(1.0f);
5680 Animation animation = Animation::New(durationSeconds);
5681 float targetValue(30.0f);
5682 float relativeValue(targetValue - startValue);
5684 animation.AnimateTo(Property(actor, index),
5686 AlphaFunction::LINEAR,
5687 TimePeriod(delay, durationSeconds - delay));
5689 // Start the animation
5692 bool signalReceived(false);
5693 AnimationFinishCheck finishCheck(signalReceived);
5694 animation.FinishedSignal().Connect(&application, finishCheck);
5696 application.SendNotification();
5697 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5699 // We didn't expect the animation to finish yet
5700 application.SendNotification();
5701 finishCheck.CheckSignalNotReceived();
5702 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
5704 application.SendNotification();
5705 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5707 // We didn't expect the animation to finish yet
5708 application.SendNotification();
5709 finishCheck.CheckSignalNotReceived();
5710 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
5712 application.SendNotification();
5713 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5715 // We did expect the animation to finish
5716 application.SendNotification();
5717 finishCheck.CheckSignalReceived();
5718 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
5722 int UtcDaliAnimationAnimateToIntegerP(void)
5724 TestApplication application;
5726 Actor actor = Actor::New();
5728 // Register an integer property
5730 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5731 Stage::GetCurrent().Add(actor);
5732 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5733 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5735 // Build the animation
5736 float durationSeconds(2.0f);
5737 Animation animation = Animation::New(durationSeconds);
5738 int targetValue(50);
5739 int relativeValue(targetValue - startValue);
5740 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5742 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5744 // Start the animation
5747 bool signalReceived(false);
5748 AnimationFinishCheck finishCheck(signalReceived);
5749 animation.FinishedSignal().Connect(&application, finishCheck);
5751 application.SendNotification();
5752 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5754 // We didn't expect the animation to finish yet
5755 application.SendNotification();
5756 finishCheck.CheckSignalNotReceived();
5757 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5759 application.SendNotification();
5760 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5762 // We did expect the animation to finish
5763 application.SendNotification();
5764 finishCheck.CheckSignalReceived();
5765 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5769 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5771 TestApplication application;
5773 Actor actor = Actor::New();
5775 // Register an integer property
5777 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5778 Stage::GetCurrent().Add(actor);
5779 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5780 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5782 // Build the animation
5783 float durationSeconds(1.0f);
5784 Animation animation = Animation::New(durationSeconds);
5785 int targetValue(90);
5786 int relativeValue(targetValue - startValue);
5787 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5789 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5791 // Start the animation
5794 bool signalReceived(false);
5795 AnimationFinishCheck finishCheck(signalReceived);
5796 animation.FinishedSignal().Connect(&application, finishCheck);
5798 application.SendNotification();
5799 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5801 // We didn't expect the animation to finish yet
5802 application.SendNotification();
5803 finishCheck.CheckSignalNotReceived();
5805 // The position should have moved more, than with a linear alpha function
5806 int current( actor.GetCurrentProperty< int >( index ) );
5807 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5809 application.SendNotification();
5810 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5812 // We did expect the animation to finish
5813 application.SendNotification();
5814 finishCheck.CheckSignalReceived();
5815 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5819 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5821 TestApplication application;
5823 Actor actor = Actor::New();
5825 // Register an integer property
5827 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5828 Stage::GetCurrent().Add(actor);
5829 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5830 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5832 // Build the animation
5833 float durationSeconds(1.0f);
5834 Animation animation = Animation::New(durationSeconds);
5835 int targetValue(30);
5836 int relativeValue(targetValue - startValue);
5838 animation.AnimateTo(Property(actor, index),
5840 TimePeriod(delay, durationSeconds - delay));
5842 // Start the animation
5845 bool signalReceived(false);
5846 AnimationFinishCheck finishCheck(signalReceived);
5847 animation.FinishedSignal().Connect(&application, finishCheck);
5849 application.SendNotification();
5850 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5852 // We didn't expect the animation to finish yet
5853 application.SendNotification();
5854 finishCheck.CheckSignalNotReceived();
5855 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5857 application.SendNotification();
5858 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5860 // We didn't expect the animation to finish yet
5861 application.SendNotification();
5862 finishCheck.CheckSignalNotReceived();
5863 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5865 application.SendNotification();
5866 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5868 // We did expect the animation to finish
5869 application.SendNotification();
5870 finishCheck.CheckSignalReceived();
5871 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5875 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5877 TestApplication application;
5879 Actor actor = Actor::New();
5881 // Register an integer property
5883 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5884 Stage::GetCurrent().Add(actor);
5885 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5886 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5888 // Build the animation
5889 float durationSeconds(1.0f);
5890 Animation animation = Animation::New(durationSeconds);
5891 int targetValue(30);
5892 int relativeValue(targetValue - startValue);
5894 animation.AnimateTo(Property(actor, index),
5896 AlphaFunction::LINEAR,
5897 TimePeriod(delay, durationSeconds - delay));
5899 // Start the animation
5902 bool signalReceived(false);
5903 AnimationFinishCheck finishCheck(signalReceived);
5904 animation.FinishedSignal().Connect(&application, finishCheck);
5906 application.SendNotification();
5907 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5909 // We didn't expect the animation to finish yet
5910 application.SendNotification();
5911 finishCheck.CheckSignalNotReceived();
5912 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
5914 application.SendNotification();
5915 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5917 // We didn't expect the animation to finish yet
5918 application.SendNotification();
5919 finishCheck.CheckSignalNotReceived();
5920 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5922 application.SendNotification();
5923 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5925 // We did expect the animation to finish
5926 application.SendNotification();
5927 finishCheck.CheckSignalReceived();
5928 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
5932 int UtcDaliAnimationAnimateToVector2P(void)
5934 TestApplication application;
5936 Actor actor = Actor::New();
5938 // Register a Vector2 property
5939 Vector2 startValue(-50.0f, -50.0f);
5940 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5941 Stage::GetCurrent().Add(actor);
5942 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5943 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5945 // Build the animation
5946 float durationSeconds(2.0f);
5947 Animation animation = Animation::New(durationSeconds);
5948 Vector2 targetValue(50.0f, 50.0f);
5949 Vector2 relativeValue(targetValue - startValue);
5950 animation.AnimateTo(Property(actor, index), targetValue);
5952 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5954 // Start the animation
5957 bool signalReceived(false);
5958 AnimationFinishCheck finishCheck(signalReceived);
5959 animation.FinishedSignal().Connect(&application, finishCheck);
5961 application.SendNotification();
5962 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5964 // We didn't expect the animation to finish yet
5965 application.SendNotification();
5966 finishCheck.CheckSignalNotReceived();
5967 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
5969 application.SendNotification();
5970 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5972 // We did expect the animation to finish
5973 application.SendNotification();
5974 finishCheck.CheckSignalReceived();
5975 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
5979 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5981 TestApplication application;
5983 Actor actor = Actor::New();
5985 // Register a Vector2 property
5986 Vector2 startValue(1000.0f, 1000.0f);
5987 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5988 Stage::GetCurrent().Add(actor);
5989 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5990 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
5992 // Build the animation
5993 float durationSeconds(1.0f);
5994 Animation animation = Animation::New(durationSeconds);
5995 Vector2 targetValue(9000.0f, 9000.0f);
5996 Vector2 relativeValue(targetValue - startValue);
5997 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5999 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6001 // Start the animation
6004 bool signalReceived(false);
6005 AnimationFinishCheck finishCheck(signalReceived);
6006 animation.FinishedSignal().Connect(&application, finishCheck);
6008 application.SendNotification();
6009 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6011 // We didn't expect the animation to finish yet
6012 application.SendNotification();
6013 finishCheck.CheckSignalNotReceived();
6015 // The position should have moved more, than with a linear alpha function
6016 Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
6017 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6018 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6020 application.SendNotification();
6021 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6023 // We did expect the animation to finish
6024 application.SendNotification();
6025 finishCheck.CheckSignalReceived();
6026 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6030 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
6032 TestApplication application;
6034 Actor actor = Actor::New();
6036 // Register a Vector2 property
6037 Vector2 startValue(10.0f, 10.0f);
6038 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6039 Stage::GetCurrent().Add(actor);
6040 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6041 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6043 // Build the animation
6044 float durationSeconds(1.0f);
6045 Animation animation = Animation::New(durationSeconds);
6046 Vector2 targetValue(-10.0f, 20.0f);
6047 Vector2 relativeValue(targetValue - startValue);
6049 animation.AnimateTo(Property(actor, index),
6051 TimePeriod(delay, durationSeconds - delay));
6053 // Start the animation
6056 bool signalReceived(false);
6057 AnimationFinishCheck finishCheck(signalReceived);
6058 animation.FinishedSignal().Connect(&application, finishCheck);
6060 application.SendNotification();
6061 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6063 // We didn't expect the animation to finish yet
6064 application.SendNotification();
6065 finishCheck.CheckSignalNotReceived();
6066 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6068 application.SendNotification();
6069 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6071 // We didn't expect the animation to finish yet
6072 application.SendNotification();
6073 finishCheck.CheckSignalNotReceived();
6074 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6076 application.SendNotification();
6077 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6079 // We did expect the animation to finish
6080 application.SendNotification();
6081 finishCheck.CheckSignalReceived();
6082 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6086 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
6088 TestApplication application;
6090 Actor actor = Actor::New();
6092 // Register a Vector2 property
6093 Vector2 startValue(10.0f, 10.0f);
6094 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6095 Stage::GetCurrent().Add(actor);
6096 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6097 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
6099 // Build the animation
6100 float durationSeconds(1.0f);
6101 Animation animation = Animation::New(durationSeconds);
6102 Vector2 targetValue(30.0f, 30.0f);
6103 Vector2 relativeValue(targetValue - startValue);
6105 animation.AnimateTo(Property(actor, index),
6107 AlphaFunction::LINEAR,
6108 TimePeriod(delay, durationSeconds - delay));
6110 // Start the animation
6113 bool signalReceived(false);
6114 AnimationFinishCheck finishCheck(signalReceived);
6115 animation.FinishedSignal().Connect(&application, finishCheck);
6117 application.SendNotification();
6118 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6120 // We didn't expect the animation to finish yet, but cached value should be the final one
6121 application.SendNotification();
6122 finishCheck.CheckSignalNotReceived();
6123 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6124 DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
6126 application.SendNotification();
6127 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6129 // We didn't expect the animation to finish yet
6130 application.SendNotification();
6131 finishCheck.CheckSignalNotReceived();
6132 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6134 application.SendNotification();
6135 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6137 // We did expect the animation to finish
6138 application.SendNotification();
6139 finishCheck.CheckSignalReceived();
6140 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6141 DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
6145 int UtcDaliAnimationAnimateToVector3P(void)
6147 TestApplication application;
6149 Actor actor = Actor::New();
6151 // Register a Vector3 property
6152 Vector3 startValue(-50.0f, -50.0f, -50.0f);
6153 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6154 Stage::GetCurrent().Add(actor);
6155 DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
6156 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6158 // Build the animation
6159 float durationSeconds(2.0f);
6160 Animation animation = Animation::New(durationSeconds);
6161 Vector3 targetValue(50.0f, 50.0f, 50.0f);
6162 Vector3 relativeValue(targetValue - startValue);
6163 animation.AnimateTo(Property(actor, index), targetValue);
6165 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6167 // Start the animation
6170 bool signalReceived(false);
6171 AnimationFinishCheck finishCheck(signalReceived);
6172 animation.FinishedSignal().Connect(&application, finishCheck);
6174 application.SendNotification();
6175 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6177 // We didn't expect the animation to finish yet
6178 application.SendNotification();
6179 finishCheck.CheckSignalNotReceived();
6180 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6182 application.SendNotification();
6183 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6185 // We did expect the animation to finish
6186 application.SendNotification();
6187 finishCheck.CheckSignalReceived();
6188 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6192 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
6194 TestApplication application;
6196 Actor actor = Actor::New();
6198 // Register a Vector3 property
6199 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
6200 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6201 Stage::GetCurrent().Add(actor);
6202 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6203 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6205 // Build the animation
6206 float durationSeconds(1.0f);
6207 Animation animation = Animation::New(durationSeconds);
6208 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
6209 Vector3 relativeValue(targetValue - startValue);
6210 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6212 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6214 // Start the animation
6217 bool signalReceived(false);
6218 AnimationFinishCheck finishCheck(signalReceived);
6219 animation.FinishedSignal().Connect(&application, finishCheck);
6221 application.SendNotification();
6222 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6224 // We didn't expect the animation to finish yet
6225 application.SendNotification();
6226 finishCheck.CheckSignalNotReceived();
6228 // The position should have moved more, than with a linear alpha function
6229 Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
6230 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6231 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6232 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6234 application.SendNotification();
6235 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6237 // We did expect the animation to finish
6238 application.SendNotification();
6239 finishCheck.CheckSignalReceived();
6240 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6244 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
6246 TestApplication application;
6248 Actor actor = Actor::New();
6250 // Register a Vector3 property
6251 Vector3 startValue(10.0f, 10.0f, 10.0f);
6252 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6253 Stage::GetCurrent().Add(actor);
6254 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6255 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6257 // Build the animation
6258 float durationSeconds(1.0f);
6259 Animation animation = Animation::New(durationSeconds);
6260 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
6261 Vector3 relativeValue(targetValue - startValue);
6263 animation.AnimateTo(Property(actor, index),
6265 TimePeriod(delay, durationSeconds - delay));
6267 // Start the animation
6270 bool signalReceived(false);
6271 AnimationFinishCheck finishCheck(signalReceived);
6272 animation.FinishedSignal().Connect(&application, finishCheck);
6274 application.SendNotification();
6275 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6277 // We didn't expect the animation to finish yet
6278 application.SendNotification();
6279 finishCheck.CheckSignalNotReceived();
6280 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6282 application.SendNotification();
6283 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6285 // We didn't expect the animation to finish yet
6286 application.SendNotification();
6287 finishCheck.CheckSignalNotReceived();
6288 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6290 application.SendNotification();
6291 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6293 // We did expect the animation to finish
6294 application.SendNotification();
6295 finishCheck.CheckSignalReceived();
6296 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6300 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
6302 TestApplication application;
6304 Actor actor = Actor::New();
6306 // Register a Vector3 property
6307 Vector3 startValue(10.0f, 10.0f, 10.0f);
6308 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6309 Stage::GetCurrent().Add(actor);
6310 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6311 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6313 // Build the animation
6314 float durationSeconds(1.0f);
6315 Animation animation = Animation::New(durationSeconds);
6316 Vector3 targetValue(30.0f, 30.0f, 30.0f);
6317 Vector3 relativeValue(targetValue - startValue);
6319 animation.AnimateTo(Property(actor, "testProperty"),
6321 AlphaFunction::LINEAR,
6322 TimePeriod(delay, durationSeconds - delay));
6324 // Start the animation
6327 bool signalReceived(false);
6328 AnimationFinishCheck finishCheck(signalReceived);
6329 animation.FinishedSignal().Connect(&application, finishCheck);
6331 application.SendNotification();
6332 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6334 // We didn't expect the animation to finish yet
6335 application.SendNotification();
6336 finishCheck.CheckSignalNotReceived();
6337 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6339 application.SendNotification();
6340 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6342 // We didn't expect the animation to finish yet
6343 application.SendNotification();
6344 finishCheck.CheckSignalNotReceived();
6345 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6347 application.SendNotification();
6348 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6350 // We did expect the animation to finish
6351 application.SendNotification();
6352 finishCheck.CheckSignalReceived();
6353 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6357 int UtcDaliAnimationAnimateToVector3ComponentP(void)
6359 TestApplication application;
6361 Actor actor = Actor::New();
6363 // Register a Vector3 property
6364 Vector3 startValue(10.0f, 10.0f, 10.0f);
6365 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6366 Stage::GetCurrent().Add(actor);
6367 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
6368 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6370 // Build the animation
6371 float durationSeconds(1.0f);
6372 Animation animation = Animation::New(durationSeconds);
6373 Vector3 targetValue(30.0f, 30.0f, 10.0f);
6374 Vector3 relativeValue(targetValue - startValue);
6376 animation.AnimateTo(Property(actor, "testProperty", 0),
6378 AlphaFunction::LINEAR,
6379 TimePeriod(delay, durationSeconds - delay));
6380 animation.AnimateTo(Property(actor, index, 1),
6382 AlphaFunction::LINEAR,
6383 TimePeriod(delay, durationSeconds - delay));
6385 // Start the animation
6388 bool signalReceived(false);
6389 AnimationFinishCheck finishCheck(signalReceived);
6390 animation.FinishedSignal().Connect(&application, finishCheck);
6392 application.SendNotification();
6393 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6395 // We didn't expect the animation to finish yet
6396 application.SendNotification();
6397 finishCheck.CheckSignalNotReceived();
6398 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
6400 application.SendNotification();
6401 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6403 // We didn't expect the animation to finish yet
6404 application.SendNotification();
6405 finishCheck.CheckSignalNotReceived();
6406 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6408 application.SendNotification();
6409 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6411 // We did expect the animation to finish
6412 application.SendNotification();
6413 finishCheck.CheckSignalReceived();
6414 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
6418 int UtcDaliAnimationAnimateToVector4P(void)
6420 TestApplication application;
6422 Actor actor = Actor::New();
6424 // Register a Vector4 property
6425 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
6426 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6427 Stage::GetCurrent().Add(actor);
6428 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6429 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6431 // Build the animation
6432 float durationSeconds(2.0f);
6433 Animation animation = Animation::New(durationSeconds);
6434 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
6435 Vector4 relativeValue(targetValue - startValue);
6436 animation.AnimateTo(Property(actor, index), targetValue);
6438 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6440 // Start the animation
6443 bool signalReceived(false);
6444 AnimationFinishCheck finishCheck(signalReceived);
6445 animation.FinishedSignal().Connect(&application, finishCheck);
6447 application.SendNotification();
6448 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6450 // We didn't expect the animation to finish yet
6451 application.SendNotification();
6452 finishCheck.CheckSignalNotReceived();
6453 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
6455 application.SendNotification();
6456 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6458 // We did expect the animation to finish
6459 application.SendNotification();
6460 finishCheck.CheckSignalReceived();
6461 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6465 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
6467 TestApplication application;
6469 Actor actor = Actor::New();
6471 // Register a Vector4 property
6472 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
6473 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6474 Stage::GetCurrent().Add(actor);
6475 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6476 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6478 // Build the animation
6479 float durationSeconds(1.0f);
6480 Animation animation = Animation::New(durationSeconds);
6481 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
6482 Vector4 relativeValue(targetValue - startValue);
6483 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
6485 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
6487 // Start the animation
6490 bool signalReceived(false);
6491 AnimationFinishCheck finishCheck(signalReceived);
6492 animation.FinishedSignal().Connect(&application, finishCheck);
6494 application.SendNotification();
6495 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
6497 // We didn't expect the animation to finish yet
6498 application.SendNotification();
6499 finishCheck.CheckSignalNotReceived();
6501 // The position should have moved more, than with a linear alpha function
6502 Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
6503 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
6504 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
6505 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
6506 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
6508 application.SendNotification();
6509 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
6511 // We did expect the animation to finish
6512 application.SendNotification();
6513 finishCheck.CheckSignalReceived();
6514 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6518 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6520 TestApplication application;
6522 Actor actor = Actor::New();
6524 // Register a Vector4 property
6525 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6526 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6527 Stage::GetCurrent().Add(actor);
6528 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6529 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6531 // Build the animation
6532 float durationSeconds(1.0f);
6533 Animation animation = Animation::New(durationSeconds);
6534 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6535 Vector4 relativeValue(targetValue - startValue);
6537 animation.AnimateTo(Property(actor, index),
6539 TimePeriod(delay, durationSeconds - delay));
6541 // Start the animation
6544 bool signalReceived(false);
6545 AnimationFinishCheck finishCheck(signalReceived);
6546 animation.FinishedSignal().Connect(&application, finishCheck);
6548 application.SendNotification();
6549 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6551 // We didn't expect the animation to finish yet
6552 application.SendNotification();
6553 finishCheck.CheckSignalNotReceived();
6554 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6556 application.SendNotification();
6557 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6559 // We didn't expect the animation to finish yet
6560 application.SendNotification();
6561 finishCheck.CheckSignalNotReceived();
6562 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6564 application.SendNotification();
6565 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6567 // We did expect the animation to finish
6568 application.SendNotification();
6569 finishCheck.CheckSignalReceived();
6570 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6574 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6576 TestApplication application;
6578 Actor actor = Actor::New();
6580 // Register a Vector4 property
6581 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6582 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6583 Stage::GetCurrent().Add(actor);
6584 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6585 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6587 // Build the animation
6588 float durationSeconds(1.0f);
6589 Animation animation = Animation::New(durationSeconds);
6590 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6591 Vector4 relativeValue(targetValue - startValue);
6593 animation.AnimateTo(Property(actor, index),
6595 AlphaFunction::LINEAR,
6596 TimePeriod(delay, durationSeconds - delay));
6598 // Start the animation
6601 bool signalReceived(false);
6602 AnimationFinishCheck finishCheck(signalReceived);
6603 animation.FinishedSignal().Connect(&application, finishCheck);
6605 application.SendNotification();
6606 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6608 // We didn't expect the animation to finish yet
6609 application.SendNotification();
6610 finishCheck.CheckSignalNotReceived();
6611 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
6613 application.SendNotification();
6614 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6616 // We didn't expect the animation to finish yet
6617 application.SendNotification();
6618 finishCheck.CheckSignalNotReceived();
6619 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
6621 application.SendNotification();
6622 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6624 // We did expect the animation to finish
6625 application.SendNotification();
6626 finishCheck.CheckSignalReceived();
6627 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
6631 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6633 TestApplication application;
6635 Actor actor = Actor::New();
6636 Stage::GetCurrent().Add(actor);
6637 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6639 // Build the animation
6640 float durationSeconds(1.0f);
6641 Animation animation = Animation::New(durationSeconds);
6642 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6646 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6648 catch (Dali::DaliException& e)
6650 DALI_TEST_PRINT_ASSERT( e );
6651 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6656 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6658 TestApplication application;
6660 Actor actor = Actor::New();
6661 Stage::GetCurrent().Add(actor);
6662 float startValue(0.0f);
6663 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6664 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6666 // Build the animation
6667 float durationSeconds(1.0f);
6668 Animation animation = Animation::New(durationSeconds);
6669 float targetX(1.0f);
6673 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6675 catch (Dali::DaliException& e)
6677 DALI_TEST_PRINT_ASSERT( e );
6678 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6683 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6685 TestApplication application;
6687 Actor actor = Actor::New();
6688 Stage::GetCurrent().Add(actor);
6689 float startValue(0.0f);
6690 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6691 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6693 // Build the animation
6694 float durationSeconds(1.0f);
6695 Animation animation = Animation::New(durationSeconds);
6696 float targetY(1.0f);
6700 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6702 catch (Dali::DaliException& e)
6704 DALI_TEST_PRINT_ASSERT( e );
6705 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6710 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6712 TestApplication application;
6714 Actor actor = Actor::New();
6715 Stage::GetCurrent().Add(actor);
6716 float startValue(0.5f);
6717 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6718 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6720 // Build the animation
6721 float durationSeconds(1.0f);
6722 Animation animation = Animation::New(durationSeconds);
6723 float targetZ(1.0f);
6727 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6729 catch (Dali::DaliException& e)
6731 DALI_TEST_PRINT_ASSERT( e );
6732 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6737 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6739 TestApplication application;
6741 Actor actor = Actor::New();
6742 Stage::GetCurrent().Add(actor);
6743 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6745 // Build the animation
6746 float durationSeconds(1.0f);
6747 Animation animation = Animation::New(durationSeconds);
6748 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6752 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6754 catch (Dali::DaliException& e)
6756 DALI_TEST_PRINT_ASSERT( e );
6757 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6762 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6764 TestApplication application;
6766 Actor actor = Actor::New();
6767 Stage::GetCurrent().Add(actor);
6768 float startValue(0.5f);
6769 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6770 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6772 // Build the animation
6773 float durationSeconds(1.0f);
6774 Animation animation = Animation::New(durationSeconds);
6775 float targetX(1.0f);
6779 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6781 catch (Dali::DaliException& e)
6783 DALI_TEST_PRINT_ASSERT( e );
6784 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6789 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6791 TestApplication application;
6793 Actor actor = Actor::New();
6794 Stage::GetCurrent().Add(actor);
6795 float startValue(0.5f);
6796 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6797 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6799 // Build the animation
6800 float durationSeconds(1.0f);
6801 Animation animation = Animation::New(durationSeconds);
6802 float targetY(0.0f);
6806 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6808 catch (Dali::DaliException& e)
6810 DALI_TEST_PRINT_ASSERT( e );
6811 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6816 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6818 TestApplication application;
6820 Actor actor = Actor::New();
6821 Stage::GetCurrent().Add(actor);
6822 float startValue(0.5f);
6823 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6824 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6826 // Build the animation
6827 float durationSeconds(1.0f);
6828 Animation animation = Animation::New(durationSeconds);
6829 float targetZ(100.0f);
6833 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6835 catch (Dali::DaliException& e)
6837 DALI_TEST_PRINT_ASSERT( e );
6838 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6843 int UtcDaliAnimationAnimateToActorSizeP(void)
6845 TestApplication application;
6847 Actor actor = Actor::New();
6848 Stage::GetCurrent().Add(actor);
6849 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6851 // Build the animation
6852 float durationSeconds(1.0f);
6853 Animation animation = Animation::New(durationSeconds);
6854 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6855 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6857 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6859 // Should return the initial properties before play
6860 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6861 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
6862 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
6863 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
6865 // Start the animation
6868 // Should return the target property after play
6869 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
6870 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
6871 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
6872 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
6874 bool signalReceived(false);
6875 AnimationFinishCheck finishCheck(signalReceived);
6876 animation.FinishedSignal().Connect(&application, finishCheck);
6878 application.SendNotification();
6879 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6881 // We didn't expect the animation to finish yet
6882 application.SendNotification();
6883 finishCheck.CheckSignalNotReceived();
6884 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6886 application.SendNotification();
6887 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6889 // We did expect the animation to finish
6890 application.SendNotification();
6891 finishCheck.CheckSignalReceived();
6892 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6895 finishCheck.Reset();
6896 actor.SetSize(Vector3::ZERO);
6897 application.SendNotification();
6898 application.Render(0);
6899 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6901 // Repeat with a different (ease-in) alpha function
6902 animation = Animation::New(durationSeconds);
6903 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6904 animation.FinishedSignal().Connect(&application, finishCheck);
6907 application.SendNotification();
6908 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6910 // We didn't expect the animation to finish yet
6911 application.SendNotification();
6912 finishCheck.CheckSignalNotReceived();
6914 // The size should have travelled less, than with a linear alpha function
6915 Vector3 current(actor.GetCurrentSize());
6916 DALI_TEST_CHECK( current.x > 0.0f );
6917 DALI_TEST_CHECK( current.y > 0.0f );
6918 DALI_TEST_CHECK( current.z > 0.0f );
6919 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6920 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6921 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6923 application.SendNotification();
6924 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6926 // We did expect the animation to finish
6927 application.SendNotification();
6928 finishCheck.CheckSignalReceived();
6929 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6932 finishCheck.Reset();
6933 actor.SetSize(Vector3::ZERO);
6934 application.SendNotification();
6935 application.Render(0);
6936 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6938 // Repeat with a delay
6940 animation = Animation::New(durationSeconds);
6941 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6942 animation.FinishedSignal().Connect(&application, finishCheck);
6945 application.SendNotification();
6946 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6948 // We didn't expect the animation to finish yet
6949 application.SendNotification();
6950 finishCheck.CheckSignalNotReceived();
6951 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6953 application.SendNotification();
6954 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6956 // We did expect the animation to finish
6957 application.SendNotification();
6958 finishCheck.CheckSignalReceived();
6959 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6963 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6965 TestApplication application;
6967 Actor actor = Actor::New();
6968 Stage::GetCurrent().Add(actor);
6969 float startValue(0.0f);
6970 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6971 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6973 // Build the animation
6974 float durationSeconds(1.0f);
6975 Animation animation = Animation::New(durationSeconds);
6976 float targetWidth(10.0f);
6977 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6979 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6981 // Should return the initial properties before play
6982 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
6983 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
6985 // Start the animation
6988 // Should return the target property after play
6989 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
6990 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
6992 bool signalReceived(false);
6993 AnimationFinishCheck finishCheck(signalReceived);
6994 animation.FinishedSignal().Connect(&application, finishCheck);
6996 application.SendNotification();
6997 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6999 // We didn't expect the animation to finish yet
7000 application.SendNotification();
7001 finishCheck.CheckSignalNotReceived();
7002 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
7004 application.SendNotification();
7005 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7007 // We did expect the animation to finish
7008 application.SendNotification();
7009 finishCheck.CheckSignalReceived();
7010 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
7011 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
7015 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
7017 TestApplication application;
7019 Actor actor = Actor::New();
7020 Stage::GetCurrent().Add(actor);
7021 float startValue(0.0f);
7022 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
7023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
7025 // Build the animation
7026 float durationSeconds(1.0f);
7027 Animation animation = Animation::New(durationSeconds);
7028 float targetHeight(-10.0f);
7029 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
7031 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
7033 // Should return the initial properties before play
7034 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7035 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
7037 // Start the animation
7040 // Should return the target property after play
7041 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
7042 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
7044 bool signalReceived(false);
7045 AnimationFinishCheck finishCheck(signalReceived);
7046 animation.FinishedSignal().Connect(&application, finishCheck);
7048 application.SendNotification();
7049 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7051 // We didn't expect the animation to finish yet
7052 application.SendNotification();
7053 finishCheck.CheckSignalNotReceived();
7054 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
7056 application.SendNotification();
7057 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7059 // We did expect the animation to finish
7060 application.SendNotification();
7061 finishCheck.CheckSignalReceived();
7062 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
7063 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
7067 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
7069 TestApplication application;
7071 Actor actor = Actor::New();
7072 Stage::GetCurrent().Add(actor);
7073 float startValue(0.0f);
7074 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
7075 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
7077 // Build the animation
7078 float durationSeconds(1.0f);
7079 Animation animation = Animation::New(durationSeconds);
7080 float targetDepth(-10.0f);
7081 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
7083 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
7085 // Should return the initial properties before play
7086 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
7087 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
7089 // Start the animation
7092 // Should return the target property after play
7093 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
7094 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
7096 bool signalReceived(false);
7097 AnimationFinishCheck finishCheck(signalReceived);
7098 animation.FinishedSignal().Connect(&application, finishCheck);
7100 application.SendNotification();
7101 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7103 // We didn't expect the animation to finish yet
7104 application.SendNotification();
7105 finishCheck.CheckSignalNotReceived();
7106 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
7108 application.SendNotification();
7109 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7111 // We did expect the animation to finish
7112 application.SendNotification();
7113 finishCheck.CheckSignalReceived();
7114 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
7115 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
7119 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
7121 TestApplication application;
7123 Actor actor = Actor::New();
7124 Stage::GetCurrent().Add(actor);
7125 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7127 // Build the animation
7128 float durationSeconds(1.0f);
7129 Animation animation = Animation::New(durationSeconds);
7130 Vector3 targetSize(100.0f, 100.0f, 100.0f);
7131 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
7133 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
7135 // Start the animation
7138 bool signalReceived(false);
7139 AnimationFinishCheck finishCheck(signalReceived);
7140 animation.FinishedSignal().Connect(&application, finishCheck);
7142 application.SendNotification();
7143 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7145 // We didn't expect the animation to finish yet
7146 application.SendNotification();
7147 finishCheck.CheckSignalNotReceived();
7148 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
7150 application.SendNotification();
7151 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7153 // We did expect the animation to finish
7154 application.SendNotification();
7155 finishCheck.CheckSignalReceived();
7156 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
7159 finishCheck.Reset();
7160 actor.SetSize(Vector3::ZERO);
7161 application.SendNotification();
7162 application.Render(0);
7163 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7165 // Repeat with a different (ease-in) alpha function
7166 animation = Animation::New(durationSeconds);
7167 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
7168 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
7169 animation.FinishedSignal().Connect(&application, finishCheck);
7172 application.SendNotification();
7173 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7175 // We didn't expect the animation to finish yet
7176 application.SendNotification();
7177 finishCheck.CheckSignalNotReceived();
7179 // The size should have travelled less, than with a linear alpha function
7180 Vector3 current(actor.GetCurrentSize());
7181 DALI_TEST_CHECK( current.x > 0.0f );
7182 DALI_TEST_CHECK( current.y > 0.0f );
7183 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7184 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7186 application.SendNotification();
7187 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7189 // We did expect the animation to finish
7190 application.SendNotification();
7191 finishCheck.CheckSignalReceived();
7192 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7193 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7196 finishCheck.Reset();
7197 actor.SetSize(Vector3::ZERO);
7198 application.SendNotification();
7199 application.Render(0);
7200 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7202 // Repeat with a delay
7204 animation = Animation::New(durationSeconds);
7205 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7206 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
7207 animation.FinishedSignal().Connect(&application, finishCheck);
7210 application.SendNotification();
7211 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7213 // We didn't expect the animation to finish yet
7214 application.SendNotification();
7215 finishCheck.CheckSignalNotReceived();
7216 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
7218 application.SendNotification();
7219 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7221 // We did expect the animation to finish
7222 application.SendNotification();
7223 finishCheck.CheckSignalReceived();
7224 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
7225 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
7229 int UtcDaliAnimationAnimateToActorPositionP(void)
7231 TestApplication application;
7233 Actor actor = Actor::New();
7234 Stage::GetCurrent().Add(actor);
7235 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7237 // Build the animation
7238 float durationSeconds(1.0f);
7239 Animation animation = Animation::New(durationSeconds);
7240 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7241 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
7243 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7245 // Should return the initial properties before play
7246 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7247 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
7248 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
7249 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
7251 // Start the animation
7254 // Should return the target property after play
7255 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
7256 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
7257 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
7258 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
7260 bool signalReceived(false);
7261 AnimationFinishCheck finishCheck(signalReceived);
7262 animation.FinishedSignal().Connect(&application, finishCheck);
7264 application.SendNotification();
7265 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7267 // We didn't expect the animation to finish yet
7268 application.SendNotification();
7269 finishCheck.CheckSignalNotReceived();
7270 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7272 application.SendNotification();
7273 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7275 // We did expect the animation to finish
7276 application.SendNotification();
7277 finishCheck.CheckSignalReceived();
7278 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7282 int UtcDaliAnimationAnimateToActorPositionXP(void)
7284 TestApplication application;
7286 Actor actor = Actor::New();
7287 Stage::GetCurrent().Add(actor);
7288 float startValue(0.0f);
7289 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
7290 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7291 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7292 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7294 // Build the animation
7295 float durationSeconds(1.0f);
7296 Animation animation = Animation::New(durationSeconds);
7297 float targetX(1.0f);
7298 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
7300 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7302 // Should return the initial properties before play
7303 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7304 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
7306 // Start the animation
7309 // Should return the target property after play
7310 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
7311 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
7313 bool signalReceived(false);
7314 AnimationFinishCheck finishCheck(signalReceived);
7315 animation.FinishedSignal().Connect(&application, finishCheck);
7317 application.SendNotification();
7318 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7320 // We didn't expect the animation to finish yet
7321 application.SendNotification();
7322 finishCheck.CheckSignalNotReceived();
7323 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
7325 application.SendNotification();
7326 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7328 // We did expect the animation to finish
7329 application.SendNotification();
7330 finishCheck.CheckSignalReceived();
7331 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
7332 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
7333 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7334 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7338 int UtcDaliAnimationAnimateToActorPositionYP(void)
7340 TestApplication application;
7342 Actor actor = Actor::New();
7343 Stage::GetCurrent().Add(actor);
7344 float startValue(0.0f);
7345 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
7346 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7347 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7348 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7350 // Build the animation
7351 float durationSeconds(1.0f);
7352 Animation animation = Animation::New(durationSeconds);
7353 float targetY(10.0f);
7354 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
7356 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7358 // Should return the initial properties before play
7359 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7360 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
7362 // Start the animation
7365 // Should return the target property after play
7366 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
7367 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
7369 bool signalReceived(false);
7370 AnimationFinishCheck finishCheck(signalReceived);
7371 animation.FinishedSignal().Connect(&application, finishCheck);
7373 application.SendNotification();
7374 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7376 // We didn't expect the animation to finish yet
7377 application.SendNotification();
7378 finishCheck.CheckSignalNotReceived();
7379 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
7381 application.SendNotification();
7382 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7384 // We did expect the animation to finish
7385 application.SendNotification();
7386 finishCheck.CheckSignalReceived();
7387 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
7388 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7389 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
7390 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7394 int UtcDaliAnimationAnimateToActorPositionZP(void)
7396 TestApplication application;
7398 Actor actor = Actor::New();
7399 Stage::GetCurrent().Add(actor);
7400 float startValue(0.0f);
7401 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
7402 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7403 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7404 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
7406 // Build the animation
7407 float durationSeconds(1.0f);
7408 Animation animation = Animation::New(durationSeconds);
7409 float targetZ(-5.0f);
7410 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
7412 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7414 // Should return the initial properties before play
7415 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
7416 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
7418 // Start the animation
7421 // Should return the target property after play
7422 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
7423 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
7425 bool signalReceived(false);
7426 AnimationFinishCheck finishCheck(signalReceived);
7427 animation.FinishedSignal().Connect(&application, finishCheck);
7429 application.SendNotification();
7430 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7432 // We didn't expect the animation to finish yet
7433 application.SendNotification();
7434 finishCheck.CheckSignalNotReceived();
7435 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
7437 application.SendNotification();
7438 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7440 // We did expect the animation to finish
7441 application.SendNotification();
7442 finishCheck.CheckSignalReceived();
7443 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
7444 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
7445 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
7446 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
7450 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
7452 TestApplication application;
7454 Actor actor = Actor::New();
7455 Stage::GetCurrent().Add(actor);
7456 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7458 // Build the animation
7459 float durationSeconds(1.0f);
7460 Animation animation = Animation::New(durationSeconds);
7461 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7462 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
7464 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7466 // Start the animation
7469 bool signalReceived(false);
7470 AnimationFinishCheck finishCheck(signalReceived);
7471 animation.FinishedSignal().Connect(&application, finishCheck);
7473 application.SendNotification();
7474 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
7476 // We didn't expect the animation to finish yet
7477 application.SendNotification();
7478 finishCheck.CheckSignalNotReceived();
7480 // The position should have moved less, than with a linear alpha function
7481 Vector3 current(actor.GetCurrentPosition());
7482 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
7483 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
7484 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
7485 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
7486 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
7487 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
7489 application.SendNotification();
7490 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7492 // We did expect the animation to finish
7493 application.SendNotification();
7494 finishCheck.CheckSignalReceived();
7495 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7499 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
7501 TestApplication application;
7503 Actor actor = Actor::New();
7504 Stage::GetCurrent().Add(actor);
7505 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7507 // Build the animation
7508 float durationSeconds(1.0f);
7509 Animation animation = Animation::New(durationSeconds);
7510 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7512 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7514 TimePeriod( delay, durationSeconds - delay ) );
7516 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7518 // Start the animation
7521 bool signalReceived(false);
7522 AnimationFinishCheck finishCheck(signalReceived);
7523 animation.FinishedSignal().Connect(&application, finishCheck);
7525 application.SendNotification();
7526 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7528 // We didn't expect the animation to finish yet
7529 application.SendNotification();
7530 finishCheck.CheckSignalNotReceived();
7531 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7533 application.SendNotification();
7534 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7536 // We didn't expect the animation to finish yet
7537 application.SendNotification();
7538 finishCheck.CheckSignalNotReceived();
7539 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7541 application.SendNotification();
7542 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7544 // We did expect the animation to finish
7545 application.SendNotification();
7546 finishCheck.CheckSignalReceived();
7547 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7551 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
7553 TestApplication application;
7555 Actor actor = Actor::New();
7556 Stage::GetCurrent().Add(actor);
7557 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7559 // Build the animation
7560 float durationSeconds(1.0f);
7561 Animation animation = Animation::New(durationSeconds);
7562 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
7564 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
7566 AlphaFunction::LINEAR,
7567 TimePeriod( delay, durationSeconds - delay ) );
7569 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
7571 // Start the animation
7574 bool signalReceived(false);
7575 AnimationFinishCheck finishCheck(signalReceived);
7576 animation.FinishedSignal().Connect(&application, finishCheck);
7578 application.SendNotification();
7579 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7581 // We didn't expect the animation to finish yet
7582 application.SendNotification();
7583 finishCheck.CheckSignalNotReceived();
7584 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7586 application.SendNotification();
7587 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7589 // We didn't expect the animation to finish yet
7590 application.SendNotification();
7591 finishCheck.CheckSignalNotReceived();
7592 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7594 application.SendNotification();
7595 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7597 // We did expect the animation to finish
7598 application.SendNotification();
7599 finishCheck.CheckSignalReceived();
7600 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7604 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7606 TestApplication application;
7608 Actor actor = Actor::New();
7609 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7610 Stage::GetCurrent().Add(actor);
7611 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7613 // Build the animation
7614 float durationSeconds(1.0f);
7615 Animation animation = Animation::New(durationSeconds);
7616 Degree targetRotationDegrees(90.0f);
7617 Radian targetRotationRadians(targetRotationDegrees);
7618 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7620 // Start the animation
7623 // Target value should be retrievable straight away
7624 DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7626 bool signalReceived(false);
7627 AnimationFinishCheck finishCheck(signalReceived);
7628 animation.FinishedSignal().Connect(&application, finishCheck);
7630 application.SendNotification();
7631 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7633 // We didn't expect the animation to finish yet
7634 application.SendNotification();
7635 finishCheck.CheckSignalNotReceived();
7636 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7638 application.SendNotification();
7639 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7641 // We didn't expect the animation to finish yet
7642 application.SendNotification();
7643 finishCheck.CheckSignalNotReceived();
7644 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7646 application.SendNotification();
7647 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7649 // We didn't expect the animation to finish yet
7650 application.SendNotification();
7651 finishCheck.CheckSignalNotReceived();
7652 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7654 application.SendNotification();
7655 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7657 // We did expect the animation to finish
7658 application.SendNotification();
7659 finishCheck.CheckSignalReceived();
7660 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7664 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7666 TestApplication application;
7668 Actor actor = Actor::New();
7669 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7670 Stage::GetCurrent().Add(actor);
7671 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7673 // Build the animation
7674 float durationSeconds(1.0f);
7675 Animation animation = Animation::New(durationSeconds);
7676 Degree targetRotationDegrees(90.0f);
7677 Radian targetRotationRadians(targetRotationDegrees);
7678 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7679 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7681 // Start the animation
7684 bool signalReceived(false);
7685 AnimationFinishCheck finishCheck(signalReceived);
7686 animation.FinishedSignal().Connect(&application, finishCheck);
7688 application.SendNotification();
7689 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7691 // We didn't expect the animation to finish yet
7692 application.SendNotification();
7693 finishCheck.CheckSignalNotReceived();
7694 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7696 application.SendNotification();
7697 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7699 // We didn't expect the animation to finish yet
7700 application.SendNotification();
7701 finishCheck.CheckSignalNotReceived();
7702 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7704 application.SendNotification();
7705 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7707 // We didn't expect the animation to finish yet
7708 application.SendNotification();
7709 finishCheck.CheckSignalNotReceived();
7710 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7712 application.SendNotification();
7713 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7715 // We did expect the animation to finish
7716 application.SendNotification();
7717 finishCheck.CheckSignalReceived();
7718 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7722 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7724 TestApplication application;
7726 Actor actor = Actor::New();
7727 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7728 Stage::GetCurrent().Add(actor);
7729 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7731 // Build the animation
7732 float durationSeconds(1.0f);
7733 Animation animation = Animation::New(durationSeconds);
7734 Degree targetRotationDegrees(90.0f);
7735 Radian targetRotationRadians(targetRotationDegrees);
7736 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7738 // Start the animation
7741 bool signalReceived(false);
7742 AnimationFinishCheck finishCheck(signalReceived);
7743 animation.FinishedSignal().Connect(&application, finishCheck);
7745 application.SendNotification();
7746 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7748 // We didn't expect the animation to finish yet
7749 application.SendNotification();
7750 finishCheck.CheckSignalNotReceived();
7751 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7753 application.SendNotification();
7754 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7756 // We didn't expect the animation to finish yet
7757 application.SendNotification();
7758 finishCheck.CheckSignalNotReceived();
7759 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7761 application.SendNotification();
7762 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7764 // We didn't expect the animation to finish yet
7765 application.SendNotification();
7766 finishCheck.CheckSignalNotReceived();
7767 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7769 application.SendNotification();
7770 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7772 // We did expect the animation to finish
7773 application.SendNotification();
7774 finishCheck.CheckSignalReceived();
7775 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7779 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7781 TestApplication application;
7783 Actor actor = Actor::New();
7784 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7785 Stage::GetCurrent().Add(actor);
7786 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7788 // Build the animation
7789 float durationSeconds(1.0f);
7790 Animation animation = Animation::New(durationSeconds);
7791 Degree targetRotationDegrees(90.0f);
7792 Radian targetRotationRadians(targetRotationDegrees);
7794 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7796 // Start the animation
7799 bool signalReceived(false);
7800 AnimationFinishCheck finishCheck(signalReceived);
7801 animation.FinishedSignal().Connect(&application, finishCheck);
7803 application.SendNotification();
7804 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7806 // We didn't expect the animation to finish yet
7807 application.SendNotification();
7808 finishCheck.CheckSignalNotReceived();
7809 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7810 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7812 application.SendNotification();
7813 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7815 // We didn't expect the animation to finish yet
7816 application.SendNotification();
7817 finishCheck.CheckSignalNotReceived();
7818 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7819 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7821 application.SendNotification();
7822 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7824 // We didn't expect the animation to finish yet
7825 application.SendNotification();
7826 finishCheck.CheckSignalNotReceived();
7827 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7828 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7830 application.SendNotification();
7831 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7833 // We did expect the animation to finish
7834 application.SendNotification();
7835 finishCheck.CheckSignalReceived();
7836 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7840 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7842 TestApplication application;
7844 Actor actor = Actor::New();
7845 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7846 Stage::GetCurrent().Add(actor);
7847 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7849 // Build the animation
7850 float durationSeconds(1.0f);
7851 Animation animation = Animation::New(durationSeconds);
7852 Degree targetRotationDegrees(90.0f);
7853 Radian targetRotationRadians(targetRotationDegrees);
7855 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7857 // Start the animation
7860 bool signalReceived(false);
7861 AnimationFinishCheck finishCheck(signalReceived);
7862 animation.FinishedSignal().Connect(&application, finishCheck);
7864 application.SendNotification();
7865 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7867 // We didn't expect the animation to finish yet
7868 application.SendNotification();
7869 finishCheck.CheckSignalNotReceived();
7870 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7871 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7873 application.SendNotification();
7874 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7876 // We didn't expect the animation to finish yet
7877 application.SendNotification();
7878 finishCheck.CheckSignalNotReceived();
7879 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7880 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7882 application.SendNotification();
7883 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7885 // We didn't expect the animation to finish yet
7886 application.SendNotification();
7887 finishCheck.CheckSignalNotReceived();
7888 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7889 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7891 application.SendNotification();
7892 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7894 // We did expect the animation to finish
7895 application.SendNotification();
7896 finishCheck.CheckSignalReceived();
7897 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7901 int UtcDaliAnimationAnimateToActorScaleP(void)
7903 TestApplication application;
7905 Actor actor = Actor::New();
7906 Stage::GetCurrent().Add(actor);
7907 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7909 // Build the animation
7910 float durationSeconds(1.0f);
7911 Animation animation = Animation::New(durationSeconds);
7912 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7913 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7915 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7917 // Start the animation
7920 // Target value should be retrievable straight away
7921 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
7922 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
7923 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
7924 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
7926 bool signalReceived(false);
7927 AnimationFinishCheck finishCheck(signalReceived);
7928 animation.FinishedSignal().Connect(&application, finishCheck);
7930 application.SendNotification();
7931 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7933 // We didn't expect the animation to finish yet
7934 application.SendNotification();
7935 finishCheck.CheckSignalNotReceived();
7936 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7938 application.SendNotification();
7939 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7941 // We did expect the animation to finish
7942 application.SendNotification();
7943 finishCheck.CheckSignalReceived();
7944 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7947 finishCheck.Reset();
7948 actor.SetScale(Vector3::ONE);
7949 application.SendNotification();
7950 application.Render(0);
7951 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7953 // Repeat with a different (ease-in) alpha function
7954 animation = Animation::New(durationSeconds);
7955 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7956 animation.FinishedSignal().Connect(&application, finishCheck);
7959 application.SendNotification();
7960 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7962 // We didn't expect the animation to finish yet
7963 application.SendNotification();
7964 finishCheck.CheckSignalNotReceived();
7966 // The scale should have grown less, than with a linear alpha function
7967 Vector3 current(actor.GetCurrentScale());
7968 DALI_TEST_CHECK( current.x > 1.0f );
7969 DALI_TEST_CHECK( current.y > 1.0f );
7970 DALI_TEST_CHECK( current.z > 1.0f );
7971 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7972 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7973 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7975 application.SendNotification();
7976 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7978 // We did expect the animation to finish
7979 application.SendNotification();
7980 finishCheck.CheckSignalReceived();
7981 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7984 finishCheck.Reset();
7985 actor.SetScale(Vector3::ONE);
7986 application.SendNotification();
7987 application.Render(0);
7988 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7990 // Repeat with a delay
7992 animation = Animation::New(durationSeconds);
7993 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7994 animation.FinishedSignal().Connect(&application, finishCheck);
7997 application.SendNotification();
7998 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
8000 // We didn't expect the animation to finish yet
8001 application.SendNotification();
8002 finishCheck.CheckSignalNotReceived();
8003 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
8005 application.SendNotification();
8006 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8008 // We did expect the animation to finish
8009 application.SendNotification();
8010 finishCheck.CheckSignalReceived();
8011 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
8015 int UtcDaliAnimationAnimateToActorScaleXP(void)
8017 TestApplication application;
8019 Actor actor = Actor::New();
8020 Stage::GetCurrent().Add(actor);
8021 float startValue(1.0f);
8022 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
8023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8024 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8025 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8026 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8027 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8028 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8030 // Build the animation
8031 float durationSeconds(1.0f);
8032 Animation animation = Animation::New(durationSeconds);
8033 float targetX(10.0f);
8034 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
8036 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
8038 // Start the animation
8041 // Target value should be retrievable straight away
8042 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
8043 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8045 bool signalReceived(false);
8046 AnimationFinishCheck finishCheck(signalReceived);
8047 animation.FinishedSignal().Connect(&application, finishCheck);
8049 application.SendNotification();
8050 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8052 // We didn't expect the animation to finish yet
8053 application.SendNotification();
8054 finishCheck.CheckSignalNotReceived();
8055 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
8056 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
8057 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8058 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8060 application.SendNotification();
8061 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8063 // We did expect the animation to finish
8064 application.SendNotification();
8065 finishCheck.CheckSignalReceived();
8066 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
8067 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
8068 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8069 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8073 int UtcDaliAnimationAnimateToActorScaleYP(void)
8075 TestApplication application;
8077 Actor actor = Actor::New();
8078 Stage::GetCurrent().Add(actor);
8079 float startValue(1.0f);
8080 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
8081 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8082 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8083 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8084 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8085 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8086 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8088 // Build the animation
8089 float durationSeconds(1.0f);
8090 Animation animation = Animation::New(durationSeconds);
8091 float targetY(1000.0f);
8092 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
8094 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
8096 // Start the animation
8099 // Target value should be retrievable straight away
8100 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
8101 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8103 bool signalReceived(false);
8104 AnimationFinishCheck finishCheck(signalReceived);
8105 animation.FinishedSignal().Connect(&application, finishCheck);
8107 application.SendNotification();
8108 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8110 // We didn't expect the animation to finish yet
8111 application.SendNotification();
8112 finishCheck.CheckSignalNotReceived();
8113 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
8114 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8115 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
8116 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8118 application.SendNotification();
8119 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8121 // We did expect the animation to finish
8122 application.SendNotification();
8123 finishCheck.CheckSignalReceived();
8124 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
8125 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8126 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
8127 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8131 int UtcDaliAnimationAnimateToActorScaleZP(void)
8133 TestApplication application;
8135 Actor actor = Actor::New();
8136 Stage::GetCurrent().Add(actor);
8137 float startValue(1.0f);
8138 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
8139 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
8140 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
8141 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
8142 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8143 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8144 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
8146 // Build the animation
8147 float durationSeconds(1.0f);
8148 Animation animation = Animation::New(durationSeconds);
8149 float targetZ(-1000.0f);
8150 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
8152 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
8154 // Start the animation
8157 // Target value should be retrievable straight away
8158 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
8159 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8161 bool signalReceived(false);
8162 AnimationFinishCheck finishCheck(signalReceived);
8163 animation.FinishedSignal().Connect(&application, finishCheck);
8165 application.SendNotification();
8166 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8168 // We didn't expect the animation to finish yet
8169 application.SendNotification();
8170 finishCheck.CheckSignalNotReceived();
8171 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
8172 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8173 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8174 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, 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.GetCurrentScale().z, targetZ, TEST_LOCATION );
8183 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
8184 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
8185 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
8189 int UtcDaliAnimationAnimateToActorColorP(void)
8191 TestApplication application;
8193 Actor actor = Actor::New();
8194 Stage::GetCurrent().Add(actor);
8195 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8197 // Build the animation
8198 float durationSeconds(1.0f);
8199 Animation animation = Animation::New(durationSeconds);
8200 Vector4 targetColor(Color::RED);
8201 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
8203 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
8204 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
8206 // Start the animation
8209 // Target value should be retrievable straight away
8210 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
8211 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
8212 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
8213 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
8214 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
8215 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
8217 bool signalReceived(false);
8218 AnimationFinishCheck finishCheck(signalReceived);
8219 animation.FinishedSignal().Connect(&application, finishCheck);
8221 application.SendNotification();
8222 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8224 // We didn't expect the animation to finish yet
8225 application.SendNotification();
8226 finishCheck.CheckSignalNotReceived();
8227 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
8229 application.SendNotification();
8230 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8232 // We did expect the animation to finish
8233 application.SendNotification();
8234 finishCheck.CheckSignalReceived();
8235 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8238 finishCheck.Reset();
8239 actor.SetColor(Color::WHITE);
8240 application.SendNotification();
8241 application.Render(0);
8242 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8244 // Repeat with a different (ease-in) alpha function
8245 animation = Animation::New(durationSeconds);
8246 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
8247 animation.FinishedSignal().Connect(&application, finishCheck);
8250 application.SendNotification();
8251 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8253 // We didn't expect the animation to finish yet
8254 application.SendNotification();
8255 finishCheck.CheckSignalNotReceived();
8257 // The color should have changed less, than with a linear alpha function
8258 Vector4 current(actor.GetCurrentColor());
8259 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
8260 DALI_TEST_CHECK( current.y < 1.0f );
8261 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
8262 DALI_TEST_CHECK( current.z < 1.0f );
8263 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
8264 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
8266 application.SendNotification();
8267 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
8269 // We did expect the animation to finish
8270 application.SendNotification();
8271 finishCheck.CheckSignalReceived();
8272 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8275 finishCheck.Reset();
8276 actor.SetColor(Color::WHITE);
8277 application.SendNotification();
8278 application.Render(0);
8279 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
8281 // Repeat with a shorter animator duration
8282 float animatorDuration = 0.5f;
8283 animation = Animation::New(durationSeconds);
8284 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
8285 animation.FinishedSignal().Connect(&application, finishCheck);
8288 application.SendNotification();
8289 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
8291 // We didn't expect the animation to finish yet
8292 application.SendNotification();
8293 finishCheck.CheckSignalNotReceived();
8294 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
8296 application.SendNotification();
8297 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
8299 // We didn't expect the animation to finish yet
8300 application.SendNotification();
8301 finishCheck.CheckSignalNotReceived();
8302 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8304 application.SendNotification();
8305 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8307 // We did expect the animation to finish
8308 application.SendNotification();
8309 finishCheck.CheckSignalReceived();
8310 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
8314 int UtcDaliAnimationAnimateToActorColorRedP(void)
8316 TestApplication application;
8318 Actor actor = Actor::New();
8319 Stage::GetCurrent().Add(actor);
8320 float startValue(1.0f);
8321 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
8322 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8323 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8324 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8325 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8326 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8327 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8328 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8329 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8331 // Build the animation
8332 float durationSeconds(1.0f);
8333 Animation animation = Animation::New(durationSeconds);
8334 float targetRed(0.5f);
8335 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
8337 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
8339 // Start the animation
8342 // Target value should be retrievable straight away
8343 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
8344 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
8346 bool signalReceived(false);
8347 AnimationFinishCheck finishCheck(signalReceived);
8348 animation.FinishedSignal().Connect(&application, finishCheck);
8350 application.SendNotification();
8351 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8353 // We didn't expect the animation to finish yet
8354 application.SendNotification();
8355 finishCheck.CheckSignalNotReceived();
8356 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
8357 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
8358 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8359 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8360 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8362 application.SendNotification();
8363 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8365 // We did expect the animation to finish
8366 application.SendNotification();
8367 finishCheck.CheckSignalReceived();
8368 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
8369 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
8370 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8371 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8372 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8376 int UtcDaliAnimationAnimateToActorColorGreenP(void)
8378 TestApplication application;
8380 Actor actor = Actor::New();
8381 Stage::GetCurrent().Add(actor);
8382 float startValue(1.0f);
8383 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
8384 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8385 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8386 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8387 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8388 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8389 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8390 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8391 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8393 // Build the animation
8394 float durationSeconds(1.0f);
8395 Animation animation = Animation::New(durationSeconds);
8396 float targetGreen(0.5f);
8397 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
8399 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
8401 // Start the animation
8404 // Target value should be retrievable straight away
8405 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
8406 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
8408 bool signalReceived(false);
8409 AnimationFinishCheck finishCheck(signalReceived);
8410 animation.FinishedSignal().Connect(&application, finishCheck);
8412 application.SendNotification();
8413 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8415 // We didn't expect the animation to finish yet
8416 application.SendNotification();
8417 finishCheck.CheckSignalNotReceived();
8418 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
8419 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8420 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
8421 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8422 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8424 application.SendNotification();
8425 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8427 // We did expect the animation to finish
8428 application.SendNotification();
8429 finishCheck.CheckSignalReceived();
8430 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
8431 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8432 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
8433 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8434 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8438 int UtcDaliAnimationAnimateToActorColorBlueP(void)
8440 TestApplication application;
8442 Actor actor = Actor::New();
8443 Stage::GetCurrent().Add(actor);
8444 float startValue(1.0f);
8445 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
8446 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8447 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8448 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8449 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8450 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8451 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8452 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8453 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8455 // Build the animation
8456 float durationSeconds(1.0f);
8457 Animation animation = Animation::New(durationSeconds);
8458 float targetBlue(0.5f);
8459 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
8461 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
8463 // Start the animation
8466 // Target value should be retrievable straight away
8467 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
8468 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8470 bool signalReceived(false);
8471 AnimationFinishCheck finishCheck(signalReceived);
8472 animation.FinishedSignal().Connect(&application, finishCheck);
8474 application.SendNotification();
8475 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8477 // We didn't expect the animation to finish yet
8478 application.SendNotification();
8479 finishCheck.CheckSignalNotReceived();
8480 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
8481 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8482 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8483 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
8484 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8486 application.SendNotification();
8487 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8489 // We did expect the animation to finish
8490 application.SendNotification();
8491 finishCheck.CheckSignalReceived();
8492 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
8493 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8494 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8495 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
8496 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8500 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
8502 TestApplication application;
8504 Actor actor = Actor::New();
8505 Stage::GetCurrent().Add(actor);
8506 float startValue(1.0f);
8507 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8508 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8509 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8510 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8511 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8512 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8513 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8514 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8515 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8517 // Build the animation
8518 float durationSeconds(1.0f);
8519 Animation animation = Animation::New(durationSeconds);
8520 float targetAlpha(0.5f);
8521 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
8523 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
8525 // Start the animation
8528 // Target value should be retrievable straight away
8529 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
8530 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8531 DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
8533 bool signalReceived(false);
8534 AnimationFinishCheck finishCheck(signalReceived);
8535 animation.FinishedSignal().Connect(&application, finishCheck);
8537 application.SendNotification();
8538 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
8540 // We didn't expect the animation to finish yet
8541 application.SendNotification();
8542 finishCheck.CheckSignalNotReceived();
8543 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
8544 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8545 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8546 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8547 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
8549 application.SendNotification();
8550 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
8552 // We did expect the animation to finish
8553 application.SendNotification();
8554 finishCheck.CheckSignalReceived();
8555 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
8556 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8557 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8558 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8559 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
8563 int UtcDaliAnimationKeyFrames01P(void)
8565 TestApplication application;
8567 KeyFrames keyFrames = KeyFrames::New();
8568 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8570 keyFrames.Add(0.0f, 0.1f);
8572 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8574 KeyFrames keyFrames2( keyFrames);
8575 DALI_TEST_CHECK( keyFrames2 );
8576 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
8578 KeyFrames keyFrames3 = KeyFrames::New();
8579 keyFrames3.Add(0.6f, true);
8580 DALI_TEST_CHECK( keyFrames3 );
8581 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
8583 keyFrames3 = keyFrames;
8584 DALI_TEST_CHECK( keyFrames3 );
8585 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
8590 int UtcDaliAnimationKeyFrames02P(void)
8592 TestApplication application;
8594 KeyFrames keyFrames = KeyFrames::New();
8595 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8597 keyFrames.Add(0.0f, 0.1f);
8598 keyFrames.Add(0.2f, 0.5f);
8599 keyFrames.Add(0.4f, 0.0f);
8600 keyFrames.Add(0.6f, 1.0f);
8601 keyFrames.Add(0.8f, 0.7f);
8602 keyFrames.Add(1.0f, 0.9f);
8604 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
8608 keyFrames.Add(1.9f, false);
8610 catch (Dali::DaliException& e)
8612 DALI_TEST_PRINT_ASSERT( e );
8613 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8618 int UtcDaliAnimationKeyFrames03P(void)
8620 TestApplication application;
8622 KeyFrames keyFrames = KeyFrames::New();
8623 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8625 keyFrames.Add(0.0f, true);
8626 keyFrames.Add(0.2f, false);
8627 keyFrames.Add(0.4f, false);
8628 keyFrames.Add(0.6f, true);
8629 keyFrames.Add(0.8f, true);
8630 keyFrames.Add(1.0f, false);
8632 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
8636 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8638 catch (Dali::DaliException& e)
8640 DALI_TEST_PRINT_ASSERT( e );
8641 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8646 int UtcDaliAnimationKeyFrames04P(void)
8648 TestApplication application;
8650 KeyFrames keyFrames = KeyFrames::New();
8651 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8653 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
8654 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
8655 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
8656 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8657 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8658 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8660 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8664 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8666 catch (Dali::DaliException& e)
8668 DALI_TEST_PRINT_ASSERT( e );
8669 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8674 int UtcDaliAnimationKeyFrames05P(void)
8676 TestApplication application;
8678 KeyFrames keyFrames = KeyFrames::New();
8679 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8681 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8682 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8683 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8684 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8685 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8686 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8688 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8692 keyFrames.Add(0.7f, 1.0f);
8694 catch (Dali::DaliException& e)
8696 DALI_TEST_PRINT_ASSERT( e );
8697 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8702 int UtcDaliAnimationKeyFrames06P(void)
8704 TestApplication application;
8706 KeyFrames keyFrames = KeyFrames::New();
8707 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8709 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8710 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8711 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8712 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8713 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8714 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8716 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8720 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8722 catch (Dali::DaliException& e)
8724 DALI_TEST_PRINT_ASSERT( e );
8725 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8730 int UtcDaliAnimationKeyFrames07P(void)
8732 TestApplication application;
8734 KeyFrames keyFrames = KeyFrames::New();
8735 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8737 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8738 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8739 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8740 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8741 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8742 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8744 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8748 keyFrames.Add(0.7f, 1.1f);
8750 catch (Dali::DaliException& e)
8752 DALI_TEST_PRINT_ASSERT( e );
8753 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8758 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8760 TestApplication application;
8762 float startValue(1.0f);
8763 Actor actor = Actor::New();
8764 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8765 Stage::GetCurrent().Add(actor);
8767 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8768 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8769 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8770 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8771 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8772 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8773 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8774 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8775 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8777 // Build the animation
8778 float durationSeconds(1.0f);
8779 Animation animation = Animation::New(durationSeconds);
8781 KeyFrames keyFrames = KeyFrames::New();
8782 keyFrames.Add(0.0f, 0.1f);
8783 keyFrames.Add(0.2f, 0.5f);
8784 keyFrames.Add(0.4f, 0.0f);
8785 keyFrames.Add(0.6f, 1.0f);
8786 keyFrames.Add(0.8f, 0.7f);
8787 keyFrames.Add(1.0f, 0.9f);
8789 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8791 // Start the animation
8794 bool signalReceived(false);
8795 AnimationFinishCheck finishCheck(signalReceived);
8796 animation.FinishedSignal().Connect(&application, finishCheck);
8797 application.SendNotification();
8798 application.Render(0);
8799 application.SendNotification();
8800 finishCheck.CheckSignalNotReceived();
8801 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8803 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8804 application.SendNotification();
8805 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8806 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8807 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8808 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8809 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8811 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8812 application.SendNotification();
8813 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8814 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8815 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8816 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8817 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8819 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8820 application.SendNotification();
8821 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8822 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8823 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8824 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8825 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8827 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8828 application.SendNotification();
8829 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8830 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8831 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8832 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8833 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8835 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8836 application.SendNotification();
8837 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8838 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8839 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8840 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8841 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8843 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8844 application.SendNotification();
8845 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8846 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8847 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8848 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8849 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8851 // We did expect the animation to finish
8853 finishCheck.CheckSignalReceived();
8857 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8859 TestApplication application;
8861 float startValue(1.0f);
8862 Actor actor = Actor::New();
8863 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8864 Stage::GetCurrent().Add(actor);
8866 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8867 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8868 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8869 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8870 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8871 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8872 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8873 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8874 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8876 // Build the animation
8877 float durationSeconds(1.0f);
8878 Animation animation = Animation::New(durationSeconds);
8880 KeyFrames keyFrames = KeyFrames::New();
8881 keyFrames.Add(0.0f, 0.1f);
8882 keyFrames.Add(0.2f, 0.5f);
8883 keyFrames.Add(0.4f, 0.0f);
8884 keyFrames.Add(0.6f, 1.0f);
8885 keyFrames.Add(0.8f, 0.7f);
8886 keyFrames.Add(1.0f, 0.9f);
8888 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8890 // Start the animation
8893 bool signalReceived(false);
8894 AnimationFinishCheck finishCheck(signalReceived);
8895 animation.FinishedSignal().Connect(&application, finishCheck);
8896 application.SendNotification();
8897 application.Render(0);
8898 application.SendNotification();
8899 finishCheck.CheckSignalNotReceived();
8900 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8902 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8903 application.SendNotification();
8904 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8905 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8906 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8907 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
8908 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8910 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8911 application.SendNotification();
8912 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8913 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8914 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8915 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
8916 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8918 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8919 application.SendNotification();
8920 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8921 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8922 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8923 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
8924 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8926 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8927 application.SendNotification();
8928 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8929 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8930 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8931 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
8932 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8934 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8935 application.SendNotification();
8936 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8937 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8938 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8939 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
8940 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8942 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8943 application.SendNotification();
8944 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8945 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8946 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8947 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
8948 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8950 // We did expect the animation to finish
8952 finishCheck.CheckSignalReceived();
8956 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8958 TestApplication application;
8960 float startValue(1.0f);
8961 Actor actor = Actor::New();
8962 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8963 Stage::GetCurrent().Add(actor);
8965 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8967 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8968 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8969 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8970 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
8971 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
8972 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
8973 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
8975 // Build the animation
8976 float durationSeconds(1.0f);
8977 Animation animation = Animation::New(durationSeconds);
8979 KeyFrames keyFrames = KeyFrames::New();
8980 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8981 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8982 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8984 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8986 // Start the animation
8989 bool signalReceived(false);
8990 AnimationFinishCheck finishCheck(signalReceived);
8991 animation.FinishedSignal().Connect(&application, finishCheck);
8992 application.SendNotification();
8993 application.Render(0);
8994 application.SendNotification();
8995 finishCheck.CheckSignalNotReceived();
8996 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
8997 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
8998 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
8999 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9001 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9002 application.SendNotification();
9003 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9004 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9005 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9006 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9008 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9009 application.SendNotification();
9010 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9011 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9012 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9013 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9015 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9016 application.SendNotification();
9017 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9018 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9019 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9020 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9022 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9023 application.SendNotification();
9024 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9025 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9026 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9027 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9029 // We did expect the animation to finish
9031 finishCheck.CheckSignalReceived();
9035 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
9037 TestApplication application;
9039 float startValue(1.0f);
9040 Actor actor = Actor::New();
9041 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9042 Stage::GetCurrent().Add(actor);
9044 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9045 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9046 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9047 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9048 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9049 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9050 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9051 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9052 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9054 // Build the animation
9055 float durationSeconds(1.0f);
9056 Animation animation = Animation::New(durationSeconds);
9058 KeyFrames keyFrames = KeyFrames::New();
9059 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9060 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9061 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9063 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
9065 // Start the animation
9068 bool signalReceived(false);
9069 AnimationFinishCheck finishCheck(signalReceived);
9070 animation.FinishedSignal().Connect(&application, finishCheck);
9071 application.SendNotification();
9072 application.Render(0);
9073 application.SendNotification();
9074 finishCheck.CheckSignalNotReceived();
9075 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9076 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9077 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9078 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9080 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9081 application.SendNotification();
9082 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9083 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9084 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9085 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9087 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9088 application.SendNotification();
9089 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9090 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9091 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9092 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9094 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9095 application.SendNotification();
9096 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9097 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9098 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9099 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9101 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9102 application.SendNotification();
9103 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9104 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9105 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9106 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9108 // We did expect the animation to finish
9110 finishCheck.CheckSignalReceived();
9114 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
9116 TestApplication application;
9118 Actor actor = Actor::New();
9119 AngleAxis aa(Degree(90), Vector3::XAXIS);
9120 actor.SetOrientation(aa.angle, aa.axis);
9121 Stage::GetCurrent().Add(actor);
9123 application.SendNotification();
9124 application.Render(0);
9126 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9128 // Build the animation
9129 float durationSeconds(1.0f);
9130 Animation animation = Animation::New(durationSeconds);
9132 KeyFrames keyFrames = KeyFrames::New();
9133 keyFrames.Add(0.0f, false);
9134 keyFrames.Add(0.2f, true);
9135 keyFrames.Add(0.4f, true);
9136 keyFrames.Add(0.8f, false);
9137 keyFrames.Add(1.0f, true);
9139 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
9141 // Start the animation
9144 bool signalReceived(false);
9145 AnimationFinishCheck finishCheck(signalReceived);
9146 animation.FinishedSignal().Connect(&application, finishCheck);
9147 application.SendNotification();
9148 application.SendNotification();
9149 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9150 application.SendNotification();
9151 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9152 application.SendNotification();
9154 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9155 finishCheck.CheckSignalReceived();
9159 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
9161 TestApplication application;
9163 Actor actor = Actor::New();
9164 AngleAxis aa(Degree(90), Vector3::XAXIS);
9165 actor.SetOrientation(aa.angle, aa.axis);
9166 Stage::GetCurrent().Add(actor);
9168 application.SendNotification();
9169 application.Render(0);
9171 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
9173 // Build the animation
9174 float durationSeconds(1.0f);
9175 Animation animation = Animation::New(durationSeconds);
9177 KeyFrames keyFrames = KeyFrames::New();
9178 keyFrames.Add(0.0f, false);
9179 keyFrames.Add(0.2f, true);
9180 keyFrames.Add(0.4f, true);
9181 keyFrames.Add(0.8f, false);
9182 keyFrames.Add(1.0f, true);
9184 //Cubic interpolation for boolean values should be ignored
9185 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
9187 // Start the animation
9190 bool signalReceived(false);
9191 AnimationFinishCheck finishCheck(signalReceived);
9192 animation.FinishedSignal().Connect(&application, finishCheck);
9193 application.SendNotification();
9194 application.SendNotification();
9195 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9196 application.SendNotification();
9197 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9198 application.SendNotification();
9200 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
9201 finishCheck.CheckSignalReceived();
9205 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
9207 TestApplication application;
9209 Actor actor = Actor::New();
9210 AngleAxis aa(Degree(90), Vector3::XAXIS);
9211 actor.SetOrientation(aa.angle, aa.axis);
9212 Stage::GetCurrent().Add(actor);
9214 application.SendNotification();
9215 application.Render(0);
9216 Quaternion start(Radian(aa.angle), aa.axis);
9217 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9219 // Build the animation
9220 float durationSeconds(1.0f);
9221 Animation animation = Animation::New(durationSeconds);
9223 KeyFrames keyFrames = KeyFrames::New();
9224 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9226 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9228 // Start the animation
9231 bool signalReceived(false);
9232 AnimationFinishCheck finishCheck(signalReceived);
9233 animation.FinishedSignal().Connect(&application, finishCheck);
9234 application.SendNotification();
9235 application.SendNotification();
9236 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9237 application.SendNotification();
9238 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9239 application.SendNotification();
9241 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9243 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9244 finishCheck.CheckSignalReceived();
9248 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
9250 TestApplication application;
9252 Actor actor = Actor::New();
9253 AngleAxis aa(Degree(90), Vector3::XAXIS);
9254 actor.SetOrientation(aa.angle, aa.axis);
9255 application.SendNotification();
9256 application.Render(0);
9257 Stage::GetCurrent().Add(actor);
9259 Quaternion start(Radian(aa.angle), aa.axis);
9260 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9262 // Build the animation
9263 float durationSeconds(1.0f);
9264 Animation animation = Animation::New(durationSeconds);
9266 KeyFrames keyFrames = KeyFrames::New();
9267 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9268 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9269 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9271 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
9273 // Start the animation
9276 bool signalReceived(false);
9277 AnimationFinishCheck finishCheck(signalReceived);
9278 animation.FinishedSignal().Connect(&application, finishCheck);
9279 application.SendNotification();
9280 application.Render(0);
9281 application.SendNotification();
9282 finishCheck.CheckSignalNotReceived();
9284 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9285 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9287 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9288 application.SendNotification();
9289 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9290 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9292 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9293 application.SendNotification();
9294 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9295 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9297 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9298 application.SendNotification();
9299 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
9300 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9302 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9303 application.SendNotification();
9304 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9305 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9307 // We did expect the animation to finish
9309 finishCheck.CheckSignalReceived();
9313 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
9315 TestApplication application;
9317 Actor actor = Actor::New();
9318 AngleAxis aa(Degree(90), Vector3::XAXIS);
9319 actor.SetOrientation(aa.angle, aa.axis);
9320 Stage::GetCurrent().Add(actor);
9322 application.SendNotification();
9323 application.Render(0);
9324 Quaternion start(Radian(aa.angle), aa.axis);
9325 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9327 // Build the animation
9328 float durationSeconds(1.0f);
9329 Animation animation = Animation::New(durationSeconds);
9331 KeyFrames keyFrames = KeyFrames::New();
9332 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
9334 //Cubic interpolation should be ignored for quaternions
9335 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9337 // Start the animation
9340 bool signalReceived(false);
9341 AnimationFinishCheck finishCheck(signalReceived);
9342 animation.FinishedSignal().Connect(&application, finishCheck);
9343 application.SendNotification();
9344 application.SendNotification();
9345 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
9346 application.SendNotification();
9347 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
9348 application.SendNotification();
9350 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
9352 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9353 finishCheck.CheckSignalReceived();
9357 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
9359 TestApplication application;
9361 Actor actor = Actor::New();
9362 AngleAxis aa(Degree(90), Vector3::XAXIS);
9363 actor.SetOrientation(aa.angle, aa.axis);
9364 application.SendNotification();
9365 application.Render(0);
9366 Stage::GetCurrent().Add(actor);
9368 Quaternion start(Radian(aa.angle), aa.axis);
9369 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
9371 // Build the animation
9372 float durationSeconds(1.0f);
9373 Animation animation = Animation::New(durationSeconds);
9375 KeyFrames keyFrames = KeyFrames::New();
9376 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
9377 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
9378 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
9380 //Cubic interpolation should be ignored for quaternions
9381 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
9383 // Start the animation
9386 bool signalReceived(false);
9387 AnimationFinishCheck finishCheck(signalReceived);
9388 animation.FinishedSignal().Connect(&application, finishCheck);
9389 application.SendNotification();
9390 application.Render(0);
9391 application.SendNotification();
9392 finishCheck.CheckSignalNotReceived();
9394 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
9395 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9397 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9398 application.SendNotification();
9399 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
9400 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9402 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9403 application.SendNotification();
9404 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
9405 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9407 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9408 application.SendNotification();
9409 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
9410 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9412 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9413 application.SendNotification();
9414 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
9415 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
9417 // We did expect the animation to finish
9419 finishCheck.CheckSignalReceived();
9423 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
9425 TestApplication application;
9427 float startValue(1.0f);
9428 Actor actor = Actor::New();
9429 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9430 Stage::GetCurrent().Add(actor);
9432 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9433 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9434 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9435 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9436 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9437 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9438 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9439 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9440 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9442 // Build the animation
9443 float durationSeconds(1.0f);
9444 Animation animation = Animation::New(durationSeconds);
9446 KeyFrames keyFrames = KeyFrames::New();
9447 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9448 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9449 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9451 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
9453 // Start the animation
9456 bool signalReceived(false);
9457 AnimationFinishCheck finishCheck(signalReceived);
9458 animation.FinishedSignal().Connect(&application, finishCheck);
9459 application.SendNotification();
9460 application.Render(0);
9461 application.SendNotification();
9462 finishCheck.CheckSignalNotReceived();
9463 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9464 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9465 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9466 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9468 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9469 application.SendNotification();
9470 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9471 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9472 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9473 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9475 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9476 application.SendNotification();
9477 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9478 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9479 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9480 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9482 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9483 application.SendNotification();
9484 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9485 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9486 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9487 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9489 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9490 application.SendNotification();
9491 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9492 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9493 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9494 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9496 // We did expect the animation to finish
9498 finishCheck.CheckSignalReceived();
9502 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
9504 TestApplication application;
9506 float startValue(1.0f);
9507 Actor actor = Actor::New();
9508 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9509 Stage::GetCurrent().Add(actor);
9511 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9512 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9513 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9514 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9515 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9516 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9517 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9518 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9519 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9521 // Build the animation
9522 float durationSeconds(1.0f);
9523 Animation animation = Animation::New(durationSeconds);
9525 KeyFrames keyFrames = KeyFrames::New();
9526 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9527 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9528 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9530 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
9532 // Start the animation
9535 bool signalReceived(false);
9536 AnimationFinishCheck finishCheck(signalReceived);
9537 animation.FinishedSignal().Connect(&application, finishCheck);
9538 application.SendNotification();
9539 application.Render(0);
9540 application.SendNotification();
9541 finishCheck.CheckSignalNotReceived();
9542 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9543 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9544 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9545 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9547 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9548 application.SendNotification();
9549 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9550 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9551 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9552 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9554 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9555 application.SendNotification();
9556 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9557 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9558 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9559 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9561 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9562 application.SendNotification();
9563 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9564 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9565 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9566 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9568 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9569 application.SendNotification();
9570 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9571 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9572 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9573 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9575 // We did expect the animation to finish
9577 finishCheck.CheckSignalReceived();
9581 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
9583 TestApplication application;
9585 float startValue(1.0f);
9586 Actor actor = Actor::New();
9587 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9588 Stage::GetCurrent().Add(actor);
9590 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9591 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9592 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9593 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9594 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9595 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9596 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9597 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9598 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9600 // Build the animation
9601 float durationSeconds(1.0f);
9603 Animation animation = Animation::New(durationSeconds);
9605 KeyFrames keyFrames = KeyFrames::New();
9606 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9607 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9608 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9610 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
9612 // Start the animation
9615 bool signalReceived(false);
9616 AnimationFinishCheck finishCheck(signalReceived);
9617 animation.FinishedSignal().Connect(&application, finishCheck);
9618 application.SendNotification();
9620 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9621 application.SendNotification();
9622 finishCheck.CheckSignalNotReceived();
9623 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9624 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9625 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9626 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9628 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9629 application.SendNotification();
9630 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9631 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9632 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9633 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9635 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9636 application.SendNotification();
9637 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9638 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9639 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9640 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9642 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9643 application.SendNotification();
9644 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9645 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9646 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9647 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9649 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9650 application.SendNotification();
9651 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9652 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9653 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9654 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9656 // We did expect the animation to finish
9658 finishCheck.CheckSignalReceived();
9662 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
9664 TestApplication application;
9666 float startValue(1.0f);
9667 Actor actor = Actor::New();
9668 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9669 Stage::GetCurrent().Add(actor);
9671 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9672 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9673 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9674 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9675 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9676 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9677 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9678 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9679 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9681 // Build the animation
9682 float durationSeconds(1.0f);
9684 Animation animation = Animation::New(durationSeconds);
9686 KeyFrames keyFrames = KeyFrames::New();
9687 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9688 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9689 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9691 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9693 // Start the animation
9696 bool signalReceived(false);
9697 AnimationFinishCheck finishCheck(signalReceived);
9698 animation.FinishedSignal().Connect(&application, finishCheck);
9699 application.SendNotification();
9701 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9702 application.SendNotification();
9703 finishCheck.CheckSignalNotReceived();
9704 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9705 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9706 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9707 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9709 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9710 application.SendNotification();
9711 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9712 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9713 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9714 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9716 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9717 application.SendNotification();
9718 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9719 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9720 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9721 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9723 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9724 application.SendNotification();
9725 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9726 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9727 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9728 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9730 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9731 application.SendNotification();
9732 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9733 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9734 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9735 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9737 // We did expect the animation to finish
9739 finishCheck.CheckSignalReceived();
9743 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9745 TestApplication application;
9747 float startValue(1.0f);
9749 Actor actor = Actor::New();
9750 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9751 Stage::GetCurrent().Add(actor);
9753 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9754 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9755 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9756 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9757 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9758 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9759 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9760 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9761 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9763 // Build the animation
9764 float durationSeconds(1.0f);
9765 Animation animation = Animation::New(durationSeconds);
9767 KeyFrames keyFrames = KeyFrames::New();
9768 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9769 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9770 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9772 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9774 // Start the animation
9777 bool signalReceived(false);
9778 AnimationFinishCheck finishCheck(signalReceived);
9779 animation.FinishedSignal().Connect(&application, finishCheck);
9780 application.SendNotification();
9782 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9783 application.SendNotification();
9784 finishCheck.CheckSignalNotReceived();
9785 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9786 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9787 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9788 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9790 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9791 application.SendNotification();
9792 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
9793 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
9794 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
9795 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
9797 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9798 application.SendNotification();
9799 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9800 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9801 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9802 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9804 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9805 application.SendNotification();
9806 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
9807 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
9808 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
9809 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
9811 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9812 application.SendNotification();
9813 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9814 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9815 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9816 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9818 // We did expect the animation to finish
9820 finishCheck.CheckSignalReceived();
9824 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9826 TestApplication application;
9828 float startValue(1.0f);
9829 Actor actor = Actor::New();
9830 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9831 Stage::GetCurrent().Add(actor);
9833 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9834 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9835 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9836 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9837 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9838 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
9839 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
9840 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
9841 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
9844 // Build the animation
9845 float durationSeconds(1.0f);
9847 Animation animation = Animation::New(durationSeconds);
9849 KeyFrames keyFrames = KeyFrames::New();
9850 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9851 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9852 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9854 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9856 // Start the animation
9859 bool signalReceived(false);
9860 AnimationFinishCheck finishCheck(signalReceived);
9861 animation.FinishedSignal().Connect(&application, finishCheck);
9862 application.SendNotification();
9864 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9865 application.SendNotification();
9866 finishCheck.CheckSignalNotReceived();
9867 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
9868 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
9869 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
9870 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
9872 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9873 application.SendNotification();
9874 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
9875 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
9876 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
9877 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
9879 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9880 application.SendNotification();
9881 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
9882 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
9883 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
9884 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
9886 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9887 application.SendNotification();
9888 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
9889 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
9890 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
9891 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
9893 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9894 application.SendNotification();
9895 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
9896 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
9897 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
9898 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
9900 // We did expect the animation to finish
9902 finishCheck.CheckSignalReceived();
9906 int UtcDaliAnimationAnimateP(void)
9908 TestApplication application;
9910 Actor actor = Actor::New();
9911 Stage::GetCurrent().Add(actor);
9914 Vector3 position0( 30.0, 80.0, 0.0);
9915 Vector3 position1( 70.0, 120.0, 0.0);
9916 Vector3 position2( 100.0, 100.0, 0.0);
9918 Dali::Path path = Dali::Path::New();
9919 path.AddPoint(position0);
9920 path.AddPoint(position1);
9921 path.AddPoint(position2);
9923 //Control points for first segment
9924 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9925 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9927 //Control points for second segment
9928 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9929 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9931 // Build the animation
9932 float durationSeconds( 1.0f );
9933 Animation animation = Animation::New(durationSeconds);
9934 animation.Animate(actor, path, Vector3::XAXIS);
9936 // Start the animation
9939 bool signalReceived(false);
9940 AnimationFinishCheck finishCheck(signalReceived);
9941 animation.FinishedSignal().Connect(&application, finishCheck);
9942 application.SendNotification();
9943 application.Render(0);
9944 application.SendNotification();
9945 finishCheck.CheckSignalNotReceived();
9946 Vector3 position, tangent;
9947 Quaternion rotation;
9948 path.Sample( 0.0f, position, tangent );
9949 rotation = Quaternion( Vector3::XAXIS, tangent );
9950 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9951 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9953 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9954 application.SendNotification();
9955 path.Sample( 0.25f, position, tangent );
9956 rotation = Quaternion( Vector3::XAXIS, tangent );
9957 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9958 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9960 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9961 application.SendNotification();
9962 path.Sample( 0.5f, position, tangent );
9963 rotation = Quaternion( Vector3::XAXIS, tangent );
9964 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9965 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9967 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9968 application.SendNotification();
9969 path.Sample( 0.75f, position, tangent );
9970 rotation = Quaternion( Vector3::XAXIS, tangent );
9971 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9972 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9974 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9975 application.SendNotification();
9976 path.Sample( 1.0f, position, tangent );
9977 rotation = Quaternion( Vector3::XAXIS, tangent );
9978 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9979 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9981 finishCheck.CheckSignalReceived();
9985 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9987 TestApplication application;
9989 Actor actor = Actor::New();
9990 Stage::GetCurrent().Add(actor);
9993 Vector3 position0( 30.0, 80.0, 0.0);
9994 Vector3 position1( 70.0, 120.0, 0.0);
9995 Vector3 position2( 100.0, 100.0, 0.0);
9997 Dali::Path path = Dali::Path::New();
9998 path.AddPoint(position0);
9999 path.AddPoint(position1);
10000 path.AddPoint(position2);
10002 //Control points for first segment
10003 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10004 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10006 //Control points for second segment
10007 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10008 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10010 // Build the animation
10011 float durationSeconds( 1.0f );
10012 Animation animation = Animation::New(durationSeconds);
10013 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
10015 // Start the animation
10018 bool signalReceived(false);
10019 AnimationFinishCheck finishCheck(signalReceived);
10020 animation.FinishedSignal().Connect(&application, finishCheck);
10021 application.SendNotification();
10022 application.Render(0);
10023 application.SendNotification();
10024 finishCheck.CheckSignalNotReceived();
10025 Vector3 position, tangent;
10026 Quaternion rotation;
10027 path.Sample( 0.0f, position, tangent );
10028 rotation = Quaternion( Vector3::XAXIS, tangent );
10029 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10030 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10032 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10033 application.SendNotification();
10034 path.Sample( 0.25f, position, tangent );
10035 rotation = Quaternion( Vector3::XAXIS, tangent );
10036 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10037 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10039 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10040 application.SendNotification();
10041 path.Sample( 0.5f, position, tangent );
10042 rotation = Quaternion( Vector3::XAXIS, tangent );
10043 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10044 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10046 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10047 application.SendNotification();
10048 path.Sample( 0.75f, position, tangent );
10049 rotation = Quaternion( Vector3::XAXIS, tangent );
10050 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10051 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10053 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10054 application.SendNotification();
10055 path.Sample( 1.0f, position, tangent );
10056 rotation = Quaternion( Vector3::XAXIS, tangent );
10057 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10058 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10060 finishCheck.CheckSignalReceived();
10064 int UtcDaliAnimationAnimateTimePeriodP(void)
10066 TestApplication application;
10068 Actor actor = Actor::New();
10069 Stage::GetCurrent().Add(actor);
10072 Vector3 position0( 30.0, 80.0, 0.0);
10073 Vector3 position1( 70.0, 120.0, 0.0);
10074 Vector3 position2( 100.0, 100.0, 0.0);
10076 Dali::Path path = Dali::Path::New();
10077 path.AddPoint(position0);
10078 path.AddPoint(position1);
10079 path.AddPoint(position2);
10081 //Control points for first segment
10082 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10083 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10085 //Control points for second segment
10086 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10087 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10089 // Build the animation
10090 float durationSeconds( 1.0f );
10091 Animation animation = Animation::New(durationSeconds);
10092 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
10094 // Start the animation
10097 bool signalReceived(false);
10098 AnimationFinishCheck finishCheck(signalReceived);
10099 animation.FinishedSignal().Connect(&application, finishCheck);
10100 application.SendNotification();
10101 application.Render(0);
10102 application.SendNotification();
10103 finishCheck.CheckSignalNotReceived();
10104 Vector3 position, tangent;
10105 Quaternion rotation;
10106 path.Sample( 0.0f, position, tangent );
10107 rotation = Quaternion( Vector3::XAXIS, tangent );
10108 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10109 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10111 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10112 application.SendNotification();
10113 path.Sample( 0.25f, position, tangent );
10114 rotation = Quaternion( Vector3::XAXIS, tangent );
10115 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10116 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10118 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10119 application.SendNotification();
10120 path.Sample( 0.5f, position, tangent );
10121 rotation = Quaternion( Vector3::XAXIS, tangent );
10122 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10123 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10125 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10126 application.SendNotification();
10127 path.Sample( 0.75f, position, tangent );
10128 rotation = Quaternion( Vector3::XAXIS, tangent );
10129 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10130 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10132 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10133 application.SendNotification();
10134 path.Sample( 1.0f, position, tangent );
10135 rotation = Quaternion( Vector3::XAXIS, tangent );
10136 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10137 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10139 finishCheck.CheckSignalReceived();
10143 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
10145 TestApplication application;
10147 Actor actor = Actor::New();
10148 Stage::GetCurrent().Add(actor);
10151 Vector3 position0( 30.0, 80.0, 0.0);
10152 Vector3 position1( 70.0, 120.0, 0.0);
10153 Vector3 position2( 100.0, 100.0, 0.0);
10155 Dali::Path path = Dali::Path::New();
10156 path.AddPoint(position0);
10157 path.AddPoint(position1);
10158 path.AddPoint(position2);
10160 //Control points for first segment
10161 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
10162 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
10164 //Control points for second segment
10165 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
10166 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
10168 // Build the animation
10169 float durationSeconds( 1.0f );
10170 Animation animation = Animation::New(durationSeconds);
10171 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
10173 // Start the animation
10176 bool signalReceived(false);
10177 AnimationFinishCheck finishCheck(signalReceived);
10178 animation.FinishedSignal().Connect(&application, finishCheck);
10179 application.SendNotification();
10180 application.Render(0);
10181 application.SendNotification();
10182 finishCheck.CheckSignalNotReceived();
10183 Vector3 position, tangent;
10184 Quaternion rotation;
10185 path.Sample( 0.0f, position, tangent );
10186 rotation = Quaternion( Vector3::XAXIS, tangent );
10187 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10188 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10190 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
10191 application.SendNotification();
10192 path.Sample( 0.25f, position, tangent );
10193 rotation = Quaternion( Vector3::XAXIS, tangent );
10194 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10195 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10197 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
10198 application.SendNotification();
10199 path.Sample( 0.5f, position, tangent );
10200 rotation = Quaternion( Vector3::XAXIS, tangent );
10201 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10202 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10204 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
10205 application.SendNotification();
10206 path.Sample( 0.75f, position, tangent );
10207 rotation = Quaternion( Vector3::XAXIS, tangent );
10208 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10209 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10211 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
10212 application.SendNotification();
10213 path.Sample( 1.0f, position, tangent );
10214 rotation = Quaternion( Vector3::XAXIS, tangent );
10215 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
10216 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
10218 finishCheck.CheckSignalReceived();
10222 int UtcDaliAnimationShowP(void)
10224 TestApplication application;
10226 Actor actor = Actor::New();
10227 actor.SetVisible(false);
10228 application.SendNotification();
10229 application.Render(0);
10230 DALI_TEST_CHECK( !actor.IsVisible() );
10231 Stage::GetCurrent().Add(actor);
10233 // Start the animation
10234 float durationSeconds(10.0f);
10235 Animation animation = Animation::New(durationSeconds);
10236 animation.Show(actor, durationSeconds*0.5f);
10239 bool signalReceived(false);
10240 AnimationFinishCheck finishCheck(signalReceived);
10241 animation.FinishedSignal().Connect(&application, finishCheck);
10243 application.SendNotification();
10244 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10246 // We didn't expect the animation to finish yet
10247 application.SendNotification();
10248 finishCheck.CheckSignalNotReceived();
10249 DALI_TEST_CHECK( !actor.IsVisible() );
10251 application.SendNotification();
10252 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
10254 // We didn't expect the animation to finish yet
10255 application.SendNotification();
10256 finishCheck.CheckSignalNotReceived();
10257 DALI_TEST_CHECK( actor.IsVisible() );
10259 application.SendNotification();
10260 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10262 // We did expect the animation to finish
10263 application.SendNotification();
10264 finishCheck.CheckSignalReceived();
10265 DALI_TEST_CHECK( actor.IsVisible() );
10269 int UtcDaliAnimationHideP(void)
10271 TestApplication application;
10273 Actor actor = Actor::New();
10274 DALI_TEST_CHECK( actor.IsVisible() );
10275 Stage::GetCurrent().Add(actor);
10277 // Start the animation
10278 float durationSeconds(10.0f);
10279 Animation animation = Animation::New(durationSeconds);
10280 animation.Hide(actor, durationSeconds*0.5f);
10283 bool signalReceived(false);
10284 AnimationFinishCheck finishCheck(signalReceived);
10285 animation.FinishedSignal().Connect(&application, finishCheck);
10287 application.SendNotification();
10288 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
10290 // We didn't expect the animation to finish yet
10291 application.SendNotification();
10292 finishCheck.CheckSignalNotReceived();
10293 DALI_TEST_CHECK( actor.IsVisible() );
10295 application.SendNotification();
10296 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
10298 // We didn't expect the animation to finish yet
10299 application.SendNotification();
10300 finishCheck.CheckSignalNotReceived();
10301 DALI_TEST_CHECK( !actor.IsVisible() );
10303 application.SendNotification();
10304 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10306 // We did expect the animation to finish
10307 application.SendNotification();
10308 finishCheck.CheckSignalReceived();
10309 DALI_TEST_CHECK( !actor.IsVisible() );
10313 int UtcDaliAnimationShowHideAtEndP(void)
10315 // Test that show/hide delay can be the same as animation duration
10316 // i.e. to show/hide at the end of the animation
10318 TestApplication application;
10320 Actor actor = Actor::New();
10321 DALI_TEST_CHECK( actor.IsVisible() );
10322 Stage::GetCurrent().Add(actor);
10324 // Start Hide animation
10325 float durationSeconds(10.0f);
10326 Animation animation = Animation::New(durationSeconds);
10327 animation.Hide(actor, durationSeconds/*Hide at end*/);
10330 bool signalReceived(false);
10331 AnimationFinishCheck finishCheck(signalReceived);
10332 animation.FinishedSignal().Connect(&application, finishCheck);
10334 application.SendNotification();
10335 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10337 // We did expect the animation to finish
10338 application.SendNotification();
10339 finishCheck.CheckSignalReceived();
10340 DALI_TEST_CHECK( !actor.IsVisible() );
10342 // Start Show animation
10343 animation = Animation::New(durationSeconds);
10344 animation.Show(actor, durationSeconds/*Show at end*/);
10345 animation.FinishedSignal().Connect(&application, finishCheck);
10348 application.SendNotification();
10349 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
10351 // We did expect the animation to finish
10352 application.SendNotification();
10353 finishCheck.CheckSignalReceived();
10354 DALI_TEST_CHECK( actor.IsVisible() );
10358 int UtcDaliKeyFramesCreateDestroyP(void)
10360 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
10362 KeyFrames* keyFrames = new KeyFrames;
10364 DALI_TEST_CHECK( true );
10368 int UtcDaliKeyFramesDownCastP(void)
10370 TestApplication application;
10371 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
10373 KeyFrames keyFrames = KeyFrames::New();
10374 BaseHandle object(keyFrames);
10376 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
10377 DALI_TEST_CHECK(keyFrames2);
10379 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
10380 DALI_TEST_CHECK(keyFrames3);
10382 BaseHandle unInitializedObject;
10383 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
10384 DALI_TEST_CHECK(!keyFrames4);
10386 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
10387 DALI_TEST_CHECK(!keyFrames5);
10391 int UtcDaliAnimationCreateDestroyP(void)
10393 TestApplication application;
10394 Animation* animation = new Animation;
10395 DALI_TEST_CHECK( animation );
10400 struct UpdateManagerTestConstraint
10402 UpdateManagerTestConstraint(TestApplication& application)
10403 : mApplication(application)
10407 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
10409 mApplication.SendNotification(); // Process events
10412 TestApplication& mApplication;
10415 int UtcDaliAnimationUpdateManagerP(void)
10417 TestApplication application;
10419 Actor actor = Actor::New();
10420 Stage::GetCurrent().Add( actor );
10422 // Build the animation
10423 Animation animation = Animation::New( 0.0f );
10425 bool signalReceived = false;
10426 AnimationFinishCheck finishCheck( signalReceived );
10427 animation.FinishedSignal().Connect( &application, finishCheck );
10429 Vector3 startValue(1.0f, 1.0f, 1.0f);
10430 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10431 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
10432 constraint.Apply();
10434 // Apply animation to actor
10435 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
10436 animation.AnimateTo( Property(actor, DevelActor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
10440 application.SendNotification();
10441 application.UpdateOnly( 16 );
10443 finishCheck.CheckSignalNotReceived();
10445 application.SendNotification(); // Process events
10447 finishCheck.CheckSignalReceived();
10452 int UtcDaliAnimationSignalOrderP(void)
10454 TestApplication application;
10456 Actor actor = Actor::New();
10457 Stage::GetCurrent().Add( actor );
10459 // Build the animations
10460 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
10461 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
10463 bool signal1Received = false;
10464 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
10466 bool signal2Received = false;
10467 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
10469 // Apply animations to actor
10470 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
10472 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
10475 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10476 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10478 application.SendNotification();
10479 application.UpdateOnly( 10 ); // 10ms progress
10481 // no notifications yet
10482 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10483 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10485 application.SendNotification();
10488 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
10489 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
10490 signal1Received = false;
10492 // 1st animation is complete now, do another update with no ProcessEvents in between
10493 application.UpdateOnly( 20 ); // 20ms progress
10496 application.SendNotification();
10498 // 2nd should complete now
10499 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
10500 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
10505 int UtcDaliAnimationExtendDurationP(void)
10507 TestApplication application;
10509 Actor actor = Actor::New();
10511 // Register a float property
10512 float startValue(10.0f);
10513 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10514 Stage::GetCurrent().Add(actor);
10515 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
10516 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10518 // Build the animation
10519 float initialDurationSeconds(1.0f);
10520 float animatorDelay = 5.0f;
10521 float animatorDurationSeconds(5.0f);
10522 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
10523 Animation animation = Animation::New(initialDurationSeconds);
10524 float targetValue(30.0f);
10525 float relativeValue(targetValue - startValue);
10527 animation.AnimateTo(Property(actor, index),
10529 TimePeriod(animatorDelay, animatorDurationSeconds));
10531 // The duration should have been extended
10532 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
10534 // Start the animation
10537 bool signalReceived(false);
10538 AnimationFinishCheck finishCheck(signalReceived);
10539 animation.FinishedSignal().Connect(&application, finishCheck);
10541 application.SendNotification();
10542 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
10544 // We didn't expect the animation to finish yet, but cached value should be the final one
10545 application.SendNotification();
10546 finishCheck.CheckSignalNotReceived();
10547 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10548 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
10550 application.SendNotification();
10551 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
10553 // We didn't expect the animation to finish yet
10554 application.SendNotification();
10555 finishCheck.CheckSignalNotReceived();
10556 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
10558 application.SendNotification();
10559 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
10561 // We did expect the animation to finish
10562 application.SendNotification();
10563 finishCheck.CheckSignalReceived();
10564 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
10565 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
10569 int UtcDaliAnimationCustomIntProperty(void)
10571 TestApplication application;
10573 Actor actor = Actor::New();
10574 Stage::GetCurrent().Add(actor);
10575 int startValue(0u);
10577 Property::Index index = actor.RegisterProperty("anIndex", startValue);
10578 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
10579 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
10581 // Build the animation
10582 float durationSeconds(1.0f);
10583 Animation animation = Animation::New(durationSeconds);
10584 animation.AnimateTo( Property(actor, index), 20 );
10586 // Start the animation
10589 // Target value should be retrievable straight away
10590 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10592 bool signalReceived(false);
10593 AnimationFinishCheck finishCheck(signalReceived);
10594 animation.FinishedSignal().Connect(&application, finishCheck);
10596 application.SendNotification();
10597 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
10599 // We didn't expect the animation to finish yet
10600 application.SendNotification();
10601 finishCheck.CheckSignalNotReceived();
10602 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
10604 application.SendNotification();
10605 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
10607 // We did expect the animation to finish
10608 application.SendNotification();
10609 finishCheck.CheckSignalReceived();
10610 DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
10611 DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
10615 int UtcDaliAnimationDuration(void)
10617 TestApplication application;
10619 Actor actor = Actor::New();
10620 Stage::GetCurrent().Add(actor);
10622 Animation animation = Animation::New( 0.0f );
10623 DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
10625 // The animation duration should automatically increase depending on the animator time period
10627 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
10628 DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
10630 animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
10631 DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
10636 int UtcDaliAnimationAnimateByNonAnimateableTypeN(void)
10638 TestApplication application;
10640 Actor actor = Actor::New();
10642 // Register an integer property
10644 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10645 Stage::GetCurrent().Add(actor);
10646 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10650 // Build the animation
10651 Animation animation = Animation::New( 2.0f );
10652 std::string relativeValue = "relative string";
10653 animation.AnimateBy( Property(actor, index), relativeValue );
10654 tet_result(TET_FAIL);
10656 catch ( Dali::DaliException& e )
10658 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10666 int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
10668 TestApplication application;
10670 Actor actor = Actor::New();
10672 // Register an integer property
10674 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10675 Stage::GetCurrent().Add(actor);
10676 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10680 // Build the animation
10681 Animation animation = Animation::New( 2.0f );
10682 std::string relativeValue = "relative string";
10683 animation.AnimateTo( Property(actor, index), relativeValue );
10685 tet_result(TET_FAIL);
10687 catch ( Dali::DaliException& e )
10689 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
10695 int UtcDaliAnimationAnimateBetweenNonAnimateableTypeN(void)
10697 TestApplication application;
10699 Actor actor = Actor::New();
10701 // Register an integer property
10703 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
10704 Stage::GetCurrent().Add(actor);
10705 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
10709 // Build the animation
10710 KeyFrames keyFrames = KeyFrames::New();
10711 keyFrames.Add( 0.0f, std::string("relative string1") );
10712 keyFrames.Add( 1.0f, std::string("relative string2") );
10713 // no need to really create the animation as keyframes do the check
10715 tet_result(TET_FAIL);
10717 catch ( Dali::DaliException& e )
10719 DALI_TEST_ASSERT( e, "Type not animateable", TEST_LOCATION );
10725 int UtcDaliAnimationSetAndGetTargetBeforePlayP(void)
10727 tet_infoline("Setting up an animation should not effect it's position property until the animation plays");
10729 TestApplication application;
10731 tet_infoline("Set initial position and set up animation to re-position actor");
10733 Actor actor = Actor::New();
10734 Stage::GetCurrent().Add(actor);
10735 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10736 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10738 // Build the animation
10739 Animation animation = Animation::New(2.0f);
10741 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10742 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10743 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10745 tet_infoline("Set target position in animation without intiating play");
10747 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
10748 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
10750 application.SendNotification();
10751 application.Render();
10753 tet_infoline("Ensure position of actor is still at intial value");
10755 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10756 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10757 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10759 tet_infoline("Play animation and ensure actor position is now target");
10762 application.SendNotification();
10763 application.Render(1000u);
10765 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10767 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10768 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10769 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10771 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10773 application.Render(2000u);
10775 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10777 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
10778 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
10779 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
10784 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsPositionP(void)
10786 tet_infoline("Setting up an animation should not effect it's position property until the animation plays even with mulitple animators");
10788 TestApplication application;
10790 std::vector<Vector3> targetPositions;
10792 targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10793 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10794 targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10796 tet_infoline("Set initial position and set up animation to re-position actor");
10798 Actor actor = Actor::New();
10799 Stage::GetCurrent().Add(actor);
10800 Vector3 initialPosition(0.0f, 0.0f, 0.0f);
10801 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10803 // Build the animation
10804 Animation animation = Animation::New(2.0f);
10806 //Test GetCurrentProgress return 0.0 as the duration is 0.0
10807 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
10808 DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentPosition(), TEST_LOCATION );
10810 tet_infoline("Set target position in animation without intiating play");
10812 for ( unsigned int i = 0; i < targetPositions.size(); i++ )
10814 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
10817 application.SendNotification();
10818 application.Render();
10820 tet_infoline("Ensure position of actor is still at intial value");
10822 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
10823 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
10824 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
10826 tet_infoline("Play animation and ensure actor position is now target");
10829 application.SendNotification();
10830 application.Render(1000u);
10832 tet_infoline("Ensure position of actor is at target value when aninmation half way");
10834 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10835 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10836 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10838 tet_printf( "x position at half way point(%f)\n", actor.GetCurrentPosition().x );
10840 application.Render(2000u);
10842 tet_infoline("Ensure position of actor is still at target value when aninmation complete");
10844 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
10845 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
10846 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
10851 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionP(void)
10853 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");
10855 TestApplication application;
10857 std::vector<Vector3> targetSizes;
10858 std::vector<Vector3> targetPositions;
10860 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10861 targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
10863 targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
10865 tet_infoline("Set initial position and set up animation to re-position actor");
10867 Actor actor = Actor::New();
10868 Stage::GetCurrent().Add(actor);
10869 Vector3 initialSize( 10.0f, 10.0f, 10.0f);
10870 Vector3 initialPosition(10.0f, 10.0f, 10.0f);
10872 actor.SetProperty( Actor::Property::SIZE, initialSize );
10873 actor.SetProperty( Actor::Property::POSITION, initialPosition );
10875 // Build the animation
10876 Animation animation = Animation::New(2.0f);
10878 tet_infoline("Set target size in animation without intiating play");
10879 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10880 tet_infoline("Set target position in animation without intiating play");
10881 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[0], AlphaFunction::LINEAR);
10882 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10884 application.SendNotification();
10885 application.Render();
10887 tet_infoline("Ensure position of actor is still at intial size and position");
10889 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10890 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10891 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10893 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
10894 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
10895 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
10897 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10900 application.SendNotification();
10901 application.Render(2000u);
10903 tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
10905 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10906 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10907 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10909 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
10910 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
10911 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
10916 int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionColourP(void)
10918 tet_infoline("Setting up an animation should not effect it's size property until the animation plays even if other Properties animated");
10920 TestApplication application;
10922 std::vector<Vector3> targetSizes;
10923 std::vector<float> targetColors;
10925 targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
10926 targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
10928 targetColors.push_back( 1.0f );
10930 tet_infoline("Set initial position and set up animation to re-position actor");
10932 Actor actor = Actor::New();
10933 Stage::GetCurrent().Add(actor);
10934 Vector3 initialSize( 10.0f, 5.0f, 10.0f);
10936 actor.SetProperty( Actor::Property::SIZE, initialSize );
10938 // Build the animation
10939 Animation animation = Animation::New(2.0f);
10941 tet_infoline("Set target size in animation without initiating play");
10942 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR);
10943 tet_infoline("Set target position in animation without intiating play");
10944 animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR);
10945 animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[1], AlphaFunction::LINEAR);
10947 application.SendNotification();
10948 application.Render();
10950 tet_infoline("Ensure position of actor is still at initial size and position");
10952 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
10953 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
10954 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
10956 tet_infoline("Play animation and ensure actor position and size is now matches targets");
10959 application.SendNotification();
10960 application.Render(2000u);
10962 tet_infoline("Ensure position and size of actor is at target value when animation playing");
10964 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
10965 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
10966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
10968 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
10973 int UtcDaliAnimationTimePeriodOrder(void)
10975 tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
10977 TestApplication application;
10979 Actor actor = Actor::New();
10980 Stage::GetCurrent().Add( actor );
10982 application.SendNotification();
10983 application.Render();
10985 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
10986 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10987 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10988 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
10989 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
10991 //////////////////////////////////////////////////////////////////////////////////
10993 tet_infoline( "With two AnimateTo calls" );
10995 Animation animation = Animation::New( 0.0f );
10996 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
10997 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11000 tet_infoline( "The target position should change instantly" );
11001 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11002 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11004 application.SendNotification();
11005 application.Render(5000); // After the animation is complete
11007 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11008 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11009 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11011 //////////////////////////////////////////////////////////////////////////////////
11013 tet_infoline( "Same animation again but in a different order - should yield the same result" );
11015 actor.SetX( 0.0f );
11016 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11017 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11019 application.SendNotification();
11020 application.Render();
11022 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11023 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11024 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11026 animation = Animation::New( 0.0f );
11027 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
11028 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
11031 tet_infoline( "The target position should change instantly" );
11032 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11033 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11035 application.SendNotification();
11036 application.Render(5000); // After the animation is complete
11038 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11039 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
11040 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
11045 int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
11047 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" );
11049 TestApplication application;
11051 Actor actor = Actor::New();
11052 Stage::GetCurrent().Add( actor );
11054 application.SendNotification();
11055 application.Render();
11057 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11058 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11059 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11060 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11061 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11063 //////////////////////////////////////////////////////////////////////////////////
11065 tet_infoline( "" );
11067 Animation animation = Animation::New( 0.0f );
11068 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11069 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11070 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11071 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11072 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11073 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11076 tet_infoline( "The target position should change instantly" );
11077 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11078 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11080 application.SendNotification();
11081 application.Render(14000); // After the animation is complete
11083 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11084 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11085 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11087 //////////////////////////////////////////////////////////////////////////////////
11089 tet_infoline( "Same animation again but in a different order - should end up at the same point" );
11091 actor.SetX( 0.0f );
11093 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11094 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11096 application.SendNotification();
11097 application.Render();
11099 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
11100 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
11101 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
11103 animation = Animation::New( 0.0f );
11104 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
11105 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
11106 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
11107 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
11108 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
11109 animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
11112 tet_infoline( "The target position should change instantly" );
11113 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11114 DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
11116 application.SendNotification();
11117 application.Render(14000); // After the animation is complete
11119 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11120 DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
11121 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );