2 * Copyright (c) 2014 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-test-suite-utils.h>
28 void utc_dali_animation_startuP(void)
30 test_return_value = TET_UNDEF;
33 void utc_dali_animation_cleanuP(void)
35 test_return_value = TET_PASS;
41 static const float ROTATION_EPSILON = 0.0001f;
42 static const float VECTOR4_EPSILON = 0.0001f;
44 // Functor to test whether a Finish signal is emitted
45 struct AnimationFinishCheck
47 AnimationFinishCheck(bool& signalReceived)
48 : mSignalReceived(signalReceived)
52 void operator()(Animation& animation)
54 mSignalReceived = true;
59 mSignalReceived = false;
62 void CheckSignalReceived()
66 tet_printf("Expected Finish signal was not received\n");
75 void CheckSignalNotReceived()
79 tet_printf("Unexpected Finish signal was received\n");
88 bool& mSignalReceived; // owned by individual tests
93 int UtcDaliAnimationConstructorP(void)
95 TestApplication application;
99 DALI_TEST_CHECK( !animation );
103 int UtcDaliAnimationNewP(void)
105 TestApplication application;
107 Animation animation = Animation::New( 1.0f );
109 DALI_TEST_CHECK(animation);
113 int UtcDaliAnimationNewN(void)
115 TestApplication application;
117 Animation animation = Animation::New( -1.0f );
119 DALI_TEST_CHECK(animation);
120 DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
124 int UtcDaliAnimationDownCastP(void)
126 TestApplication application;
128 tet_infoline("Testing Dali::Animation::DownCast()");
130 float durationSeconds(1.0f);
131 Animation animation = Animation::New(durationSeconds);
133 BaseHandle object(animation);
135 Animation animation2 = Animation::DownCast(object);
136 DALI_TEST_CHECK(animation2);
138 Animation animation3 = DownCast< Animation >(object);
139 DALI_TEST_CHECK(animation3);
143 int UtcDaliAnimationDownCastN(void)
145 TestApplication application;
147 BaseHandle unInitializedObject;
149 Animation animation1 = Animation::DownCast( unInitializedObject );
150 DALI_TEST_CHECK( !animation1 );
152 Animation animation2 = DownCast< Animation >( unInitializedObject );
153 DALI_TEST_CHECK( !animation2 );
157 int UtcDaliAnimationCopyConstructorP(void)
159 TestApplication application;
161 // Initialize an object, ref count == 1
162 Animation animation = Animation::New( 1.0f );
164 Animation copy( animation );
165 DALI_TEST_CHECK( copy );
167 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
171 int UtcDaliAnimationAssignmentOperatorP(void)
173 TestApplication application;
175 Animation animation = Animation::New( 1.0f );
177 Animation copy = animation;
178 DALI_TEST_CHECK( copy );
180 DALI_TEST_CHECK( animation == copy );
182 DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
186 int UtcDaliAnimationSetDurationP(void)
188 TestApplication application;
190 Actor actor = Actor::New();
191 Stage::GetCurrent().Add(actor);
193 // Build the animation
194 float durationSeconds(1.0f);
195 Animation animation = Animation::New(durationSeconds);
196 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
198 // Start the animation
199 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
200 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
203 bool signalReceived(false);
204 AnimationFinishCheck finishCheck(signalReceived);
205 animation.FinishedSignal().Connect(&application, finishCheck);
207 application.SendNotification();
208 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
210 // We didn't expect the animation to finish yet
211 application.SendNotification();
212 finishCheck.CheckSignalNotReceived();
214 application.Render(2u/*just beyond the animation duration*/);
216 // We did expect the animation to finish
217 application.SendNotification();
218 finishCheck.CheckSignalReceived();
219 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
221 // Restart the animation, with a different duration
223 actor.SetPosition(Vector3::ZERO);
224 durationSeconds = 3.5f;
225 animation.SetDuration(durationSeconds);
226 DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
229 application.SendNotification();
230 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
232 // We didn't expect the animation to finish yet
233 application.SendNotification();
234 finishCheck.CheckSignalNotReceived();
236 application.Render(2u/*just beyond the animation duration*/);
238 // We did expect the animation to finish
239 application.SendNotification();
240 finishCheck.CheckSignalReceived();
241 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
243 // Check that nothing has changed after a couple of buffer swaps
244 application.Render(0);
245 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
246 application.Render(0);
247 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
251 int UtcDaliAnimationSetDurationN(void)
253 TestApplication application;
255 Animation animation = Animation::New( 1.0f );
256 DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
258 animation.SetDuration( -1.0f );
259 DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
263 int UtcDaliAnimationGetDurationP(void)
265 TestApplication application;
267 Animation animation = Animation::New(1.0f);
268 DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
270 animation.SetDuration(2.0f);
271 DALI_TEST_EQUALS(animation.GetDuration(), 2.0f, TEST_LOCATION);
275 int UtcDaliAnimationSetLoopingP(void)
277 TestApplication application;
279 Actor actor = Actor::New();
280 Stage::GetCurrent().Add(actor);
282 // Build the animation
283 float durationSeconds(1.0f);
284 Animation animation = Animation::New(durationSeconds);
285 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
286 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
288 // Start the animation
289 animation.SetLooping(true);
290 DALI_TEST_CHECK(animation.IsLooping());
293 bool signalReceived(false);
294 AnimationFinishCheck finishCheck(signalReceived);
295 animation.FinishedSignal().Connect(&application, finishCheck);
297 application.SendNotification();
300 float intervalSeconds = 0.25f;
301 float progress = 0.0f;
302 for (int iterations = 0; iterations < 5;)
304 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
306 progress += intervalSeconds;
307 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
309 if (progress >= 1.0f)
311 progress = progress - 1.0f;
316 // We didn't expect the animation to finish yet
317 application.SendNotification();
318 finishCheck.CheckSignalNotReceived();
320 animation.SetLooping(false);
321 DALI_TEST_CHECK(!animation.IsLooping());
323 application.SendNotification();
324 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
326 // We did expect the animation to finish
327 application.SendNotification();
328 finishCheck.CheckSignalReceived();
329 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
331 // Check that nothing has changed after a couple of buffer swaps
332 application.Render(0);
333 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
334 application.Render(0);
335 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
339 int UtcDaliAnimationSetLoopCountP(void)
341 TestApplication application;
343 Actor actor = Actor::New();
344 Stage::GetCurrent().Add(actor);
346 // Build the animation
347 float durationSeconds(1.0f);
348 Animation animation = Animation::New(durationSeconds);
349 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
350 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
352 // Start the animation
353 animation.SetLoopCount(3);
354 DALI_TEST_CHECK(animation.IsLooping());
357 bool signalReceived(false);
358 AnimationFinishCheck finishCheck(signalReceived);
359 animation.FinishedSignal().Connect(&application, finishCheck);
361 application.Render(0);
362 application.SendNotification();
363 application.Render(0);
364 application.SendNotification();
365 application.Render(0);
366 application.SendNotification();
367 application.Render(0);
368 application.SendNotification();
371 float intervalSeconds = 3.0f;
373 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
374 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
376 application.Render(0);
377 application.SendNotification();
378 application.Render(0);
379 application.SendNotification();
380 application.Render(0);
381 application.SendNotification();
382 application.Render(0);
383 application.SendNotification();
384 finishCheck.CheckSignalNotReceived();
386 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
388 application.SendNotification();
389 finishCheck.CheckSignalReceived();
390 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
394 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
395 application.SendNotification();
396 finishCheck.CheckSignalNotReceived();
398 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
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.SendNotification();
403 finishCheck.CheckSignalNotReceived();
408 int UtcDaliAnimationSetLoopCountP2(void)
410 TestApplication application;
413 // switching between forever and loop count
416 Actor actor = Actor::New();
417 Stage::GetCurrent().Add(actor);
419 // Build the animation
420 float durationSeconds(1.0f);
421 Animation animation = Animation::New(durationSeconds);
422 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
423 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
424 animation.SetEndAction(Animation::Discard);
426 // Start the animation
427 animation.SetLoopCount(3);
428 DALI_TEST_CHECK(animation.IsLooping());
431 bool signalReceived(false);
432 AnimationFinishCheck finishCheck(signalReceived);
433 animation.FinishedSignal().Connect(&application, finishCheck);
435 float intervalSeconds = 3.0f;
437 application.SendNotification();
438 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
439 application.SendNotification();
440 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
441 application.SendNotification();
442 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
443 application.SendNotification();
445 application.SendNotification();
446 finishCheck.CheckSignalReceived();
451 animation.SetLooping(true);
452 DALI_TEST_CHECK(animation.IsLooping());
454 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
455 application.SendNotification();
456 finishCheck.CheckSignalNotReceived();
458 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
459 application.SendNotification();
460 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
461 application.SendNotification();
462 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
463 application.SendNotification();
464 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
465 application.SendNotification();
466 application.SendNotification();
467 finishCheck.CheckSignalNotReceived();
472 animation.SetLoopCount(3);
473 DALI_TEST_CHECK(animation.IsLooping());
476 application.SendNotification();
477 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
478 application.SendNotification();
479 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
480 application.SendNotification();
481 finishCheck.CheckSignalNotReceived();
483 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
484 application.SendNotification();
485 finishCheck.CheckSignalReceived();
490 animation.SetLooping(true);
491 DALI_TEST_CHECK(animation.IsLooping());
493 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
494 application.SendNotification();
495 finishCheck.CheckSignalNotReceived();
497 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
498 application.SendNotification();
499 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
500 application.SendNotification();
501 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
502 application.SendNotification();
503 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
504 application.SendNotification();
505 finishCheck.CheckSignalNotReceived();
510 animation.SetLoopCount(3);
511 DALI_TEST_CHECK(animation.IsLooping());
513 application.SendNotification();
514 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
515 application.SendNotification();
516 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
517 application.SendNotification();
518 finishCheck.CheckSignalNotReceived();
520 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
521 application.SendNotification();
522 finishCheck.CheckSignalNotReceived(); // we never hit play
530 int UtcDaliAnimationSetLoopCountP3(void)
532 TestApplication application;
535 // switching between forever and loop count
537 Actor actor = Actor::New();
538 Stage::GetCurrent().Add(actor);
540 // Build the animation
541 float durationSeconds(1.0f);
542 Animation animation = Animation::New(durationSeconds);
543 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
544 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
545 animation.SetEndAction(Animation::Discard);
547 float intervalSeconds = 3.0f;
549 bool signalReceived(false);
550 AnimationFinishCheck finishCheck(signalReceived);
551 animation.FinishedSignal().Connect(&application, finishCheck);
554 animation.SetLooping(true);
555 DALI_TEST_CHECK(animation.IsLooping());
557 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
558 application.SendNotification();
559 finishCheck.CheckSignalNotReceived();
561 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
562 application.SendNotification();
563 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
564 application.SendNotification();
565 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
566 application.SendNotification();
567 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
568 application.SendNotification();
569 finishCheck.CheckSignalNotReceived();
574 animation.SetLoopCount(3);
575 DALI_TEST_CHECK(animation.IsLooping());
577 application.SendNotification();
578 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
579 application.SendNotification();
580 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
581 application.SendNotification();
582 finishCheck.CheckSignalNotReceived();
584 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
585 application.SendNotification();
586 finishCheck.CheckSignalNotReceived(); // we never hit play
594 int UtcDaliAnimationSetLoopCountP4(void)
596 TestApplication application;
601 Actor actor = Actor::New();
602 Stage::GetCurrent().Add(actor);
604 // Build the animation
605 float durationSeconds(1.0f);
606 Animation animation = Animation::New(durationSeconds);
607 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
608 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
609 animation.SetEndAction(Animation::Bake);
611 float intervalSeconds = 3.0f;
613 bool signalReceived(false);
614 AnimationFinishCheck finishCheck(signalReceived);
615 animation.FinishedSignal().Connect(&application, finishCheck);
617 animation.SetLoopCount(1);
619 DALI_TEST_CHECK(!animation.IsLooping());
621 application.SendNotification();
622 finishCheck.CheckSignalNotReceived();
623 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
624 application.SendNotification();
625 finishCheck.CheckSignalReceived();
627 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
628 actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
632 animation.Play(); // again
633 DALI_TEST_CHECK(!animation.IsLooping());
635 application.SendNotification();
636 finishCheck.CheckSignalNotReceived();
637 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
638 application.SendNotification();
639 finishCheck.CheckSignalReceived();
641 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
646 int UtcDaliAnimationGetLoopCountP(void)
648 TestApplication application;
650 Actor actor = Actor::New();
651 Stage::GetCurrent().Add(actor);
653 // Build the animation
654 float durationSeconds(1.0f);
655 Animation animation = Animation::New(durationSeconds);
656 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
657 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
659 DALI_TEST_CHECK(1 == animation.GetLoopCount());
661 // Start the animation
662 animation.SetLoopCount(3);
663 DALI_TEST_CHECK(animation.IsLooping());
664 DALI_TEST_CHECK(3 == animation.GetLoopCount());
668 application.Render(0);
669 application.SendNotification();
672 float intervalSeconds = 3.0f;
674 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
675 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
677 application.Render(0);
678 application.SendNotification();
680 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
681 application.SendNotification();
683 animation.SetLoopCount(0);
684 DALI_TEST_CHECK(animation.IsLooping());
685 DALI_TEST_CHECK(0 == animation.GetLoopCount());
687 animation.SetLoopCount(1);
688 DALI_TEST_CHECK(!animation.IsLooping());
689 DALI_TEST_CHECK(1 == animation.GetLoopCount());
695 int UtcDaliAnimationGetCurrentLoopP(void)
697 TestApplication application;
699 Actor actor = Actor::New();
700 Stage::GetCurrent().Add(actor);
702 // Build the animation
703 float durationSeconds(1.0f);
704 Animation animation = Animation::New(durationSeconds);
705 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
706 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
708 // Start the animation
709 animation.SetLoopCount(3);
710 DALI_TEST_CHECK(animation.IsLooping());
711 DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
714 bool signalReceived(false);
715 AnimationFinishCheck finishCheck(signalReceived);
716 animation.FinishedSignal().Connect(&application, finishCheck);
718 application.SendNotification();
721 float intervalSeconds = 3.0f;
723 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
724 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
726 application.SendNotification();
727 finishCheck.CheckSignalNotReceived();
728 DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
730 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
732 application.SendNotification();
733 finishCheck.CheckSignalReceived();
734 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
735 DALI_TEST_CHECK(animation.GetLoopCount() == animation.GetCurrentLoop());
739 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
740 application.SendNotification();
741 finishCheck.CheckSignalNotReceived();
742 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
744 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
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.SendNotification();
749 finishCheck.CheckSignalNotReceived();
750 DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
755 int UtcDaliAnimationIsLoopingP(void)
757 TestApplication application;
759 Animation animation = Animation::New(1.0f);
760 DALI_TEST_CHECK(!animation.IsLooping());
762 animation.SetLooping(true);
763 DALI_TEST_CHECK(animation.IsLooping());
767 int UtcDaliAnimationSetEndActioN(void)
769 TestApplication application;
771 Actor actor = Actor::New();
772 Stage::GetCurrent().Add(actor);
774 // Build the animation
775 float durationSeconds(1.0f);
776 Animation animation = Animation::New(durationSeconds);
777 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
779 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
780 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
782 // Start the animation
785 bool signalReceived(false);
786 AnimationFinishCheck finishCheck(signalReceived);
787 animation.FinishedSignal().Connect(&application, finishCheck);
789 application.SendNotification();
790 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
792 // We did expect the animation to finish
793 application.SendNotification();
794 finishCheck.CheckSignalReceived();
795 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
797 // Go back to the start
798 actor.SetPosition(Vector3::ZERO);
799 application.SendNotification();
800 application.Render(0);
801 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
803 // Test BakeFinal, animate again, for half the duration
805 animation.SetEndAction(Animation::BakeFinal);
806 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
809 application.SendNotification();
810 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
812 // Stop the animation early
815 // We did NOT expect the animation to finish
816 application.SendNotification();
817 finishCheck.CheckSignalNotReceived();
818 DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentPosition(), VECTOR4_EPSILON, TEST_LOCATION );
820 // The position should be same with target position in the next frame
821 application.Render(0);
822 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
824 // Go back to the start
825 actor.SetPosition(Vector3::ZERO);
826 application.SendNotification();
827 application.Render(0);
828 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
830 // Test EndAction::Discard, animate again, but don't bake this time
832 animation.SetEndAction(Animation::Discard);
833 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
836 application.SendNotification();
837 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
839 // We did expect the animation to finish
840 application.SendNotification();
841 finishCheck.CheckSignalReceived();
842 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
844 // The position should be discarded in the next frame
845 application.Render(0);
846 DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentPosition(), TEST_LOCATION );
848 // Check that nothing has changed after a couple of buffer swaps
849 application.Render(0);
850 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
851 application.Render(0);
852 DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentPosition(), TEST_LOCATION );
856 int UtcDaliAnimationGetEndActionP(void)
858 TestApplication application;
860 Animation animation = Animation::New(1.0f);
861 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
863 animation.SetEndAction(Animation::Discard);
864 DALI_TEST_CHECK(animation.GetEndAction() == Animation::Discard);
866 animation.SetEndAction(Animation::BakeFinal);
867 DALI_TEST_CHECK(animation.GetEndAction() == Animation::BakeFinal);
872 int UtcDaliAnimationSetDisconnectActionP(void)
874 TestApplication application;
875 Stage stage( Stage::GetCurrent() );
877 // Default: BakeFinal
879 Actor actor = Actor::New();
882 // Build the animation
883 float durationSeconds(1.0f);
884 Animation animation = Animation::New(durationSeconds);
885 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
887 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
888 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
890 // Start the animation
893 application.SendNotification();
894 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
898 application.SendNotification();
899 application.Render();
901 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
906 Actor actor = Actor::New();
909 // Build the animation
910 float durationSeconds(1.0f);
911 Animation animation = Animation::New(durationSeconds);
912 animation.SetDisconnectAction( Animation::Bake );
914 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
915 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
917 // Start the animation
920 application.SendNotification();
921 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
925 application.SendNotification();
926 application.Render();
928 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition*0.5f, TEST_LOCATION );
933 Actor actor = Actor::New();
936 // Build the animation
937 float durationSeconds(1.0f);
938 Animation animation = Animation::New(durationSeconds);
939 animation.SetDisconnectAction( Animation::Discard );
941 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
942 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
944 // Start the animation
947 application.SendNotification();
948 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
952 application.SendNotification();
953 application.Render();
955 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
958 // Don't play the animation: disconnect action should not be applied
960 Actor actor = Actor::New();
963 // Build the animation
964 float durationSeconds(1.0f);
965 Animation animation = Animation::New(durationSeconds);
967 Vector3 targetPosition(10.0f, 10.0f, 10.0f);
968 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
970 application.SendNotification();
971 application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
975 application.SendNotification();
976 application.Render();
978 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
984 int UtcDaliAnimationGetDisconnectActionP(void)
986 TestApplication application;
987 Animation animation = Animation::New(1.0f);
988 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal); // default!
990 animation.SetDisconnectAction(Animation::Discard);
991 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Discard);
993 animation.SetDisconnectAction(Animation::Bake);
994 DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::Bake);
999 int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
1001 TestApplication application;
1003 Animation animation = Animation::New(1.0f);
1004 AlphaFunction func = animation.GetDefaultAlphaFunction();
1005 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1007 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1008 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1009 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1013 int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
1015 TestApplication application;
1017 Animation animation = Animation::New(1.0f);
1018 AlphaFunction func = animation.GetDefaultAlphaFunction();
1020 // Test that the default is linear
1021 DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
1023 animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
1024 AlphaFunction func2 = animation.GetDefaultAlphaFunction();
1025 DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
1030 int UtcDaliAnimationSetCurrentProgressP(void)
1032 TestApplication application;
1034 Actor actor = Actor::New();
1035 Stage::GetCurrent().Add(actor);
1037 // Build the animation
1038 Animation animation = Animation::New(0.0f);
1041 float durationSeconds(1.0f);
1042 animation.SetDuration(durationSeconds);
1044 bool signalReceived(false);
1045 AnimationFinishCheck finishCheck(signalReceived);
1046 animation.FinishedSignal().Connect(&application, finishCheck);
1047 application.SendNotification();
1049 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1050 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1052 // Start the animation from 40% progress
1053 animation.SetCurrentProgress( 0.4f );
1056 application.SendNotification();
1057 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1059 // We didn't expect the animation to finish yet
1060 application.SendNotification();
1061 finishCheck.CheckSignalNotReceived();
1062 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1063 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1065 animation.Play(); // Test that calling play has no effect, when animation is already playing
1066 application.SendNotification();
1068 //Set the progress to 70%
1069 animation.SetCurrentProgress( 0.7f );
1070 application.SendNotification();
1071 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1072 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1074 application.SendNotification();
1075 finishCheck.CheckSignalNotReceived();
1076 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1077 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1079 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1080 // We did expect the animation to finish
1081 application.SendNotification();
1082 finishCheck.CheckSignalReceived();
1083 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1085 // Check that nothing has changed after a couple of buffer swaps
1086 application.Render(0);
1087 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1088 application.Render(0);
1089 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1093 int UtcDaliAnimationSetCurrentProgressN(void)
1095 TestApplication application;
1097 Actor actor = Actor::New();
1098 Stage::GetCurrent().Add(actor);
1100 // Build the animation
1101 Animation animation = Animation::New(0.0f);
1104 float durationSeconds(1.0f);
1105 animation.SetDuration(durationSeconds);
1107 bool signalReceived(false);
1108 AnimationFinishCheck finishCheck(signalReceived);
1109 animation.FinishedSignal().Connect(&application, finishCheck);
1110 application.SendNotification();
1112 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1113 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1115 //Trying to set the current cursor outside the range [0..1] is ignored
1116 animation.SetCurrentProgress( -1.0f);
1117 application.SendNotification();
1118 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1120 animation.SetCurrentProgress( 100.0f);
1121 application.SendNotification();
1122 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1126 int UtcDaliAnimationGetCurrentProgressP(void)
1128 TestApplication application;
1130 Actor actor = Actor::New();
1131 Stage::GetCurrent().Add(actor);
1133 // Build the animation
1134 Animation animation = Animation::New(0.0f);
1137 //Test GetCurrentProgress return 0.0 as the duration is 0.0
1138 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1140 animation.SetCurrentProgress( 0.5f );
1141 application.SendNotification();
1142 application.Render(static_cast<unsigned int>(100.0f));
1144 //Progress should still be 0.0
1145 DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
1148 float durationSeconds(1.0f);
1149 animation.SetDuration(durationSeconds);
1150 application.SendNotification();
1152 bool signalReceived(false);
1153 AnimationFinishCheck finishCheck(signalReceived);
1154 animation.FinishedSignal().Connect(&application, finishCheck);
1155 application.SendNotification();
1157 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1158 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1160 // Start the animation from 40% progress
1161 animation.SetCurrentProgress( 0.4f );
1164 application.SendNotification();
1165 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1167 // We didn't expect the animation to finish yet
1168 application.SendNotification();
1169 finishCheck.CheckSignalNotReceived();
1170 DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
1172 animation.Play(); // Test that calling play has no effect, when animation is already playing
1173 application.SendNotification();
1175 //Set the progress to 70%
1176 animation.SetCurrentProgress( 0.7f );
1177 application.SendNotification();
1178 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
1179 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1181 application.SendNotification();
1182 finishCheck.CheckSignalNotReceived();
1183 DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
1185 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1186 // We did expect the animation to finish
1187 application.SendNotification();
1188 finishCheck.CheckSignalReceived();
1192 int UtcDaliAnimationSetSpeedFactorP1(void)
1194 TestApplication application;
1196 tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
1198 Actor actor = Actor::New();
1199 Stage::GetCurrent().Add(actor);
1201 // Build the animation
1202 float durationSeconds(1.0f);
1203 Animation animation = Animation::New(durationSeconds);
1205 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1206 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1208 KeyFrames keyframes = KeyFrames::New();
1209 keyframes.Add( 0.0f, initialPosition);
1210 keyframes.Add( 1.0f, targetPosition );
1211 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1213 //Set speed to be x2
1214 animation.SetSpeedFactor(2.0f);
1216 // Start the animation
1219 bool signalReceived(false);
1220 AnimationFinishCheck finishCheck(signalReceived);
1221 animation.FinishedSignal().Connect(&application, finishCheck);
1223 application.SendNotification();
1224 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1226 // We didn't expect the animation to finish yet
1227 application.SendNotification();
1228 finishCheck.CheckSignalNotReceived();
1229 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1231 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1233 // We didn't expect the animation to finish yet
1234 application.SendNotification();
1235 finishCheck.CheckSignalNotReceived();
1236 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1238 application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
1240 // We did expect the animation to finish
1241 application.SendNotification();
1242 finishCheck.CheckSignalReceived();
1243 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1245 // Check that nothing has changed after a couple of buffer swaps
1246 application.Render(0);
1247 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1248 application.Render(0);
1249 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1254 int UtcDaliAnimationSetSpeedFactorP2(void)
1256 TestApplication application;
1258 Actor actor = Actor::New();
1259 Stage::GetCurrent().Add(actor);
1261 // Build the animation
1262 float durationSeconds(1.0f);
1263 Animation animation = Animation::New(durationSeconds);
1265 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1266 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1268 KeyFrames keyframes = KeyFrames::New();
1269 keyframes.Add( 0.0f, initialPosition);
1270 keyframes.Add( 1.0f, targetPosition );
1271 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1273 tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
1274 animation.SetSpeedFactor( -1.0f );
1276 // Start the animation
1279 bool signalReceived(false);
1280 AnimationFinishCheck finishCheck(signalReceived);
1281 animation.FinishedSignal().Connect(&application, finishCheck);
1283 application.SendNotification();
1284 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
1286 // We didn't expect the animation to finish yet
1287 application.SendNotification();
1288 finishCheck.CheckSignalNotReceived();
1289 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
1291 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1293 // We didn't expect the animation to finish yet
1294 application.SendNotification();
1295 finishCheck.CheckSignalNotReceived();
1296 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1298 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1300 // We didn't expect the animation to finish yet
1301 application.SendNotification();
1302 finishCheck.CheckSignalNotReceived();
1303 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1305 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1307 // We didn't expect the animation to finish yet
1308 application.SendNotification();
1309 finishCheck.CheckSignalNotReceived();
1310 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1312 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1314 // We did expect the animation to finish
1315 application.SendNotification();
1316 finishCheck.CheckSignalReceived();
1317 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1319 // Check that nothing has changed after a couple of buffer swaps
1320 application.Render(0);
1321 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1322 application.Render(0);
1323 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1328 int UtcDaliAnimationSetSpeedFactorP3(void)
1330 TestApplication application;
1332 Actor actor = Actor::New();
1333 Stage::GetCurrent().Add(actor);
1335 // Build the animation
1336 float durationSeconds(1.0f);
1337 Animation animation = Animation::New(durationSeconds);
1339 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1340 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1342 KeyFrames keyframes = KeyFrames::New();
1343 keyframes.Add( 0.0f, initialPosition);
1344 keyframes.Add( 1.0f, targetPosition );
1345 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1347 bool signalReceived(false);
1348 AnimationFinishCheck finishCheck(signalReceived);
1349 animation.FinishedSignal().Connect(&application, finishCheck);
1351 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1353 //Set speed to be half of normal speed
1354 animation.SetSpeedFactor( 0.5f );
1356 // Start the animation
1359 application.SendNotification();
1360 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1362 // We didn't expect the animation to finish yet
1363 application.SendNotification();
1364 finishCheck.CheckSignalNotReceived();
1365 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1367 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1369 // We didn't expect the animation to finish yet
1370 application.SendNotification();
1371 finishCheck.CheckSignalNotReceived();
1372 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1374 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1376 // We didn't expect the animation to finish yet
1377 application.SendNotification();
1378 finishCheck.CheckSignalNotReceived();
1379 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1381 application.SendNotification();
1382 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1384 // We didn't expect the animation to finish yet
1385 application.SendNotification();
1386 finishCheck.CheckSignalNotReceived();
1387 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1389 application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
1391 // We did expect the animation to finish
1392 application.SendNotification();
1393 finishCheck.CheckSignalReceived();
1394 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
1396 // Check that nothing has changed after a couple of buffer swaps
1397 application.Render(0);
1398 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1399 application.Render(0);
1400 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1405 int UtcDaliAnimationSetSpeedFactorP4(void)
1407 TestApplication application;
1409 Actor actor = Actor::New();
1410 Stage::GetCurrent().Add(actor);
1412 // Build the animation
1413 float durationSeconds(1.0f);
1414 Animation animation = Animation::New(durationSeconds);
1416 const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
1417 const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1419 KeyFrames keyframes = KeyFrames::New();
1420 keyframes.Add( 0.0f, initialPosition);
1421 keyframes.Add( 1.0f, targetPosition );
1422 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1424 bool signalReceived(false);
1425 AnimationFinishCheck finishCheck(signalReceived);
1426 animation.FinishedSignal().Connect(&application, finishCheck);
1428 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1430 tet_printf("Set speed to be half of normal speed\n");
1431 tet_printf("SetSpeedFactor(0.5f)\n");
1432 animation.SetSpeedFactor( 0.5f );
1434 // Start the animation
1437 application.SendNotification();
1438 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1440 // We didn't expect the animation to finish yet
1441 application.SendNotification();
1442 finishCheck.CheckSignalNotReceived();
1443 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
1445 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1447 // We didn't expect the animation to finish yet
1448 application.SendNotification();
1449 finishCheck.CheckSignalNotReceived();
1450 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1452 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
1454 // We didn't expect the animation to finish yet
1455 application.SendNotification();
1456 finishCheck.CheckSignalNotReceived();
1457 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
1459 tet_printf("Reverse direction of animation whilst playing\n");
1460 tet_printf("SetSpeedFactor(-0.5f)\n");
1461 animation.SetSpeedFactor(-0.5f);
1463 application.SendNotification();
1464 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1466 // We didn't expect the animation to finish yet
1467 application.SendNotification();
1468 finishCheck.CheckSignalNotReceived();
1469 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1471 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
1473 // We didn't expect the animation to finish yet
1474 application.SendNotification();
1475 finishCheck.CheckSignalNotReceived();
1476 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
1478 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
1480 // We did expect the animation to finish
1481 application.SendNotification();
1482 finishCheck.CheckSignalReceived();
1483 DALI_TEST_EQUALS( actor.GetCurrentPosition(), initialPosition, TEST_LOCATION );
1485 // Check that nothing has changed after a couple of buffer swaps
1486 application.Render(0);
1487 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1488 application.Render(0);
1489 DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
1493 int UtcDaliAnimationSetSpeedFactorAndRange(void)
1495 TestApplication application;
1497 const unsigned int NUM_FRAMES(15);
1505 float expected[NUM_FRAMES];
1508 TestData testData[] = {
1510 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1511 /* |----------PlayRange---------------| */
1513 { 0.0f, 1.0f, // TimePeriod
1514 0.0f, 100.0f, // POS
1515 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1516 /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
1527 // ACTOR 1 - Across start of range
1528 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1529 /* |----------PlayRange---------------| */
1531 { 0.2f, 0.5f, // TimePeriod
1532 20.0f, 50.0f, // POS
1533 {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
1534 /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
1544 // ACTOR 2 - Across end of range
1545 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1546 /* |----------PlayRange---------------| */
1548 {/**/ 0.5f, 0.9f, // TimePeriod
1549 /**/ 50.0f, 90.0f, // POS
1550 { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1551 /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
1560 // ACTOR 3 - Before beginning of range
1561 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1562 /* |----------PlayRange---------------| */
1564 {/**/ 0.1f, 0.25f, // TimePeriod
1565 /**/ 10.0f, 25.0f, // POS
1567 /**/ 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
1572 // ACTOR 4 - After end of range
1573 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1574 /* |----------PlayRange---------------| */
1576 {/**/ 0.85f, 1.0f, // TimePeriod
1577 /**/ 85.0f, 100.0f, // POS
1579 /**/ 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
1583 // Actor 5 - Middle of range
1584 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1585 /* |----------PlayRange---------------| */
1587 {/**/ 0.4f, 0.65f, // Time Period
1588 /**/ 40.0f, 65.0f, // Position
1589 { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
1590 /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse
1601 const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
1603 // Build the animation
1604 float durationSeconds(1.0f);
1605 Animation animation = Animation::New(durationSeconds);
1606 bool signalReceived(false);
1607 AnimationFinishCheck finishCheck(signalReceived);
1608 animation.FinishedSignal().Connect(&application, finishCheck);
1610 std::vector<Dali::Actor> actors;
1612 for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
1614 Actor actor = Actor::New();
1615 actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
1616 actors.push_back(actor);
1617 Stage::GetCurrent().Add(actor);
1619 if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
1621 KeyFrames keyframes = KeyFrames::New();
1622 keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
1623 keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
1624 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1628 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
1632 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1633 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1634 tet_printf("SetSpeedFactor(0.5f)\n");
1635 animation.SetSpeedFactor( 0.5f );
1636 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1637 animation.SetLooping(true);
1639 // Start the animation
1641 application.SendNotification();
1642 application.Render(0); // Frame 0 tests initial values
1644 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1646 unsigned int actorIndex = 0u;
1647 for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
1649 DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
1650 if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
1652 tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
1658 tet_printf("Reverse direction of animation whilst playing after frame 8\n");
1659 tet_printf("SetSpeedFactor(-0.5f)\n");
1660 animation.SetSpeedFactor(-0.5f);
1661 application.SendNotification();
1663 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1665 // We didn't expect the animation to finish yet
1666 application.SendNotification();
1667 finishCheck.CheckSignalNotReceived();
1673 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
1675 TestApplication application;
1677 const unsigned int NUM_FRAMES(15);
1685 float expected[NUM_FRAMES];
1690 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1691 /* |----------PlayRange---------------| */
1692 { 0.0f, 1.0f, // TimePeriod
1693 0.0f, 100.0f, // POS
1694 {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
1695 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1696 /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
1702 // Build the animation
1703 float durationSeconds(1.0f);
1704 Animation animation = Animation::New(durationSeconds);
1705 bool signalReceived(false);
1706 AnimationFinishCheck finishCheck(signalReceived);
1707 animation.FinishedSignal().Connect(&application, finishCheck);
1709 std::vector<Dali::Actor> actors;
1711 Actor actor = Actor::New();
1712 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1713 actors.push_back(actor);
1714 Stage::GetCurrent().Add(actor);
1716 KeyFrames keyframes = KeyFrames::New();
1717 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1718 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1719 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1721 tet_printf("Test half speed factor. Animation will take twice the duration\n");
1722 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1723 tet_printf("SetSpeedFactor(0.5f)\n");
1724 tet_printf("SetLoopCount(3)\n");
1725 animation.SetSpeedFactor( 0.5f );
1726 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1727 animation.SetLoopCount(3);
1729 // Start the animation
1731 application.SendNotification();
1732 application.Render(0); // Frame 0 tests initial values
1734 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1736 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1738 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1740 if( frame < NUM_FRAMES-1 )
1742 // We didn't expect the animation to finish yet
1743 application.SendNotification();
1744 finishCheck.CheckSignalNotReceived();
1748 // We did expect the animation to finish
1749 application.SendNotification();
1750 finishCheck.CheckSignalReceived();
1751 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
1756 int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
1758 TestApplication application;
1760 const unsigned int NUM_FRAMES(15);
1768 float expected[NUM_FRAMES];
1773 /*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
1774 /* |----------PlayRange---------------| */
1775 { 0.0f, 1.0f, // TimePeriod
1776 0.0f, 100.0f, // POS
1777 {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1778 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1779 /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
1784 // Build the animation
1785 float durationSeconds(1.0f);
1786 Animation animation = Animation::New(durationSeconds);
1787 bool signalReceived(false);
1788 AnimationFinishCheck finishCheck(signalReceived);
1789 animation.FinishedSignal().Connect(&application, finishCheck);
1791 std::vector<Dali::Actor> actors;
1793 Actor actor = Actor::New();
1794 actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
1795 actors.push_back(actor);
1796 Stage::GetCurrent().Add(actor);
1798 KeyFrames keyframes = KeyFrames::New();
1799 keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
1800 keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
1801 animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
1803 tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
1804 tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
1805 tet_printf("SetSpeedFactor(-0.5f)\n");
1806 tet_printf("SetLoopCount(3)\n");
1807 animation.SetSpeedFactor( -0.5f );
1808 animation.SetPlayRange( Vector2(0.3f, 0.8f) );
1809 animation.SetLoopCount(3);
1811 // Start the animation
1813 application.SendNotification();
1814 application.Render(0); // Frame 0 tests initial values
1816 for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
1818 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
1820 application.Render(200); // 200 ms at half speed corresponds to 0.1 s
1822 if( frame < NUM_FRAMES-1 )
1824 // We didn't expect the animation to finish yet
1825 application.SendNotification();
1826 finishCheck.CheckSignalNotReceived();
1830 // We did expect the animation to finish
1831 application.SendNotification();
1832 finishCheck.CheckSignalReceived();
1833 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
1839 int UtcDaliAnimationGetSpeedFactorP(void)
1841 TestApplication application;
1843 Animation animation = Animation::New(1.0f);
1844 animation.SetSpeedFactor(0.5f);
1845 DALI_TEST_EQUALS(animation.GetSpeedFactor(), 0.5f, TEST_LOCATION);
1847 animation.SetSpeedFactor(-2.5f);
1848 DALI_TEST_EQUALS(animation.GetSpeedFactor(), -2.5f, TEST_LOCATION);
1852 int UtcDaliAnimationSetPlayRangeP(void)
1854 TestApplication application;
1856 Actor actor = Actor::New();
1857 Stage::GetCurrent().Add( actor );
1859 // Build the animation
1860 float durationSeconds( 1.0f );
1861 Animation animation = Animation::New( durationSeconds );
1863 bool signalReceived( false );
1864 AnimationFinishCheck finishCheck( signalReceived );
1865 animation.FinishedSignal().Connect( &application, finishCheck );
1866 application.SendNotification();
1868 // Set range between 0.4 and 0.8
1869 animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
1870 application.SendNotification();
1871 DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
1873 Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
1874 animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
1876 // Start the animation from 40% progress
1879 application.SendNotification();
1880 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
1882 // We didn't expect the animation to finish yet
1883 application.SendNotification();
1884 finishCheck.CheckSignalNotReceived();
1885 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.6f ), TEST_LOCATION );
1887 application.SendNotification();
1888 application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
1890 application.SendNotification();
1891 finishCheck.CheckSignalNotReceived();
1892 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.8f ), TEST_LOCATION );
1894 application.SendNotification();
1895 application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
1897 // We did expect the animation to finish
1898 application.SendNotification();
1899 finishCheck.CheckSignalReceived();
1900 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ( targetPosition * 0.9f ), TEST_LOCATION );
1904 int UtcDaliAnimationSetPlayRangeN(void)
1906 TestApplication application;
1908 Actor actor = Actor::New();
1909 Stage::GetCurrent().Add(actor);
1911 // Build the animation
1912 Animation animation = Animation::New(0);
1913 application.SendNotification();
1915 //PlayRange out of bounds
1916 animation.SetPlayRange( Vector2(-1.0f,1.0f) );
1917 application.SendNotification();
1918 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1919 animation.SetPlayRange( Vector2(0.0f,2.0f) );
1920 application.SendNotification();
1921 DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
1923 //If playRange is not in the correct order it has to be ordered
1924 animation.SetPlayRange( Vector2(0.8f,0.2f) );
1925 application.SendNotification();
1926 DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
1931 int UtcDaliAnimationGetPlayRangeP(void)
1933 TestApplication application;
1935 Actor actor = Actor::New();
1936 Stage::GetCurrent().Add( actor );
1938 // Build the animation
1939 Animation animation = Animation::New( 1.0f );
1940 application.SendNotification();
1942 //If PlayRange not specified it should be 0.0-1.0 by default
1943 DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
1945 // Set range between 0.4 and 0.8
1946 animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
1947 application.SendNotification();
1948 DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
1953 int UtcDaliAnimationPlayP(void)
1955 TestApplication application;
1957 Actor actor = Actor::New();
1958 Stage::GetCurrent().Add(actor);
1960 // Build the animation
1961 float durationSeconds(1.0f);
1962 Animation animation = Animation::New(durationSeconds);
1963 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
1964 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
1966 // Start the animation
1969 bool signalReceived(false);
1970 AnimationFinishCheck finishCheck(signalReceived);
1971 animation.FinishedSignal().Connect(&application, finishCheck);
1973 application.SendNotification();
1974 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
1976 // We didn't expect the animation to finish yet
1977 application.SendNotification();
1978 finishCheck.CheckSignalNotReceived();
1979 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
1981 animation.Play(); // Test that calling play has no effect, when animation is already playing
1982 application.SendNotification();
1983 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
1985 // We didn't expect the animation to finish yet
1986 application.SendNotification();
1987 finishCheck.CheckSignalNotReceived();
1988 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
1990 animation.Play(); // Test that calling play has no effect, when animation is already playing
1991 application.SendNotification();
1992 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
1994 // We didn't expect the animation to finish yet
1995 application.SendNotification();
1996 finishCheck.CheckSignalNotReceived();
1997 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
1999 animation.Play(); // Test that calling play has no effect, when animation is already playing
2000 application.SendNotification();
2001 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2003 // We didn't expect the animation to finish yet
2004 application.SendNotification();
2005 finishCheck.CheckSignalNotReceived();
2006 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2008 animation.Play(); // Test that calling play has no effect, when animation is already playing
2009 application.SendNotification();
2010 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2012 // We did expect the animation to finish
2013 application.SendNotification();
2014 finishCheck.CheckSignalReceived();
2015 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2017 // Check that nothing has changed after a couple of buffer swaps
2018 application.Render(0);
2019 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2020 application.Render(0);
2021 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2025 int UtcDaliAnimationPlayOffStageP(void)
2027 // Test that an animation can be played, when the actor is off-stage.
2028 // When the actor is added to the stage, it should appear at the current position
2029 // i.e. where it would have been anyway, if on-stage from the beginning.
2031 TestApplication application;
2033 Actor actor = Actor::New();
2034 Vector3 basePosition(Vector3::ZERO);
2035 DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
2036 // Not added to the stage!
2038 // Build the animation
2039 float durationSeconds(1.0f);
2040 Animation animation = Animation::New(durationSeconds);
2041 animation.SetDisconnectAction( Animation::Discard );
2042 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2043 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2045 // Start the animation
2048 bool signalReceived(false);
2049 AnimationFinishCheck finishCheck(signalReceived);
2050 animation.FinishedSignal().Connect(&application, finishCheck);
2052 application.SendNotification();
2053 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2055 // We didn't expect the animation to finish yet
2056 application.SendNotification();
2057 finishCheck.CheckSignalNotReceived();
2058 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
2061 Stage::GetCurrent().Add(actor);
2063 application.SendNotification();
2064 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2066 // We didn't expect the animation to finish yet
2067 application.SendNotification();
2068 finishCheck.CheckSignalNotReceived();
2069 Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
2070 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
2072 // Remove from the stage
2073 Stage::GetCurrent().Remove(actor);
2075 application.SendNotification();
2076 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2078 // We didn't expect the animation to finish yet
2079 application.SendNotification();
2080 finishCheck.CheckSignalNotReceived();
2081 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
2084 Stage::GetCurrent().Add(actor);
2086 application.SendNotification();
2087 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2089 // We didn't expect the animation to finish yet
2090 application.SendNotification();
2091 finishCheck.CheckSignalNotReceived();
2092 expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
2093 DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
2095 application.SendNotification();
2096 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2098 // We did expect the animation to finish
2099 application.SendNotification();
2100 finishCheck.CheckSignalReceived();
2101 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2103 // Check that nothing has changed after a couple of buffer swaps
2104 application.Render(0);
2105 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2106 application.Render(0);
2107 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2111 int UtcDaliAnimationPlayDiscardHandleP(void)
2113 TestApplication application;
2115 Actor actor = Actor::New();
2116 Stage::GetCurrent().Add(actor);
2118 // Build the animation
2119 float durationSeconds(1.0f);
2120 Animation animation = Animation::New(durationSeconds);
2121 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2122 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2124 bool signalReceived(false);
2125 AnimationFinishCheck finishCheck(signalReceived);
2126 animation.FinishedSignal().Connect(&application, finishCheck);
2128 // Start the animation
2131 // This is a test of the "Fire and Forget" behaviour
2132 // Discard the animation handle!
2134 DALI_TEST_CHECK( !animation );
2136 application.SendNotification();
2137 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2139 // We didn't expect the animation to finish yet
2140 application.SendNotification();
2141 finishCheck.CheckSignalNotReceived();
2142 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2144 application.SendNotification();
2145 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2147 // We didn't expect the animation to finish yet
2148 application.SendNotification();
2149 finishCheck.CheckSignalNotReceived();
2150 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
2152 application.SendNotification();
2153 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2155 // We didn't expect the animation to finish yet
2156 application.SendNotification();
2157 finishCheck.CheckSignalNotReceived();
2158 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2160 application.SendNotification();
2161 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2163 // We didn't expect the animation to finish yet
2164 application.SendNotification();
2165 finishCheck.CheckSignalNotReceived();
2166 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2168 application.SendNotification();
2169 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2171 // We did expect the animation to finish
2172 application.SendNotification();
2173 finishCheck.CheckSignalReceived();
2174 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2176 // Check that nothing has changed after a couple of buffer swaps
2177 application.Render(0);
2178 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2179 application.Render(0);
2180 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2184 int UtcDaliAnimationPlayStopDiscardHandleP(void)
2186 TestApplication application;
2188 Actor actor = Actor::New();
2189 Stage::GetCurrent().Add(actor);
2191 // Build the animation
2192 float durationSeconds(1.0f);
2193 Animation animation = Animation::New(durationSeconds);
2194 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2195 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2197 // Start the animation
2200 bool signalReceived(false);
2201 AnimationFinishCheck finishCheck(signalReceived);
2202 animation.FinishedSignal().Connect(&application, finishCheck);
2204 application.SendNotification();
2205 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
2207 // We didn't expect the animation to finish yet
2208 application.SendNotification();
2209 finishCheck.CheckSignalNotReceived();
2210 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2212 // This is a test of the "Fire and Forget" behaviour
2213 // Stop the animation, and Discard the animation handle!
2216 DALI_TEST_CHECK( !animation );
2218 application.SendNotification();
2219 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
2221 // We expect the animation to finish at 20% progress
2222 application.SendNotification();
2223 finishCheck.CheckSignalReceived();
2224 finishCheck.Reset();
2225 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2227 application.SendNotification();
2228 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2230 // Check that nothing has changed
2231 application.SendNotification();
2232 finishCheck.CheckSignalNotReceived();
2233 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2235 application.SendNotification();
2236 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2238 // Check that nothing has changed
2239 application.SendNotification();
2240 finishCheck.CheckSignalNotReceived();
2241 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2243 application.SendNotification();
2244 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
2246 // Check that nothing has changed
2247 application.SendNotification();
2248 finishCheck.CheckSignalNotReceived();
2249 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
2253 int UtcDaliAnimationPlayRangeP(void)
2255 TestApplication application;
2257 Actor actor = Actor::New();
2258 Stage::GetCurrent().Add(actor);
2260 // Build the animation
2261 float durationSeconds(1.0f);
2262 Animation animation = Animation::New(durationSeconds);
2263 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2264 KeyFrames keyframes = KeyFrames::New();
2265 keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
2266 keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
2268 animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
2270 // Set range between 0.4 and 0.8
2271 animation.SetPlayRange( Vector2(0.4f,0.8f) );
2274 bool signalReceived(false);
2275 AnimationFinishCheck finishCheck(signalReceived);
2276 animation.FinishedSignal().Connect(&application, finishCheck);
2278 //Test that setting progress outside the range doesn't work
2279 animation.SetCurrentProgress( 0.9f );
2280 application.SendNotification();
2281 application.Render(0);
2282 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2283 animation.SetCurrentProgress( 0.2f );
2284 application.SendNotification();
2285 application.Render(0);
2286 DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
2288 application.SendNotification();
2289 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2291 // We didn't expect the animation to finish yet
2292 application.SendNotification();
2293 finishCheck.CheckSignalNotReceived();
2294 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2296 animation.Play(); // Test that calling play has no effect, when animation is already playing
2297 application.SendNotification();
2298 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
2300 // We did expect the animation to finish
2301 application.SendNotification();
2302 finishCheck.CheckSignalReceived();
2303 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2305 // Check that nothing has changed after a couple of buffer swaps
2306 application.Render(0);
2307 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2308 application.Render(0);
2309 DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentPosition(), TEST_LOCATION );
2312 //Loop inside the range
2313 finishCheck.Reset();
2314 animation.SetLooping( true );
2316 application.SendNotification();
2317 float intervalSeconds = 0.1f;
2318 float progress = 0.4f;
2319 for (int iterations = 0; iterations < 10; ++iterations )
2321 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2323 progress += intervalSeconds;
2324 if (progress > 0.8f)
2326 progress = progress - 0.4f;
2329 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2332 // We didn't expect the animation to finish yet
2333 application.SendNotification();
2334 finishCheck.CheckSignalNotReceived();
2337 //Test change range on the fly
2338 animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
2339 application.SendNotification();
2341 for (int iterations = 0; iterations < 10; ++iterations )
2343 application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
2345 progress += intervalSeconds;
2346 if (progress > 0.9f)
2348 progress = progress - 0.7f;
2351 DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentPosition(), 0.001f, TEST_LOCATION );
2357 int UtcDaliAnimationPlayFromP(void)
2359 TestApplication application;
2361 Actor actor = Actor::New();
2362 Stage::GetCurrent().Add(actor);
2364 // Build the animation
2365 float durationSeconds(1.0f);
2366 Animation animation = Animation::New(durationSeconds);
2367 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2368 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2370 // Start the animation from 40% progress
2371 animation.PlayFrom( 0.4f );
2373 bool signalReceived(false);
2374 AnimationFinishCheck finishCheck(signalReceived);
2375 animation.FinishedSignal().Connect(&application, finishCheck);
2377 application.SendNotification();
2378 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
2380 // We didn't expect the animation to finish yet
2381 application.SendNotification();
2382 finishCheck.CheckSignalNotReceived();
2383 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.6f), TEST_LOCATION );
2385 animation.Play(); // Test that calling play has no effect, when animation is already playing
2386 application.SendNotification();
2387 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
2389 // We didn't expect the animation to finish yet
2390 application.SendNotification();
2391 finishCheck.CheckSignalNotReceived();
2392 DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.8f), TEST_LOCATION );
2394 application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
2395 // We did expect the animation to finish
2396 application.SendNotification();
2397 finishCheck.CheckSignalReceived();
2398 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2400 // Check that nothing has changed after a couple of buffer swaps
2401 application.Render(0);
2402 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2403 application.Render(0);
2404 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2408 int UtcDaliAnimationPlayFromN(void)
2410 TestApplication application;
2412 Actor actor = Actor::New();
2413 Stage::GetCurrent().Add(actor);
2415 // Build the animation
2416 float durationSeconds(1.0f);
2417 Animation animation = Animation::New(durationSeconds);
2418 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2419 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2421 //PlayFrom with an argument outside the range [0..1] will be ignored
2422 animation.PlayFrom(-1.0f);
2423 application.SendNotification();
2424 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2426 animation.PlayFrom(100.0f);
2427 application.SendNotification();
2428 DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
2432 int UtcDaliAnimationPauseP(void)
2434 TestApplication application;
2436 Actor actor = Actor::New();
2437 Stage::GetCurrent().Add(actor);
2439 // Build the animation
2440 float durationSeconds(1.0f);
2441 Animation animation = Animation::New(durationSeconds);
2442 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2443 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2445 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2447 // Start the animation
2450 bool signalReceived(false);
2451 AnimationFinishCheck finishCheck(signalReceived);
2452 animation.FinishedSignal().Connect(&application, finishCheck);
2454 application.SendNotification();
2455 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2457 // We didn't expect the animation to finish yet
2458 application.SendNotification();
2459 finishCheck.CheckSignalNotReceived();
2460 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2462 // Pause the animation
2464 application.SendNotification();
2467 for (int i=0; i<5; ++i)
2469 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2471 // We didn't expect the animation to finish yet
2472 application.SendNotification();
2473 finishCheck.CheckSignalNotReceived();
2474 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2479 application.SendNotification();
2480 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2482 // We didn't expect the animation to finish yet
2483 application.SendNotification();
2484 finishCheck.CheckSignalNotReceived();
2486 application.SendNotification();
2487 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2489 // We did expect the animation to finish
2490 application.SendNotification();
2491 finishCheck.CheckSignalReceived();
2492 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2494 // Check that nothing has changed after a couple of buffer swaps
2495 application.Render(0);
2496 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2497 application.Render(0);
2498 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2503 int UtcDaliAnimationGetStateP(void)
2505 TestApplication application;
2507 Actor actor = Actor::New();
2508 Stage::GetCurrent().Add(actor);
2510 // Build the animation
2511 float durationSeconds(1.0f);
2512 Animation animation = Animation::New(durationSeconds);
2513 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2514 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2515 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2517 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2519 // Start the animation
2522 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2524 bool signalReceived(false);
2525 AnimationFinishCheck finishCheck(signalReceived);
2526 animation.FinishedSignal().Connect(&application, finishCheck);
2528 application.SendNotification();
2529 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2531 // We didn't expect the animation to finish yet
2532 application.SendNotification();
2533 finishCheck.CheckSignalNotReceived();
2534 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2535 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2537 // Pause the animation
2539 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2540 application.SendNotification();
2541 application.Render(0.f);
2544 for (int i=0; i<5; ++i)
2546 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2548 // We didn't expect the animation to finish yet
2549 application.SendNotification();
2550 finishCheck.CheckSignalNotReceived();
2551 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
2552 DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
2556 finishCheck.Reset();
2558 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2559 application.SendNotification();
2560 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2561 // We didn't expect the animation to finish yet
2562 application.SendNotification();
2563 finishCheck.CheckSignalNotReceived();
2564 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2566 application.SendNotification();
2567 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
2569 // We did expect the animation to finish
2570 application.SendNotification();
2571 finishCheck.CheckSignalReceived();
2572 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
2573 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2575 // Check that nothing has changed after a couple of buffer swaps
2576 application.Render(0);
2577 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2578 application.Render(0);
2579 DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
2580 DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
2583 finishCheck.Reset();
2585 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2586 application.SendNotification();
2587 application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
2588 application.SendNotification();
2589 finishCheck.CheckSignalNotReceived();
2590 DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
2596 int UtcDaliAnimationStopP(void)
2598 TestApplication application;
2600 Actor actor = Actor::New();
2601 Stage::GetCurrent().Add(actor);
2603 // Build the animation
2604 float durationSeconds(1.0f);
2605 Animation animation = Animation::New(durationSeconds);
2606 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2607 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2609 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2611 // Start the animation
2614 bool signalReceived(false);
2615 AnimationFinishCheck finishCheck(signalReceived);
2616 animation.FinishedSignal().Connect(&application, finishCheck);
2618 application.SendNotification();
2619 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2621 // We didn't expect the animation to finish yet
2622 application.SendNotification();
2623 finishCheck.CheckSignalNotReceived();
2624 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2626 // Stop the animation
2628 application.SendNotification();
2631 for (int i=0; i<5; ++i)
2633 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2635 // We did expect the animation to finish
2636 application.SendNotification();
2637 finishCheck.CheckSignalReceived();
2638 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
2643 int UtcDaliAnimationStopSetPositionP(void)
2645 // Test that Animation::Stop & Actor::SetPosition can be used in conjunction
2646 // i.e. to check that the animation does not interfere with the position set.
2648 TestApplication application;
2650 Actor actor = Actor::New();
2651 Stage::GetCurrent().Add(actor);
2653 // Build the animation
2654 float durationSeconds(1.0f);
2655 Animation animation = Animation::New(durationSeconds);
2656 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2657 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2659 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2661 // Start the animation
2664 bool signalReceived(false);
2665 AnimationFinishCheck finishCheck(signalReceived);
2666 animation.FinishedSignal().Connect(&application, finishCheck);
2668 application.SendNotification();
2669 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2671 // We didn't expect the animation to finish yet
2672 application.SendNotification();
2673 finishCheck.CheckSignalNotReceived();
2674 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2676 // Stop the animation
2678 Vector3 positionSet(2.0f, 3.0f, 4.0f);
2679 actor.SetPosition(positionSet);
2680 application.SendNotification();
2683 for (int i=0; i<5; ++i)
2685 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
2687 // We did expect the animation to finish
2688 application.SendNotification();
2689 finishCheck.CheckSignalReceived();
2690 DALI_TEST_EQUALS( actor.GetCurrentPosition(), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
2695 int UtcDaliAnimationClearP(void)
2697 TestApplication application;
2699 Actor actor = Actor::New();
2700 Stage::GetCurrent().Add(actor);
2702 // Build the animation
2703 float durationSeconds(1.0f);
2704 Animation animation = Animation::New(durationSeconds);
2705 Vector3 targetPosition(100.0f, 100.0f, 100.0f);
2706 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
2708 Vector3 fiftyPercentProgress(targetPosition * 0.5f);
2710 // Start the animation
2713 bool signalReceived(false);
2714 AnimationFinishCheck finishCheck(signalReceived);
2715 animation.FinishedSignal().Connect(&application, finishCheck);
2717 application.SendNotification();
2718 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2720 // We didn't expect the animation to finish yet
2721 application.SendNotification();
2722 finishCheck.CheckSignalNotReceived();
2723 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress, TEST_LOCATION );
2725 // Clear the animation
2727 application.SendNotification();
2729 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2731 // We don't expect the animation to finish now
2732 application.SendNotification();
2733 finishCheck.CheckSignalNotReceived();
2734 DALI_TEST_EQUALS( actor.GetCurrentPosition(), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
2736 // Restart as a scale animation; this should not move the actor's position
2737 finishCheck.Reset();
2738 actor.SetPosition(Vector3::ZERO);
2739 Vector3 targetScale(3.0f, 3.0f, 3.0f);
2740 animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
2743 application.SendNotification();
2744 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
2746 // We didn't expect the animation to finish yet
2747 application.SendNotification();
2748 finishCheck.CheckSignalNotReceived();
2749 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2750 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
2752 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
2754 // We did expect the animation to finish
2755 application.SendNotification();
2756 finishCheck.CheckSignalReceived();
2757 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
2758 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
2762 int UtcDaliAnimationFinishedSignalP(void)
2764 TestApplication application;
2766 // Start the empty animation
2767 float durationSeconds(1.0f);
2768 Animation animation = Animation::New(durationSeconds);
2771 bool signalReceived(false);
2772 AnimationFinishCheck finishCheck(signalReceived);
2773 animation.FinishedSignal().Connect(&application, finishCheck);
2775 application.SendNotification();
2776 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
2778 // We did expect the animation to finish
2779 application.SendNotification();
2780 finishCheck.CheckSignalReceived();
2784 int UtcDaliAnimationAnimateByBooleanP(void)
2786 TestApplication application;
2788 Actor actor = Actor::New();
2790 // Register a boolean property
2791 bool startValue(false);
2792 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2793 Stage::GetCurrent().Add(actor);
2794 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2796 // Build the animation
2797 float durationSeconds(2.0f);
2798 Animation animation = Animation::New(durationSeconds);
2799 const bool relativeValue(true);
2800 const bool finalValue( false || relativeValue );
2801 animation.AnimateBy(Property(actor, index), relativeValue);
2803 // Start the animation
2806 bool signalReceived(false);
2807 AnimationFinishCheck finishCheck(signalReceived);
2808 animation.FinishedSignal().Connect(&application, finishCheck);
2810 application.SendNotification();
2811 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2813 // We didn't expect the animation to finish yet
2814 application.SendNotification();
2815 finishCheck.CheckSignalNotReceived();
2816 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2818 application.SendNotification();
2819 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2821 // We did expect the animation to finish
2822 application.SendNotification();
2823 finishCheck.CheckSignalReceived();
2824 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2826 // Check that nothing has changed after a couple of buffer swaps
2827 application.Render(0);
2828 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2829 application.Render(0);
2830 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2832 // Repeat with relative value "false" - this should be an NOOP
2833 animation = Animation::New(durationSeconds);
2834 bool noOpValue(false);
2835 animation.AnimateBy(Property(actor, index), noOpValue);
2837 // Start the animation
2840 finishCheck.Reset();
2841 animation.FinishedSignal().Connect(&application, finishCheck);
2843 application.SendNotification();
2844 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2846 // We didn't expect the animation to finish yet
2847 application.SendNotification();
2848 finishCheck.CheckSignalNotReceived();
2849 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2851 application.SendNotification();
2852 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2854 // We did expect the animation to finish
2855 application.SendNotification();
2856 finishCheck.CheckSignalReceived();
2857 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2859 // Check that nothing has changed after a couple of buffer swaps
2860 application.Render(0);
2861 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2862 application.Render(0);
2863 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2867 int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
2869 TestApplication application;
2871 Actor actor = Actor::New();
2873 // Register a boolean property
2874 bool startValue(false);
2875 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2876 Stage::GetCurrent().Add(actor);
2877 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2879 // Build the animation
2880 float durationSeconds(2.0f);
2881 Animation animation = Animation::New(durationSeconds);
2882 bool relativeValue(true);
2883 bool finalValue( false || relativeValue );
2884 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
2886 // Start the animation
2889 bool signalReceived(false);
2890 AnimationFinishCheck finishCheck(signalReceived);
2891 animation.FinishedSignal().Connect(&application, finishCheck);
2893 application.SendNotification();
2894 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2896 // We didn't expect the animation to finish yet
2897 application.SendNotification();
2898 finishCheck.CheckSignalNotReceived();
2899 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2901 application.SendNotification();
2902 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2904 // We did expect the animation to finish
2905 application.SendNotification();
2906 finishCheck.CheckSignalReceived();
2907 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2909 // Check that nothing has changed after a couple of buffer swaps
2910 application.Render(0);
2911 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2912 application.Render(0);
2913 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2915 // Repeat with relative value "false" - this should be an NOOP
2916 animation = Animation::New(durationSeconds);
2917 bool noOpValue(false);
2918 animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
2920 // Start the animation
2923 finishCheck.Reset();
2924 animation.FinishedSignal().Connect(&application, finishCheck);
2926 application.SendNotification();
2927 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
2929 // We didn't expect the animation to finish yet
2930 application.SendNotification();
2931 finishCheck.CheckSignalNotReceived();
2932 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2934 application.SendNotification();
2935 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
2937 // We did expect the animation to finish
2938 application.SendNotification();
2939 finishCheck.CheckSignalReceived();
2940 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2944 int UtcDaliAnimationAnimateByBooleanTimePeriodP(void)
2946 TestApplication application;
2948 Actor actor = Actor::New();
2950 // Register a boolean property
2951 bool startValue(false);
2952 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
2953 Stage::GetCurrent().Add(actor);
2954 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2956 // Build the animation
2957 float durationSeconds(2.0f);
2958 Animation animation = Animation::New(durationSeconds);
2959 bool relativeValue(true);
2960 bool finalValue( false || relativeValue );
2961 float animatorDurationSeconds(durationSeconds * 0.5f);
2962 animation.AnimateBy( Property(actor, index),
2964 TimePeriod( animatorDurationSeconds ) );
2966 // Start the animation
2969 bool signalReceived(false);
2970 AnimationFinishCheck finishCheck(signalReceived);
2971 animation.FinishedSignal().Connect(&application, finishCheck);
2973 application.SendNotification();
2974 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
2976 // We didn't expect the animation to finish yet
2977 application.SendNotification();
2978 finishCheck.CheckSignalNotReceived();
2979 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
2981 application.SendNotification();
2982 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
2984 // We didn't expect the animation to finish yet...
2985 application.SendNotification();
2986 finishCheck.CheckSignalNotReceived();
2988 // ...however we should have reached the final value
2989 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2991 application.SendNotification();
2992 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
2994 // We did expect the animation to finish
2995 application.SendNotification();
2996 finishCheck.CheckSignalReceived();
2997 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
2999 // Check that nothing has changed after a couple of buffer swaps
3000 application.Render(0);
3001 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3002 application.Render(0);
3003 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3007 int UtcDaliAnimationAnimateByBooleanAlphaFunctionTimePeriodP(void)
3009 TestApplication application;
3011 Actor actor = Actor::New();
3013 // Register a boolean property
3014 bool startValue(false);
3015 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3016 Stage::GetCurrent().Add(actor);
3017 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3019 // Build the animation
3020 float durationSeconds(2.0f);
3021 Animation animation = Animation::New(durationSeconds);
3022 bool relativeValue(true);
3023 bool finalValue( false || relativeValue );
3024 float animatorDurationSeconds(durationSeconds * 0.5f);
3025 animation.AnimateBy( Property(actor, index),
3027 AlphaFunction::EASE_IN_OUT,
3028 TimePeriod( animatorDurationSeconds ) );
3030 // Start the animation
3033 bool signalReceived(false);
3034 AnimationFinishCheck finishCheck(signalReceived);
3035 animation.FinishedSignal().Connect(&application, finishCheck);
3037 application.SendNotification();
3038 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
3040 // We didn't expect the animation to finish yet
3041 application.SendNotification();
3042 finishCheck.CheckSignalNotReceived();
3043 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
3045 application.SendNotification();
3046 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
3048 // We didn't expect the animation to finish yet...
3049 application.SendNotification();
3050 finishCheck.CheckSignalNotReceived();
3052 // ...however we should have reached the final value
3053 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3055 application.SendNotification();
3056 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
3058 // We did expect the animation to finish
3059 application.SendNotification();
3060 finishCheck.CheckSignalReceived();
3061 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3063 // Check that nothing has changed after a couple of buffer swaps
3064 application.Render(0);
3065 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3066 application.Render(0);
3067 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
3071 int UtcDaliAnimationAnimateByFloatP(void)
3073 TestApplication application;
3075 Actor actor = Actor::New();
3077 // Register a float property
3078 float startValue(10.0f);
3079 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3080 Stage::GetCurrent().Add(actor);
3081 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3083 // Build the animation
3084 float durationSeconds(2.0f);
3085 Animation animation = Animation::New(durationSeconds);
3086 float targetValue(50.0f);
3087 float relativeValue(targetValue - startValue);
3088 animation.AnimateBy(Property(actor, index), relativeValue);
3090 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3092 // Start the animation
3095 bool signalReceived(false);
3096 AnimationFinishCheck finishCheck(signalReceived);
3097 animation.FinishedSignal().Connect(&application, finishCheck);
3099 application.SendNotification();
3100 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3102 // We didn't expect the animation to finish yet
3103 application.SendNotification();
3104 finishCheck.CheckSignalNotReceived();
3105 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
3107 application.SendNotification();
3108 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3110 // We did expect the animation to finish
3111 application.SendNotification();
3112 finishCheck.CheckSignalReceived();
3113 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3115 // Check that nothing has changed after a couple of buffer swaps
3116 application.Render(0);
3117 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3118 application.Render(0);
3119 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3123 int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
3125 TestApplication application;
3127 Actor actor = Actor::New();
3129 // Register a float property
3130 float startValue(10.0f);
3131 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3132 Stage::GetCurrent().Add(actor);
3133 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3135 // Build the animation
3136 float durationSeconds(1.0f);
3137 Animation animation = Animation::New(durationSeconds);
3138 float targetValue(90.0f);
3139 float relativeValue(targetValue - startValue);
3140 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3142 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3144 // Start the animation
3147 bool signalReceived(false);
3148 AnimationFinishCheck finishCheck(signalReceived);
3149 animation.FinishedSignal().Connect(&application, finishCheck);
3151 application.SendNotification();
3152 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3154 // We didn't expect the animation to finish yet
3155 application.SendNotification();
3156 finishCheck.CheckSignalNotReceived();
3158 // The position should have moved more, than with a linear alpha function
3159 float current(actor.GetProperty<float>(index));
3160 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3162 application.SendNotification();
3163 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3165 // We did expect the animation to finish
3166 application.SendNotification();
3167 finishCheck.CheckSignalReceived();
3168 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3170 // Check that nothing has changed after a couple of buffer swaps
3171 application.Render(0);
3172 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3173 application.Render(0);
3174 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3178 int UtcDaliAnimationAnimateByFloatTimePeriodP(void)
3180 TestApplication application;
3182 Actor actor = Actor::New();
3184 // Register a float property
3185 float startValue(10.0f);
3186 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3187 Stage::GetCurrent().Add(actor);
3188 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3190 // Build the animation
3191 float durationSeconds(1.0f);
3192 Animation animation = Animation::New(durationSeconds);
3193 float targetValue(30.0f);
3194 float relativeValue(targetValue - startValue);
3196 animation.AnimateBy(Property(actor, index),
3198 TimePeriod(delay, durationSeconds - delay));
3200 // Start the animation
3203 bool signalReceived(false);
3204 AnimationFinishCheck finishCheck(signalReceived);
3205 animation.FinishedSignal().Connect(&application, finishCheck);
3207 application.SendNotification();
3208 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3210 // We didn't expect the animation to finish yet
3211 application.SendNotification();
3212 finishCheck.CheckSignalNotReceived();
3213 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3215 application.SendNotification();
3216 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3218 // We didn't expect the animation to finish yet
3219 application.SendNotification();
3220 finishCheck.CheckSignalNotReceived();
3221 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3223 application.SendNotification();
3224 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3226 // We did expect the animation to finish
3227 application.SendNotification();
3228 finishCheck.CheckSignalReceived();
3229 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3231 // Check that nothing has changed after a couple of buffer swaps
3232 application.Render(0);
3233 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3234 application.Render(0);
3235 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3239 int UtcDaliAnimationAnimateByFloatAlphaFunctionTimePeriodP(void)
3241 TestApplication application;
3243 Actor actor = Actor::New();
3245 // Register a float property
3246 float startValue(10.0f);
3247 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3248 Stage::GetCurrent().Add(actor);
3249 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3251 // Build the animation
3252 float durationSeconds(1.0f);
3253 Animation animation = Animation::New(durationSeconds);
3254 float targetValue(30.0f);
3255 float relativeValue(targetValue - startValue);
3257 animation.AnimateBy(Property(actor, index),
3259 AlphaFunction::LINEAR,
3260 TimePeriod(delay, durationSeconds - delay));
3262 // Start the animation
3265 bool signalReceived(false);
3266 AnimationFinishCheck finishCheck(signalReceived);
3267 animation.FinishedSignal().Connect(&application, finishCheck);
3269 application.SendNotification();
3270 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3272 // We didn't expect the animation to finish yet
3273 application.SendNotification();
3274 finishCheck.CheckSignalNotReceived();
3275 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
3277 application.SendNotification();
3278 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3280 // We didn't expect the animation to finish yet
3281 application.SendNotification();
3282 finishCheck.CheckSignalNotReceived();
3283 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3285 application.SendNotification();
3286 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3288 // We did expect the animation to finish
3289 application.SendNotification();
3290 finishCheck.CheckSignalReceived();
3291 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3293 // Check that nothing has changed after a couple of buffer swaps
3294 application.Render(0);
3295 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3296 application.Render(0);
3297 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
3301 int UtcDaliAnimationAnimateByIntegerP(void)
3303 TestApplication application;
3305 Actor actor = Actor::New();
3307 // Register an integer property
3309 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3310 Stage::GetCurrent().Add(actor);
3311 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3313 // Build the animation
3314 float durationSeconds(2.0f);
3315 Animation animation = Animation::New(durationSeconds);
3316 int targetValue(50);
3317 int relativeValue(targetValue - startValue);
3318 animation.AnimateBy(Property(actor, index), relativeValue);
3320 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3322 // Start the animation
3325 bool signalReceived(false);
3326 AnimationFinishCheck finishCheck(signalReceived);
3327 animation.FinishedSignal().Connect(&application, finishCheck);
3329 application.SendNotification();
3330 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3332 // We didn't expect the animation to finish yet
3333 application.SendNotification();
3334 finishCheck.CheckSignalNotReceived();
3335 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
3337 application.SendNotification();
3338 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3340 // We did expect the animation to finish
3341 application.SendNotification();
3342 finishCheck.CheckSignalReceived();
3343 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3345 // Check that nothing has changed after a couple of buffer swaps
3346 application.Render(0);
3347 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3348 application.Render(0);
3349 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3353 int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
3355 TestApplication application;
3357 Actor actor = Actor::New();
3359 // Register an integer property
3361 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3362 Stage::GetCurrent().Add(actor);
3363 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3365 // Build the animation
3366 float durationSeconds(1.0f);
3367 Animation animation = Animation::New(durationSeconds);
3368 int targetValue(90);
3369 int relativeValue(targetValue - startValue);
3370 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3372 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
3374 // Start the animation
3377 bool signalReceived(false);
3378 AnimationFinishCheck finishCheck(signalReceived);
3379 animation.FinishedSignal().Connect(&application, finishCheck);
3381 application.SendNotification();
3382 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3384 // We didn't expect the animation to finish yet
3385 application.SendNotification();
3386 finishCheck.CheckSignalNotReceived();
3388 // The position should have moved more, than with a linear alpha function
3389 int current(actor.GetProperty<int>(index));
3390 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
3392 application.SendNotification();
3393 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3395 // We did expect the animation to finish
3396 application.SendNotification();
3397 finishCheck.CheckSignalReceived();
3398 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3400 // Check that nothing has changed after a couple of buffer swaps
3401 application.Render(0);
3402 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3403 application.Render(0);
3404 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3408 int UtcDaliAnimationAnimateByIntegerTimePeriodP(void)
3410 TestApplication application;
3412 Actor actor = Actor::New();
3414 // Register an integer property
3416 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3417 Stage::GetCurrent().Add(actor);
3418 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3420 // Build the animation
3421 float durationSeconds(1.0f);
3422 Animation animation = Animation::New(durationSeconds);
3423 int targetValue(30);
3424 int relativeValue(targetValue - startValue);
3426 animation.AnimateBy(Property(actor, index),
3428 TimePeriod(delay, durationSeconds - delay));
3430 // Start the animation
3433 bool signalReceived(false);
3434 AnimationFinishCheck finishCheck(signalReceived);
3435 animation.FinishedSignal().Connect(&application, finishCheck);
3437 application.SendNotification();
3438 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3440 // We didn't expect the animation to finish yet
3441 application.SendNotification();
3442 finishCheck.CheckSignalNotReceived();
3443 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3445 application.SendNotification();
3446 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3448 // We didn't expect the animation to finish yet
3449 application.SendNotification();
3450 finishCheck.CheckSignalNotReceived();
3451 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3453 application.SendNotification();
3454 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3456 // We did expect the animation to finish
3457 application.SendNotification();
3458 finishCheck.CheckSignalReceived();
3459 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3461 // Check that nothing has changed after a couple of buffer swaps
3462 application.Render(0);
3463 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3464 application.Render(0);
3465 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3469 int UtcDaliAnimationAnimateByIntegerAlphaFunctionTimePeriodP(void)
3471 TestApplication application;
3473 Actor actor = Actor::New();
3475 // Register an integer property
3477 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3478 Stage::GetCurrent().Add(actor);
3479 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3481 // Build the animation
3482 float durationSeconds(1.0f);
3483 Animation animation = Animation::New(durationSeconds);
3484 int targetValue(30);
3485 int relativeValue(targetValue - startValue);
3487 animation.AnimateBy(Property(actor, index),
3489 AlphaFunction::LINEAR,
3490 TimePeriod(delay, durationSeconds - delay));
3492 // Start the animation
3495 bool signalReceived(false);
3496 AnimationFinishCheck finishCheck(signalReceived);
3497 animation.FinishedSignal().Connect(&application, finishCheck);
3499 application.SendNotification();
3500 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3502 // We didn't expect the animation to finish yet
3503 application.SendNotification();
3504 finishCheck.CheckSignalNotReceived();
3505 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
3507 application.SendNotification();
3508 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3510 // We didn't expect the animation to finish yet
3511 application.SendNotification();
3512 finishCheck.CheckSignalNotReceived();
3513 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
3515 application.SendNotification();
3516 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3518 // We did expect the animation to finish
3519 application.SendNotification();
3520 finishCheck.CheckSignalReceived();
3521 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3523 // Check that nothing has changed after a couple of buffer swaps
3524 application.Render(0);
3525 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3526 application.Render(0);
3527 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
3531 int UtcDaliAnimationAnimateByVector2P(void)
3533 TestApplication application;
3535 Actor actor = Actor::New();
3537 // Register a Vector2 property
3538 Vector2 startValue(10.0f, 10.0f);
3539 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3540 Stage::GetCurrent().Add(actor);
3541 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3543 // Build the animation
3544 float durationSeconds(2.0f);
3545 Animation animation = Animation::New(durationSeconds);
3546 Vector2 targetValue(60.0f, 60.0f);
3547 Vector2 relativeValue(targetValue - startValue);
3548 animation.AnimateBy(Property(actor, index), relativeValue);
3550 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3552 // Start the animation
3555 bool signalReceived(false);
3556 AnimationFinishCheck finishCheck(signalReceived);
3557 animation.FinishedSignal().Connect(&application, finishCheck);
3559 application.SendNotification();
3560 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3562 // We didn't expect the animation to finish yet
3563 application.SendNotification();
3564 finishCheck.CheckSignalNotReceived();
3565 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
3567 application.SendNotification();
3568 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3570 // We did expect the animation to finish
3571 application.SendNotification();
3572 finishCheck.CheckSignalReceived();
3573 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3575 // Check that nothing has changed after a couple of buffer swaps
3576 application.Render(0);
3577 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3578 application.Render(0);
3579 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3583 int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
3585 TestApplication application;
3587 Actor actor = Actor::New();
3589 // Register a Vector2 property
3590 Vector2 startValue(100.0f, 100.0f);
3591 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3592 Stage::GetCurrent().Add(actor);
3593 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3595 // Build the animation
3596 float durationSeconds(1.0f);
3597 Animation animation = Animation::New(durationSeconds);
3598 Vector2 targetValue(20.0f, 20.0f);
3599 Vector2 relativeValue(targetValue - startValue);
3600 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3602 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3604 // Start the animation
3607 bool signalReceived(false);
3608 AnimationFinishCheck finishCheck(signalReceived);
3609 animation.FinishedSignal().Connect(&application, finishCheck);
3611 application.SendNotification();
3612 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3614 // We didn't expect the animation to finish yet
3615 application.SendNotification();
3616 finishCheck.CheckSignalNotReceived();
3618 // The position should have moved more, than with a linear alpha function
3619 Vector2 current(actor.GetProperty<Vector2>(index));
3620 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3621 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3623 application.SendNotification();
3624 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3626 // We did expect the animation to finish
3627 application.SendNotification();
3628 finishCheck.CheckSignalReceived();
3629 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3631 // Check that nothing has changed after a couple of buffer swaps
3632 application.Render(0);
3633 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3634 application.Render(0);
3635 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3639 int UtcDaliAnimationAnimateByVector2TimePeriodP(void)
3641 TestApplication application;
3643 Actor actor = Actor::New();
3645 // Register a Vector2 property
3646 Vector2 startValue(10.0f, 10.0f);
3647 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3648 Stage::GetCurrent().Add(actor);
3649 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3651 // Build the animation
3652 float durationSeconds(1.0f);
3653 Animation animation = Animation::New(durationSeconds);
3654 Vector2 targetValue(30.0f, 30.0f);
3655 Vector2 relativeValue(targetValue - startValue);
3657 animation.AnimateBy(Property(actor, index),
3659 TimePeriod(delay, durationSeconds - delay));
3661 // Start the animation
3664 bool signalReceived(false);
3665 AnimationFinishCheck finishCheck(signalReceived);
3666 animation.FinishedSignal().Connect(&application, finishCheck);
3668 application.SendNotification();
3669 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3671 // We didn't expect the animation to finish yet
3672 application.SendNotification();
3673 finishCheck.CheckSignalNotReceived();
3674 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3676 application.SendNotification();
3677 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3679 // We didn't expect the animation to finish yet
3680 application.SendNotification();
3681 finishCheck.CheckSignalNotReceived();
3682 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3684 application.SendNotification();
3685 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3687 // We did expect the animation to finish
3688 application.SendNotification();
3689 finishCheck.CheckSignalReceived();
3690 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3692 // Check that nothing has changed after a couple of buffer swaps
3693 application.Render(0);
3694 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3695 application.Render(0);
3696 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3700 int UtcDaliAnimationAnimateByVector2AlphaFunctionTimePeriodP(void)
3702 TestApplication application;
3704 Actor actor = Actor::New();
3706 // Register a Vector2 property
3707 Vector2 startValue(5.0f, 5.0f);
3708 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3709 Stage::GetCurrent().Add(actor);
3710 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3712 // Build the animation
3713 float durationSeconds(1.0f);
3714 Animation animation = Animation::New(durationSeconds);
3715 Vector2 targetValue(10.0f, 10.0f);
3716 Vector2 relativeValue(targetValue - startValue);
3718 animation.AnimateBy(Property(actor, index),
3720 AlphaFunction::LINEAR,
3721 TimePeriod(delay, durationSeconds - delay));
3723 // Start the animation
3726 bool signalReceived(false);
3727 AnimationFinishCheck finishCheck(signalReceived);
3728 animation.FinishedSignal().Connect(&application, finishCheck);
3730 application.SendNotification();
3731 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3733 // We didn't expect the animation to finish yet
3734 application.SendNotification();
3735 finishCheck.CheckSignalNotReceived();
3736 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
3738 application.SendNotification();
3739 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3741 // We didn't expect the animation to finish yet
3742 application.SendNotification();
3743 finishCheck.CheckSignalNotReceived();
3744 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3746 application.SendNotification();
3747 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3749 // We did expect the animation to finish
3750 application.SendNotification();
3751 finishCheck.CheckSignalReceived();
3752 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3754 // Check that nothing has changed after a couple of buffer swaps
3755 application.Render(0);
3756 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3757 application.Render(0);
3758 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
3762 int UtcDaliAnimationAnimateByVector3P(void)
3764 TestApplication application;
3766 Actor actor = Actor::New();
3768 // Register a Vector3 property
3769 Vector3 startValue(10.0f, 10.0f, 10.0f);
3770 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3771 Stage::GetCurrent().Add(actor);
3772 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3774 // Build the animation
3775 float durationSeconds(2.0f);
3776 Animation animation = Animation::New(durationSeconds);
3777 Vector3 targetValue(60.0f, 60.0f, 60.0f);
3778 Vector3 relativeValue(targetValue - startValue);
3779 animation.AnimateBy(Property(actor, index), relativeValue);
3781 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3783 // Start the animation
3786 bool signalReceived(false);
3787 AnimationFinishCheck finishCheck(signalReceived);
3788 animation.FinishedSignal().Connect(&application, finishCheck);
3790 application.SendNotification();
3791 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3793 // We didn't expect the animation to finish yet
3794 application.SendNotification();
3795 finishCheck.CheckSignalNotReceived();
3796 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
3798 application.SendNotification();
3799 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3801 // We did expect the animation to finish
3802 application.SendNotification();
3803 finishCheck.CheckSignalReceived();
3804 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3806 // Check that nothing has changed after a couple of buffer swaps
3807 application.Render(0);
3808 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3809 application.Render(0);
3810 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3814 int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
3816 TestApplication application;
3818 Actor actor = Actor::New();
3820 // Register a Vector3 property
3821 Vector3 startValue(100.0f, 100.0f, 100.0f);
3822 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3823 Stage::GetCurrent().Add(actor);
3824 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3826 // Build the animation
3827 float durationSeconds(1.0f);
3828 Animation animation = Animation::New(durationSeconds);
3829 Vector3 targetValue(20.0f, 20.0f, 20.0f);
3830 Vector3 relativeValue(targetValue - startValue);
3831 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
3833 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
3835 // Start the animation
3838 bool signalReceived(false);
3839 AnimationFinishCheck finishCheck(signalReceived);
3840 animation.FinishedSignal().Connect(&application, finishCheck);
3842 application.SendNotification();
3843 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
3845 // We didn't expect the animation to finish yet
3846 application.SendNotification();
3847 finishCheck.CheckSignalNotReceived();
3849 // The position should have moved more, than with a linear alpha function
3850 Vector3 current(actor.GetProperty<Vector3>(index));
3851 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
3852 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
3853 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
3855 application.SendNotification();
3856 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
3858 // We did expect the animation to finish
3859 application.SendNotification();
3860 finishCheck.CheckSignalReceived();
3861 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3863 // Check that nothing has changed after a couple of buffer swaps
3864 application.Render(0);
3865 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3866 application.Render(0);
3867 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3871 int UtcDaliAnimationAnimateByVector3TimePeriodP(void)
3873 TestApplication application;
3875 Actor actor = Actor::New();
3877 // Register a Vector3 property
3878 Vector3 startValue(10.0f, 10.0f, 10.0f);
3879 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3880 Stage::GetCurrent().Add(actor);
3881 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3883 // Build the animation
3884 float durationSeconds(1.0f);
3885 Animation animation = Animation::New(durationSeconds);
3886 Vector3 targetValue(30.0f, 30.0f, 30.0f);
3887 Vector3 relativeValue(targetValue - startValue);
3889 animation.AnimateBy(Property(actor, index),
3891 TimePeriod(delay, durationSeconds - delay));
3893 // Start the animation
3896 bool signalReceived(false);
3897 AnimationFinishCheck finishCheck(signalReceived);
3898 animation.FinishedSignal().Connect(&application, finishCheck);
3900 application.SendNotification();
3901 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3903 // We didn't expect the animation to finish yet
3904 application.SendNotification();
3905 finishCheck.CheckSignalNotReceived();
3906 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3908 application.SendNotification();
3909 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3911 // We didn't expect the animation to finish yet
3912 application.SendNotification();
3913 finishCheck.CheckSignalNotReceived();
3914 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3916 application.SendNotification();
3917 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3919 // We did expect the animation to finish
3920 application.SendNotification();
3921 finishCheck.CheckSignalReceived();
3922 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3924 // Check that nothing has changed after a couple of buffer swaps
3925 application.Render(0);
3926 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3927 application.Render(0);
3928 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3932 int UtcDaliAnimationAnimateByVector3AlphaFunctionTimePeriodP(void)
3934 TestApplication application;
3936 Actor actor = Actor::New();
3938 // Register a Vector3 property
3939 Vector3 startValue(5.0f, 5.0f, 5.0f);
3940 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
3941 Stage::GetCurrent().Add(actor);
3942 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3944 // Build the animation
3945 float durationSeconds(1.0f);
3946 Animation animation = Animation::New(durationSeconds);
3947 Vector3 targetValue(10.0f, 10.0f, 10.0f);
3948 Vector3 relativeValue(targetValue - startValue);
3950 animation.AnimateBy(Property(actor, index),
3952 AlphaFunction::LINEAR,
3953 TimePeriod(delay, durationSeconds - delay));
3955 // Start the animation
3958 bool signalReceived(false);
3959 AnimationFinishCheck finishCheck(signalReceived);
3960 animation.FinishedSignal().Connect(&application, finishCheck);
3962 application.SendNotification();
3963 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
3965 // We didn't expect the animation to finish yet
3966 application.SendNotification();
3967 finishCheck.CheckSignalNotReceived();
3968 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
3970 application.SendNotification();
3971 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
3973 // We didn't expect the animation to finish yet
3974 application.SendNotification();
3975 finishCheck.CheckSignalNotReceived();
3976 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
3978 application.SendNotification();
3979 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
3981 // We did expect the animation to finish
3982 application.SendNotification();
3983 finishCheck.CheckSignalReceived();
3984 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3986 // Check that nothing has changed after a couple of buffer swaps
3987 application.Render(0);
3988 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3989 application.Render(0);
3990 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
3994 int UtcDaliAnimationAnimateByVector4P(void)
3996 TestApplication application;
3998 Actor actor = Actor::New();
4000 // Register a Vector4 property
4001 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4002 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4003 Stage::GetCurrent().Add(actor);
4004 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4006 // Build the animation
4007 float durationSeconds(2.0f);
4008 Animation animation = Animation::New(durationSeconds);
4009 Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
4010 Vector4 relativeValue(targetValue - startValue);
4011 animation.AnimateBy(Property(actor, index), relativeValue);
4013 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4015 // Start the animation
4018 bool signalReceived(false);
4019 AnimationFinishCheck finishCheck(signalReceived);
4020 animation.FinishedSignal().Connect(&application, finishCheck);
4022 application.SendNotification();
4023 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4025 // We didn't expect the animation to finish yet
4026 application.SendNotification();
4027 finishCheck.CheckSignalNotReceived();
4028 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
4030 application.SendNotification();
4031 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4033 // We did expect the animation to finish
4034 application.SendNotification();
4035 finishCheck.CheckSignalReceived();
4036 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4038 // Check that nothing has changed after a couple of buffer swaps
4039 application.Render(0);
4040 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4041 application.Render(0);
4042 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4046 int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
4048 TestApplication application;
4050 Actor actor = Actor::New();
4052 // Register a Vector4 property
4053 Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
4054 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4055 Stage::GetCurrent().Add(actor);
4056 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4058 // Build the animation
4059 float durationSeconds(1.0f);
4060 Animation animation = Animation::New(durationSeconds);
4061 Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
4062 Vector4 relativeValue(targetValue - startValue);
4063 animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
4065 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
4067 // Start the animation
4070 bool signalReceived(false);
4071 AnimationFinishCheck finishCheck(signalReceived);
4072 animation.FinishedSignal().Connect(&application, finishCheck);
4074 application.SendNotification();
4075 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4077 // We didn't expect the animation to finish yet
4078 application.SendNotification();
4079 finishCheck.CheckSignalNotReceived();
4081 // The position should have moved more, than with a linear alpha function
4082 Vector4 current(actor.GetProperty<Vector4>(index));
4083 DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
4084 DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
4085 DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
4086 DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
4088 application.SendNotification();
4089 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4091 // We did expect the animation to finish
4092 application.SendNotification();
4093 finishCheck.CheckSignalReceived();
4094 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4096 // Check that nothing has changed after a couple of buffer swaps
4097 application.Render(0);
4098 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4099 application.Render(0);
4100 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4104 int UtcDaliAnimationAnimateByVector4TimePeriodP(void)
4106 TestApplication application;
4108 Actor actor = Actor::New();
4110 // Register a Vector4 property
4111 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
4112 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4113 Stage::GetCurrent().Add(actor);
4114 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4116 // Build the animation
4117 float durationSeconds(1.0f);
4118 Animation animation = Animation::New(durationSeconds);
4119 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
4120 Vector4 relativeValue(targetValue - startValue);
4122 animation.AnimateBy(Property(actor, index),
4124 TimePeriod(delay, durationSeconds - delay));
4126 // Start the animation
4129 bool signalReceived(false);
4130 AnimationFinishCheck finishCheck(signalReceived);
4131 animation.FinishedSignal().Connect(&application, finishCheck);
4133 application.SendNotification();
4134 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4136 // We didn't expect the animation to finish yet
4137 application.SendNotification();
4138 finishCheck.CheckSignalNotReceived();
4139 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4141 application.SendNotification();
4142 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4144 // We didn't expect the animation to finish yet
4145 application.SendNotification();
4146 finishCheck.CheckSignalNotReceived();
4147 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4149 application.SendNotification();
4150 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4152 // We did expect the animation to finish
4153 application.SendNotification();
4154 finishCheck.CheckSignalReceived();
4155 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4157 // Check that nothing has changed after a couple of buffer swaps
4158 application.Render(0);
4159 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4160 application.Render(0);
4161 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4165 int UtcDaliAnimationAnimateByVector4AlphaFunctionTimePeriodP(void)
4167 TestApplication application;
4169 Actor actor = Actor::New();
4171 // Register a Vector4 property
4172 Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
4173 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4174 Stage::GetCurrent().Add(actor);
4175 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4177 // Build the animation
4178 float durationSeconds(1.0f);
4179 Animation animation = Animation::New(durationSeconds);
4180 Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
4181 Vector4 relativeValue(targetValue - startValue);
4183 animation.AnimateBy(Property(actor, index),
4185 AlphaFunction::LINEAR,
4186 TimePeriod(delay, durationSeconds - delay));
4188 // Start the animation
4191 bool signalReceived(false);
4192 AnimationFinishCheck finishCheck(signalReceived);
4193 animation.FinishedSignal().Connect(&application, finishCheck);
4195 application.SendNotification();
4196 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4198 // We didn't expect the animation to finish yet
4199 application.SendNotification();
4200 finishCheck.CheckSignalNotReceived();
4201 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
4203 application.SendNotification();
4204 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
4206 // We didn't expect the animation to finish yet
4207 application.SendNotification();
4208 finishCheck.CheckSignalNotReceived();
4209 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
4211 application.SendNotification();
4212 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4214 // We did expect the animation to finish
4215 application.SendNotification();
4216 finishCheck.CheckSignalReceived();
4217 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4219 // Check that nothing has changed after a couple of buffer swaps
4220 application.Render(0);
4221 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4222 application.Render(0);
4223 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
4227 int UtcDaliAnimationAnimateByActorPositionP(void)
4229 TestApplication application;
4231 Actor actor = Actor::New();
4232 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4233 actor.SetPosition(startPosition);
4234 Stage::GetCurrent().Add(actor);
4235 application.SendNotification();
4236 application.Render(0);
4237 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4239 // Build the animation
4240 float durationSeconds(1.0f);
4241 Animation animation = Animation::New(durationSeconds);
4242 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4243 Vector3 relativePosition(targetPosition - startPosition);
4244 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
4246 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4248 // Start the animation
4251 bool signalReceived(false);
4252 AnimationFinishCheck finishCheck(signalReceived);
4253 animation.FinishedSignal().Connect(&application, finishCheck);
4255 application.SendNotification();
4256 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4258 // We didn't expect the animation to finish yet
4259 application.SendNotification();
4260 finishCheck.CheckSignalNotReceived();
4261 DALI_TEST_EQUALS( actor.GetCurrentPosition(), ninetyFivePercentProgress, TEST_LOCATION );
4263 application.SendNotification();
4264 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4266 // We did expect the animation to finish
4267 application.SendNotification();
4268 finishCheck.CheckSignalReceived();
4269 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4271 // Check that nothing has changed after a couple of buffer swaps
4272 application.Render(0);
4273 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4274 application.Render(0);
4275 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4279 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
4281 TestApplication application;
4283 Actor actor = Actor::New();
4284 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4285 actor.SetPosition(startPosition);
4286 Stage::GetCurrent().Add(actor);
4287 application.SendNotification();
4288 application.Render(0);
4289 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4291 // Build the animation
4292 float durationSeconds(1.0f);
4293 Animation animation = Animation::New(durationSeconds);
4294 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4295 Vector3 relativePosition(targetPosition - startPosition);
4296 animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
4298 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4300 // Start the animation
4303 bool signalReceived(false);
4304 AnimationFinishCheck finishCheck(signalReceived);
4305 animation.FinishedSignal().Connect(&application, finishCheck);
4307 application.SendNotification();
4308 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4310 // We didn't expect the animation to finish yet
4311 application.SendNotification();
4312 finishCheck.CheckSignalNotReceived();
4314 // The position should have moved more, than with a linear alpha function
4315 Vector3 current(actor.GetCurrentPosition());
4316 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
4317 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
4318 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
4320 application.SendNotification();
4321 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4323 // We did expect the animation to finish
4324 application.SendNotification();
4325 finishCheck.CheckSignalReceived();
4326 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4328 // Check that nothing has changed after a couple of buffer swaps
4329 application.Render(0);
4330 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4331 application.Render(0);
4332 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4336 int UtcDaliAnimationAnimateByActorPositionTimePeriodP(void)
4338 TestApplication application;
4340 Actor actor = Actor::New();
4341 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4342 actor.SetPosition(startPosition);
4343 Stage::GetCurrent().Add(actor);
4344 application.SendNotification();
4345 application.Render(0);
4346 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4348 // Build the animation
4349 float durationSeconds(1.0f);
4350 Animation animation = Animation::New(durationSeconds);
4351 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4352 Vector3 relativePosition(targetPosition - startPosition);
4354 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4356 TimePeriod(delay, durationSeconds - delay));
4358 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4360 // Start the animation
4363 bool signalReceived(false);
4364 AnimationFinishCheck finishCheck(signalReceived);
4365 animation.FinishedSignal().Connect(&application, finishCheck);
4367 application.SendNotification();
4368 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4370 // We didn't expect the animation to finish yet
4371 application.SendNotification();
4372 finishCheck.CheckSignalNotReceived();
4373 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4375 application.SendNotification();
4376 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4378 // We did expect the animation to finish
4379 application.SendNotification();
4380 finishCheck.CheckSignalReceived();
4381 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4383 // Check that nothing has changed after a couple of buffer swaps
4384 application.Render(0);
4385 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4386 application.Render(0);
4387 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4391 int UtcDaliAnimationAnimateByActorPositionAlphaFunctionTimePeriodP(void)
4393 TestApplication application;
4395 Actor actor = Actor::New();
4396 Vector3 startPosition(10.0f, 10.0f, 10.0f);
4397 actor.SetPosition(startPosition);
4398 Stage::GetCurrent().Add(actor);
4399 application.SendNotification();
4400 application.Render(0);
4401 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4403 // Build the animation
4404 float durationSeconds(1.0f);
4405 Animation animation = Animation::New(durationSeconds);
4406 Vector3 targetPosition(20.0f, 20.0f, 20.0f);
4407 Vector3 relativePosition(targetPosition - startPosition);
4409 animation.AnimateBy(Property(actor, Actor::Property::POSITION),
4411 AlphaFunction::LINEAR,
4412 TimePeriod(delay, durationSeconds - delay));
4414 Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
4416 // Start the animation
4419 bool signalReceived(false);
4420 AnimationFinishCheck finishCheck(signalReceived);
4421 animation.FinishedSignal().Connect(&application, finishCheck);
4423 application.SendNotification();
4424 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4426 // We didn't expect the animation to finish yet
4427 application.SendNotification();
4428 finishCheck.CheckSignalNotReceived();
4429 DALI_TEST_EQUALS( actor.GetCurrentPosition(), startPosition, TEST_LOCATION );
4431 application.SendNotification();
4432 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4434 // We did expect the animation to finish
4435 application.SendNotification();
4436 finishCheck.CheckSignalReceived();
4437 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4439 // Check that nothing has changed after a couple of buffer swaps
4440 application.Render(0);
4441 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4442 application.Render(0);
4443 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
4447 int UtcDaliAnimationAnimateByActorOrientationP(void)
4449 TestApplication application;
4451 Actor actor = Actor::New();
4452 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4453 Stage::GetCurrent().Add(actor);
4454 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4456 // Build the animation
4457 float durationSeconds(1.0f);
4458 Animation animation = Animation::New(durationSeconds);
4459 Degree relativeRotationDegrees(360.0f);
4460 Radian relativeRotationRadians(relativeRotationDegrees);
4461 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
4463 // Start the animation
4466 bool signalReceived(false);
4467 AnimationFinishCheck finishCheck(signalReceived);
4468 animation.FinishedSignal().Connect(&application, finishCheck);
4470 application.SendNotification();
4471 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4473 // We didn't expect the animation to finish yet
4474 application.SendNotification();
4475 finishCheck.CheckSignalNotReceived();
4476 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4478 application.SendNotification();
4479 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4481 // We didn't expect the animation to finish yet
4482 application.SendNotification();
4483 finishCheck.CheckSignalNotReceived();
4484 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4486 application.SendNotification();
4487 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4489 // We didn't expect the animation to finish yet
4490 application.SendNotification();
4491 finishCheck.CheckSignalNotReceived();
4492 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4494 application.SendNotification();
4495 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4497 // We did expect the animation to finish
4498 application.SendNotification();
4499 finishCheck.CheckSignalReceived();
4500 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4504 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
4506 TestApplication application;
4508 Actor actor = Actor::New();
4509 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4510 Stage::GetCurrent().Add(actor);
4511 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4513 // Build the animation
4514 float durationSeconds(1.0f);
4515 Animation animation = Animation::New(durationSeconds);
4516 Degree relativeRotationDegrees(360.0f);
4517 Radian relativeRotationRadians(relativeRotationDegrees);
4518 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
4520 // Start the animation
4523 bool signalReceived(false);
4524 AnimationFinishCheck finishCheck(signalReceived);
4525 animation.FinishedSignal().Connect(&application, finishCheck);
4527 application.SendNotification();
4528 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4530 // We didn't expect the animation to finish yet
4531 application.SendNotification();
4532 finishCheck.CheckSignalNotReceived();
4533 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4535 application.SendNotification();
4536 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4538 // We didn't expect the animation to finish yet
4539 application.SendNotification();
4540 finishCheck.CheckSignalNotReceived();
4541 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4543 application.SendNotification();
4544 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4546 // We didn't expect the animation to finish yet
4547 application.SendNotification();
4548 finishCheck.CheckSignalNotReceived();
4549 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4551 application.SendNotification();
4552 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4554 // We did expect the animation to finish
4555 application.SendNotification();
4556 finishCheck.CheckSignalReceived();
4557 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4561 int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionTimePeriodP(void)
4563 TestApplication application;
4565 Actor actor = Actor::New();
4566 actor.SetOrientation( Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
4567 Stage::GetCurrent().Add(actor);
4568 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
4570 // Build the animation
4571 float durationSeconds(1.0f);
4572 Animation animation = Animation::New(durationSeconds);
4573 Degree relativeRotationDegrees(360.0f);
4574 Radian relativeRotationRadians(relativeRotationDegrees);
4576 animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
4577 AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
4579 // Start the animation
4582 bool signalReceived(false);
4583 AnimationFinishCheck finishCheck(signalReceived);
4584 animation.FinishedSignal().Connect(&application, finishCheck);
4586 application.SendNotification();
4587 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
4589 // We didn't expect the animation to finish yet
4590 application.SendNotification();
4591 finishCheck.CheckSignalNotReceived();
4592 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
4593 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4595 application.SendNotification();
4596 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
4598 // We didn't expect the animation to finish yet
4599 application.SendNotification();
4600 finishCheck.CheckSignalNotReceived();
4601 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
4602 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4604 application.SendNotification();
4605 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
4607 // We didn't expect the animation to finish yet
4608 application.SendNotification();
4609 finishCheck.CheckSignalNotReceived();
4610 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
4611 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4613 application.SendNotification();
4614 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
4616 // We did expect the animation to finish
4617 application.SendNotification();
4618 finishCheck.CheckSignalReceived();
4619 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
4623 int UtcDaliAnimationAnimateByActorScaleP(void)
4625 TestApplication application;
4627 Actor actor = Actor::New();
4628 Stage::GetCurrent().Add(actor);
4629 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4631 // Build the animation
4632 float durationSeconds(1.0f);
4633 Animation animation = Animation::New(durationSeconds);
4634 Vector3 targetScale(2.0f, 2.0f, 2.0f);
4635 Vector3 relativeScale(targetScale - Vector3::ONE);
4636 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
4638 Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
4640 // Start the animation
4643 bool signalReceived(false);
4644 AnimationFinishCheck finishCheck(signalReceived);
4645 animation.FinishedSignal().Connect(&application, finishCheck);
4647 application.SendNotification();
4648 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4650 // We didn't expect the animation to finish yet
4651 application.SendNotification();
4652 finishCheck.CheckSignalNotReceived();
4653 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
4655 application.SendNotification();
4656 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4658 // We did expect the animation to finish
4659 application.SendNotification();
4660 finishCheck.CheckSignalReceived();
4661 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4664 finishCheck.Reset();
4665 actor.SetScale(Vector3::ONE);
4666 application.SendNotification();
4667 application.Render(0);
4668 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4670 // Repeat with a different (ease-in) alpha function
4671 animation = Animation::New(durationSeconds);
4672 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
4673 animation.FinishedSignal().Connect(&application, finishCheck);
4676 application.SendNotification();
4677 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
4679 // We didn't expect the animation to finish yet
4680 application.SendNotification();
4681 finishCheck.CheckSignalNotReceived();
4683 // The scale should have grown less, than with a linear alpha function
4684 Vector3 current(actor.GetCurrentScale());
4685 DALI_TEST_CHECK( current.x > 1.0f );
4686 DALI_TEST_CHECK( current.y > 1.0f );
4687 DALI_TEST_CHECK( current.z > 1.0f );
4688 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
4689 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
4690 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
4692 application.SendNotification();
4693 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
4695 // We did expect the animation to finish
4696 application.SendNotification();
4697 finishCheck.CheckSignalReceived();
4698 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4701 finishCheck.Reset();
4702 actor.SetScale(Vector3::ONE);
4703 application.SendNotification();
4704 application.Render(0);
4705 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4707 // Repeat with a delay
4709 animation = Animation::New(durationSeconds);
4710 animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
4711 animation.FinishedSignal().Connect(&application, finishCheck);
4714 application.SendNotification();
4715 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
4717 // We didn't expect the animation to finish yet
4718 application.SendNotification();
4719 finishCheck.CheckSignalNotReceived();
4720 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
4722 application.SendNotification();
4723 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
4725 // We did expect the animation to finish
4726 application.SendNotification();
4727 finishCheck.CheckSignalReceived();
4728 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
4732 int UtcDaliAnimationAnimateToBooleanP(void)
4734 TestApplication application;
4736 Actor actor = Actor::New();
4738 // Register a boolean property
4739 const bool startValue(false);
4740 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4741 Stage::GetCurrent().Add(actor);
4742 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4744 // Build the animation
4745 float durationSeconds(2.0f);
4746 Animation animation = Animation::New(durationSeconds);
4747 const bool targetValue( !startValue );
4748 animation.AnimateTo(Property(actor, index), targetValue);
4750 // Start the animation
4753 bool signalReceived(false);
4754 AnimationFinishCheck finishCheck(signalReceived);
4755 animation.FinishedSignal().Connect(&application, finishCheck);
4757 application.SendNotification();
4758 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4760 // We didn't expect the animation to finish yet
4761 application.SendNotification();
4762 finishCheck.CheckSignalNotReceived();
4763 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4765 application.SendNotification();
4766 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4768 // We did expect the animation to finish
4769 application.SendNotification();
4770 finishCheck.CheckSignalReceived();
4771 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4773 // Check that nothing has changed after a couple of buffer swaps
4774 application.Render(0);
4775 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4776 application.Render(0);
4777 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4779 // Repeat with target value "false"
4780 animation = Animation::New(durationSeconds);
4781 const bool finalValue( !targetValue );
4782 animation.AnimateTo(Property(actor, index), finalValue);
4784 // Start the animation
4787 finishCheck.Reset();
4788 animation.FinishedSignal().Connect(&application, finishCheck);
4790 application.SendNotification();
4791 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4793 // We didn't expect the animation to finish yet
4794 application.SendNotification();
4795 finishCheck.CheckSignalNotReceived();
4796 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4798 application.SendNotification();
4799 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4801 // We did expect the animation to finish
4802 application.SendNotification();
4803 finishCheck.CheckSignalReceived();
4804 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4806 // Check that nothing has changed after a couple of buffer swaps
4807 application.Render(0);
4808 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4809 application.Render(0);
4810 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4814 int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
4816 TestApplication application;
4818 Actor actor = Actor::New();
4820 // Register a boolean property
4821 const bool startValue(false);
4822 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4823 Stage::GetCurrent().Add(actor);
4824 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4826 // Build the animation
4827 float durationSeconds(2.0f);
4828 Animation animation = Animation::New(durationSeconds);
4829 const bool targetValue( !startValue );
4830 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
4832 // Start the animation
4835 bool signalReceived(false);
4836 AnimationFinishCheck finishCheck(signalReceived);
4837 animation.FinishedSignal().Connect(&application, finishCheck);
4839 application.SendNotification();
4840 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4842 // We didn't expect the animation to finish yet
4843 application.SendNotification();
4844 finishCheck.CheckSignalNotReceived();
4845 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4847 application.SendNotification();
4848 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4850 // We did expect the animation to finish
4851 application.SendNotification();
4852 finishCheck.CheckSignalReceived();
4853 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4855 // Check that nothing has changed after a couple of buffer swaps
4856 application.Render(0);
4857 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4858 application.Render(0);
4859 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4861 // Repeat with target value "false"
4862 animation = Animation::New(durationSeconds);
4863 const bool finalValue( !targetValue );
4864 animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
4866 // Start the animation
4869 finishCheck.Reset();
4870 animation.FinishedSignal().Connect(&application, finishCheck);
4872 application.SendNotification();
4873 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
4875 // We didn't expect the animation to finish yet
4876 application.SendNotification();
4877 finishCheck.CheckSignalNotReceived();
4878 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == targetValue );
4880 application.SendNotification();
4881 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
4883 // We did expect the animation to finish
4884 application.SendNotification();
4885 finishCheck.CheckSignalReceived();
4886 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4888 // Check that nothing has changed after a couple of buffer swaps
4889 application.Render(0);
4890 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4891 application.Render(0);
4892 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4896 int UtcDaliAnimationAnimateToBooleanTimePeriodP(void)
4898 TestApplication application;
4900 Actor actor = Actor::New();
4902 // Register a boolean property
4903 bool startValue(false);
4904 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4905 Stage::GetCurrent().Add(actor);
4906 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4908 // Build the animation
4909 float durationSeconds(2.0f);
4910 Animation animation = Animation::New(durationSeconds);
4911 bool finalValue( !startValue );
4912 float animatorDurationSeconds(durationSeconds * 0.5f);
4913 animation.AnimateTo( Property(actor, index),
4915 TimePeriod( animatorDurationSeconds ) );
4917 // Start the animation
4920 bool signalReceived(false);
4921 AnimationFinishCheck finishCheck(signalReceived);
4922 animation.FinishedSignal().Connect(&application, finishCheck);
4924 application.SendNotification();
4925 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
4927 // We didn't expect the animation to finish yet
4928 application.SendNotification();
4929 finishCheck.CheckSignalNotReceived();
4930 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4932 application.SendNotification();
4933 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
4935 // We didn't expect the animation to finish yet...
4936 application.SendNotification();
4937 finishCheck.CheckSignalNotReceived();
4939 // ...however we should have reached the final value
4940 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4942 application.SendNotification();
4943 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
4945 // We did expect the animation to finish
4946 application.SendNotification();
4947 finishCheck.CheckSignalReceived();
4948 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4950 // Check that nothing has changed after a couple of buffer swaps
4951 application.Render(0);
4952 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4953 application.Render(0);
4954 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
4958 int UtcDaliAnimationAnimateToBooleanAlphaFunctionTimePeriodP(void)
4960 TestApplication application;
4962 Actor actor = Actor::New();
4964 // Register a boolean property
4965 bool startValue(false);
4966 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
4967 Stage::GetCurrent().Add(actor);
4968 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4970 // Build the animation
4971 float durationSeconds(2.0f);
4972 Animation animation = Animation::New(durationSeconds);
4973 bool finalValue( !startValue );
4974 float animatorDurationSeconds(durationSeconds * 0.5f);
4975 animation.AnimateTo( Property(actor, index),
4977 AlphaFunction::LINEAR,
4978 TimePeriod( animatorDurationSeconds ) );
4980 // Start the animation
4983 bool signalReceived(false);
4984 AnimationFinishCheck finishCheck(signalReceived);
4985 animation.FinishedSignal().Connect(&application, finishCheck);
4987 application.SendNotification();
4988 application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
4990 // We didn't expect the animation to finish yet
4991 application.SendNotification();
4992 finishCheck.CheckSignalNotReceived();
4993 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
4995 application.SendNotification();
4996 application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
4998 // We didn't expect the animation to finish yet...
4999 application.SendNotification();
5000 finishCheck.CheckSignalNotReceived();
5002 // ...however we should have reached the final value
5003 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5005 application.SendNotification();
5006 application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
5008 // We did expect the animation to finish
5009 application.SendNotification();
5010 finishCheck.CheckSignalReceived();
5011 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5013 // Check that nothing has changed after a couple of buffer swaps
5014 application.Render(0);
5015 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5016 application.Render(0);
5017 DALI_TEST_CHECK( actor.GetProperty<bool>(index) == finalValue );
5021 int UtcDaliAnimationAnimateToFloatP(void)
5023 TestApplication application;
5025 Actor actor = Actor::New();
5027 // Register a float property
5028 float startValue(10.0f);
5029 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5030 Stage::GetCurrent().Add(actor);
5031 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5033 // Build the animation
5034 float durationSeconds(2.0f);
5035 Animation animation = Animation::New(durationSeconds);
5036 float targetValue(50.0f);
5037 float relativeValue(targetValue - startValue);
5038 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5040 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5042 // Start the animation
5045 bool signalReceived(false);
5046 AnimationFinishCheck finishCheck(signalReceived);
5047 animation.FinishedSignal().Connect(&application, finishCheck);
5049 application.SendNotification();
5050 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5052 // We didn't expect the animation to finish yet
5053 application.SendNotification();
5054 finishCheck.CheckSignalNotReceived();
5055 DALI_TEST_EQUALS( actor.GetProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION );
5057 application.SendNotification();
5058 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5060 // We did expect the animation to finish
5061 application.SendNotification();
5062 finishCheck.CheckSignalReceived();
5063 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5067 int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
5069 TestApplication application;
5071 Actor actor = Actor::New();
5073 // Register a float property
5074 float startValue(10.0f);
5075 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5076 Stage::GetCurrent().Add(actor);
5077 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5079 // Build the animation
5080 float durationSeconds(1.0f);
5081 Animation animation = Animation::New(durationSeconds);
5082 float targetValue(90.0f);
5083 float relativeValue(targetValue - startValue);
5084 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5086 float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5088 // Start the animation
5091 bool signalReceived(false);
5092 AnimationFinishCheck finishCheck(signalReceived);
5093 animation.FinishedSignal().Connect(&application, finishCheck);
5095 application.SendNotification();
5096 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5098 // We didn't expect the animation to finish yet
5099 application.SendNotification();
5100 finishCheck.CheckSignalNotReceived();
5102 // The position should have moved more, than with a linear alpha function
5103 float current(actor.GetProperty<float>(index));
5104 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5106 application.SendNotification();
5107 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5109 // We did expect the animation to finish
5110 application.SendNotification();
5111 finishCheck.CheckSignalReceived();
5112 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5116 int UtcDaliAnimationAnimateToFloatTimePeriodP(void)
5118 TestApplication application;
5120 Actor actor = Actor::New();
5122 // Register a float property
5123 float startValue(10.0f);
5124 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5125 Stage::GetCurrent().Add(actor);
5126 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5128 // Build the animation
5129 float durationSeconds(1.0f);
5130 Animation animation = Animation::New(durationSeconds);
5131 float targetValue(30.0f);
5132 float relativeValue(targetValue - startValue);
5134 animation.AnimateTo(Property(actor, index),
5136 TimePeriod(delay, durationSeconds - delay));
5138 // Start the animation
5141 bool signalReceived(false);
5142 AnimationFinishCheck finishCheck(signalReceived);
5143 animation.FinishedSignal().Connect(&application, finishCheck);
5145 application.SendNotification();
5146 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5148 // We didn't expect the animation to finish yet
5149 application.SendNotification();
5150 finishCheck.CheckSignalNotReceived();
5151 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5153 application.SendNotification();
5154 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5156 // We didn't expect the animation to finish yet
5157 application.SendNotification();
5158 finishCheck.CheckSignalNotReceived();
5159 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5161 application.SendNotification();
5162 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5164 // We did expect the animation to finish
5165 application.SendNotification();
5166 finishCheck.CheckSignalReceived();
5167 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5171 int UtcDaliAnimationAnimateToFloatAlphaFunctionTimePeriodP(void)
5173 TestApplication application;
5175 Actor actor = Actor::New();
5177 // Register a float property
5178 float startValue(10.0f);
5179 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5180 Stage::GetCurrent().Add(actor);
5181 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5183 // Build the animation
5184 float durationSeconds(1.0f);
5185 Animation animation = Animation::New(durationSeconds);
5186 float targetValue(30.0f);
5187 float relativeValue(targetValue - startValue);
5189 animation.AnimateTo(Property(actor, index),
5191 AlphaFunction::LINEAR,
5192 TimePeriod(delay, durationSeconds - delay));
5194 // Start the animation
5197 bool signalReceived(false);
5198 AnimationFinishCheck finishCheck(signalReceived);
5199 animation.FinishedSignal().Connect(&application, finishCheck);
5201 application.SendNotification();
5202 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5204 // We didn't expect the animation to finish yet
5205 application.SendNotification();
5206 finishCheck.CheckSignalNotReceived();
5207 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
5209 application.SendNotification();
5210 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5212 // We didn't expect the animation to finish yet
5213 application.SendNotification();
5214 finishCheck.CheckSignalNotReceived();
5215 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5217 application.SendNotification();
5218 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5220 // We did expect the animation to finish
5221 application.SendNotification();
5222 finishCheck.CheckSignalReceived();
5223 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
5227 int UtcDaliAnimationAnimateToIntegerP(void)
5229 TestApplication application;
5231 Actor actor = Actor::New();
5233 // Register an integer property
5235 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5236 Stage::GetCurrent().Add(actor);
5237 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5239 // Build the animation
5240 float durationSeconds(2.0f);
5241 Animation animation = Animation::New(durationSeconds);
5242 int targetValue(50);
5243 int relativeValue(targetValue - startValue);
5244 animation.AnimateTo(Property(actor, "testProperty"), targetValue);
5246 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5248 // Start the animation
5251 bool signalReceived(false);
5252 AnimationFinishCheck finishCheck(signalReceived);
5253 animation.FinishedSignal().Connect(&application, finishCheck);
5255 application.SendNotification();
5256 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5258 // We didn't expect the animation to finish yet
5259 application.SendNotification();
5260 finishCheck.CheckSignalNotReceived();
5261 DALI_TEST_EQUALS( actor.GetProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION );
5263 application.SendNotification();
5264 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5266 // We did expect the animation to finish
5267 application.SendNotification();
5268 finishCheck.CheckSignalReceived();
5269 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5273 int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
5275 TestApplication application;
5277 Actor actor = Actor::New();
5279 // Register an integer property
5281 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5282 Stage::GetCurrent().Add(actor);
5283 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5285 // Build the animation
5286 float durationSeconds(1.0f);
5287 Animation animation = Animation::New(durationSeconds);
5288 int targetValue(90);
5289 int relativeValue(targetValue - startValue);
5290 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5292 int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
5294 // Start the animation
5297 bool signalReceived(false);
5298 AnimationFinishCheck finishCheck(signalReceived);
5299 animation.FinishedSignal().Connect(&application, finishCheck);
5301 application.SendNotification();
5302 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5304 // We didn't expect the animation to finish yet
5305 application.SendNotification();
5306 finishCheck.CheckSignalNotReceived();
5308 // The position should have moved more, than with a linear alpha function
5309 int current(actor.GetProperty<int>(index));
5310 DALI_TEST_CHECK( current > ninetyFivePercentProgress );
5312 application.SendNotification();
5313 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5315 // We did expect the animation to finish
5316 application.SendNotification();
5317 finishCheck.CheckSignalReceived();
5318 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5322 int UtcDaliAnimationAnimateToIntegerTimePeriodP(void)
5324 TestApplication application;
5326 Actor actor = Actor::New();
5328 // Register an integer property
5330 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5331 Stage::GetCurrent().Add(actor);
5332 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5334 // Build the animation
5335 float durationSeconds(1.0f);
5336 Animation animation = Animation::New(durationSeconds);
5337 int targetValue(30);
5338 int relativeValue(targetValue - startValue);
5340 animation.AnimateTo(Property(actor, index),
5342 TimePeriod(delay, durationSeconds - delay));
5344 // Start the animation
5347 bool signalReceived(false);
5348 AnimationFinishCheck finishCheck(signalReceived);
5349 animation.FinishedSignal().Connect(&application, finishCheck);
5351 application.SendNotification();
5352 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5354 // We didn't expect the animation to finish yet
5355 application.SendNotification();
5356 finishCheck.CheckSignalNotReceived();
5357 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5359 application.SendNotification();
5360 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5362 // We didn't expect the animation to finish yet
5363 application.SendNotification();
5364 finishCheck.CheckSignalNotReceived();
5365 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5367 application.SendNotification();
5368 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5370 // We did expect the animation to finish
5371 application.SendNotification();
5372 finishCheck.CheckSignalReceived();
5373 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5377 int UtcDaliAnimationAnimateToIntegerAlphaFunctionTimePeriodP(void)
5379 TestApplication application;
5381 Actor actor = Actor::New();
5383 // Register an integer property
5385 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5386 Stage::GetCurrent().Add(actor);
5387 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5389 // Build the animation
5390 float durationSeconds(1.0f);
5391 Animation animation = Animation::New(durationSeconds);
5392 int targetValue(30);
5393 int relativeValue(targetValue - startValue);
5395 animation.AnimateTo(Property(actor, index),
5397 AlphaFunction::LINEAR,
5398 TimePeriod(delay, durationSeconds - delay));
5400 // Start the animation
5403 bool signalReceived(false);
5404 AnimationFinishCheck finishCheck(signalReceived);
5405 animation.FinishedSignal().Connect(&application, finishCheck);
5407 application.SendNotification();
5408 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5410 // We didn't expect the animation to finish yet
5411 application.SendNotification();
5412 finishCheck.CheckSignalNotReceived();
5413 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
5415 application.SendNotification();
5416 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5418 // We didn't expect the animation to finish yet
5419 application.SendNotification();
5420 finishCheck.CheckSignalNotReceived();
5421 DALI_TEST_EQUALS( actor.GetProperty<int>(index), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
5423 application.SendNotification();
5424 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5426 // We did expect the animation to finish
5427 application.SendNotification();
5428 finishCheck.CheckSignalReceived();
5429 DALI_TEST_EQUALS( actor.GetProperty<int>(index), targetValue, TEST_LOCATION );
5433 int UtcDaliAnimationAnimateToVector2P(void)
5435 TestApplication application;
5437 Actor actor = Actor::New();
5439 // Register a Vector2 property
5440 Vector2 startValue(-50.0f, -50.0f);
5441 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5442 Stage::GetCurrent().Add(actor);
5443 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5445 // Build the animation
5446 float durationSeconds(2.0f);
5447 Animation animation = Animation::New(durationSeconds);
5448 Vector2 targetValue(50.0f, 50.0f);
5449 Vector2 relativeValue(targetValue - startValue);
5450 animation.AnimateTo(Property(actor, index), targetValue);
5452 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5454 // Start the animation
5457 bool signalReceived(false);
5458 AnimationFinishCheck finishCheck(signalReceived);
5459 animation.FinishedSignal().Connect(&application, finishCheck);
5461 application.SendNotification();
5462 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5464 // We didn't expect the animation to finish yet
5465 application.SendNotification();
5466 finishCheck.CheckSignalNotReceived();
5467 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION );
5469 application.SendNotification();
5470 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5472 // We did expect the animation to finish
5473 application.SendNotification();
5474 finishCheck.CheckSignalReceived();
5475 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5479 int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
5481 TestApplication application;
5483 Actor actor = Actor::New();
5485 // Register a Vector2 property
5486 Vector2 startValue(1000.0f, 1000.0f);
5487 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5488 Stage::GetCurrent().Add(actor);
5489 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5491 // Build the animation
5492 float durationSeconds(1.0f);
5493 Animation animation = Animation::New(durationSeconds);
5494 Vector2 targetValue(9000.0f, 9000.0f);
5495 Vector2 relativeValue(targetValue - startValue);
5496 animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
5498 Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5500 // Start the animation
5503 bool signalReceived(false);
5504 AnimationFinishCheck finishCheck(signalReceived);
5505 animation.FinishedSignal().Connect(&application, finishCheck);
5507 application.SendNotification();
5508 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5510 // We didn't expect the animation to finish yet
5511 application.SendNotification();
5512 finishCheck.CheckSignalNotReceived();
5514 // The position should have moved more, than with a linear alpha function
5515 Vector2 current(actor.GetProperty<Vector2>(index));
5516 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5517 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5519 application.SendNotification();
5520 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5522 // We did expect the animation to finish
5523 application.SendNotification();
5524 finishCheck.CheckSignalReceived();
5525 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5529 int UtcDaliAnimationAnimateToVector2TimePeriodP(void)
5531 TestApplication application;
5533 Actor actor = Actor::New();
5535 // Register a Vector2 property
5536 Vector2 startValue(10.0f, 10.0f);
5537 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5538 Stage::GetCurrent().Add(actor);
5539 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5541 // Build the animation
5542 float durationSeconds(1.0f);
5543 Animation animation = Animation::New(durationSeconds);
5544 Vector2 targetValue(-10.0f, 20.0f);
5545 Vector2 relativeValue(targetValue - startValue);
5547 animation.AnimateTo(Property(actor, index),
5549 TimePeriod(delay, durationSeconds - delay));
5551 // Start the animation
5554 bool signalReceived(false);
5555 AnimationFinishCheck finishCheck(signalReceived);
5556 animation.FinishedSignal().Connect(&application, finishCheck);
5558 application.SendNotification();
5559 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5561 // We didn't expect the animation to finish yet
5562 application.SendNotification();
5563 finishCheck.CheckSignalNotReceived();
5564 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5566 application.SendNotification();
5567 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5569 // We didn't expect the animation to finish yet
5570 application.SendNotification();
5571 finishCheck.CheckSignalNotReceived();
5572 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5574 application.SendNotification();
5575 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5577 // We did expect the animation to finish
5578 application.SendNotification();
5579 finishCheck.CheckSignalReceived();
5580 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5584 int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void)
5586 TestApplication application;
5588 Actor actor = Actor::New();
5590 // Register a Vector2 property
5591 Vector2 startValue(10.0f, 10.0f);
5592 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5593 Stage::GetCurrent().Add(actor);
5594 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5596 // Build the animation
5597 float durationSeconds(1.0f);
5598 Animation animation = Animation::New(durationSeconds);
5599 Vector2 targetValue(30.0f, 30.0f);
5600 Vector2 relativeValue(targetValue - startValue);
5602 animation.AnimateTo(Property(actor, index),
5604 AlphaFunction::LINEAR,
5605 TimePeriod(delay, durationSeconds - delay));
5607 // Start the animation
5610 bool signalReceived(false);
5611 AnimationFinishCheck finishCheck(signalReceived);
5612 animation.FinishedSignal().Connect(&application, finishCheck);
5614 application.SendNotification();
5615 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5617 // We didn't expect the animation to finish yet
5618 application.SendNotification();
5619 finishCheck.CheckSignalNotReceived();
5620 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
5622 application.SendNotification();
5623 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5625 // We didn't expect the animation to finish yet
5626 application.SendNotification();
5627 finishCheck.CheckSignalNotReceived();
5628 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5630 application.SendNotification();
5631 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5633 // We did expect the animation to finish
5634 application.SendNotification();
5635 finishCheck.CheckSignalReceived();
5636 DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION );
5640 int UtcDaliAnimationAnimateToVector3P(void)
5642 TestApplication application;
5644 Actor actor = Actor::New();
5646 // Register a Vector3 property
5647 Vector3 startValue(-50.0f, -50.0f, -50.0f);
5648 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5649 Stage::GetCurrent().Add(actor);
5650 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5652 // Build the animation
5653 float durationSeconds(2.0f);
5654 Animation animation = Animation::New(durationSeconds);
5655 Vector3 targetValue(50.0f, 50.0f, 50.0f);
5656 Vector3 relativeValue(targetValue - startValue);
5657 animation.AnimateTo(Property(actor, index), targetValue);
5659 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5661 // Start the animation
5664 bool signalReceived(false);
5665 AnimationFinishCheck finishCheck(signalReceived);
5666 animation.FinishedSignal().Connect(&application, finishCheck);
5668 application.SendNotification();
5669 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5671 // We didn't expect the animation to finish yet
5672 application.SendNotification();
5673 finishCheck.CheckSignalNotReceived();
5674 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION );
5676 application.SendNotification();
5677 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5679 // We did expect the animation to finish
5680 application.SendNotification();
5681 finishCheck.CheckSignalReceived();
5682 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5686 int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
5688 TestApplication application;
5690 Actor actor = Actor::New();
5692 // Register a Vector3 property
5693 Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
5694 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5695 Stage::GetCurrent().Add(actor);
5696 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5698 // Build the animation
5699 float durationSeconds(1.0f);
5700 Animation animation = Animation::New(durationSeconds);
5701 Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
5702 Vector3 relativeValue(targetValue - startValue);
5703 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5705 Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5707 // Start the animation
5710 bool signalReceived(false);
5711 AnimationFinishCheck finishCheck(signalReceived);
5712 animation.FinishedSignal().Connect(&application, finishCheck);
5714 application.SendNotification();
5715 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5717 // We didn't expect the animation to finish yet
5718 application.SendNotification();
5719 finishCheck.CheckSignalNotReceived();
5721 // The position should have moved more, than with a linear alpha function
5722 Vector3 current(actor.GetProperty<Vector3>(index));
5723 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5724 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5725 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5727 application.SendNotification();
5728 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5730 // We did expect the animation to finish
5731 application.SendNotification();
5732 finishCheck.CheckSignalReceived();
5733 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5737 int UtcDaliAnimationAnimateToVector3TimePeriodP(void)
5739 TestApplication application;
5741 Actor actor = Actor::New();
5743 // Register a Vector3 property
5744 Vector3 startValue(10.0f, 10.0f, 10.0f);
5745 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5746 Stage::GetCurrent().Add(actor);
5747 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5749 // Build the animation
5750 float durationSeconds(1.0f);
5751 Animation animation = Animation::New(durationSeconds);
5752 Vector3 targetValue(-10.0f, 20.0f, 100.0f);
5753 Vector3 relativeValue(targetValue - startValue);
5755 animation.AnimateTo(Property(actor, index),
5757 TimePeriod(delay, durationSeconds - delay));
5759 // Start the animation
5762 bool signalReceived(false);
5763 AnimationFinishCheck finishCheck(signalReceived);
5764 animation.FinishedSignal().Connect(&application, finishCheck);
5766 application.SendNotification();
5767 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5769 // We didn't expect the animation to finish yet
5770 application.SendNotification();
5771 finishCheck.CheckSignalNotReceived();
5772 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5774 application.SendNotification();
5775 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5777 // We didn't expect the animation to finish yet
5778 application.SendNotification();
5779 finishCheck.CheckSignalNotReceived();
5780 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5782 application.SendNotification();
5783 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5785 // We did expect the animation to finish
5786 application.SendNotification();
5787 finishCheck.CheckSignalReceived();
5788 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5792 int UtcDaliAnimationAnimateToVector3AlphaFunctionTimePeriodP(void)
5794 TestApplication application;
5796 Actor actor = Actor::New();
5798 // Register a Vector3 property
5799 Vector3 startValue(10.0f, 10.0f, 10.0f);
5800 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5801 Stage::GetCurrent().Add(actor);
5802 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5804 // Build the animation
5805 float durationSeconds(1.0f);
5806 Animation animation = Animation::New(durationSeconds);
5807 Vector3 targetValue(30.0f, 30.0f, 30.0f);
5808 Vector3 relativeValue(targetValue - startValue);
5810 animation.AnimateTo(Property(actor, "testProperty"),
5812 AlphaFunction::LINEAR,
5813 TimePeriod(delay, durationSeconds - delay));
5815 // Start the animation
5818 bool signalReceived(false);
5819 AnimationFinishCheck finishCheck(signalReceived);
5820 animation.FinishedSignal().Connect(&application, finishCheck);
5822 application.SendNotification();
5823 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5825 // We didn't expect the animation to finish yet
5826 application.SendNotification();
5827 finishCheck.CheckSignalNotReceived();
5828 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5830 application.SendNotification();
5831 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5833 // We didn't expect the animation to finish yet
5834 application.SendNotification();
5835 finishCheck.CheckSignalNotReceived();
5836 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5838 application.SendNotification();
5839 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5841 // We did expect the animation to finish
5842 application.SendNotification();
5843 finishCheck.CheckSignalReceived();
5844 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5848 int UtcDaliAnimationAnimateToVector3ComponentP(void)
5850 TestApplication application;
5852 Actor actor = Actor::New();
5854 // Register a Vector3 property
5855 Vector3 startValue(10.0f, 10.0f, 10.0f);
5856 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5857 Stage::GetCurrent().Add(actor);
5858 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5860 // Build the animation
5861 float durationSeconds(1.0f);
5862 Animation animation = Animation::New(durationSeconds);
5863 Vector3 targetValue(30.0f, 30.0f, 10.0f);
5864 Vector3 relativeValue(targetValue - startValue);
5866 animation.AnimateTo(Property(actor, "testProperty", 0),
5868 AlphaFunction::LINEAR,
5869 TimePeriod(delay, durationSeconds - delay));
5870 animation.AnimateTo(Property(actor, index, 1),
5872 AlphaFunction::LINEAR,
5873 TimePeriod(delay, durationSeconds - delay));
5875 // Start the animation
5878 bool signalReceived(false);
5879 AnimationFinishCheck finishCheck(signalReceived);
5880 animation.FinishedSignal().Connect(&application, finishCheck);
5882 application.SendNotification();
5883 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
5885 // We didn't expect the animation to finish yet
5886 application.SendNotification();
5887 finishCheck.CheckSignalNotReceived();
5888 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
5890 application.SendNotification();
5891 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
5893 // We didn't expect the animation to finish yet
5894 application.SendNotification();
5895 finishCheck.CheckSignalNotReceived();
5896 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
5898 application.SendNotification();
5899 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
5901 // We did expect the animation to finish
5902 application.SendNotification();
5903 finishCheck.CheckSignalReceived();
5904 DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION );
5908 int UtcDaliAnimationAnimateToVector4P(void)
5910 TestApplication application;
5912 Actor actor = Actor::New();
5914 // Register a Vector4 property
5915 Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
5916 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5917 Stage::GetCurrent().Add(actor);
5918 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5920 // Build the animation
5921 float durationSeconds(2.0f);
5922 Animation animation = Animation::New(durationSeconds);
5923 Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
5924 Vector4 relativeValue(targetValue - startValue);
5925 animation.AnimateTo(Property(actor, index), targetValue);
5927 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5929 // Start the animation
5932 bool signalReceived(false);
5933 AnimationFinishCheck finishCheck(signalReceived);
5934 animation.FinishedSignal().Connect(&application, finishCheck);
5936 application.SendNotification();
5937 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5939 // We didn't expect the animation to finish yet
5940 application.SendNotification();
5941 finishCheck.CheckSignalNotReceived();
5942 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION );
5944 application.SendNotification();
5945 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5947 // We did expect the animation to finish
5948 application.SendNotification();
5949 finishCheck.CheckSignalReceived();
5950 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
5954 int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
5956 TestApplication application;
5958 Actor actor = Actor::New();
5960 // Register a Vector4 property
5961 Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
5962 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
5963 Stage::GetCurrent().Add(actor);
5964 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
5966 // Build the animation
5967 float durationSeconds(1.0f);
5968 Animation animation = Animation::New(durationSeconds);
5969 Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
5970 Vector4 relativeValue(targetValue - startValue);
5971 animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
5973 Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
5975 // Start the animation
5978 bool signalReceived(false);
5979 AnimationFinishCheck finishCheck(signalReceived);
5980 animation.FinishedSignal().Connect(&application, finishCheck);
5982 application.SendNotification();
5983 application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
5985 // We didn't expect the animation to finish yet
5986 application.SendNotification();
5987 finishCheck.CheckSignalNotReceived();
5989 // The position should have moved more, than with a linear alpha function
5990 Vector4 current(actor.GetProperty<Vector4>(index));
5991 DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
5992 DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
5993 DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
5994 DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
5996 application.SendNotification();
5997 application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
5999 // We did expect the animation to finish
6000 application.SendNotification();
6001 finishCheck.CheckSignalReceived();
6002 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
6006 int UtcDaliAnimationAnimateToVector4TimePeriodP(void)
6008 TestApplication application;
6010 Actor actor = Actor::New();
6012 // Register a Vector4 property
6013 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6014 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6015 Stage::GetCurrent().Add(actor);
6016 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6018 // Build the animation
6019 float durationSeconds(1.0f);
6020 Animation animation = Animation::New(durationSeconds);
6021 Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
6022 Vector4 relativeValue(targetValue - startValue);
6024 animation.AnimateTo(Property(actor, index),
6026 TimePeriod(delay, durationSeconds - delay));
6028 // Start the animation
6031 bool signalReceived(false);
6032 AnimationFinishCheck finishCheck(signalReceived);
6033 animation.FinishedSignal().Connect(&application, finishCheck);
6035 application.SendNotification();
6036 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6038 // We didn't expect the animation to finish yet
6039 application.SendNotification();
6040 finishCheck.CheckSignalNotReceived();
6041 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION );
6043 application.SendNotification();
6044 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6046 // We didn't expect the animation to finish yet
6047 application.SendNotification();
6048 finishCheck.CheckSignalNotReceived();
6049 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
6051 application.SendNotification();
6052 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6054 // We did expect the animation to finish
6055 application.SendNotification();
6056 finishCheck.CheckSignalReceived();
6057 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
6061 int UtcDaliAnimationAnimateToVector4AlphaFunctionTimePeriodP(void)
6063 TestApplication application;
6065 Actor actor = Actor::New();
6067 // Register a Vector4 property
6068 Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
6069 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
6070 Stage::GetCurrent().Add(actor);
6071 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6073 // Build the animation
6074 float durationSeconds(1.0f);
6075 Animation animation = Animation::New(durationSeconds);
6076 Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
6077 Vector4 relativeValue(targetValue - startValue);
6079 animation.AnimateTo(Property(actor, index),
6081 AlphaFunction::LINEAR,
6082 TimePeriod(delay, durationSeconds - delay));
6084 // Start the animation
6087 bool signalReceived(false);
6088 AnimationFinishCheck finishCheck(signalReceived);
6089 animation.FinishedSignal().Connect(&application, finishCheck);
6091 application.SendNotification();
6092 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6094 // We didn't expect the animation to finish yet
6095 application.SendNotification();
6096 finishCheck.CheckSignalNotReceived();
6097 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
6099 application.SendNotification();
6100 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
6102 // We didn't expect the animation to finish yet
6103 application.SendNotification();
6104 finishCheck.CheckSignalNotReceived();
6105 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
6107 application.SendNotification();
6108 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6110 // We did expect the animation to finish
6111 application.SendNotification();
6112 finishCheck.CheckSignalReceived();
6113 DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION );
6117 int UtcDaliAnimationAnimateToActorParentOriginP(void)
6119 TestApplication application;
6121 Actor actor = Actor::New();
6122 Stage::GetCurrent().Add(actor);
6123 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin(), ParentOrigin::TOP_LEFT, TEST_LOCATION );
6125 // Build the animation
6126 float durationSeconds(1.0f);
6127 Animation animation = Animation::New(durationSeconds);
6128 Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
6132 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
6134 catch (Dali::DaliException& e)
6136 DALI_TEST_PRINT_ASSERT( e );
6137 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6142 int UtcDaliAnimationAnimateToActorParentOriginXP(void)
6144 TestApplication application;
6146 Actor actor = Actor::New();
6147 Stage::GetCurrent().Add(actor);
6148 float startValue(0.0f);
6149 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().x, startValue, TEST_LOCATION );
6150 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
6152 // Build the animation
6153 float durationSeconds(1.0f);
6154 Animation animation = Animation::New(durationSeconds);
6155 float targetX(1.0f);
6159 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
6161 catch (Dali::DaliException& e)
6163 DALI_TEST_PRINT_ASSERT( e );
6164 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6169 int UtcDaliAnimationAnimateToActorParentOriginYP(void)
6171 TestApplication application;
6173 Actor actor = Actor::New();
6174 Stage::GetCurrent().Add(actor);
6175 float startValue(0.0f);
6176 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().y, startValue, TEST_LOCATION );
6177 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
6179 // Build the animation
6180 float durationSeconds(1.0f);
6181 Animation animation = Animation::New(durationSeconds);
6182 float targetY(1.0f);
6186 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
6188 catch (Dali::DaliException& e)
6190 DALI_TEST_PRINT_ASSERT( e );
6191 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6196 int UtcDaliAnimationAnimateToActorParentOriginZP(void)
6198 TestApplication application;
6200 Actor actor = Actor::New();
6201 Stage::GetCurrent().Add(actor);
6202 float startValue(0.5f);
6203 DALI_TEST_EQUALS( actor.GetCurrentParentOrigin().z, startValue, TEST_LOCATION );
6204 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
6206 // Build the animation
6207 float durationSeconds(1.0f);
6208 Animation animation = Animation::New(durationSeconds);
6209 float targetZ(1.0f);
6213 animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
6215 catch (Dali::DaliException& e)
6217 DALI_TEST_PRINT_ASSERT( e );
6218 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6223 int UtcDaliAnimationAnimateToActorAnchorPointP(void)
6225 TestApplication application;
6227 Actor actor = Actor::New();
6228 Stage::GetCurrent().Add(actor);
6229 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint(), AnchorPoint::CENTER, TEST_LOCATION );
6231 // Build the animation
6232 float durationSeconds(1.0f);
6233 Animation animation = Animation::New(durationSeconds);
6234 Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
6238 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
6240 catch (Dali::DaliException& e)
6242 DALI_TEST_PRINT_ASSERT( e );
6243 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6248 int UtcDaliAnimationAnimateToActorAnchorPointXP(void)
6250 TestApplication application;
6252 Actor actor = Actor::New();
6253 Stage::GetCurrent().Add(actor);
6254 float startValue(0.5f);
6255 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().x, startValue, TEST_LOCATION );
6256 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
6258 // Build the animation
6259 float durationSeconds(1.0f);
6260 Animation animation = Animation::New(durationSeconds);
6261 float targetX(1.0f);
6265 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
6267 catch (Dali::DaliException& e)
6269 DALI_TEST_PRINT_ASSERT( e );
6270 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6275 int UtcDaliAnimationAnimateToActorAnchorPointYP(void)
6277 TestApplication application;
6279 Actor actor = Actor::New();
6280 Stage::GetCurrent().Add(actor);
6281 float startValue(0.5f);
6282 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().y, startValue, TEST_LOCATION );
6283 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
6285 // Build the animation
6286 float durationSeconds(1.0f);
6287 Animation animation = Animation::New(durationSeconds);
6288 float targetY(0.0f);
6292 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
6294 catch (Dali::DaliException& e)
6296 DALI_TEST_PRINT_ASSERT( e );
6297 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6302 int UtcDaliAnimationAnimateToActorAnchorPointZP(void)
6304 TestApplication application;
6306 Actor actor = Actor::New();
6307 Stage::GetCurrent().Add(actor);
6308 float startValue(0.5f);
6309 DALI_TEST_EQUALS( actor.GetCurrentAnchorPoint().z, startValue, TEST_LOCATION );
6310 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
6312 // Build the animation
6313 float durationSeconds(1.0f);
6314 Animation animation = Animation::New(durationSeconds);
6315 float targetZ(100.0f);
6319 animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
6321 catch (Dali::DaliException& e)
6323 DALI_TEST_PRINT_ASSERT( e );
6324 DALI_TEST_ASSERT(e, "IsPropertyAnimatable( index )", TEST_LOCATION);
6329 int UtcDaliAnimationAnimateToActorSizeP(void)
6331 TestApplication application;
6333 Actor actor = Actor::New();
6334 Stage::GetCurrent().Add(actor);
6335 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6337 // Build the animation
6338 float durationSeconds(1.0f);
6339 Animation animation = Animation::New(durationSeconds);
6340 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6341 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
6343 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6345 // Start the animation
6348 bool signalReceived(false);
6349 AnimationFinishCheck finishCheck(signalReceived);
6350 animation.FinishedSignal().Connect(&application, finishCheck);
6352 application.SendNotification();
6353 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6355 // We didn't expect the animation to finish yet
6356 application.SendNotification();
6357 finishCheck.CheckSignalNotReceived();
6358 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6360 application.SendNotification();
6361 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6363 // We did expect the animation to finish
6364 application.SendNotification();
6365 finishCheck.CheckSignalReceived();
6366 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6369 finishCheck.Reset();
6370 actor.SetSize(Vector3::ZERO);
6371 application.SendNotification();
6372 application.Render(0);
6373 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6375 // Repeat with a different (ease-in) alpha function
6376 animation = Animation::New(durationSeconds);
6377 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
6378 animation.FinishedSignal().Connect(&application, finishCheck);
6381 application.SendNotification();
6382 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6384 // We didn't expect the animation to finish yet
6385 application.SendNotification();
6386 finishCheck.CheckSignalNotReceived();
6388 // The size should have travelled less, than with a linear alpha function
6389 Vector3 current(actor.GetCurrentSize());
6390 DALI_TEST_CHECK( current.x > 0.0f );
6391 DALI_TEST_CHECK( current.y > 0.0f );
6392 DALI_TEST_CHECK( current.z > 0.0f );
6393 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6394 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6395 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
6397 application.SendNotification();
6398 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6400 // We did expect the animation to finish
6401 application.SendNotification();
6402 finishCheck.CheckSignalReceived();
6403 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6406 finishCheck.Reset();
6407 actor.SetSize(Vector3::ZERO);
6408 application.SendNotification();
6409 application.Render(0);
6410 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6412 // Repeat with a delay
6414 animation = Animation::New(durationSeconds);
6415 animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
6416 animation.FinishedSignal().Connect(&application, finishCheck);
6419 application.SendNotification();
6420 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6422 // We didn't expect the animation to finish yet
6423 application.SendNotification();
6424 finishCheck.CheckSignalNotReceived();
6425 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6427 application.SendNotification();
6428 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6430 // We did expect the animation to finish
6431 application.SendNotification();
6432 finishCheck.CheckSignalReceived();
6433 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6437 int UtcDaliAnimationAnimateToActorSizeWidthP(void)
6439 TestApplication application;
6441 Actor actor = Actor::New();
6442 Stage::GetCurrent().Add(actor);
6443 float startValue(0.0f);
6444 DALI_TEST_EQUALS( actor.GetCurrentSize().width, startValue, TEST_LOCATION );
6445 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
6447 // Build the animation
6448 float durationSeconds(1.0f);
6449 Animation animation = Animation::New(durationSeconds);
6450 float targetWidth(10.0f);
6451 animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
6453 float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
6455 // Start the animation
6458 bool signalReceived(false);
6459 AnimationFinishCheck finishCheck(signalReceived);
6460 animation.FinishedSignal().Connect(&application, finishCheck);
6462 application.SendNotification();
6463 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6465 // We didn't expect the animation to finish yet
6466 application.SendNotification();
6467 finishCheck.CheckSignalNotReceived();
6468 DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION );
6470 application.SendNotification();
6471 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6473 // We did expect the animation to finish
6474 application.SendNotification();
6475 finishCheck.CheckSignalReceived();
6476 DALI_TEST_EQUALS( actor.GetCurrentSize().width, targetWidth, TEST_LOCATION );
6477 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
6481 int UtcDaliAnimationAnimateToActorSizeHeightP(void)
6483 TestApplication application;
6485 Actor actor = Actor::New();
6486 Stage::GetCurrent().Add(actor);
6487 float startValue(0.0f);
6488 DALI_TEST_EQUALS( actor.GetCurrentSize().height, startValue, TEST_LOCATION );
6489 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
6491 // Build the animation
6492 float durationSeconds(1.0f);
6493 Animation animation = Animation::New(durationSeconds);
6494 float targetHeight(-10.0f);
6495 animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
6497 float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
6499 // Start the animation
6502 bool signalReceived(false);
6503 AnimationFinishCheck finishCheck(signalReceived);
6504 animation.FinishedSignal().Connect(&application, finishCheck);
6506 application.SendNotification();
6507 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6509 // We didn't expect the animation to finish yet
6510 application.SendNotification();
6511 finishCheck.CheckSignalNotReceived();
6512 DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION );
6514 application.SendNotification();
6515 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6517 // We did expect the animation to finish
6518 application.SendNotification();
6519 finishCheck.CheckSignalReceived();
6520 DALI_TEST_EQUALS( actor.GetCurrentSize().height, targetHeight, TEST_LOCATION );
6521 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
6525 int UtcDaliAnimationAnimateToActorSizeDepthP(void)
6527 TestApplication application;
6529 Actor actor = Actor::New();
6530 Stage::GetCurrent().Add(actor);
6531 float startValue(0.0f);
6532 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, startValue, TEST_LOCATION );
6533 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
6535 // Build the animation
6536 float durationSeconds(1.0f);
6537 Animation animation = Animation::New(durationSeconds);
6538 float targetDepth(-10.0f);
6539 animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
6541 float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
6543 // Start the animation
6546 bool signalReceived(false);
6547 AnimationFinishCheck finishCheck(signalReceived);
6548 animation.FinishedSignal().Connect(&application, finishCheck);
6550 application.SendNotification();
6551 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6553 // We didn't expect the animation to finish yet
6554 application.SendNotification();
6555 finishCheck.CheckSignalNotReceived();
6556 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION );
6558 application.SendNotification();
6559 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6561 // We did expect the animation to finish
6562 application.SendNotification();
6563 finishCheck.CheckSignalReceived();
6564 DALI_TEST_EQUALS( actor.GetCurrentSize().depth, targetDepth, TEST_LOCATION );
6565 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
6569 int UtcDaliAnimationAnimateToActorSizeWidthHeightP(void)
6571 TestApplication application;
6573 Actor actor = Actor::New();
6574 Stage::GetCurrent().Add(actor);
6575 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6577 // Build the animation
6578 float durationSeconds(1.0f);
6579 Animation animation = Animation::New(durationSeconds);
6580 Vector3 targetSize(100.0f, 100.0f, 100.0f);
6581 animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
6583 Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
6585 // Start the animation
6588 bool signalReceived(false);
6589 AnimationFinishCheck finishCheck(signalReceived);
6590 animation.FinishedSignal().Connect(&application, finishCheck);
6592 application.SendNotification();
6593 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6595 // We didn't expect the animation to finish yet
6596 application.SendNotification();
6597 finishCheck.CheckSignalNotReceived();
6598 DALI_TEST_EQUALS( actor.GetCurrentSize(), ninetyNinePercentProgress, TEST_LOCATION );
6600 application.SendNotification();
6601 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6603 // We did expect the animation to finish
6604 application.SendNotification();
6605 finishCheck.CheckSignalReceived();
6606 DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
6609 finishCheck.Reset();
6610 actor.SetSize(Vector3::ZERO);
6611 application.SendNotification();
6612 application.Render(0);
6613 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6615 // Repeat with a different (ease-in) alpha function
6616 animation = Animation::New(durationSeconds);
6617 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
6618 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
6619 animation.FinishedSignal().Connect(&application, finishCheck);
6622 application.SendNotification();
6623 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
6625 // We didn't expect the animation to finish yet
6626 application.SendNotification();
6627 finishCheck.CheckSignalNotReceived();
6629 // The size should have travelled less, than with a linear alpha function
6630 Vector3 current(actor.GetCurrentSize());
6631 DALI_TEST_CHECK( current.x > 0.0f );
6632 DALI_TEST_CHECK( current.y > 0.0f );
6633 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
6634 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
6636 application.SendNotification();
6637 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
6639 // We did expect the animation to finish
6640 application.SendNotification();
6641 finishCheck.CheckSignalReceived();
6642 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6643 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6646 finishCheck.Reset();
6647 actor.SetSize(Vector3::ZERO);
6648 application.SendNotification();
6649 application.Render(0);
6650 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6652 // Repeat with a delay
6654 animation = Animation::New(durationSeconds);
6655 animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6656 animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
6657 animation.FinishedSignal().Connect(&application, finishCheck);
6660 application.SendNotification();
6661 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6663 // We didn't expect the animation to finish yet
6664 application.SendNotification();
6665 finishCheck.CheckSignalNotReceived();
6666 DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
6668 application.SendNotification();
6669 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6671 // We did expect the animation to finish
6672 application.SendNotification();
6673 finishCheck.CheckSignalReceived();
6674 DALI_TEST_EQUALS( actor.GetCurrentSize().x, targetSize.x, TEST_LOCATION );
6675 DALI_TEST_EQUALS( actor.GetCurrentSize().y, targetSize.y, TEST_LOCATION );
6679 int UtcDaliAnimationAnimateToActorPositionP(void)
6681 TestApplication application;
6683 Actor actor = Actor::New();
6684 Stage::GetCurrent().Add(actor);
6685 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6687 // Build the animation
6688 float durationSeconds(1.0f);
6689 Animation animation = Animation::New(durationSeconds);
6690 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6691 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
6693 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6695 // Start the animation
6698 bool signalReceived(false);
6699 AnimationFinishCheck finishCheck(signalReceived);
6700 animation.FinishedSignal().Connect(&application, finishCheck);
6702 application.SendNotification();
6703 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6705 // We didn't expect the animation to finish yet
6706 application.SendNotification();
6707 finishCheck.CheckSignalNotReceived();
6708 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6710 application.SendNotification();
6711 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6713 // We did expect the animation to finish
6714 application.SendNotification();
6715 finishCheck.CheckSignalReceived();
6716 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6720 int UtcDaliAnimationAnimateToActorPositionXP(void)
6722 TestApplication application;
6724 Actor actor = Actor::New();
6725 Stage::GetCurrent().Add(actor);
6726 float startValue(0.0f);
6727 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, startValue, TEST_LOCATION );
6728 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6729 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6730 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6732 // Build the animation
6733 float durationSeconds(1.0f);
6734 Animation animation = Animation::New(durationSeconds);
6735 float targetX(1.0f);
6736 animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
6738 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
6740 // Start the animation
6743 bool signalReceived(false);
6744 AnimationFinishCheck finishCheck(signalReceived);
6745 animation.FinishedSignal().Connect(&application, finishCheck);
6747 application.SendNotification();
6748 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6750 // We didn't expect the animation to finish yet
6751 application.SendNotification();
6752 finishCheck.CheckSignalNotReceived();
6753 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION );
6755 application.SendNotification();
6756 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6758 // We did expect the animation to finish
6759 application.SendNotification();
6760 finishCheck.CheckSignalReceived();
6761 DALI_TEST_EQUALS( actor.GetCurrentPosition().x, targetX, TEST_LOCATION );
6762 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
6763 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6764 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6768 int UtcDaliAnimationAnimateToActorPositionYP(void)
6770 TestApplication application;
6772 Actor actor = Actor::New();
6773 Stage::GetCurrent().Add(actor);
6774 float startValue(0.0f);
6775 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, startValue, TEST_LOCATION );
6776 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6777 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6778 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6780 // Build the animation
6781 float durationSeconds(1.0f);
6782 Animation animation = Animation::New(durationSeconds);
6783 float targetY(10.0f);
6784 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
6786 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
6788 // Start the animation
6791 bool signalReceived(false);
6792 AnimationFinishCheck finishCheck(signalReceived);
6793 animation.FinishedSignal().Connect(&application, finishCheck);
6795 application.SendNotification();
6796 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6798 // We didn't expect the animation to finish yet
6799 application.SendNotification();
6800 finishCheck.CheckSignalNotReceived();
6801 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION );
6803 application.SendNotification();
6804 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6806 // We did expect the animation to finish
6807 application.SendNotification();
6808 finishCheck.CheckSignalReceived();
6809 DALI_TEST_EQUALS( actor.GetCurrentPosition().y, targetY, TEST_LOCATION );
6810 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6811 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
6812 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6816 int UtcDaliAnimationAnimateToActorPositionZP(void)
6818 TestApplication application;
6820 Actor actor = Actor::New();
6821 Stage::GetCurrent().Add(actor);
6822 float startValue(0.0f);
6823 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, startValue, TEST_LOCATION );
6824 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6825 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6826 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
6828 // Build the animation
6829 float durationSeconds(1.0f);
6830 Animation animation = Animation::New(durationSeconds);
6831 float targetZ(-5.0f);
6832 animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
6834 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
6836 // Start the animation
6839 bool signalReceived(false);
6840 AnimationFinishCheck finishCheck(signalReceived);
6841 animation.FinishedSignal().Connect(&application, finishCheck);
6843 application.SendNotification();
6844 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
6846 // We didn't expect the animation to finish yet
6847 application.SendNotification();
6848 finishCheck.CheckSignalNotReceived();
6849 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION );
6851 application.SendNotification();
6852 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
6854 // We did expect the animation to finish
6855 application.SendNotification();
6856 finishCheck.CheckSignalReceived();
6857 DALI_TEST_EQUALS( actor.GetCurrentPosition().z, targetZ, TEST_LOCATION );
6858 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
6859 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
6860 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
6864 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
6866 TestApplication application;
6868 Actor actor = Actor::New();
6869 Stage::GetCurrent().Add(actor);
6870 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6872 // Build the animation
6873 float durationSeconds(1.0f);
6874 Animation animation = Animation::New(durationSeconds);
6875 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6876 animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
6878 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6880 // Start the animation
6883 bool signalReceived(false);
6884 AnimationFinishCheck finishCheck(signalReceived);
6885 animation.FinishedSignal().Connect(&application, finishCheck);
6887 application.SendNotification();
6888 application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
6890 // We didn't expect the animation to finish yet
6891 application.SendNotification();
6892 finishCheck.CheckSignalNotReceived();
6894 // The position should have moved less, than with a linear alpha function
6895 Vector3 current(actor.GetCurrentPosition());
6896 DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
6897 DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
6898 DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
6899 DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
6900 DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
6901 DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
6903 application.SendNotification();
6904 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
6906 // We did expect the animation to finish
6907 application.SendNotification();
6908 finishCheck.CheckSignalReceived();
6909 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6913 int UtcDaliAnimationAnimateToActorPositionTimePeriodP(void)
6915 TestApplication application;
6917 Actor actor = Actor::New();
6918 Stage::GetCurrent().Add(actor);
6919 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6921 // Build the animation
6922 float durationSeconds(1.0f);
6923 Animation animation = Animation::New(durationSeconds);
6924 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6926 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
6928 TimePeriod( delay, durationSeconds - delay ) );
6930 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6932 // Start the animation
6935 bool signalReceived(false);
6936 AnimationFinishCheck finishCheck(signalReceived);
6937 animation.FinishedSignal().Connect(&application, finishCheck);
6939 application.SendNotification();
6940 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6942 // We didn't expect the animation to finish yet
6943 application.SendNotification();
6944 finishCheck.CheckSignalNotReceived();
6945 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6947 application.SendNotification();
6948 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
6950 // We didn't expect the animation to finish yet
6951 application.SendNotification();
6952 finishCheck.CheckSignalNotReceived();
6953 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
6955 application.SendNotification();
6956 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
6958 // We did expect the animation to finish
6959 application.SendNotification();
6960 finishCheck.CheckSignalReceived();
6961 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
6965 int UtcDaliAnimationAnimateToActorPositionAlphaFunctionTimePeriodP(void)
6967 TestApplication application;
6969 Actor actor = Actor::New();
6970 Stage::GetCurrent().Add(actor);
6971 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
6973 // Build the animation
6974 float durationSeconds(1.0f);
6975 Animation animation = Animation::New(durationSeconds);
6976 Vector3 targetPosition(200.0f, 200.0f, 200.0f);
6978 animation.AnimateTo( Property(actor, Actor::Property::POSITION),
6980 AlphaFunction::LINEAR,
6981 TimePeriod( delay, durationSeconds - delay ) );
6983 Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
6985 // Start the animation
6988 bool signalReceived(false);
6989 AnimationFinishCheck finishCheck(signalReceived);
6990 animation.FinishedSignal().Connect(&application, finishCheck);
6992 application.SendNotification();
6993 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
6995 // We didn't expect the animation to finish yet
6996 application.SendNotification();
6997 finishCheck.CheckSignalNotReceived();
6998 DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
7000 application.SendNotification();
7001 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
7003 // We didn't expect the animation to finish yet
7004 application.SendNotification();
7005 finishCheck.CheckSignalNotReceived();
7006 DALI_TEST_EQUALS( actor.GetCurrentPosition(), seventyFivePercentProgress, TEST_LOCATION );
7008 application.SendNotification();
7009 application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
7011 // We did expect the animation to finish
7012 application.SendNotification();
7013 finishCheck.CheckSignalReceived();
7014 DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
7018 int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void)
7020 TestApplication application;
7022 Actor actor = Actor::New();
7023 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7024 Stage::GetCurrent().Add(actor);
7025 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7027 // Build the animation
7028 float durationSeconds(1.0f);
7029 Animation animation = Animation::New(durationSeconds);
7030 Degree targetRotationDegrees(90.0f);
7031 Radian targetRotationRadians(targetRotationDegrees);
7032 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
7034 // Start the animation
7037 bool signalReceived(false);
7038 AnimationFinishCheck finishCheck(signalReceived);
7039 animation.FinishedSignal().Connect(&application, finishCheck);
7041 application.SendNotification();
7042 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7044 // We didn't expect the animation to finish yet
7045 application.SendNotification();
7046 finishCheck.CheckSignalNotReceived();
7047 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7049 application.SendNotification();
7050 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7052 // We didn't expect the animation to finish yet
7053 application.SendNotification();
7054 finishCheck.CheckSignalNotReceived();
7055 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7057 application.SendNotification();
7058 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7060 // We didn't expect the animation to finish yet
7061 application.SendNotification();
7062 finishCheck.CheckSignalNotReceived();
7063 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7065 application.SendNotification();
7066 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7068 // We did expect the animation to finish
7069 application.SendNotification();
7070 finishCheck.CheckSignalReceived();
7071 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7075 int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
7077 TestApplication application;
7079 Actor actor = Actor::New();
7080 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7081 Stage::GetCurrent().Add(actor);
7082 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7084 // Build the animation
7085 float durationSeconds(1.0f);
7086 Animation animation = Animation::New(durationSeconds);
7087 Degree targetRotationDegrees(90.0f);
7088 Radian targetRotationRadians(targetRotationDegrees);
7089 Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
7090 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
7092 // Start the animation
7095 bool signalReceived(false);
7096 AnimationFinishCheck finishCheck(signalReceived);
7097 animation.FinishedSignal().Connect(&application, finishCheck);
7099 application.SendNotification();
7100 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7102 // We didn't expect the animation to finish yet
7103 application.SendNotification();
7104 finishCheck.CheckSignalNotReceived();
7105 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7107 application.SendNotification();
7108 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7110 // We didn't expect the animation to finish yet
7111 application.SendNotification();
7112 finishCheck.CheckSignalNotReceived();
7113 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7115 application.SendNotification();
7116 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7118 // We didn't expect the animation to finish yet
7119 application.SendNotification();
7120 finishCheck.CheckSignalNotReceived();
7121 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7123 application.SendNotification();
7124 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7126 // We did expect the animation to finish
7127 application.SendNotification();
7128 finishCheck.CheckSignalReceived();
7129 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7133 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
7135 TestApplication application;
7137 Actor actor = Actor::New();
7138 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7139 Stage::GetCurrent().Add(actor);
7140 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7142 // Build the animation
7143 float durationSeconds(1.0f);
7144 Animation animation = Animation::New(durationSeconds);
7145 Degree targetRotationDegrees(90.0f);
7146 Radian targetRotationRadians(targetRotationDegrees);
7147 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
7149 // Start the animation
7152 bool signalReceived(false);
7153 AnimationFinishCheck finishCheck(signalReceived);
7154 animation.FinishedSignal().Connect(&application, finishCheck);
7156 application.SendNotification();
7157 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7159 // We didn't expect the animation to finish yet
7160 application.SendNotification();
7161 finishCheck.CheckSignalNotReceived();
7162 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7164 application.SendNotification();
7165 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7167 // We didn't expect the animation to finish yet
7168 application.SendNotification();
7169 finishCheck.CheckSignalNotReceived();
7170 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7172 application.SendNotification();
7173 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7175 // We didn't expect the animation to finish yet
7176 application.SendNotification();
7177 finishCheck.CheckSignalNotReceived();
7178 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7180 application.SendNotification();
7181 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7183 // We did expect the animation to finish
7184 application.SendNotification();
7185 finishCheck.CheckSignalReceived();
7186 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7190 int UtcDaliAnimationAnimateToActorOrientationTimePeriodP(void)
7192 TestApplication application;
7194 Actor actor = Actor::New();
7195 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7196 Stage::GetCurrent().Add(actor);
7197 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7199 // Build the animation
7200 float durationSeconds(1.0f);
7201 Animation animation = Animation::New(durationSeconds);
7202 Degree targetRotationDegrees(90.0f);
7203 Radian targetRotationRadians(targetRotationDegrees);
7205 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
7207 // Start the animation
7210 bool signalReceived(false);
7211 AnimationFinishCheck finishCheck(signalReceived);
7212 animation.FinishedSignal().Connect(&application, finishCheck);
7214 application.SendNotification();
7215 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7217 // We didn't expect the animation to finish yet
7218 application.SendNotification();
7219 finishCheck.CheckSignalNotReceived();
7220 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7221 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7223 application.SendNotification();
7224 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7226 // We didn't expect the animation to finish yet
7227 application.SendNotification();
7228 finishCheck.CheckSignalNotReceived();
7229 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7230 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7232 application.SendNotification();
7233 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7235 // We didn't expect the animation to finish yet
7236 application.SendNotification();
7237 finishCheck.CheckSignalNotReceived();
7238 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7239 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7241 application.SendNotification();
7242 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7244 // We did expect the animation to finish
7245 application.SendNotification();
7246 finishCheck.CheckSignalReceived();
7247 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7251 int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionTimePeriodP(void)
7253 TestApplication application;
7255 Actor actor = Actor::New();
7256 actor.SetOrientation(Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
7257 Stage::GetCurrent().Add(actor);
7258 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
7260 // Build the animation
7261 float durationSeconds(1.0f);
7262 Animation animation = Animation::New(durationSeconds);
7263 Degree targetRotationDegrees(90.0f);
7264 Radian targetRotationRadians(targetRotationDegrees);
7266 animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
7268 // Start the animation
7271 bool signalReceived(false);
7272 AnimationFinishCheck finishCheck(signalReceived);
7273 animation.FinishedSignal().Connect(&application, finishCheck);
7275 application.SendNotification();
7276 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
7278 // We didn't expect the animation to finish yet
7279 application.SendNotification();
7280 finishCheck.CheckSignalNotReceived();
7281 float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
7282 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7284 application.SendNotification();
7285 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
7287 // We didn't expect the animation to finish yet
7288 application.SendNotification();
7289 finishCheck.CheckSignalNotReceived();
7290 progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
7291 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7293 application.SendNotification();
7294 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
7296 // We didn't expect the animation to finish yet
7297 application.SendNotification();
7298 finishCheck.CheckSignalNotReceived();
7299 progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
7300 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7302 application.SendNotification();
7303 application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
7305 // We did expect the animation to finish
7306 application.SendNotification();
7307 finishCheck.CheckSignalReceived();
7308 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
7312 int UtcDaliAnimationAnimateToActorScaleP(void)
7314 TestApplication application;
7316 Actor actor = Actor::New();
7317 Stage::GetCurrent().Add(actor);
7318 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7320 // Build the animation
7321 float durationSeconds(1.0f);
7322 Animation animation = Animation::New(durationSeconds);
7323 Vector3 targetScale(2.0f, 2.0f, 2.0f);
7324 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
7326 Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
7328 // Start the animation
7331 bool signalReceived(false);
7332 AnimationFinishCheck finishCheck(signalReceived);
7333 animation.FinishedSignal().Connect(&application, finishCheck);
7335 application.SendNotification();
7336 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7338 // We didn't expect the animation to finish yet
7339 application.SendNotification();
7340 finishCheck.CheckSignalNotReceived();
7341 DALI_TEST_EQUALS( actor.GetCurrentScale(), ninetyNinePercentProgress, TEST_LOCATION );
7343 application.SendNotification();
7344 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7346 // We did expect the animation to finish
7347 application.SendNotification();
7348 finishCheck.CheckSignalReceived();
7349 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7352 finishCheck.Reset();
7353 actor.SetScale(Vector3::ONE);
7354 application.SendNotification();
7355 application.Render(0);
7356 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7358 // Repeat with a different (ease-in) alpha function
7359 animation = Animation::New(durationSeconds);
7360 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
7361 animation.FinishedSignal().Connect(&application, finishCheck);
7364 application.SendNotification();
7365 application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
7367 // We didn't expect the animation to finish yet
7368 application.SendNotification();
7369 finishCheck.CheckSignalNotReceived();
7371 // The scale should have grown less, than with a linear alpha function
7372 Vector3 current(actor.GetCurrentScale());
7373 DALI_TEST_CHECK( current.x > 1.0f );
7374 DALI_TEST_CHECK( current.y > 1.0f );
7375 DALI_TEST_CHECK( current.z > 1.0f );
7376 DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
7377 DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
7378 DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
7380 application.SendNotification();
7381 application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
7383 // We did expect the animation to finish
7384 application.SendNotification();
7385 finishCheck.CheckSignalReceived();
7386 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7389 finishCheck.Reset();
7390 actor.SetScale(Vector3::ONE);
7391 application.SendNotification();
7392 application.Render(0);
7393 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7395 // Repeat with a delay
7397 animation = Animation::New(durationSeconds);
7398 animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
7399 animation.FinishedSignal().Connect(&application, finishCheck);
7402 application.SendNotification();
7403 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
7405 // We didn't expect the animation to finish yet
7406 application.SendNotification();
7407 finishCheck.CheckSignalNotReceived();
7408 DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
7410 application.SendNotification();
7411 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7413 // We did expect the animation to finish
7414 application.SendNotification();
7415 finishCheck.CheckSignalReceived();
7416 DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
7420 int UtcDaliAnimationAnimateToActorScaleXP(void)
7422 TestApplication application;
7424 Actor actor = Actor::New();
7425 Stage::GetCurrent().Add(actor);
7426 float startValue(1.0f);
7427 DALI_TEST_EQUALS( actor.GetCurrentScale().x, startValue, TEST_LOCATION );
7428 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7429 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7430 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7432 // Build the animation
7433 float durationSeconds(1.0f);
7434 Animation animation = Animation::New(durationSeconds);
7435 float targetX(10.0f);
7436 animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
7438 float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
7440 // Start the animation
7443 bool signalReceived(false);
7444 AnimationFinishCheck finishCheck(signalReceived);
7445 animation.FinishedSignal().Connect(&application, finishCheck);
7447 application.SendNotification();
7448 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7450 // We didn't expect the animation to finish yet
7451 application.SendNotification();
7452 finishCheck.CheckSignalNotReceived();
7453 DALI_TEST_EQUALS( actor.GetCurrentScale().x, fiftyPercentProgress, TEST_LOCATION );
7454 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION );
7455 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7456 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7458 application.SendNotification();
7459 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7461 // We did expect the animation to finish
7462 application.SendNotification();
7463 finishCheck.CheckSignalReceived();
7464 DALI_TEST_EQUALS( actor.GetCurrentScale().x, targetX, TEST_LOCATION );
7465 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION );
7466 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7467 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7471 int UtcDaliAnimationAnimateToActorScaleYP(void)
7473 TestApplication application;
7475 Actor actor = Actor::New();
7476 Stage::GetCurrent().Add(actor);
7477 float startValue(1.0f);
7478 DALI_TEST_EQUALS( actor.GetCurrentScale().y, startValue, TEST_LOCATION );
7479 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7480 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7481 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7483 // Build the animation
7484 float durationSeconds(1.0f);
7485 Animation animation = Animation::New(durationSeconds);
7486 float targetY(1000.0f);
7487 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
7489 float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
7491 // Start the animation
7494 bool signalReceived(false);
7495 AnimationFinishCheck finishCheck(signalReceived);
7496 animation.FinishedSignal().Connect(&application, finishCheck);
7498 application.SendNotification();
7499 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7501 // We didn't expect the animation to finish yet
7502 application.SendNotification();
7503 finishCheck.CheckSignalNotReceived();
7504 DALI_TEST_EQUALS( actor.GetCurrentScale().y, fiftyPercentProgress, TEST_LOCATION );
7505 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7506 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION );
7507 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7509 application.SendNotification();
7510 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7512 // We did expect the animation to finish
7513 application.SendNotification();
7514 finishCheck.CheckSignalReceived();
7515 DALI_TEST_EQUALS( actor.GetCurrentScale().y, targetY, TEST_LOCATION );
7516 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7517 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION );
7518 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7522 int UtcDaliAnimationAnimateToActorScaleZP(void)
7524 TestApplication application;
7526 Actor actor = Actor::New();
7527 Stage::GetCurrent().Add(actor);
7528 float startValue(1.0f);
7529 DALI_TEST_EQUALS( actor.GetCurrentScale().z, startValue, TEST_LOCATION );
7530 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7531 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7532 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
7534 // Build the animation
7535 float durationSeconds(1.0f);
7536 Animation animation = Animation::New(durationSeconds);
7537 float targetZ(-1000.0f);
7538 animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
7540 float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
7542 // Start the animation
7545 bool signalReceived(false);
7546 AnimationFinishCheck finishCheck(signalReceived);
7547 animation.FinishedSignal().Connect(&application, finishCheck);
7549 application.SendNotification();
7550 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7552 // We didn't expect the animation to finish yet
7553 application.SendNotification();
7554 finishCheck.CheckSignalNotReceived();
7555 DALI_TEST_EQUALS( actor.GetCurrentScale().z, fiftyPercentProgress, TEST_LOCATION );
7556 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7557 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7558 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION );
7560 application.SendNotification();
7561 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7563 // We did expect the animation to finish
7564 application.SendNotification();
7565 finishCheck.CheckSignalReceived();
7566 DALI_TEST_EQUALS( actor.GetCurrentScale().z, targetZ, TEST_LOCATION );
7567 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
7568 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
7569 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION );
7573 int UtcDaliAnimationAnimateToActorColorP(void)
7575 TestApplication application;
7577 Actor actor = Actor::New();
7578 Stage::GetCurrent().Add(actor);
7579 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7581 // Build the animation
7582 float durationSeconds(1.0f);
7583 Animation animation = Animation::New(durationSeconds);
7584 Vector4 targetColor(Color::RED);
7585 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
7587 Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
7588 Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
7590 // Start the animation
7593 bool signalReceived(false);
7594 AnimationFinishCheck finishCheck(signalReceived);
7595 animation.FinishedSignal().Connect(&application, finishCheck);
7597 application.SendNotification();
7598 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7600 // We didn't expect the animation to finish yet
7601 application.SendNotification();
7602 finishCheck.CheckSignalNotReceived();
7603 DALI_TEST_EQUALS( actor.GetCurrentColor(), tenPercentProgress, TEST_LOCATION );
7605 application.SendNotification();
7606 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7608 // We did expect the animation to finish
7609 application.SendNotification();
7610 finishCheck.CheckSignalReceived();
7611 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7614 finishCheck.Reset();
7615 actor.SetColor(Color::WHITE);
7616 application.SendNotification();
7617 application.Render(0);
7618 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7620 // Repeat with a different (ease-in) alpha function
7621 animation = Animation::New(durationSeconds);
7622 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
7623 animation.FinishedSignal().Connect(&application, finishCheck);
7626 application.SendNotification();
7627 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
7629 // We didn't expect the animation to finish yet
7630 application.SendNotification();
7631 finishCheck.CheckSignalNotReceived();
7633 // The color should have changed less, than with a linear alpha function
7634 Vector4 current(actor.GetCurrentColor());
7635 DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
7636 DALI_TEST_CHECK( current.y < 1.0f );
7637 DALI_TEST_CHECK( current.y > tenPercentProgress.y );
7638 DALI_TEST_CHECK( current.z < 1.0f );
7639 DALI_TEST_CHECK( current.z > tenPercentProgress.z );
7640 DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
7642 application.SendNotification();
7643 application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
7645 // We did expect the animation to finish
7646 application.SendNotification();
7647 finishCheck.CheckSignalReceived();
7648 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7651 finishCheck.Reset();
7652 actor.SetColor(Color::WHITE);
7653 application.SendNotification();
7654 application.Render(0);
7655 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
7657 // Repeat with a shorter animator duration
7658 float animatorDuration = 0.5f;
7659 animation = Animation::New(durationSeconds);
7660 animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
7661 animation.FinishedSignal().Connect(&application, finishCheck);
7664 application.SendNotification();
7665 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
7667 // We didn't expect the animation to finish yet
7668 application.SendNotification();
7669 finishCheck.CheckSignalNotReceived();
7670 DALI_TEST_EQUALS( actor.GetCurrentColor(), twentyPercentProgress, TEST_LOCATION );
7672 application.SendNotification();
7673 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
7675 // We didn't expect the animation to finish yet
7676 application.SendNotification();
7677 finishCheck.CheckSignalNotReceived();
7678 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7680 application.SendNotification();
7681 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7683 // We did expect the animation to finish
7684 application.SendNotification();
7685 finishCheck.CheckSignalReceived();
7686 DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
7690 int UtcDaliAnimationAnimateToActorColorRedP(void)
7692 TestApplication application;
7694 Actor actor = Actor::New();
7695 Stage::GetCurrent().Add(actor);
7696 float startValue(1.0f);
7697 DALI_TEST_EQUALS( actor.GetCurrentColor().r, startValue, TEST_LOCATION );
7698 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7699 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7700 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7701 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7703 // Build the animation
7704 float durationSeconds(1.0f);
7705 Animation animation = Animation::New(durationSeconds);
7706 float targetRed(0.5f);
7707 animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
7709 float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
7711 // Start the animation
7714 bool signalReceived(false);
7715 AnimationFinishCheck finishCheck(signalReceived);
7716 animation.FinishedSignal().Connect(&application, finishCheck);
7718 application.SendNotification();
7719 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7721 // We didn't expect the animation to finish yet
7722 application.SendNotification();
7723 finishCheck.CheckSignalNotReceived();
7724 DALI_TEST_EQUALS( actor.GetCurrentColor().r, fiftyPercentProgress, TEST_LOCATION );
7725 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
7726 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7727 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7728 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7730 application.SendNotification();
7731 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7733 // We did expect the animation to finish
7734 application.SendNotification();
7735 finishCheck.CheckSignalReceived();
7736 DALI_TEST_EQUALS( actor.GetCurrentColor().r, targetRed, TEST_LOCATION );
7737 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
7738 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7739 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7740 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7744 int UtcDaliAnimationAnimateToActorColorGreenP(void)
7746 TestApplication application;
7748 Actor actor = Actor::New();
7749 Stage::GetCurrent().Add(actor);
7750 float startValue(1.0f);
7751 DALI_TEST_EQUALS( actor.GetCurrentColor().g, startValue, TEST_LOCATION );
7752 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7753 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7754 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7755 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7757 // Build the animation
7758 float durationSeconds(1.0f);
7759 Animation animation = Animation::New(durationSeconds);
7760 float targetGreen(0.5f);
7761 animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
7763 float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
7765 // Start the animation
7768 bool signalReceived(false);
7769 AnimationFinishCheck finishCheck(signalReceived);
7770 animation.FinishedSignal().Connect(&application, finishCheck);
7772 application.SendNotification();
7773 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7775 // We didn't expect the animation to finish yet
7776 application.SendNotification();
7777 finishCheck.CheckSignalNotReceived();
7778 DALI_TEST_EQUALS( actor.GetCurrentColor().g, fiftyPercentProgress, TEST_LOCATION );
7779 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7780 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
7781 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7782 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7784 application.SendNotification();
7785 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7787 // We did expect the animation to finish
7788 application.SendNotification();
7789 finishCheck.CheckSignalReceived();
7790 DALI_TEST_EQUALS( actor.GetCurrentColor().g, targetGreen, TEST_LOCATION );
7791 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7792 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
7793 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7794 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7798 int UtcDaliAnimationAnimateToActorColorBlueP(void)
7800 TestApplication application;
7802 Actor actor = Actor::New();
7803 Stage::GetCurrent().Add(actor);
7804 float startValue(1.0f);
7805 DALI_TEST_EQUALS( actor.GetCurrentColor().b, startValue, TEST_LOCATION );
7806 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7807 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7808 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7809 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7811 // Build the animation
7812 float durationSeconds(1.0f);
7813 Animation animation = Animation::New(durationSeconds);
7814 float targetBlue(0.5f);
7815 animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
7817 float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
7819 // Start the animation
7822 bool signalReceived(false);
7823 AnimationFinishCheck finishCheck(signalReceived);
7824 animation.FinishedSignal().Connect(&application, finishCheck);
7826 application.SendNotification();
7827 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7829 // We didn't expect the animation to finish yet
7830 application.SendNotification();
7831 finishCheck.CheckSignalNotReceived();
7832 DALI_TEST_EQUALS( actor.GetCurrentColor().b, fiftyPercentProgress, TEST_LOCATION );
7833 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7834 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7835 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION );
7836 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7838 application.SendNotification();
7839 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7841 // We did expect the animation to finish
7842 application.SendNotification();
7843 finishCheck.CheckSignalReceived();
7844 DALI_TEST_EQUALS( actor.GetCurrentColor().b, targetBlue, TEST_LOCATION );
7845 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7846 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7847 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION );
7848 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7852 int UtcDaliAnimationAnimateToActorColorAlphaP(void)
7854 TestApplication application;
7856 Actor actor = Actor::New();
7857 Stage::GetCurrent().Add(actor);
7858 float startValue(1.0f);
7859 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
7860 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7861 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7862 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7863 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
7865 // Build the animation
7866 float durationSeconds(1.0f);
7867 Animation animation = Animation::New(durationSeconds);
7868 float targetAlpha(0.5f);
7869 animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
7871 float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
7873 // Start the animation
7876 bool signalReceived(false);
7877 AnimationFinishCheck finishCheck(signalReceived);
7878 animation.FinishedSignal().Connect(&application, finishCheck);
7880 application.SendNotification();
7881 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
7883 // We didn't expect the animation to finish yet
7884 application.SendNotification();
7885 finishCheck.CheckSignalNotReceived();
7886 DALI_TEST_EQUALS( actor.GetCurrentColor().a, fiftyPercentProgress, TEST_LOCATION );
7887 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7888 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7889 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7890 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION );
7892 application.SendNotification();
7893 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
7895 // We did expect the animation to finish
7896 application.SendNotification();
7897 finishCheck.CheckSignalReceived();
7898 DALI_TEST_EQUALS( actor.GetCurrentColor().a, targetAlpha, TEST_LOCATION );
7899 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
7900 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
7901 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
7902 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION );
7906 int UtcDaliAnimationKeyFrames01P(void)
7908 TestApplication application;
7910 KeyFrames keyFrames = KeyFrames::New();
7911 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7913 keyFrames.Add(0.0f, 0.1f);
7915 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
7917 KeyFrames keyFrames2( keyFrames);
7918 DALI_TEST_CHECK( keyFrames2 );
7919 DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
7921 KeyFrames keyFrames3 = KeyFrames::New();
7922 keyFrames3.Add(0.6f, true);
7923 DALI_TEST_CHECK( keyFrames3 );
7924 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
7926 keyFrames3 = keyFrames;
7927 DALI_TEST_CHECK( keyFrames3 );
7928 DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
7933 int UtcDaliAnimationKeyFrames02P(void)
7935 TestApplication application;
7937 KeyFrames keyFrames = KeyFrames::New();
7938 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7940 keyFrames.Add(0.0f, 0.1f);
7941 keyFrames.Add(0.2f, 0.5f);
7942 keyFrames.Add(0.4f, 0.0f);
7943 keyFrames.Add(0.6f, 1.0f);
7944 keyFrames.Add(0.8f, 0.7f);
7945 keyFrames.Add(1.0f, 0.9f);
7947 DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
7951 keyFrames.Add(1.9f, false);
7953 catch (Dali::DaliException& e)
7955 DALI_TEST_PRINT_ASSERT( e );
7956 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7961 int UtcDaliAnimationKeyFrames03P(void)
7963 TestApplication application;
7965 KeyFrames keyFrames = KeyFrames::New();
7966 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7968 keyFrames.Add(0.0f, true);
7969 keyFrames.Add(0.2f, false);
7970 keyFrames.Add(0.4f, false);
7971 keyFrames.Add(0.6f, true);
7972 keyFrames.Add(0.8f, true);
7973 keyFrames.Add(1.0f, false);
7975 DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
7979 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
7981 catch (Dali::DaliException& e)
7983 DALI_TEST_PRINT_ASSERT( e );
7984 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
7989 int UtcDaliAnimationKeyFrames04P(void)
7991 TestApplication application;
7993 KeyFrames keyFrames = KeyFrames::New();
7994 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
7996 keyFrames.Add(0.0f, Vector2(0.0f, 0.0f));
7997 keyFrames.Add(0.2f, Vector2(1.0f, 1.0f));
7998 keyFrames.Add(0.4f, Vector2(2.0f, 2.0f));
7999 keyFrames.Add(0.6f, Vector2(3.0f, 5.0f));
8000 keyFrames.Add(0.8f, Vector2(4.0f, 3.0f));
8001 keyFrames.Add(1.0f, Vector2(6.0f, 2.0f));
8003 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
8007 keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
8009 catch (Dali::DaliException& e)
8011 DALI_TEST_PRINT_ASSERT( e );
8012 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8017 int UtcDaliAnimationKeyFrames05P(void)
8019 TestApplication application;
8021 KeyFrames keyFrames = KeyFrames::New();
8022 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8024 keyFrames.Add(0.0f, Vector3(0.0f, 4.0f, 0.0f));
8025 keyFrames.Add(0.2f, Vector3(1.0f, 3.0f, 1.0f));
8026 keyFrames.Add(0.4f, Vector3(2.0f, 2.0f, 2.0f));
8027 keyFrames.Add(0.6f, Vector3(3.0f, 2.0f, 5.0f));
8028 keyFrames.Add(0.8f, Vector3(4.0f, 4.0f, 3.0f));
8029 keyFrames.Add(1.0f, Vector3(6.0f, 8.0f, 2.0f));
8031 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
8035 keyFrames.Add(0.7f, 1.0f);
8037 catch (Dali::DaliException& e)
8039 DALI_TEST_PRINT_ASSERT( e );
8040 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8045 int UtcDaliAnimationKeyFrames06P(void)
8047 TestApplication application;
8049 KeyFrames keyFrames = KeyFrames::New();
8050 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8052 keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
8053 keyFrames.Add(0.2f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8054 keyFrames.Add(0.4f, Vector4(2.0f, 2.0f, 2.0f, 2.0f));
8055 keyFrames.Add(0.6f, Vector4(3.0f, 5.0f, 3.0f, 5.0f));
8056 keyFrames.Add(0.8f, Vector4(4.0f, 3.0f, 4.0f, 3.0f));
8057 keyFrames.Add(1.0f, Vector4(6.0f, 2.0f, 6.0f, 2.0f));
8059 DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
8063 keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8065 catch (Dali::DaliException& e)
8067 DALI_TEST_PRINT_ASSERT( e );
8068 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8073 int UtcDaliAnimationKeyFrames07P(void)
8075 TestApplication application;
8077 KeyFrames keyFrames = KeyFrames::New();
8078 DALI_TEST_EQUALS(keyFrames.GetType(), Property::NONE, TEST_LOCATION);
8080 keyFrames.Add(0.0f, Quaternion(Radian(1.717f), Vector3::XAXIS));
8081 keyFrames.Add(0.2f, Quaternion(Radian(2.0f), Vector3::XAXIS));
8082 keyFrames.Add(0.4f, Quaternion(Radian(3.0f), Vector3::ZAXIS));
8083 keyFrames.Add(0.6f, Quaternion(Radian(4.0f), Vector3(1.0f, 1.0f, 1.0f)));
8084 keyFrames.Add(0.8f, AngleAxis(Degree(90), Vector3::XAXIS));
8085 keyFrames.Add(1.0f, Quaternion(Radian(3.0f), Vector3::YAXIS));
8087 DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
8091 keyFrames.Add(0.7f, 1.1f);
8093 catch (Dali::DaliException& e)
8095 DALI_TEST_PRINT_ASSERT( e );
8096 DALI_TEST_ASSERT(e, "mType == value.GetType()", TEST_LOCATION);
8101 int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
8103 TestApplication application;
8105 float startValue(1.0f);
8106 Actor actor = Actor::New();
8107 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8108 Stage::GetCurrent().Add(actor);
8110 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8111 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8112 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8113 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8114 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8116 // Build the animation
8117 float durationSeconds(1.0f);
8118 Animation animation = Animation::New(durationSeconds);
8120 KeyFrames keyFrames = KeyFrames::New();
8121 keyFrames.Add(0.0f, 0.1f);
8122 keyFrames.Add(0.2f, 0.5f);
8123 keyFrames.Add(0.4f, 0.0f);
8124 keyFrames.Add(0.6f, 1.0f);
8125 keyFrames.Add(0.8f, 0.7f);
8126 keyFrames.Add(1.0f, 0.9f);
8128 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
8130 // Start the animation
8133 bool signalReceived(false);
8134 AnimationFinishCheck finishCheck(signalReceived);
8135 animation.FinishedSignal().Connect(&application, finishCheck);
8136 application.SendNotification();
8137 application.Render(0);
8138 application.SendNotification();
8139 finishCheck.CheckSignalNotReceived();
8140 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8142 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8143 application.SendNotification();
8144 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8145 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8146 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8147 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
8148 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.3f, 0.01f, TEST_LOCATION );
8150 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8151 application.SendNotification();
8152 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8153 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8154 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8155 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
8156 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.25f, 0.01f, TEST_LOCATION );
8158 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8159 application.SendNotification();
8160 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8161 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8162 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8163 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8164 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8166 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8167 application.SendNotification();
8168 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8169 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8171 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8172 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8174 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8175 application.SendNotification();
8176 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8177 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8178 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8179 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
8180 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.8f, 0.01f, TEST_LOCATION );
8182 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8183 application.SendNotification();
8184 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8185 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8186 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8187 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8188 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8190 // We did expect the animation to finish
8192 finishCheck.CheckSignalReceived();
8196 int UtcDaliAnimationAnimateBetweenActorColorAlphaCubicP(void)
8198 TestApplication application;
8200 float startValue(1.0f);
8201 Actor actor = Actor::New();
8202 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8203 Stage::GetCurrent().Add(actor);
8205 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8206 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8207 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8208 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8209 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8211 // Build the animation
8212 float durationSeconds(1.0f);
8213 Animation animation = Animation::New(durationSeconds);
8215 KeyFrames keyFrames = KeyFrames::New();
8216 keyFrames.Add(0.0f, 0.1f);
8217 keyFrames.Add(0.2f, 0.5f);
8218 keyFrames.Add(0.4f, 0.0f);
8219 keyFrames.Add(0.6f, 1.0f);
8220 keyFrames.Add(0.8f, 0.7f);
8221 keyFrames.Add(1.0f, 0.9f);
8223 animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::Cubic );
8225 // Start the animation
8228 bool signalReceived(false);
8229 AnimationFinishCheck finishCheck(signalReceived);
8230 animation.FinishedSignal().Connect(&application, finishCheck);
8231 application.SendNotification();
8232 application.Render(0);
8233 application.SendNotification();
8234 finishCheck.CheckSignalNotReceived();
8235 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.1f, TEST_LOCATION );
8237 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
8238 application.SendNotification();
8239 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8240 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8241 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8242 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION );
8243 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.36f, 0.01f, TEST_LOCATION );
8245 application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
8246 application.SendNotification();
8247 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8248 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8249 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8250 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION );
8251 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.21f, 0.01f, TEST_LOCATION );
8253 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
8254 application.SendNotification();
8255 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8256 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8257 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8258 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
8259 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.0f, 0.01f, TEST_LOCATION );
8261 application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
8262 application.SendNotification();
8263 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8264 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8265 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8266 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
8267 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.7f, 0.01f, TEST_LOCATION );
8269 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
8270 application.SendNotification();
8271 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8272 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8273 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8274 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION );
8275 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.76f, 0.01f, TEST_LOCATION );
8277 application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
8278 application.SendNotification();
8279 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8280 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8281 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8282 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
8283 DALI_TEST_EQUALS( actor.GetCurrentColor().a, 0.9f, 0.01f, TEST_LOCATION );
8285 // We did expect the animation to finish
8287 finishCheck.CheckSignalReceived();
8291 int UtcDaliAnimationAnimateBetweenActorColorP(void)
8293 TestApplication application;
8295 float startValue(1.0f);
8296 Actor actor = Actor::New();
8297 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8298 Stage::GetCurrent().Add(actor);
8300 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8301 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8302 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8303 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8304 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8306 // Build the animation
8307 float durationSeconds(1.0f);
8308 Animation animation = Animation::New(durationSeconds);
8310 KeyFrames keyFrames = KeyFrames::New();
8311 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8312 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8313 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8315 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
8317 // Start the animation
8320 bool signalReceived(false);
8321 AnimationFinishCheck finishCheck(signalReceived);
8322 animation.FinishedSignal().Connect(&application, finishCheck);
8323 application.SendNotification();
8324 application.Render(0);
8325 application.SendNotification();
8326 finishCheck.CheckSignalNotReceived();
8327 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8328 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8329 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8330 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8332 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8333 application.SendNotification();
8334 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8335 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8336 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8337 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8339 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8340 application.SendNotification();
8341 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8342 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8343 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8344 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8346 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8347 application.SendNotification();
8348 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8349 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8350 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8351 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8353 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8354 application.SendNotification();
8355 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8356 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8357 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8358 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8360 // We did expect the animation to finish
8362 finishCheck.CheckSignalReceived();
8366 int UtcDaliAnimationAnimateBetweenActorColorCubicP(void)
8368 TestApplication application;
8370 float startValue(1.0f);
8371 Actor actor = Actor::New();
8372 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8373 Stage::GetCurrent().Add(actor);
8375 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8376 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8377 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8378 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8379 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8381 // Build the animation
8382 float durationSeconds(1.0f);
8383 Animation animation = Animation::New(durationSeconds);
8385 KeyFrames keyFrames = KeyFrames::New();
8386 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8387 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8388 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8390 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::Cubic );
8392 // Start the animation
8395 bool signalReceived(false);
8396 AnimationFinishCheck finishCheck(signalReceived);
8397 animation.FinishedSignal().Connect(&application, finishCheck);
8398 application.SendNotification();
8399 application.Render(0);
8400 application.SendNotification();
8401 finishCheck.CheckSignalNotReceived();
8402 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8403 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8404 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8405 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8407 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8408 application.SendNotification();
8409 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8410 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8411 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8412 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8414 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8415 application.SendNotification();
8416 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8417 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8418 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8419 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8421 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8422 application.SendNotification();
8423 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8424 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8425 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8426 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8428 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8429 application.SendNotification();
8430 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8431 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8432 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8433 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8435 // We did expect the animation to finish
8437 finishCheck.CheckSignalReceived();
8441 int UtcDaliAnimationAnimateBetweenActorVisibleP(void)
8443 TestApplication application;
8445 Actor actor = Actor::New();
8446 AngleAxis aa(Degree(90), Vector3::XAXIS);
8447 actor.SetOrientation(aa.angle, aa.axis);
8448 Stage::GetCurrent().Add(actor);
8450 application.SendNotification();
8451 application.Render(0);
8453 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8455 // Build the animation
8456 float durationSeconds(1.0f);
8457 Animation animation = Animation::New(durationSeconds);
8459 KeyFrames keyFrames = KeyFrames::New();
8460 keyFrames.Add(0.0f, false);
8461 keyFrames.Add(0.2f, true);
8462 keyFrames.Add(0.4f, true);
8463 keyFrames.Add(0.8f, false);
8464 keyFrames.Add(1.0f, true);
8466 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
8468 // Start the animation
8471 bool signalReceived(false);
8472 AnimationFinishCheck finishCheck(signalReceived);
8473 animation.FinishedSignal().Connect(&application, finishCheck);
8474 application.SendNotification();
8475 application.SendNotification();
8476 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8477 application.SendNotification();
8478 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8479 application.SendNotification();
8481 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8482 finishCheck.CheckSignalReceived();
8486 int UtcDaliAnimationAnimateBetweenActorVisibleCubicP(void)
8488 TestApplication application;
8490 Actor actor = Actor::New();
8491 AngleAxis aa(Degree(90), Vector3::XAXIS);
8492 actor.SetOrientation(aa.angle, aa.axis);
8493 Stage::GetCurrent().Add(actor);
8495 application.SendNotification();
8496 application.Render(0);
8498 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
8500 // Build the animation
8501 float durationSeconds(1.0f);
8502 Animation animation = Animation::New(durationSeconds);
8504 KeyFrames keyFrames = KeyFrames::New();
8505 keyFrames.Add(0.0f, false);
8506 keyFrames.Add(0.2f, true);
8507 keyFrames.Add(0.4f, true);
8508 keyFrames.Add(0.8f, false);
8509 keyFrames.Add(1.0f, true);
8511 //Cubic interpolation for boolean values should be ignored
8512 animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::Cubic );
8514 // Start the animation
8517 bool signalReceived(false);
8518 AnimationFinishCheck finishCheck(signalReceived);
8519 animation.FinishedSignal().Connect(&application, finishCheck);
8520 application.SendNotification();
8521 application.SendNotification();
8522 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8523 application.SendNotification();
8524 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8525 application.SendNotification();
8527 DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION);
8528 finishCheck.CheckSignalReceived();
8532 int UtcDaliAnimationAnimateBetweenActorOrientation01P(void)
8534 TestApplication application;
8536 Actor actor = Actor::New();
8537 AngleAxis aa(Degree(90), Vector3::XAXIS);
8538 actor.SetOrientation(aa.angle, aa.axis);
8539 Stage::GetCurrent().Add(actor);
8541 application.SendNotification();
8542 application.Render(0);
8543 Quaternion start(Radian(aa.angle), aa.axis);
8544 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8546 // Build the animation
8547 float durationSeconds(1.0f);
8548 Animation animation = Animation::New(durationSeconds);
8550 KeyFrames keyFrames = KeyFrames::New();
8551 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8553 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8555 // Start the animation
8558 bool signalReceived(false);
8559 AnimationFinishCheck finishCheck(signalReceived);
8560 animation.FinishedSignal().Connect(&application, finishCheck);
8561 application.SendNotification();
8562 application.SendNotification();
8563 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8564 application.SendNotification();
8565 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8566 application.SendNotification();
8568 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8570 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8571 finishCheck.CheckSignalReceived();
8575 int UtcDaliAnimationAnimateBetweenActorOrientation02P(void)
8577 TestApplication application;
8579 Actor actor = Actor::New();
8580 AngleAxis aa(Degree(90), Vector3::XAXIS);
8581 actor.SetOrientation(aa.angle, aa.axis);
8582 application.SendNotification();
8583 application.Render(0);
8584 Stage::GetCurrent().Add(actor);
8586 Quaternion start(Radian(aa.angle), aa.axis);
8587 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8589 // Build the animation
8590 float durationSeconds(1.0f);
8591 Animation animation = Animation::New(durationSeconds);
8593 KeyFrames keyFrames = KeyFrames::New();
8594 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8595 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8596 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8598 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
8600 // Start the animation
8603 bool signalReceived(false);
8604 AnimationFinishCheck finishCheck(signalReceived);
8605 animation.FinishedSignal().Connect(&application, finishCheck);
8606 application.SendNotification();
8607 application.Render(0);
8608 application.SendNotification();
8609 finishCheck.CheckSignalNotReceived();
8611 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8612 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8614 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8615 application.SendNotification();
8616 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8617 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8619 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8620 application.SendNotification();
8621 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8622 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8624 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8625 application.SendNotification();
8626 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
8627 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8629 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8630 application.SendNotification();
8631 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8632 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8634 // We did expect the animation to finish
8636 finishCheck.CheckSignalReceived();
8640 int UtcDaliAnimationAnimateBetweenActorOrientation01CubicP(void)
8642 TestApplication application;
8644 Actor actor = Actor::New();
8645 AngleAxis aa(Degree(90), Vector3::XAXIS);
8646 actor.SetOrientation(aa.angle, aa.axis);
8647 Stage::GetCurrent().Add(actor);
8649 application.SendNotification();
8650 application.Render(0);
8651 Quaternion start(Radian(aa.angle), aa.axis);
8652 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8654 // Build the animation
8655 float durationSeconds(1.0f);
8656 Animation animation = Animation::New(durationSeconds);
8658 KeyFrames keyFrames = KeyFrames::New();
8659 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
8661 //Cubic interpolation should be ignored for quaternions
8662 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8664 // Start the animation
8667 bool signalReceived(false);
8668 AnimationFinishCheck finishCheck(signalReceived);
8669 animation.FinishedSignal().Connect(&application, finishCheck);
8670 application.SendNotification();
8671 application.SendNotification();
8672 application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
8673 application.SendNotification();
8674 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
8675 application.SendNotification();
8677 Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
8679 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8680 finishCheck.CheckSignalReceived();
8684 int UtcDaliAnimationAnimateBetweenActorOrientation02CubicP(void)
8686 TestApplication application;
8688 Actor actor = Actor::New();
8689 AngleAxis aa(Degree(90), Vector3::XAXIS);
8690 actor.SetOrientation(aa.angle, aa.axis);
8691 application.SendNotification();
8692 application.Render(0);
8693 Stage::GetCurrent().Add(actor);
8695 Quaternion start(Radian(aa.angle), aa.axis);
8696 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), start, 0.001f, TEST_LOCATION );
8698 // Build the animation
8699 float durationSeconds(1.0f);
8700 Animation animation = Animation::New(durationSeconds);
8702 KeyFrames keyFrames = KeyFrames::New();
8703 keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::XAXIS));
8704 keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
8705 keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
8707 //Cubic interpolation should be ignored for quaternions
8708 animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::Cubic );
8710 // Start the animation
8713 bool signalReceived(false);
8714 AnimationFinishCheck finishCheck(signalReceived);
8715 animation.FinishedSignal().Connect(&application, finishCheck);
8716 application.SendNotification();
8717 application.Render(0);
8718 application.SendNotification();
8719 finishCheck.CheckSignalNotReceived();
8721 Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
8722 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8724 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8725 application.SendNotification();
8726 check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
8727 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8729 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8730 application.SendNotification();
8731 check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
8732 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8734 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8735 application.SendNotification();
8736 check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
8737 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8739 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8740 application.SendNotification();
8741 check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
8742 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), check, 0.001f, TEST_LOCATION );
8744 // We did expect the animation to finish
8746 finishCheck.CheckSignalReceived();
8750 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
8752 TestApplication application;
8754 float startValue(1.0f);
8755 Actor actor = Actor::New();
8756 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8757 Stage::GetCurrent().Add(actor);
8759 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8760 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8761 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8762 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8763 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8765 // Build the animation
8766 float durationSeconds(1.0f);
8767 Animation animation = Animation::New(durationSeconds);
8769 KeyFrames keyFrames = KeyFrames::New();
8770 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8771 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8772 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8774 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
8776 // Start the animation
8779 bool signalReceived(false);
8780 AnimationFinishCheck finishCheck(signalReceived);
8781 animation.FinishedSignal().Connect(&application, finishCheck);
8782 application.SendNotification();
8783 application.Render(0);
8784 application.SendNotification();
8785 finishCheck.CheckSignalNotReceived();
8786 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8787 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8788 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8789 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8791 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8792 application.SendNotification();
8793 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8794 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8795 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8796 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8798 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8799 application.SendNotification();
8800 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8801 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8802 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8803 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8805 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8806 application.SendNotification();
8807 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8808 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8809 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8810 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8812 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8813 application.SendNotification();
8814 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8815 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8816 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8817 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8819 // We did expect the animation to finish
8821 finishCheck.CheckSignalReceived();
8825 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionCubicP(void)
8827 TestApplication application;
8829 float startValue(1.0f);
8830 Actor actor = Actor::New();
8831 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8832 Stage::GetCurrent().Add(actor);
8834 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8835 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8836 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8837 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8838 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8840 // Build the animation
8841 float durationSeconds(1.0f);
8842 Animation animation = Animation::New(durationSeconds);
8844 KeyFrames keyFrames = KeyFrames::New();
8845 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8846 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8847 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8849 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
8851 // Start the animation
8854 bool signalReceived(false);
8855 AnimationFinishCheck finishCheck(signalReceived);
8856 animation.FinishedSignal().Connect(&application, finishCheck);
8857 application.SendNotification();
8858 application.Render(0);
8859 application.SendNotification();
8860 finishCheck.CheckSignalNotReceived();
8861 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8862 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8863 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8864 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8866 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
8867 application.SendNotification();
8868 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
8869 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
8870 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
8871 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
8873 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
8874 application.SendNotification();
8875 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8876 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8877 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8878 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8880 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
8881 application.SendNotification();
8882 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
8883 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
8884 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
8885 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
8887 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
8888 application.SendNotification();
8889 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8890 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8891 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8892 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8894 // We did expect the animation to finish
8896 finishCheck.CheckSignalReceived();
8900 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodP(void)
8902 TestApplication application;
8904 float startValue(1.0f);
8905 Actor actor = Actor::New();
8906 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8907 Stage::GetCurrent().Add(actor);
8909 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8910 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8911 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8912 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8913 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8915 // Build the animation
8916 float durationSeconds(1.0f);
8918 Animation animation = Animation::New(durationSeconds);
8920 KeyFrames keyFrames = KeyFrames::New();
8921 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8922 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
8923 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
8925 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
8927 // Start the animation
8930 bool signalReceived(false);
8931 AnimationFinishCheck finishCheck(signalReceived);
8932 animation.FinishedSignal().Connect(&application, finishCheck);
8933 application.SendNotification();
8935 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
8936 application.SendNotification();
8937 finishCheck.CheckSignalNotReceived();
8938 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
8939 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
8940 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
8941 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
8943 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
8944 application.SendNotification();
8945 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
8946 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
8947 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
8948 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
8950 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
8951 application.SendNotification();
8952 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
8953 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
8954 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
8955 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
8957 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
8958 application.SendNotification();
8959 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
8960 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
8961 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
8962 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
8964 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
8965 application.SendNotification();
8966 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
8967 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
8968 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
8969 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
8971 // We did expect the animation to finish
8973 finishCheck.CheckSignalReceived();
8977 int UtcDaliAnimationAnimateBetweenActorColorTimePeriodCubicP(void)
8979 TestApplication application;
8981 float startValue(1.0f);
8982 Actor actor = Actor::New();
8983 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
8984 Stage::GetCurrent().Add(actor);
8986 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
8987 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
8988 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
8989 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
8990 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
8992 // Build the animation
8993 float durationSeconds(1.0f);
8995 Animation animation = Animation::New(durationSeconds);
8997 KeyFrames keyFrames = KeyFrames::New();
8998 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
8999 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9000 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9002 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9004 // Start the animation
9007 bool signalReceived(false);
9008 AnimationFinishCheck finishCheck(signalReceived);
9009 animation.FinishedSignal().Connect(&application, finishCheck);
9010 application.SendNotification();
9012 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9013 application.SendNotification();
9014 finishCheck.CheckSignalNotReceived();
9015 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9016 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9017 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9018 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9020 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9021 application.SendNotification();
9022 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
9023 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
9024 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
9025 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
9027 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9028 application.SendNotification();
9029 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9030 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9031 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9032 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9034 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9035 application.SendNotification();
9036 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
9037 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
9038 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
9039 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
9041 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9042 application.SendNotification();
9043 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9044 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9045 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9046 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9048 // We did expect the animation to finish
9050 finishCheck.CheckSignalReceived();
9054 int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionTimePeriodP(void)
9056 TestApplication application;
9058 float startValue(1.0f);
9060 Actor actor = Actor::New();
9061 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9062 Stage::GetCurrent().Add(actor);
9064 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9065 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9066 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9067 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9068 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9070 // Build the animation
9071 float durationSeconds(1.0f);
9072 Animation animation = Animation::New(durationSeconds);
9074 KeyFrames keyFrames = KeyFrames::New();
9075 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9076 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9077 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9079 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
9081 // Start the animation
9084 bool signalReceived(false);
9085 AnimationFinishCheck finishCheck(signalReceived);
9086 animation.FinishedSignal().Connect(&application, finishCheck);
9087 application.SendNotification();
9089 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9090 application.SendNotification();
9091 finishCheck.CheckSignalNotReceived();
9092 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9093 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9094 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9095 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9097 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9098 application.SendNotification();
9099 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION );
9100 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION );
9101 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION );
9102 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION );
9104 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9105 application.SendNotification();
9106 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9107 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9108 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9109 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9111 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9112 application.SendNotification();
9113 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION );
9114 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION );
9115 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION );
9116 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION );
9118 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9119 application.SendNotification();
9120 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9121 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9122 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9123 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9125 // We did expect the animation to finish
9127 finishCheck.CheckSignalReceived();
9131 int UtcDaliAnimationAnimateBetweenActorColorCubicWithDelayP(void)
9133 TestApplication application;
9135 float startValue(1.0f);
9136 Actor actor = Actor::New();
9137 actor.SetColor(Vector4(startValue, startValue, startValue, startValue));
9138 Stage::GetCurrent().Add(actor);
9140 DALI_TEST_EQUALS( actor.GetCurrentColor().a, startValue, TEST_LOCATION );
9141 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
9142 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
9143 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
9144 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
9146 // Build the animation
9147 float durationSeconds(1.0f);
9149 Animation animation = Animation::New(durationSeconds);
9151 KeyFrames keyFrames = KeyFrames::New();
9152 keyFrames.Add(0.0f, Vector4(0.1f, 0.2f, 0.3f, 0.4f));
9153 keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
9154 keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
9156 animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
9158 // Start the animation
9161 bool signalReceived(false);
9162 AnimationFinishCheck finishCheck(signalReceived);
9163 animation.FinishedSignal().Connect(&application, finishCheck);
9164 application.SendNotification();
9166 application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
9167 application.SendNotification();
9168 finishCheck.CheckSignalNotReceived();
9169 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION );
9170 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION );
9171 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION );
9172 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION );
9174 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
9175 application.SendNotification();
9176 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION );
9177 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION );
9178 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION );
9179 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION );
9181 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
9182 application.SendNotification();
9183 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION );
9184 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
9185 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION );
9186 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION );
9188 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
9189 application.SendNotification();
9190 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION );
9191 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION );
9192 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION );
9193 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION );
9195 application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
9196 application.SendNotification();
9197 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION );
9198 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION );
9199 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION );
9200 DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION );
9202 // We did expect the animation to finish
9204 finishCheck.CheckSignalReceived();
9208 int UtcDaliAnimationAnimateP(void)
9210 TestApplication application;
9212 Actor actor = Actor::New();
9213 Stage::GetCurrent().Add(actor);
9216 Vector3 position0( 30.0, 80.0, 0.0);
9217 Vector3 position1( 70.0, 120.0, 0.0);
9218 Vector3 position2( 100.0, 100.0, 0.0);
9220 Dali::Path path = Dali::Path::New();
9221 path.AddPoint(position0);
9222 path.AddPoint(position1);
9223 path.AddPoint(position2);
9225 //Control points for first segment
9226 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9227 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9229 //Control points for second segment
9230 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9231 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9233 // Build the animation
9234 float durationSeconds( 1.0f );
9235 Animation animation = Animation::New(durationSeconds);
9236 animation.Animate(actor, path, Vector3::XAXIS);
9238 // Start the animation
9241 bool signalReceived(false);
9242 AnimationFinishCheck finishCheck(signalReceived);
9243 animation.FinishedSignal().Connect(&application, finishCheck);
9244 application.SendNotification();
9245 application.Render(0);
9246 application.SendNotification();
9247 finishCheck.CheckSignalNotReceived();
9248 Vector3 position, tangent;
9249 Quaternion rotation;
9250 path.Sample( 0.0f, position, tangent );
9251 rotation = Quaternion( Vector3::XAXIS, tangent );
9252 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9253 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9255 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9256 application.SendNotification();
9257 path.Sample( 0.25f, position, tangent );
9258 rotation = Quaternion( Vector3::XAXIS, tangent );
9259 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9260 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9262 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9263 application.SendNotification();
9264 path.Sample( 0.5f, position, tangent );
9265 rotation = Quaternion( Vector3::XAXIS, tangent );
9266 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9267 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9269 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9270 application.SendNotification();
9271 path.Sample( 0.75f, position, tangent );
9272 rotation = Quaternion( Vector3::XAXIS, tangent );
9273 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9274 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9276 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9277 application.SendNotification();
9278 path.Sample( 1.0f, position, tangent );
9279 rotation = Quaternion( Vector3::XAXIS, tangent );
9280 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9281 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9283 finishCheck.CheckSignalReceived();
9287 int UtcDaliAnimationAnimateAlphaFunctionP(void)
9289 TestApplication application;
9291 Actor actor = Actor::New();
9292 Stage::GetCurrent().Add(actor);
9295 Vector3 position0( 30.0, 80.0, 0.0);
9296 Vector3 position1( 70.0, 120.0, 0.0);
9297 Vector3 position2( 100.0, 100.0, 0.0);
9299 Dali::Path path = Dali::Path::New();
9300 path.AddPoint(position0);
9301 path.AddPoint(position1);
9302 path.AddPoint(position2);
9304 //Control points for first segment
9305 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9306 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9308 //Control points for second segment
9309 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9310 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9312 // Build the animation
9313 float durationSeconds( 1.0f );
9314 Animation animation = Animation::New(durationSeconds);
9315 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
9317 // Start the animation
9320 bool signalReceived(false);
9321 AnimationFinishCheck finishCheck(signalReceived);
9322 animation.FinishedSignal().Connect(&application, finishCheck);
9323 application.SendNotification();
9324 application.Render(0);
9325 application.SendNotification();
9326 finishCheck.CheckSignalNotReceived();
9327 Vector3 position, tangent;
9328 Quaternion rotation;
9329 path.Sample( 0.0f, position, tangent );
9330 rotation = Quaternion( Vector3::XAXIS, tangent );
9331 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9332 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9334 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9335 application.SendNotification();
9336 path.Sample( 0.25f, position, tangent );
9337 rotation = Quaternion( Vector3::XAXIS, tangent );
9338 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9339 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9341 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9342 application.SendNotification();
9343 path.Sample( 0.5f, position, tangent );
9344 rotation = Quaternion( Vector3::XAXIS, tangent );
9345 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9346 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9348 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9349 application.SendNotification();
9350 path.Sample( 0.75f, position, tangent );
9351 rotation = Quaternion( Vector3::XAXIS, tangent );
9352 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9353 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9355 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9356 application.SendNotification();
9357 path.Sample( 1.0f, position, tangent );
9358 rotation = Quaternion( Vector3::XAXIS, tangent );
9359 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9360 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9362 finishCheck.CheckSignalReceived();
9366 int UtcDaliAnimationAnimateTimePeriodP(void)
9368 TestApplication application;
9370 Actor actor = Actor::New();
9371 Stage::GetCurrent().Add(actor);
9374 Vector3 position0( 30.0, 80.0, 0.0);
9375 Vector3 position1( 70.0, 120.0, 0.0);
9376 Vector3 position2( 100.0, 100.0, 0.0);
9378 Dali::Path path = Dali::Path::New();
9379 path.AddPoint(position0);
9380 path.AddPoint(position1);
9381 path.AddPoint(position2);
9383 //Control points for first segment
9384 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9385 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9387 //Control points for second segment
9388 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9389 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9391 // Build the animation
9392 float durationSeconds( 1.0f );
9393 Animation animation = Animation::New(durationSeconds);
9394 animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
9396 // Start the animation
9399 bool signalReceived(false);
9400 AnimationFinishCheck finishCheck(signalReceived);
9401 animation.FinishedSignal().Connect(&application, finishCheck);
9402 application.SendNotification();
9403 application.Render(0);
9404 application.SendNotification();
9405 finishCheck.CheckSignalNotReceived();
9406 Vector3 position, tangent;
9407 Quaternion rotation;
9408 path.Sample( 0.0f, position, tangent );
9409 rotation = Quaternion( Vector3::XAXIS, tangent );
9410 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9411 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9413 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9414 application.SendNotification();
9415 path.Sample( 0.25f, position, tangent );
9416 rotation = Quaternion( Vector3::XAXIS, tangent );
9417 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9418 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9420 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9421 application.SendNotification();
9422 path.Sample( 0.5f, position, tangent );
9423 rotation = Quaternion( Vector3::XAXIS, tangent );
9424 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9425 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9427 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9428 application.SendNotification();
9429 path.Sample( 0.75f, position, tangent );
9430 rotation = Quaternion( Vector3::XAXIS, tangent );
9431 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9432 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9434 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9435 application.SendNotification();
9436 path.Sample( 1.0f, position, tangent );
9437 rotation = Quaternion( Vector3::XAXIS, tangent );
9438 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9439 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9441 finishCheck.CheckSignalReceived();
9445 int UtcDaliAnimationAnimateAlphaFunctionTimePeriodP(void)
9447 TestApplication application;
9449 Actor actor = Actor::New();
9450 Stage::GetCurrent().Add(actor);
9453 Vector3 position0( 30.0, 80.0, 0.0);
9454 Vector3 position1( 70.0, 120.0, 0.0);
9455 Vector3 position2( 100.0, 100.0, 0.0);
9457 Dali::Path path = Dali::Path::New();
9458 path.AddPoint(position0);
9459 path.AddPoint(position1);
9460 path.AddPoint(position2);
9462 //Control points for first segment
9463 path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
9464 path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
9466 //Control points for second segment
9467 path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
9468 path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
9470 // Build the animation
9471 float durationSeconds( 1.0f );
9472 Animation animation = Animation::New(durationSeconds);
9473 animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
9475 // Start the animation
9478 bool signalReceived(false);
9479 AnimationFinishCheck finishCheck(signalReceived);
9480 animation.FinishedSignal().Connect(&application, finishCheck);
9481 application.SendNotification();
9482 application.Render(0);
9483 application.SendNotification();
9484 finishCheck.CheckSignalNotReceived();
9485 Vector3 position, tangent;
9486 Quaternion rotation;
9487 path.Sample( 0.0f, position, tangent );
9488 rotation = Quaternion( Vector3::XAXIS, tangent );
9489 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9490 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9492 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
9493 application.SendNotification();
9494 path.Sample( 0.25f, position, tangent );
9495 rotation = Quaternion( Vector3::XAXIS, tangent );
9496 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9497 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9499 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
9500 application.SendNotification();
9501 path.Sample( 0.5f, position, tangent );
9502 rotation = Quaternion( Vector3::XAXIS, tangent );
9503 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9504 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9506 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
9507 application.SendNotification();
9508 path.Sample( 0.75f, position, tangent );
9509 rotation = Quaternion( Vector3::XAXIS, tangent );
9510 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9511 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9513 application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
9514 application.SendNotification();
9515 path.Sample( 1.0f, position, tangent );
9516 rotation = Quaternion( Vector3::XAXIS, tangent );
9517 DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION );
9518 DALI_TEST_EQUALS( actor.GetCurrentOrientation(), rotation, TEST_LOCATION );
9520 finishCheck.CheckSignalReceived();
9524 int UtcDaliAnimationShowP(void)
9526 TestApplication application;
9528 Actor actor = Actor::New();
9529 actor.SetVisible(false);
9530 application.SendNotification();
9531 application.Render(0);
9532 DALI_TEST_CHECK( !actor.IsVisible() );
9533 Stage::GetCurrent().Add(actor);
9535 // Start the animation
9536 float durationSeconds(10.0f);
9537 Animation animation = Animation::New(durationSeconds);
9538 animation.Show(actor, durationSeconds*0.5f);
9541 bool signalReceived(false);
9542 AnimationFinishCheck finishCheck(signalReceived);
9543 animation.FinishedSignal().Connect(&application, finishCheck);
9545 application.SendNotification();
9546 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9548 // We didn't expect the animation to finish yet
9549 application.SendNotification();
9550 finishCheck.CheckSignalNotReceived();
9551 DALI_TEST_CHECK( !actor.IsVisible() );
9553 application.SendNotification();
9554 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
9556 // We didn't expect the animation to finish yet
9557 application.SendNotification();
9558 finishCheck.CheckSignalNotReceived();
9559 DALI_TEST_CHECK( actor.IsVisible() );
9561 application.SendNotification();
9562 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9564 // We did expect the animation to finish
9565 application.SendNotification();
9566 finishCheck.CheckSignalReceived();
9567 DALI_TEST_CHECK( actor.IsVisible() );
9571 int UtcDaliAnimationHideP(void)
9573 TestApplication application;
9575 Actor actor = Actor::New();
9576 DALI_TEST_CHECK( actor.IsVisible() );
9577 Stage::GetCurrent().Add(actor);
9579 // Start the animation
9580 float durationSeconds(10.0f);
9581 Animation animation = Animation::New(durationSeconds);
9582 animation.Hide(actor, durationSeconds*0.5f);
9585 bool signalReceived(false);
9586 AnimationFinishCheck finishCheck(signalReceived);
9587 animation.FinishedSignal().Connect(&application, finishCheck);
9589 application.SendNotification();
9590 application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
9592 // We didn't expect the animation to finish yet
9593 application.SendNotification();
9594 finishCheck.CheckSignalNotReceived();
9595 DALI_TEST_CHECK( actor.IsVisible() );
9597 application.SendNotification();
9598 application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
9600 // We didn't expect the animation to finish yet
9601 application.SendNotification();
9602 finishCheck.CheckSignalNotReceived();
9603 DALI_TEST_CHECK( !actor.IsVisible() );
9605 application.SendNotification();
9606 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9608 // We did expect the animation to finish
9609 application.SendNotification();
9610 finishCheck.CheckSignalReceived();
9611 DALI_TEST_CHECK( !actor.IsVisible() );
9615 int UtcDaliAnimationShowHideAtEndP(void)
9617 // Test that show/hide delay can be the same as animation duration
9618 // i.e. to show/hide at the end of the animation
9620 TestApplication application;
9622 Actor actor = Actor::New();
9623 DALI_TEST_CHECK( actor.IsVisible() );
9624 Stage::GetCurrent().Add(actor);
9626 // Start Hide animation
9627 float durationSeconds(10.0f);
9628 Animation animation = Animation::New(durationSeconds);
9629 animation.Hide(actor, durationSeconds/*Hide at end*/);
9632 bool signalReceived(false);
9633 AnimationFinishCheck finishCheck(signalReceived);
9634 animation.FinishedSignal().Connect(&application, finishCheck);
9636 application.SendNotification();
9637 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9639 // We did expect the animation to finish
9640 application.SendNotification();
9641 finishCheck.CheckSignalReceived();
9642 DALI_TEST_CHECK( !actor.IsVisible() );
9644 // Start Show animation
9645 animation = Animation::New(durationSeconds);
9646 animation.Show(actor, durationSeconds/*Show at end*/);
9647 animation.FinishedSignal().Connect(&application, finishCheck);
9650 application.SendNotification();
9651 application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
9653 // We did expect the animation to finish
9654 application.SendNotification();
9655 finishCheck.CheckSignalReceived();
9656 DALI_TEST_CHECK( actor.IsVisible() );
9660 int UtcDaliKeyFramesCreateDestroyP(void)
9662 tet_infoline("Testing Dali::Animation::UtcDaliKeyFramesCreateDestroy()");
9664 KeyFrames* keyFrames = new KeyFrames;
9666 DALI_TEST_CHECK( true );
9670 int UtcDaliKeyFramesDownCastP(void)
9672 TestApplication application;
9673 tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
9675 KeyFrames keyFrames = KeyFrames::New();
9676 BaseHandle object(keyFrames);
9678 KeyFrames keyFrames2 = KeyFrames::DownCast(object);
9679 DALI_TEST_CHECK(keyFrames2);
9681 KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
9682 DALI_TEST_CHECK(keyFrames3);
9684 BaseHandle unInitializedObject;
9685 KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
9686 DALI_TEST_CHECK(!keyFrames4);
9688 KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
9689 DALI_TEST_CHECK(!keyFrames5);
9693 int UtcDaliAnimationCreateDestroyP(void)
9695 TestApplication application;
9696 Animation* animation = new Animation;
9697 DALI_TEST_CHECK( animation );
9702 struct UpdateManagerTestConstraint
9704 UpdateManagerTestConstraint(TestApplication& application)
9705 : mApplication(application)
9709 void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
9711 mApplication.SendNotification(); // Process events
9714 TestApplication& mApplication;
9717 int UtcDaliAnimationUpdateManagerP(void)
9719 TestApplication application;
9721 Actor actor = Actor::New();
9722 Stage::GetCurrent().Add( actor );
9724 // Build the animation
9725 Animation animation = Animation::New( 0.0f );
9727 bool signalReceived = false;
9728 AnimationFinishCheck finishCheck( signalReceived );
9729 animation.FinishedSignal().Connect( &application, finishCheck );
9731 Vector3 startValue(1.0f, 1.0f, 1.0f);
9732 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9733 Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
9736 // Apply animation to actor
9737 animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
9741 application.SendNotification();
9742 application.UpdateOnly( 16 );
9744 finishCheck.CheckSignalNotReceived();
9746 application.SendNotification(); // Process events
9748 finishCheck.CheckSignalReceived();
9753 int UtcDaliAnimationSignalOrderP(void)
9755 TestApplication application;
9757 Actor actor = Actor::New();
9758 Stage::GetCurrent().Add( actor );
9760 // Build the animations
9761 Animation animation1 = Animation::New( 0.0f ); // finishes first frame
9762 Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
9764 bool signal1Received = false;
9765 animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
9767 bool signal2Received = false;
9768 animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
9770 // Apply animations to actor
9771 animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
9773 animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
9776 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9777 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9779 application.SendNotification();
9780 application.UpdateOnly( 10 ); // 10ms progress
9782 // no notifications yet
9783 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9784 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9786 application.SendNotification();
9789 DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
9790 DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
9791 signal1Received = false;
9793 // 1st animation is complete now, do another update with no ProcessEvents in between
9794 application.UpdateOnly( 20 ); // 20ms progress
9797 application.SendNotification();
9799 // 2nd should complete now
9800 DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
9801 DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
9806 int UtcDaliAnimationExtendDurationP(void)
9808 TestApplication application;
9810 Actor actor = Actor::New();
9812 // Register a float property
9813 float startValue(10.0f);
9814 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
9815 Stage::GetCurrent().Add(actor);
9816 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9818 // Build the animation
9819 float initialDurationSeconds(1.0f);
9820 float animatorDelay = 5.0f;
9821 float animatorDurationSeconds(5.0f);
9822 float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
9823 Animation animation = Animation::New(initialDurationSeconds);
9824 float targetValue(30.0f);
9825 float relativeValue(targetValue - startValue);
9827 animation.AnimateTo(Property(actor, index),
9829 TimePeriod(animatorDelay, animatorDurationSeconds));
9831 // The duration should have been extended
9832 DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
9834 // Start the animation
9837 bool signalReceived(false);
9838 AnimationFinishCheck finishCheck(signalReceived);
9839 animation.FinishedSignal().Connect(&application, finishCheck);
9841 application.SendNotification();
9842 application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
9844 // We didn't expect the animation to finish yet
9845 application.SendNotification();
9846 finishCheck.CheckSignalNotReceived();
9847 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
9849 application.SendNotification();
9850 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
9852 // We didn't expect the animation to finish yet
9853 application.SendNotification();
9854 finishCheck.CheckSignalNotReceived();
9855 DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue+(relativeValue*0.5f), TEST_LOCATION );
9857 application.SendNotification();
9858 application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
9860 // We did expect the animation to finish
9861 application.SendNotification();
9862 finishCheck.CheckSignalReceived();
9863 DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
9867 int UtcDaliAnimationCustomIntProperty(void)
9869 TestApplication application;
9871 Actor actor = Actor::New();
9872 Stage::GetCurrent().Add(actor);
9875 Property::Index index = actor.RegisterProperty("anIndex", startValue);
9876 DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
9878 // Build the animation
9879 float durationSeconds(1.0f);
9880 Animation animation = Animation::New(durationSeconds);
9881 animation.AnimateTo( Property(actor, index), 20 );
9883 // Start the animation
9886 bool signalReceived(false);
9887 AnimationFinishCheck finishCheck(signalReceived);
9888 animation.FinishedSignal().Connect(&application, finishCheck);
9890 application.SendNotification();
9891 application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
9893 // We didn't expect the animation to finish yet
9894 application.SendNotification();
9895 finishCheck.CheckSignalNotReceived();
9896 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 10, TEST_LOCATION );
9898 application.SendNotification();
9899 application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
9901 // We did expect the animation to finish
9902 application.SendNotification();
9903 finishCheck.CheckSignalReceived();
9904 DALI_TEST_EQUALS( actor.GetProperty<int>(index), 20, TEST_LOCATION );